diff options
author | Tyler Murphy <tylermurphy534@gmail.com> | 2022-11-21 13:33:55 -0500 |
---|---|---|
committer | Tyler Murphy <tylermurphy534@gmail.com> | 2022-11-21 13:33:55 -0500 |
commit | 1815b63bc94382a36b610be8082a423364e51b21 (patch) | |
tree | 574ebf7d505b6f1b438765aff6e743c5e972d661 /src/main/java/net/tylermurphy/hideAndSeek/command/world/Tp.java | |
parent | 1.7.0 beta 5 (diff) | |
download | kenshinshideandseek-1815b63bc94382a36b610be8082a423364e51b21.tar.gz kenshinshideandseek-1815b63bc94382a36b610be8082a423364e51b21.tar.bz2 kenshinshideandseek-1815b63bc94382a36b610be8082a423364e51b21.zip |
1.7.0 beta 6
Diffstat (limited to 'src/main/java/net/tylermurphy/hideAndSeek/command/world/Tp.java')
-rw-r--r-- | src/main/java/net/tylermurphy/hideAndSeek/command/world/Tp.java | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/src/main/java/net/tylermurphy/hideAndSeek/command/world/Tp.java b/src/main/java/net/tylermurphy/hideAndSeek/command/world/Tp.java new file mode 100644 index 0000000..b166297 --- /dev/null +++ b/src/main/java/net/tylermurphy/hideAndSeek/command/world/Tp.java @@ -0,0 +1,49 @@ +package net.tylermurphy.hideAndSeek.command.world; + +import net.tylermurphy.hideAndSeek.Main; +import net.tylermurphy.hideAndSeek.command.util.ICommand; +import net.tylermurphy.hideAndSeek.util.Location; +import org.bukkit.World; +import org.bukkit.entity.Player; +import org.jetbrains.annotations.NotNull; + +import java.util.List; + +import static net.tylermurphy.hideAndSeek.configuration.Config.errorPrefix; +import static net.tylermurphy.hideAndSeek.configuration.Localization.message; + +public class Tp implements ICommand { + public void execute(Player sender, String[] args) { + Location test = new Location(args[0], 0, 0,0); + if(!test.exists()) { + sender.sendMessage(errorPrefix + message("WORLD_DOESNT_EXIT")); + return; + } + World world = test.load(); + if(world == null) { + sender.sendMessage(errorPrefix + message("WORLD_LOAD_FAILED")); + return; + } + Location loc = new Location(world.getName(), world.getSpawnLocation()); + loc.teleport(sender); + } + + public String getLabel() { + return "tp"; + } + + public String getUsage() { + return "<world>"; + } + + public String getDescription() { + return "Teleport to another world"; + } + + public List<String> autoComplete(@NotNull String parameter, @NotNull String typed) { + if(parameter.equals("world")) { + return Main.getInstance().getWorlds(); + } + return null; + } +} |