Class StSpawnCommand
java.lang.Object
com.storytimeproductions.stweaks.commands.StSpawnCommand
- All Implemented Interfaces:
org.bukkit.command.CommandExecutor
Command that teleports a player to a configured spawn location in the "world" world.
This command can only be executed by players who are currently in the world specified in the config file. The destination coordinates (x, y, z) and the world name must be defined in config.yml under the "spawn" section.
Example config section:
spawn: world: world x: -1939 y: 166 z: 862
-
Constructor Summary
ConstructorsConstructorDescriptionStSpawnCommand
(org.bukkit.configuration.file.FileConfiguration config) Constructs a new StSpawnCommand using the provided configuration file. -
Method Summary
-
Constructor Details
-
StSpawnCommand
public StSpawnCommand(org.bukkit.configuration.file.FileConfiguration config) Constructs a new StSpawnCommand using the provided configuration file.- Parameters:
config
- The plugin's configuration file used to retrieve spawn coordinates and world.
-
-
Method Details
-
onCommand
public boolean onCommand(org.bukkit.command.CommandSender sender, org.bukkit.command.Command command, String label, String[] args) Executes the /spawn command.This command checks if the sender is a player and ensures they are in the allowed world (as specified in config). If the checks pass, the player is teleported to the coordinates specified in the config file.
- Specified by:
onCommand
in interfaceorg.bukkit.command.CommandExecutor
- Parameters:
sender
- The source of the command.command
- The command object that was executed.label
- The alias of the command used.args
- Any additional arguments (ignored).- Returns:
- true if the command was successfully handled; false otherwise.
-