diff --git a/src/main/java/com/gmail/nossr50/commands/party/PartyJoinCommand.java b/src/main/java/com/gmail/nossr50/commands/party/PartyJoinCommand.java index 9a122f598..9086f7643 100644 --- a/src/main/java/com/gmail/nossr50/commands/party/PartyJoinCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/party/PartyJoinCommand.java @@ -9,8 +9,6 @@ import com.gmail.nossr50.datatypes.party.Party; import com.gmail.nossr50.datatypes.player.McMMOPlayer; import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.party.PartyManager; -import com.gmail.nossr50.util.Misc; -import com.gmail.nossr50.util.commands.CommandUtils; import com.gmail.nossr50.util.player.UserManager; public class PartyJoinCommand implements CommandExecutor { 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 b2dc25627..680105a0d 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 @@ -88,7 +88,7 @@ public class PtpCommand implements TabExecutor { } } - sendTeleportRequest(sender, player, Misc.getMatchedPlayerName(args[0])); + sendTeleportRequest(player, Misc.getMatchedPlayerName(args[0])); return true; default: @@ -113,8 +113,8 @@ public class PtpCommand implements TabExecutor { } } - private void sendTeleportRequest(CommandSender sender, Player player, String targetName) { - if (!canTeleport(sender, player, targetName)) { + private void sendTeleportRequest(Player player, String targetName) { + if (!canTeleport(player, targetName)) { return; } @@ -132,20 +132,21 @@ public class PtpCommand implements TabExecutor { target.sendMessage(LocaleLoader.getString("Commands.ptp.Request2", Config.getInstance().getPTPCommandTimeout())); } - protected static boolean canTeleport(CommandSender sender, Player player, String targetName) { - mcMMOTarget = UserManager.getPlayer(targetName); + protected static boolean canTeleport(Player player, String targetName) { + target = mcMMO.p.getServer().getPlayerExact(targetName); - if (!CommandUtils.checkPlayerExistence(sender, targetName, mcMMOTarget)) { + if (target == null) { + player.sendMessage(LocaleLoader.getString("Commands.Offline")); return false; } - target = mcMMOTarget.getPlayer(); - if (player.equals(target)) { player.sendMessage(LocaleLoader.getString("Party.Teleport.Self")); return false; } + mcMMOTarget = UserManager.getPlayer(target); + if (!PartyManager.inSameParty(player, target)) { player.sendMessage(LocaleLoader.getString("Party.NotInYourParty", targetName)); return false;