From 9dc58948b232e43742abfcdcd683e1f3325481c7 Mon Sep 17 00:00:00 2001 From: Drkmaster83 Date: Mon, 25 Dec 2017 01:08:08 -0600 Subject: [PATCH] =?UTF-8?q?Implements=20PR#1516=20-=20TPPos=20World-Telepo?= =?UTF-8?q?rt=20Permissions=20https://github.com/EssentialsX/Essentials/is?= =?UTF-8?q?sues/1516=20Considerations:=20=E2=80=A2=20TPPos=20on=20a=20targ?= =?UTF-8?q?et=20doesn't=20consider=20the=20target's=20world=20access=20per?= =?UTF-8?q?missions,=20reminiscent=20of=20the=20TP=20A=20to=20B=20command.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../earth2me/essentials/commands/Commandtppos.java | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandtppos.java b/Essentials/src/com/earth2me/essentials/commands/Commandtppos.java index 01a2a4039..763e5cec8 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandtppos.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandtppos.java @@ -32,14 +32,22 @@ public class Commandtppos extends EssentialsCommand { final double z = args[2].startsWith("~") ? user.getLocation().getZ() + (args[2].length() > 1 ? Integer.parseInt(args[2].substring(1)) : 0) : Integer.parseInt(args[2]); final Location loc = new Location(user.getWorld(), x, y, z, user.getLocation().getYaw(), user.getLocation().getPitch()); if (args.length == 4) { - loc.setWorld(ess.getWorld(args[3])); + World w = ess.getWorld(args[3]); + if (user.getWorld() != w && ess.getSettings().isWorldTeleportPermissions() && !user.isAuthorized("essentials.worlds." + w.getName())) { + throw new Exception(tl("noPerm", "essentials.worlds." + w.getName())); + } + loc.setWorld(w); } if (args.length > 4) { loc.setYaw((FloatUtil.parseFloat(args[3]) + 360) % 360); loc.setPitch(FloatUtil.parseFloat(args[4])); } if (args.length > 5) { - loc.setWorld(ess.getWorld(args[5])); + World w = ess.getWorld(args[5]); + if (user.getWorld() != w && ess.getSettings().isWorldTeleportPermissions() && !user.isAuthorized("essentials.worlds." + w.getName())) { + throw new Exception(tl("noPerm", "essentials.worlds." + w.getName())); + } + loc.setWorld(w); } if (x > 30000000 || y > 30000000 || z > 30000000 || x < -30000000 || y < -30000000 || z < -30000000) { throw new NotEnoughArgumentsException(tl("teleportInvalidLocation")); @@ -116,4 +124,4 @@ public class Commandtppos extends EssentialsCommand { return Collections.emptyList(); } } -} +} \ No newline at end of file