diff --git a/src/main/java/org/ultramine/commands/basic/BasicCommands.java b/src/main/java/org/ultramine/commands/basic/BasicCommands.java index a0ddcdc..5be44d0 100644 --- a/src/main/java/org/ultramine/commands/basic/BasicCommands.java +++ b/src/main/java/org/ultramine/commands/basic/BasicCommands.java @@ -44,7 +44,7 @@ ctx.check(home != null, "command.home.fail.notset"); if(home.dimension != target.dimension && !ConfigurationHandler.getServerConfig().settings.teleportation.interWorldHome) ctx.checkSenderPermission("ability.admin.ignoreInterworldHome", "command.home.fail.interworld"); - Teleporter.tpLater(target, home); + Teleporter.tpLaterOrNow(target, home, ctx.contains("target")); } @Command( @@ -106,19 +106,18 @@ permissions = {"command.basic.warp", "command.basic.warp.other"}, syntax = { "", - " " + " " } ) public static void warp(CommandContext ctx) { - if(ctx.contains("player")) - ctx.checkSenderPermission("command.warp.other", "command.warp.noperm.other"); - EntityPlayerMP target = ctx.contains("player") ? ctx.get("player").asPlayer() : ctx.getSenderAsPlayer(); + ctx.checkPermissionIfArg("target", "command.warp.other", "command.warp.noperm.other"); + EntityPlayerMP target = ctx.contains("target") ? ctx.get("target").asPlayer() : ctx.getSenderAsPlayer(); WarpLocation warp = ctx.getServerData().getWarp(ctx.get("name").asString()); ctx.check(warp != null, "command.warp.fail"); if(warp.dimension != target.dimension && !ConfigurationHandler.getServerConfig().settings.teleportation.interWorldWarp) ctx.checkSenderPermission("ability.admin.ignoreInterworldHome", "command.warp.fail.interworld"); - Teleporter.tpLater(target, warp); + Teleporter.tpLaterOrNow(target, warp, ctx.contains("target")); } @Command( diff --git a/src/main/java/org/ultramine/server/Teleporter.java b/src/main/java/org/ultramine/server/Teleporter.java index d2a7dff..78c9bac 100644 --- a/src/main/java/org/ultramine/server/Teleporter.java +++ b/src/main/java/org/ultramine/server/Teleporter.java @@ -40,6 +40,14 @@ doTeleportation(target, dst); } + public static void tpLaterOrNow(EntityPlayerMP target, WarpLocation dst, boolean now) + { + if(now) + tpNow(target, dst); + else + tpLater(target, dst); + } + public static void tpLater(EntityPlayerMP target, WarpLocation dst) { long timeto = target.getData().core().getNextTeleportationTime() - System.currentTimeMillis();