protected void executeWithTarget(Player player, String message, Player target1) {
String[] arguments = extractArguments(message);
Server server = player.getServer();
if (arguments.length > 1) {
Player target2 = server.findPlayer(arguments[1]);
if (target2 == null) {
player.addTMessage(Color.RED, "Player not online (%s)", arguments[1]);
} else {
if (target1.getDimension() == target2.getDimension()) {
target1.teleportTo(target2);
player.addTMessage(Color.GRAY, "Teleported %s to %s!",
target1.getName(), target2.getName());
server.adminLog("User " + player.getName() + " teleported:\t "
+ target1.getName() + "\tto\t" + target2.getName());
} else {
player.addTMessage(Color.RED, "Players %s and %s are in different dimensions.",
target1.getName(),
target2.getName());
player.addTMessage(Color.RED, "No teleport possible!");
}
}
} else {
player.addTMessage(Color.RED, "Must specify two players.");