2011-03-19 23:39:51 +01:00
|
|
|
package com.earth2me.essentials.commands;
|
|
|
|
|
|
|
|
import com.earth2me.essentials.User;
|
2011-11-18 18:42:26 +01:00
|
|
|
import org.bukkit.Server;
|
2011-12-07 02:12:36 +01:00
|
|
|
import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
|
2011-03-19 23:39:51 +01:00
|
|
|
|
2017-06-11 02:17:43 +02:00
|
|
|
import java.util.Collections;
|
|
|
|
import java.util.List;
|
|
|
|
|
2015-04-15 06:06:16 +02:00
|
|
|
import static com.earth2me.essentials.I18n.tl;
|
|
|
|
|
|
|
|
|
|
|
|
public class Commandtpohere extends EssentialsCommand {
|
|
|
|
public Commandtpohere() {
|
|
|
|
super("tpohere");
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception {
|
|
|
|
if (args.length < 1) {
|
|
|
|
throw new NotEnoughArgumentsException();
|
|
|
|
}
|
|
|
|
|
|
|
|
//Just basically the old tphere command
|
|
|
|
final User player = getPlayer(server, user, args, 0);
|
|
|
|
|
|
|
|
if (user.getWorld() != player.getWorld() && ess.getSettings().isWorldTeleportPermissions() && !user.isAuthorized("essentials.worlds." + user.getWorld().getName())) {
|
|
|
|
throw new Exception(tl("noPerm", "essentials.worlds." + user.getWorld().getName()));
|
|
|
|
}
|
2011-03-19 23:39:51 +01:00
|
|
|
|
2020-06-24 10:52:25 +02:00
|
|
|
player.getAsyncTeleport().now(user.getBase(), false, TeleportCause.COMMAND, getNewExceptionFuture(user.getSource(), commandLabel));
|
2015-04-15 06:06:16 +02:00
|
|
|
}
|
2017-06-11 02:17:43 +02:00
|
|
|
|
|
|
|
@Override
|
|
|
|
protected List<String> getTabCompleteOptions(Server server, User user, String commandLabel, String[] args) {
|
|
|
|
if (args.length == 1) {
|
|
|
|
return getPlayers(server, user);
|
|
|
|
} else {
|
|
|
|
return Collections.emptyList();
|
|
|
|
}
|
|
|
|
}
|
2011-03-19 23:39:51 +01:00
|
|
|
}
|