From a83e0aee6f460d2ad618e78231019af03054e341 Mon Sep 17 00:00:00 2001 From: libraryaddict Date: Tue, 26 Aug 2014 14:39:24 +1200 Subject: [PATCH] Only lookup valid MC names from mojang. We can't save your soul if you do strange names --- .../disguise/utilities/DisguiseUtilities.java | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/me/libraryaddict/disguise/utilities/DisguiseUtilities.java b/src/me/libraryaddict/disguise/utilities/DisguiseUtilities.java index b0f3edc8..7271083a 100644 --- a/src/me/libraryaddict/disguise/utilities/DisguiseUtilities.java +++ b/src/me/libraryaddict/disguise/utilities/DisguiseUtilities.java @@ -9,6 +9,7 @@ import java.util.HashSet; import java.util.Iterator; import java.util.LinkedHashMap; import java.util.UUID; +import java.util.regex.Pattern; import me.libraryaddict.disguise.DisguiseAPI; import me.libraryaddict.disguise.DisguiseConfig; @@ -345,7 +346,8 @@ public class DisguiseUtilities { getAddedByPlugins().remove(disguise.getName().toLowerCase()); } if (DisguiseAPI.isDisguiseInUse(disguise) - && (!gameProfile.getName().equals(disguise.getName()) || (LibVersion.is1_7_6() && !gameProfile.getProperties().isEmpty()))) { + && (!gameProfile.getName().equals(disguise.getName()) || (LibVersion.is1_7_6() && !gameProfile + .getProperties().isEmpty()))) { // TODO Resend for UUID? Might need to in the future. DisguiseUtilities.refreshTrackers(disguise); } @@ -367,7 +369,7 @@ public class DisguiseUtilities { if (gameProfiles.get(playerName) != null) { return gameProfiles.get(playerName); } - } else { + } else if (Pattern.matches("([A-Za-z0-9_]){1,16}", origName)) { getAddedByPlugins().add(playerName); Player player = Bukkit.getPlayerExact(playerName); if (player != null) { @@ -409,12 +411,12 @@ public class DisguiseUtilities { } } }); - } - if (runnable != null) { - if (!runnables.containsKey(playerName)) { - runnables.put(playerName, new ArrayList()); + if (runnable != null) { + if (!runnables.containsKey(playerName)) { + runnables.put(playerName, new ArrayList()); + } + runnables.get(playerName).add(runnable); } - runnables.get(playerName).add(runnable); } return ReflectionManager.getGameProfile(null, origName); }