Only lookup valid MC names from mojang. We can't save your soul if you do strange names

This commit is contained in:
libraryaddict 2014-08-26 14:39:24 +12:00
parent a5d8c8ee39
commit a83e0aee6f

View File

@ -9,6 +9,7 @@ import java.util.HashSet;
import java.util.Iterator; import java.util.Iterator;
import java.util.LinkedHashMap; import java.util.LinkedHashMap;
import java.util.UUID; import java.util.UUID;
import java.util.regex.Pattern;
import me.libraryaddict.disguise.DisguiseAPI; import me.libraryaddict.disguise.DisguiseAPI;
import me.libraryaddict.disguise.DisguiseConfig; import me.libraryaddict.disguise.DisguiseConfig;
@ -345,7 +346,8 @@ public class DisguiseUtilities {
getAddedByPlugins().remove(disguise.getName().toLowerCase()); getAddedByPlugins().remove(disguise.getName().toLowerCase());
} }
if (DisguiseAPI.isDisguiseInUse(disguise) 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. // TODO Resend for UUID? Might need to in the future.
DisguiseUtilities.refreshTrackers(disguise); DisguiseUtilities.refreshTrackers(disguise);
} }
@ -367,7 +369,7 @@ public class DisguiseUtilities {
if (gameProfiles.get(playerName) != null) { if (gameProfiles.get(playerName) != null) {
return gameProfiles.get(playerName); return gameProfiles.get(playerName);
} }
} else { } else if (Pattern.matches("([A-Za-z0-9_]){1,16}", origName)) {
getAddedByPlugins().add(playerName); getAddedByPlugins().add(playerName);
Player player = Bukkit.getPlayerExact(playerName); Player player = Bukkit.getPlayerExact(playerName);
if (player != null) { if (player != null) {
@ -409,12 +411,12 @@ public class DisguiseUtilities {
} }
} }
}); });
} if (runnable != null) {
if (runnable != null) { if (!runnables.containsKey(playerName)) {
if (!runnables.containsKey(playerName)) { runnables.put(playerName, new ArrayList<Object>());
runnables.put(playerName, new ArrayList<Object>()); }
runnables.get(playerName).add(runnable);
} }
runnables.get(playerName).add(runnable);
} }
return ReflectionManager.getGameProfile(null, origName); return ReflectionManager.getGameProfile(null, origName);
} }