From 3e5bd4cf09e13444c6ff8b25a9cbf770edb33900 Mon Sep 17 00:00:00 2001 From: oxygencraft <21054297+oxygencraft@users.noreply.github.com> Date: Mon, 15 Jun 2020 22:36:13 +1000 Subject: [PATCH] Deny teleport requests to players lacking permission to accept (#3361) This PR will deny any teleport requests to players lacking permission to accept the request (`essentials.tpaccept`). Closes #1259. --- .../src/com/earth2me/essentials/commands/Commandtpa.java | 3 +++ Essentials/src/messages.properties | 1 + 2 files changed, 4 insertions(+) diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandtpa.java b/Essentials/src/com/earth2me/essentials/commands/Commandtpa.java index 9d57137f7..5d68bb596 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandtpa.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandtpa.java @@ -28,6 +28,9 @@ public class Commandtpa extends EssentialsCommand { if (user.getName().equalsIgnoreCase(player.getName())) { throw new NotEnoughArgumentsException(); } + if (!player.isAuthorized("essentials.tpaccept")) { + throw new Exception(tl("teleportNoAcceptPermission", player.getDisplayName())); + } if (!player.isTeleportEnabled()) { throw new Exception(tl("teleportDisabled", player.getDisplayName())); } diff --git a/Essentials/src/messages.properties b/Essentials/src/messages.properties index 72bcf07ad..41d99be20 100644 --- a/Essentials/src/messages.properties +++ b/Essentials/src/messages.properties @@ -538,6 +538,7 @@ teleportHome=\u00a76Teleporting to \u00a7c{0}\u00a76. teleporting=\u00a76Teleporting... teleportInvalidLocation=Value of coordinates cannot be over 30000000 teleportNewPlayerError=\u00a74Failed to teleport new player\! +teleportNoAcceptPermission=\u00a7c{0} \u00a74does not have permission to accept teleport requests. teleportRequest=\u00a7c{0}\u00a76 has requested to teleport to you. teleportRequestAllCancelled=\u00a76All outstanding teleport requests cancelled. teleportRequestCancelled=\u00a76Your teleport request to \u00a7c{0}\u00a76 was cancelled.