summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorementalo <ementalo@e251c2fe-e539-e718-e476-b85c1f46cddb>2011-05-04 15:53:32 +0000
committerementalo <ementalo@e251c2fe-e539-e718-e476-b85c1f46cddb>2011-05-04 15:53:32 +0000
commit50780f73997d6ed304255dca440dbc2e7f61a64f (patch)
treeb0a682927e6443862dc566f2691b8cb17a77e536
parentd9a5b73ea4bde8c0d6074d2d31f1cab04f17cb13 (diff)
downloadEssentials-50780f73997d6ed304255dca440dbc2e7f61a64f.tar
Essentials-50780f73997d6ed304255dca440dbc2e7f61a64f.tar.gz
Essentials-50780f73997d6ed304255dca440dbc2e7f61a64f.tar.lz
Essentials-50780f73997d6ed304255dca440dbc2e7f61a64f.tar.xz
Essentials-50780f73997d6ed304255dca440dbc2e7f61a64f.zip
[trunk] adding support to warp other players to warps, this requires the essentials.warp.otherplayers permission
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1342 e251c2fe-e539-e718-e476-b85c1f46cddb
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandwarp.java42
-rw-r--r--Essentials/src/plugin.yml2
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.