Clean up /ptp a bit more.

This commit is contained in:
GJ 2013-02-13 19:29:46 -05:00
parent dda9c82940
commit 25a54ea802

View File

@ -84,7 +84,7 @@ public class PtpCommand implements CommandExecutor {
} }
if (!mcMMOTarget.getPtpConfirmRequired()) { if (!mcMMOTarget.getPtpConfirmRequired()) {
return handlePartyTeleportEvent(player, target); return handlePartyTeleportEvent();
} }
mcMMOTarget.setPtpRequest(player); mcMMOTarget.setPtpRequest(player);
@ -111,9 +111,10 @@ public class PtpCommand implements CommandExecutor {
return true; return true;
} }
Player requestTarget = mcMMOPlayer.getPtpRequest(); target = mcMMOPlayer.getPtpRequest();
if (!canTeleport(requestTarget.getName())) { if (!canTeleport(target.getName())) {
mcMMOPlayer.removePtpRequest();
return true; return true;
} }
@ -121,17 +122,17 @@ public class PtpCommand implements CommandExecutor {
if (Config.getInstance().getPTPCommandWorldPermissions()) { if (Config.getInstance().getPTPCommandWorldPermissions()) {
String perm = "mcmmo.commands.ptp.world."; String perm = "mcmmo.commands.ptp.world.";
if (!Permissions.hasDynamicPermission(requestTarget, perm + "all", "op")) { if (!Permissions.hasDynamicPermission(target, perm + "all", "op")) {
if (!Permissions.hasDynamicPermission(requestTarget, perm + requestTarget.getWorld().getName(), "op")) { if (!Permissions.hasDynamicPermission(target, perm + target.getWorld().getName(), "op")) {
return true; return true;
} }
else if (requestTarget.getWorld() != player.getWorld() && !Permissions.hasDynamicPermission(requestTarget, perm + player.getWorld().getName(), "op")) { else if (target.getWorld() != player.getWorld() && !Permissions.hasDynamicPermission(target, perm + player.getWorld().getName(), "op")) {
return true; return true;
} }
} }
} }
return handlePartyTeleportEvent(player, requestTarget); return handlePartyTeleportEvent();
} }
private boolean acceptAnyTeleportRequest() { private boolean acceptAnyTeleportRequest() {
@ -196,7 +197,7 @@ public class PtpCommand implements CommandExecutor {
return true; return true;
} }
private boolean handlePartyTeleportEvent(Player player, Player target) { private boolean handlePartyTeleportEvent() {
McMMOPlayer mcMMOPlayer= Users.getPlayer(player); McMMOPlayer mcMMOPlayer= Users.getPlayer(player);
McMMOPartyTeleportEvent event = new McMMOPartyTeleportEvent(player, target, mcMMOPlayer.getParty().getName()); McMMOPartyTeleportEvent event = new McMMOPartyTeleportEvent(player, target, mcMMOPlayer.getParty().getName());