diff options
-rw-r--r-- | Essentials/src/com/earth2me/essentials/commands/Commandwarp.java | 42 | ||||
-rw-r--r-- | Essentials/src/plugin.yml | 2 |
2 files changed, 28 insertions, 16 deletions
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandwarp.java b/Essentials/src/com/earth2me/essentials/commands/Commandwarp.java index 4a7765dab..8b8df3c19 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandwarp.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandwarp.java @@ -4,6 +4,7 @@ import org.bukkit.Server; import com.earth2me.essentials.Essentials; import com.earth2me.essentials.User; import com.earth2me.essentials.Warps; +import org.bukkit.command.CommandSender; public class Commandwarp extends EssentialsCommand @@ -16,7 +17,7 @@ public class Commandwarp extends EssentialsCommand @Override public void run(Server server, User user, String commandLabel, String[] args) throws Exception { - boolean perWarpPermission = ess.getSettings().getPerWarpPermission(); + if (args.length == 0) { if (!user.isAuthorized("essentials.warp.list")) @@ -34,7 +35,7 @@ public class Commandwarp extends EssentialsCommand int i = 0; for (String warpName : warps.getWarpNames()) { - if (perWarpPermission) + if (ess.getSettings().getPerWarpPermission()) { if (user.isAuthorized("essentials.warp." + warpName)) { @@ -52,26 +53,37 @@ public class Commandwarp extends EssentialsCommand user.sendMessage(sb.toString()); return; } - - try + if (args.length > 0) { - if (perWarpPermission) + User otherUser = null; + if (args.length == 2 && user.isAuthorized("essentials.warp.otherplayers")) { - if (user.isAuthorized("essentials.warp." + args[0])) + otherUser = ess.getUser(server.getPlayer(args[1])); + if(otherUser == null) { - user.charge(this); - user.getTeleport().warp(args[0], this.getName()); + user.sendMessage("§cPlayer not found"); return; } - user.sendMessage("§cYou do not have Permission to use that warp."); - return; + warpUser(otherUser, args[0]); } - user.charge(this); - user.getTeleport().warp(args[0], this.getName()); + warpUser(user, args[0]); } - catch (Exception ex) + } + + private void warpUser(User user, String name) throws Exception + { + if (ess.getSettings().getPerWarpPermission()) { - user.sendMessage(ex.getMessage()); + if (user.isAuthorized("essentials.warp." + name)) + { + charge(user); + user.getTeleport().warp(name, this.getName()); + return; + } + user.sendMessage("§cYou do not have Permission to use that warp."); + return; } + charge(user); + user.getTeleport().warp(name, this.getName()); } -} +}
\ No newline at end of file diff --git a/Essentials/src/plugin.yml b/Essentials/src/plugin.yml index 6b3cae73b..dcbddc706 100644 --- a/Essentials/src/plugin.yml +++ b/Essentials/src/plugin.yml @@ -309,7 +309,7 @@ commands: aliases: [eunlimited]
warp:
description: List all warps or warp to the specified location.
- usage: /<command> <warp>
+ usage: /<command> <warp> <player>
aliases: [ewarp]
weather:
description: Setting the weather.
|