summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKHobbits <rob@khobbits.co.uk>2012-03-25 23:31:02 +0100
committerKHobbits <rob@khobbits.co.uk>2012-03-25 23:32:04 +0100
commit2cc96e995b2040baa56ba3b6bf58c5766b588708 (patch)
tree55c3a524d287c366873e761d49c36a41a25cf7b5
parent47cf1289d7baa72b318ecc444102dfe234c98e75 (diff)
downloadEssentials-2cc96e995b2040baa56ba3b6bf58c5766b588708.tar
Essentials-2cc96e995b2040baa56ba3b6bf58c5766b588708.tar.gz
Essentials-2cc96e995b2040baa56ba3b6bf58c5766b588708.tar.lz
Essentials-2cc96e995b2040baa56ba3b6bf58c5766b588708.tar.xz
Essentials-2cc96e995b2040baa56ba3b6bf58c5766b588708.zip
Update tp to check if target player has tptoggle disabled.
Update tpo to allow player to player tp.
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandtp.java8
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandtpo.java50
-rw-r--r--Essentials/src/plugin.yml2
3 files changed, 42 insertions, 18 deletions
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandtp.java b/Essentials/src/com/earth2me/essentials/commands/Commandtp.java
index 22d4778d3..d6d6b76f9 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandtp.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandtp.java
@@ -49,6 +49,14 @@ public class Commandtp extends EssentialsCommand
user.sendMessage(_("teleporting"));
final User target = getPlayer(server, args, 0);
final User toPlayer = getPlayer(server, args, 1);
+ if (!target.isTeleportEnabled())
+ {
+ throw new Exception(_("teleportDisabled", target.getDisplayName()));
+ }
+ if (!toPlayer.isTeleportEnabled())
+ {
+ throw new Exception(_("teleportDisabled", toPlayer.getDisplayName()));
+ }
if (target.getWorld() != toPlayer.getWorld() && ess.getSettings().isWorldTeleportPermissions()
&& !user.isAuthorized("essentials.world." + toPlayer.getWorld().getName()))
{
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandtpo.java b/Essentials/src/com/earth2me/essentials/commands/Commandtpo.java
index e30aee127..53204114e 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandtpo.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandtpo.java
@@ -16,33 +16,49 @@ public class Commandtpo extends EssentialsCommand
@Override
public void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception
{
- if (args.length < 1)
+ switch (args.length)
{
+ case 0:
throw new NotEnoughArgumentsException();
- }
- //Just basically the old tp command
- final User player = getPlayer(server, args, 0, true);
- // Check if user is offline
- if (!player.isOnline())
- {
- throw new NoSuchFieldException(_("playerNotFound"));
- }
-
- // Verify permission
- if (!player.isHidden() || user.isAuthorized("essentials.teleport.hidden"))
- {
+ case 1:
+ final User player = getPlayer(server, args, 0, true);
+ if (!player.isOnline() || (player.isHidden() && !user.isAuthorized("essentials.teleport.hidden")))
+ {
+ throw new NoSuchFieldException(_("playerNotFound"));
+ }
if (user.getWorld() != player.getWorld() && ess.getSettings().isWorldTeleportPermissions()
&& !user.isAuthorized("essentials.world." + player.getWorld().getName()))
{
throw new Exception(_("noPerm", "essentials.world." + player.getWorld().getName()));
}
+ user.sendMessage(_("teleporting"));
user.getTeleport().now(player, false, TeleportCause.COMMAND);
+
+ default:
+ if (!user.isAuthorized("essentials.tp.others"))
+ {
+ throw new Exception(_("noPerm", "essentials.tp.others"));
+ }
user.sendMessage(_("teleporting"));
- }
- else
- {
- throw new NoSuchFieldException(_("playerNotFound"));
+ final User target = getPlayer(server, args, 0, true);
+ final User toPlayer = getPlayer(server, args, 1, true);
+
+ if (!target.isOnline() || !toPlayer.isOnline()
+ || ((target.isHidden() || toPlayer.isHidden()) && !user.isAuthorized("essentials.teleport.hidden")))
+ {
+ throw new NoSuchFieldException(_("playerNotFound"));
+ }
+
+ if (target.getWorld() != toPlayer.getWorld() && ess.getSettings().isWorldTeleportPermissions()
+ && !user.isAuthorized("essentials.world." + toPlayer.getWorld().getName()))
+ {
+ throw new Exception(_("noPerm", "essentials.world." + toPlayer.getWorld().getName()));
+ }
+
+ target.getTeleport().now(toPlayer, false, TeleportCause.COMMAND);
+ target.sendMessage(_("teleportAtoB", user.getDisplayName(), toPlayer.getDisplayName()));
+ break;
}
}
}
diff --git a/Essentials/src/plugin.yml b/Essentials/src/plugin.yml
index 2230cf71c..022143b3f 100644
--- a/Essentials/src/plugin.yml
+++ b/Essentials/src/plugin.yml
@@ -375,7 +375,7 @@ commands:
aliases: [s,etphere]
tpo:
description: Teleport override for tptoggle.
- usage: /<command> <player>
+ usage: /<command> <player> [otherplayer]
aliases: [etpo]
tpohere:
description: Teleport here override for tptoggle.