PlayerMenuSpell - TheComputerGeek2/MagicSpells GitHub Wiki

Source Code

This spell extends its options from Instant Spell.

spell-class: ".PlayerMenuSpell"
  • disabled - Plays the effect at the caster's location when their menu is force-closed.
Value Supported
entity true
location false
entity_from_location false

Description:

This spell opens a menu with player heads of the current online players. Spells can be cast targeting selected players. Most options are "optional", as in they aren't required. For instance, you can specifically use the function of the spell to store the clicked player's name in a variable. You can limit who shows up in the menu using special modifiers or ranges.

Configuration:

Since 4.0 Beta 13 some of these options support dynamic values through numeric or string expressions.

Options Description Type Default Supports expressions
title Rich Text "PlayerMenuSpell '<internalName>'" true
skull-name Rich Text "&6%t" true
variable-target Stores the selected player's username in this variable. String true
skull-name-radius Skull name displayed if the player is outside of the radius if radius is used. Rich Text true
skull-name-offline Rich Text true
skull-lore List of Rich Text true
delay Delay in server ticks. Integer 1 true
radius When set to 0, shows all online players, otherwise all in radius. Double 0 true
stay-open When a player is selected in the menu, this defines if the menu should close. Boolean false true
spell-range Sub-spell casted if selected player is out of range. String false
spell-on-left Sub-spell casted when skull is left-clicked. If they are targeted spells, they will target the selected player. Otherwise, they'll be cast normally. String false
spell-offline Sub-spell cast if the selected player is offline. String false
spell-on-right Same as above, but for right-click. String false
spell-on-middle Removed in 4.0 Beta 14. Undetectable unless in Creative mode since around 1.18. Same as above, but for the middle click. String false
spell-on-sneak-left Same as above, but for sneak left click. String false
spell-on-sneak-right Same as above, but for sneak right click. String false
spell-drop Since 4.0 Beta 14. Same as above, but for when the item is dropped with the drop key. String false
spell-swap Since 4.0 Beta 14. Same as above, but for when the item is swapped offhand with the swap key. String false
player-modifiers If these modifiers don't pass, the player won't be shown in the menu. String List false
previous-page-item Since 4.0 Beta 13. Magic Item for the "previous page" button when multiple pages of the menu are displayed. String 'green_wool{name: "<gold>Previous Page</gold>"}' false
next-page-item Since 4.0 Beta 13. Magic Item for the "next page" button when multiple pages of the menu are displayed. String 'green_wool{name: "<gold>Next Page</gold>"}' false

Examples:

damagePlayerMenu:
    spell-class: ".PlayerMenuSpell"
    always-granted: true
    title: "L - Smite | R - Teleport"
    # Menu opens for the target. We need the caster to open it here.
    target-self: true
    # If false, close the menu on click.
    stay-open: true
    spell-on-left: lightning
    # Click spells don't have to be specified. If they aren't, that click won't do anything.
    spell-on-right: teleport
    # Conditions are checked against the target. If empty or not specified, they aren't checked.
    player-modifiers: [sneaking deny]

lightning:
    spell-class: ".targeted.PainSpell"
    helper-spell: true
    damage: 5
    effects:
      Lightning:
          position: target
          effect: lightning

teleport:
    spell-class: ".targeted.ShadowstepSpell"
    helper-spell: true
    distance: 0
    str-no-landing-spot: "Cannot teleport to that player."
variables:
    username:
      type: playerstring

selectPlayerMenu:
    spell-class: ".PlayerMenuSpell"
    always-granted: true
    target-self: true
    title: "&9Select to teleport"
    add-opener: true
    # ExternalCommandSpell extends Targeted, and we don't want it to be treated so.
    cast-spells-on-target: false
    spell-on-left: teleport
    # The value of the string variable can be used in further spells.
    variable-target: username

teleport:
    spell-class: ".ExternalCommandSpell"
    helper-spell: true
    do-variable-replacement: true
    command-to-execute: ["minecraft:tp %a %var:username%"]
⚠️ **GitHub.com Fallback** ⚠️