Created
August 25, 2011 19:10
-
-
Save 14mRh4X0r/1171523 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** The {@code BaseCommand} that's handling the command */ | |
private static final BaseCommand tpto = new BaseCommand( | |
"[x] [y] [z] - Teleports you to the given coordinates", | |
"Usage: /tpto [x] [y] [z]", 4, 5) { | |
@Override | |
void execute(MessageReceiver caller, String[] split) { | |
Player toWarp; | |
if (split.length == 5) { | |
if ((toWarp = etc.getServer().matchPlayer(split[4])) == null) { | |
caller.notify("Could not find player " + split[4]); | |
return; | |
} | |
if (caller instanceof Player | |
&& !((Player) caller).canIgnoreRestrictions()) { | |
onBadSyntax(caller, split); | |
return; | |
} | |
} else if (caller instanceof Player) | |
toWarp = (Player) caller; | |
else | |
return; | |
try { | |
toWarp.teleportTo(Double.parseDouble(split[1]), | |
Double.parseDouble(split[2]), | |
Double.parseDouble(split[3]), | |
toWarp.getRotation(), toWarp.getPitch()); | |
} catch (NumberFormatException e) { | |
caller.notify("All coordinates need to be numbers."); | |
} | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment