mirror of
https://github.com/TotalFreedomMC/TF-EssentialsX.git
synced 2025-02-12 12:23:59 +00:00
Allow tppos to be used in console.
This commit is contained in:
parent
767703bfc9
commit
bf1e073ef4
1 changed files with 27 additions and 0 deletions
|
@ -5,6 +5,7 @@ import com.earth2me.essentials.Trade;
|
||||||
import com.earth2me.essentials.User;
|
import com.earth2me.essentials.User;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Server;
|
import org.bukkit.Server;
|
||||||
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
|
import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
|
||||||
|
|
||||||
|
|
||||||
|
@ -41,4 +42,30 @@ public class Commandtppos extends EssentialsCommand
|
||||||
user.getTeleport().teleport(location, charge, TeleportCause.COMMAND);
|
user.getTeleport().teleport(location, charge, TeleportCause.COMMAND);
|
||||||
throw new NoChargeException();
|
throw new NoChargeException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void run(final Server server, final CommandSender sender, final String commandLabel, final String[] args) throws Exception
|
||||||
|
{
|
||||||
|
if (args.length < 4)
|
||||||
|
{
|
||||||
|
throw new NotEnoughArgumentsException();
|
||||||
|
}
|
||||||
|
|
||||||
|
User user = ess.getUser(server.getPlayer(args[0]));
|
||||||
|
final int x = Integer.parseInt(args[1]);
|
||||||
|
final int y = Integer.parseInt(args[2]);
|
||||||
|
final int z = Integer.parseInt(args[3]);
|
||||||
|
final Location location = new Location(user.getWorld(), x, y, z);
|
||||||
|
if (args.length > 4)
|
||||||
|
{
|
||||||
|
location.setYaw((Float.parseFloat(args[4]) + 180 + 360) % 360);
|
||||||
|
}
|
||||||
|
if (args.length > 5)
|
||||||
|
{
|
||||||
|
location.setPitch(Float.parseFloat(args[5]));
|
||||||
|
}
|
||||||
|
sender.sendMessage(_("teleporting"));
|
||||||
|
user.sendMessage(_("teleporting"));
|
||||||
|
user.getTeleport().teleport(location, null, TeleportCause.COMMAND);
|
||||||
|
}
|
||||||
}
|
}
|
Loading…
Reference in a new issue