Class StructCommand
java.lang.Object
org.skriptlang.skript.lang.structure.Structure
org.skriptlang.skript.bukkit.command.elements.structures.StructCommand
- All Implemented Interfaces:
Debuggable, SyntaxElement
@Name("Command")
@Description("Used for registering custom commands.")
@Example("command /broadcast <string>:\n\taliases: /bc\n\texecutable by: players and console\n\tusage: A command for broadcasting a message to all players.\n\tpermission: skript.command.broadcast\n\tcooldown: 15 seconds\n\tcooldown message: You last broadcast a message %elapsed time% ago. You can broadcast another message in %remaining time%.\n\tcooldown bypass: skript.command.broadcast.admin\n\tcooldown storage: {cooldown::%player%}\n\ttrigger:\n\t\tbroadcast the argument\n") @Example("command /home:\n\tsubcommand set <name: text>:\n\t\ttrigger:\n\t\t\tset {homes::%player%::%{_name}%} to the player's location\n\tsubcommand <name: text>:\n\t\tsuggestions:\n\t\t\tloop {homes::%player%::*}:\n\t\t\t\tadd formatted \"<ttp:'Location: %loop-value%'>%loop-index%\" to the suggestions for the text argument\n\t\ttrigger:\n\t\t\tteleport the player to {homes::%player%::%{_name}%}\n")
@Since({"1.0","2.17 (subcommands, suggestions, etc.)"})
public class StructCommand
extends Structure
-
Nested Class Summary
Nested classes/interfaces inherited from class Structure
Structure.Priority, Structure.StructureData -
Field Summary
Fields inherited from class Structure
DEFAULT_PRIORITY -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleaninit(Literal<?>[] args, int matchedPattern, SkriptParser.ParseResult parseResult, EntryContainer entryContainer) The initialization phase of a Structure.booleanload()The second phase of Structure loading.booleanpostLoad()The third and final phase of Structure loading.voidCalled when this structure is unloaded.static voidregister(SkriptAddon addon, SyntaxRegistry syntaxRegistry) toString(@Nullable org.bukkit.event.Event event, boolean debug) voidunload()Called when this structure is unloaded.Methods inherited from class Structure
getEntryContainer, getPriority, getSyntaxTypeName, init, parse, parse, preLoad, toStringMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface SyntaxElement
getParser, preInit
-
Constructor Details
-
StructCommand
public StructCommand()
-
-
Method Details
-
register
-
init
public boolean init(Literal<?>[] args, int matchedPattern, SkriptParser.ParseResult parseResult, EntryContainer entryContainer) Description copied from class:StructureThe initialization phase of a Structure. Typically, this should be used for preparing fields (e.g. handling arguments, parse tags) Logic such as trigger loading should be saved for a loading phase (e.g.Structure.load()).- Specified by:
initin classStructure- Parameters:
args- The arguments of the Structure.matchedPattern- The matched pattern of the Structure.parseResult- The parse result of the Structure.entryContainer- The EntryContainer of the Structure. Will not be null if the Structure provides aEntryValidator.- Returns:
- Whether initialization was successful.
-
load
public boolean load()Description copied from class:StructureThe second phase of Structure loading. During this phase, all Structures across all loading scripts are loaded with respect to their priorities. -
postLoad
public boolean postLoad()Description copied from class:StructureThe third and final phase of Structure loading. During this phase, all Structures across all loading scripts are loaded with respect to their priorities. This method is primarily designed for Structures that wish to execute actions after most other Structures have finished loading. -
unload
-
postUnload
public void postUnload()Description copied from class:StructureCalled when this structure is unloaded. This method is primarily designed for Structures that wish to execute actions after most other Structures have finished unloading.- Overrides:
postUnloadin classStructure
-
toString
- Parameters:
event- The event to get information from. This is always null if debug == false.debug- If true this should print more information, if false this should print what is shown to the end user- Returns:
- String representation of this object
-