mirror of
https://github.com/libraryaddict/LibsDisguises.git
synced 2024-12-15 15:28:36 +01:00
Stupid hashsets and hashmaps and their unability to equalsignorecase on strings
This commit is contained in:
parent
dc6348cf38
commit
01023a29ed
@ -10,7 +10,6 @@ import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.Reader;
|
||||
import java.lang.reflect.Field;
|
||||
|
||||
import me.libraryaddict.disguise.commands.*;
|
||||
import me.libraryaddict.disguise.disguisetypes.Disguise;
|
||||
import me.libraryaddict.disguise.disguisetypes.DisguiseType;
|
||||
|
@ -447,7 +447,7 @@ public abstract class Disguise {
|
||||
|
||||
if (isPlayerDisguise()) {
|
||||
String name = ((PlayerDisguise) this).getName();
|
||||
if (!DisguiseUtilities.getAddedByPlugins().contains(name)) {
|
||||
if (!DisguiseUtilities.getAddedByPlugins().contains(name.toLowerCase())) {
|
||||
for (HashSet<TargetedDisguise> disguise : disguises.values()) {
|
||||
for (Disguise d : disguise) {
|
||||
if (d.isPlayerDisguise() && ((PlayerDisguise) d).getName().equals(name)) {
|
||||
@ -455,7 +455,7 @@ public abstract class Disguise {
|
||||
}
|
||||
}
|
||||
}
|
||||
DisguiseUtilities.getGameProfiles().remove(name);
|
||||
DisguiseUtilities.getGameProfiles().remove(name.toLowerCase());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -224,7 +224,7 @@ public enum DisguiseType {
|
||||
|
||||
public static DisguiseType getType(EntityType entityType) {
|
||||
try {
|
||||
return DisguiseType.valueOf(entityType.name());
|
||||
return valueOf(entityType.name().toUpperCase());
|
||||
} catch (Throwable ex) {
|
||||
return null;
|
||||
}
|
||||
|
@ -121,7 +121,7 @@ public class DisguiseUtilities {
|
||||
|
||||
public static void addGameProfile(String string, WrappedGameProfile gameProfile) {
|
||||
getGameProfiles().put(string, gameProfile);
|
||||
addedByPlugins.add(string);
|
||||
getAddedByPlugins().add(string.toLowerCase());
|
||||
}
|
||||
|
||||
/**
|
||||
@ -291,7 +291,7 @@ public class DisguiseUtilities {
|
||||
}
|
||||
|
||||
public static WrappedGameProfile getGameProfile(String playerName) {
|
||||
return gameProfiles.get(playerName);
|
||||
return gameProfiles.get(playerName.toLowerCase());
|
||||
}
|
||||
|
||||
public static HashMap<String, WrappedGameProfile> getGameProfiles() {
|
||||
@ -335,11 +335,14 @@ public class DisguiseUtilities {
|
||||
}
|
||||
|
||||
public static WrappedGameProfile getProfileFromMojang(final PlayerDisguise disguise) {
|
||||
final boolean remove = getAddedByPlugins().contains(disguise.getName().toLowerCase());
|
||||
return getProfileFromMojang(disguise.getName(), new LibsProfileLookup() {
|
||||
|
||||
@Override
|
||||
public void onLookup(WrappedGameProfile gameProfile) {
|
||||
getAddedByPlugins().remove(disguise.getName());
|
||||
if (remove) {
|
||||
getAddedByPlugins().remove(disguise.getName().toLowerCase());
|
||||
}
|
||||
if (DisguiseAPI.isDisguiseInUse(disguise)) {
|
||||
DisguiseUtilities.refreshTrackers(disguise);
|
||||
if (disguise.getEntity() instanceof Player && disguise.isSelfDisguiseVisible()) {
|
||||
@ -358,8 +361,8 @@ public class DisguiseUtilities {
|
||||
return getProfileFromMojang(playerName, (Object) runnableIfCantReturn);
|
||||
}
|
||||
|
||||
private static WrappedGameProfile getProfileFromMojang(String name, final Object runnable) {
|
||||
final String playerName = name.toLowerCase();
|
||||
private static WrappedGameProfile getProfileFromMojang(String origName, final Object runnable) {
|
||||
final String playerName = origName.toLowerCase();
|
||||
if (gameProfiles.containsKey(playerName)) {
|
||||
if (gameProfiles.get(playerName) != null) {
|
||||
return gameProfiles.get(playerName);
|
||||
@ -413,7 +416,7 @@ public class DisguiseUtilities {
|
||||
}
|
||||
runnables.get(playerName).add(runnable);
|
||||
}
|
||||
return ReflectionManager.getGameProfile(null, playerName);
|
||||
return ReflectionManager.getGameProfile(null, origName);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -556,11 +559,11 @@ public class DisguiseUtilities {
|
||||
|
||||
@Deprecated
|
||||
public static void removeGameprofile(String string) {
|
||||
gameProfiles.remove(string);
|
||||
removeGameProfile(string);
|
||||
}
|
||||
|
||||
public static void removeGameProfile(String string) {
|
||||
gameProfiles.remove(string);
|
||||
gameProfiles.remove(string.toLowerCase());
|
||||
}
|
||||
|
||||
public static void removeSelfDisguise(Player player) {
|
||||
|
@ -14,6 +14,7 @@ import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
|
||||
import org.bukkit.Art;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
@ -85,7 +86,7 @@ public class ReflectionManager {
|
||||
private static final Field pingField;
|
||||
private static Map<Class<?>, String> primitiveTypes;
|
||||
private static final Field trackerField;
|
||||
|
||||
|
||||
/*
|
||||
* This portion of code is originally Copyright (C) 2014-2014 Kane York.
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user