idk why that wasn't working

This commit is contained in:
Jesse Boyd 2017-08-18 23:34:27 +10:00
parent 538e2a6002
commit 17154ef1d5
No known key found for this signature in database
GPG Key ID: 59F1DE6293AF6E1F

View File

@ -28,7 +28,7 @@ public abstract class UUIDHandlerImplementation {
public UUIDWrapper uuidWrapper;
private boolean cached = false;
private BiMap<StringWrapper, UUID> uuidMap = HashBiMap.create(new HashMap<StringWrapper, UUID>());
private BiMap<UUID, StringWrapper> nameMap = uuidMap.inverse();
// private BiMap<UUID, StringWrapper> nameMap = uuidMap.inverse();
public UUIDHandlerImplementation(UUIDWrapper wrapper) {
this.uuidWrapper = wrapper;
@ -62,7 +62,7 @@ public abstract class UUIDHandlerImplementation {
}
public void rename(UUID uuid, StringWrapper name) {
this.nameMap.remove(uuid);
this.uuidMap.inverse().remove(uuid);
this.uuidMap.put(name, uuid);
}
@ -76,8 +76,7 @@ public abstract class UUIDHandlerImplementation {
if (uuid == null || name == null) {
continue;
}
BiMap<UUID, StringWrapper> inverse = this.nameMap;
if (inverse.containsKey(uuid)) {
if (this.uuidMap.inverse().containsKey(uuid)) {
if (this.uuidMap.containsKey(name)) {
continue;
}
@ -166,16 +165,17 @@ public abstract class UUIDHandlerImplementation {
}
return true;
} else {
StringWrapper oName = this.nameMap.get(offline);
StringWrapper oName = this.uuidMap.inverse().get(offline);
if (!oName.equals(name)) {
this.uuidMap.remove(name);
System.out.println("Remove " + name);
this.uuidMap.remove (name);
this.uuidMap.put(name, uuid);
}
}
return false;
}
} catch (Exception ignored) {
BiMap<UUID, StringWrapper> inverse = this.nameMap;
BiMap<UUID, StringWrapper> inverse = this.uuidMap.inverse();
if (inverse.containsKey(uuid)) {
if (this.uuidMap.containsKey(name)) {
return false;
@ -216,7 +216,7 @@ public abstract class UUIDHandlerImplementation {
if (uuid == null) {
return null;
}
StringWrapper name = this.nameMap.get(uuid);
StringWrapper name = this.uuidMap.inverse().get(uuid);
if (name != null) {
return name.value;
}