Răsfoiți Sursa

PTP exploit fix

nossr50 13 ani în urmă
părinte
comite
8669582e8f

+ 1 - 0
Changelog.txt

@@ -18,6 +18,7 @@ Version 2.0.00-dev
  = Fixed issue where every block broken had a mining check applied
  = Fixed issue where every block broken had a herbalism check applied
  = Fixed issue where blocks weren't being removed from the watchlist
+ = Fixed exploit where you could use /ptp to teleport to anyone
  ! Changed inspect failed message to say inspect rather than whois
  ! Changed Call of the Wild to activate on left-click rather than right-click
  ! Changed Blast Mining to track based on Entity ID vs. Location

+ 9 - 0
src/main/java/com/gmail/nossr50/commands/party/PtpCommand.java

@@ -34,10 +34,17 @@ public class PtpCommand implements CommandExecutor {
 			player.sendMessage(ChatColor.YELLOW + "[mcMMO] " + ChatColor.DARK_RED + mcLocale.getString("mcPlayerListener.NoPermission"));
 			return true;
 		}
+		
+		if(PP.getParty() == null || PP.getParty() == "")
+		{
+		    player.sendMessage(ChatColor.RED+"You are not in a party!");
+		    return true;
+		}
 		if (args.length < 1) {
 			player.sendMessage(ChatColor.RED + "Usage is /ptp <playername>");
 			return true;
 		}
+		
 		if (plugin.getServer().getPlayer(args[0]) == null) {
 			player.sendMessage("That is not a valid player");
 		}
@@ -49,6 +56,8 @@ public class PtpCommand implements CommandExecutor {
 				player.teleport(target);
 				player.sendMessage(ChatColor.GREEN + "You have teleported to " + target.getName());
 				target.sendMessage(ChatColor.GREEN + player.getName() + " has teleported to you.");
+			} else {
+			    player.sendMessage(ChatColor.RED + "That player is in a different party than you.");
 			}
 		}