diff options
Diffstat (limited to 'src/main/java/net/tylermurphy/hideAndSeek/command/SetExitLocation.java')
-rw-r--r-- | src/main/java/net/tylermurphy/hideAndSeek/command/SetExitLocation.java | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/src/main/java/net/tylermurphy/hideAndSeek/command/SetExitLocation.java b/src/main/java/net/tylermurphy/hideAndSeek/command/SetExitLocation.java new file mode 100644 index 0000000..3f872a1 --- /dev/null +++ b/src/main/java/net/tylermurphy/hideAndSeek/command/SetExitLocation.java @@ -0,0 +1,49 @@ +package net.tylermurphy.hideAndSeek.command; + +import static net.tylermurphy.hideAndSeek.Store.*; + +import java.util.HashMap; +import java.util.Map; + +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; +import org.bukkit.util.Vector; + +import net.tylermurphy.hideAndSeek.util.ICommand; + +public class SetExitLocation implements ICommand { + + public void execute(CommandSender sender, String[] args) { + Vector newExitPosition = new Vector(); + Player player = (Player) sender; + newExitPosition.setX(player.getLocation().getBlockX()); + newExitPosition.setY(player.getLocation().getBlockY()); + newExitPosition.setZ(player.getLocation().getBlockZ()); + if(!status.equals("Standby")) { + sender.sendMessage(errorPrefix + "Game is currently in session"); + return; + } + exitPosition = newExitPosition; + sender.sendMessage(messagePrefix + "Set exit position to current location"); + Map<String, Object> temp = new HashMap<String,Object>(); + temp.put("x", exitPosition.getX()); + temp.put("y", exitPosition.getY()); + temp.put("z", exitPosition.getZ()); + temp.put("world", player.getLocation().getWorld().getName()); + addToSection("spawns.exit",temp); + saveConfig(); + } + + public String getLabel() { + return "setexit"; + } + + public String getUsage() { + return ""; + } + + public String getDescription() { + return "Sets hide and seeks exit location to current position and world"; + } + +} |