From d4adb490e2b4c31b68be4770161c3985b3296f4b Mon Sep 17 00:00:00 2001 From: t00thpick1 Date: Wed, 15 Jan 2020 13:32:10 -0800 Subject: [PATCH] Fixing PTP exploit --- .../commands/party/teleport/PtpCommand.java | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/main/java/com/gmail/nossr50/commands/party/teleport/PtpCommand.java b/src/main/java/com/gmail/nossr50/commands/party/teleport/PtpCommand.java index 5ba7b5654..8d046c8fb 100644 --- a/src/main/java/com/gmail/nossr50/commands/party/teleport/PtpCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/party/teleport/PtpCommand.java @@ -19,6 +19,7 @@ import com.gmail.nossr50.util.skills.SkillUtils; import com.gmail.nossr50.worldguard.WorldGuardManager; import com.gmail.nossr50.worldguard.WorldGuardUtils; import com.google.common.collect.ImmutableList; +import org.bukkit.World; import org.bukkit.command.Command; import org.bukkit.command.CommandExecutor; import org.bukkit.command.CommandSender; @@ -168,6 +169,23 @@ public class PtpCommand implements TabExecutor { McMMOPlayer mcMMOTarget = UserManager.getPlayer(targetName); Player target = mcMMOTarget.getPlayer(); + + if (Config.getInstance().getPTPCommandWorldPermissions()) { + World targetWorld = target.getWorld(); + World playerWorld = player.getWorld(); + + if (!Permissions.partyTeleportAllWorlds(player)) { + if (!Permissions.partyTeleportWorld(target, targetWorld)) { + player.sendMessage(LocaleLoader.getString("Commands.ptp.NoWorldPermissions", targetWorld.getName())); + return; + } + else if (targetWorld != playerWorld && !Permissions.partyTeleportWorld(player, targetWorld)) { + player.sendMessage(LocaleLoader.getString("Commands.ptp.NoWorldPermissions", targetWorld.getName())); + return; + } + } + } + PartyTeleportRecord ptpRecord = mcMMOTarget.getPartyTeleportRecord(); if (!ptpRecord.isConfirmRequired()) {