Access to the hashmap is now through one method

This commit is contained in:
Andrew 2013-06-23 08:58:53 +12:00
parent 5aef4bf0ba
commit 7ec82735f9

View File

@ -36,15 +36,22 @@ public class DisguiseAPI {
private static JavaPlugin plugin; private static JavaPlugin plugin;
private static boolean soundsEnabled; private static boolean soundsEnabled;
private synchronized static void put(Object obj, Disguise disguise) { private static void put(Object obj, Disguise disguise) {
if (disguise == null) access(obj, disguise);
disguises.remove(obj);
else
disguises.put(obj, disguise);
} }
private synchronized static Disguise get(Object obj) { private synchronized static Disguise access(Object obj, Disguise... object) {
return disguises.get(obj); if (object.length == 0)
return disguises.get(obj);
if (object[0] == null)
disguises.remove(obj);
else
disguises.put(obj, object[0]);
return null;
}
private static Disguise get(Object obj) {
return access(obj);
} }
/** /**