mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-22 21:26:45 +01:00
idk why that wasn't working
This commit is contained in:
parent
538e2a6002
commit
17154ef1d5
@ -28,7 +28,7 @@ public abstract class UUIDHandlerImplementation {
|
|||||||
public UUIDWrapper uuidWrapper;
|
public UUIDWrapper uuidWrapper;
|
||||||
private boolean cached = false;
|
private boolean cached = false;
|
||||||
private BiMap<StringWrapper, UUID> uuidMap = HashBiMap.create(new HashMap<StringWrapper, UUID>());
|
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) {
|
public UUIDHandlerImplementation(UUIDWrapper wrapper) {
|
||||||
this.uuidWrapper = wrapper;
|
this.uuidWrapper = wrapper;
|
||||||
@ -62,7 +62,7 @@ public abstract class UUIDHandlerImplementation {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void rename(UUID uuid, StringWrapper name) {
|
public void rename(UUID uuid, StringWrapper name) {
|
||||||
this.nameMap.remove(uuid);
|
this.uuidMap.inverse().remove(uuid);
|
||||||
this.uuidMap.put(name, uuid);
|
this.uuidMap.put(name, uuid);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -76,8 +76,7 @@ public abstract class UUIDHandlerImplementation {
|
|||||||
if (uuid == null || name == null) {
|
if (uuid == null || name == null) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
BiMap<UUID, StringWrapper> inverse = this.nameMap;
|
if (this.uuidMap.inverse().containsKey(uuid)) {
|
||||||
if (inverse.containsKey(uuid)) {
|
|
||||||
if (this.uuidMap.containsKey(name)) {
|
if (this.uuidMap.containsKey(name)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -166,16 +165,17 @@ public abstract class UUIDHandlerImplementation {
|
|||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
StringWrapper oName = this.nameMap.get(offline);
|
StringWrapper oName = this.uuidMap.inverse().get(offline);
|
||||||
if (!oName.equals(name)) {
|
if (!oName.equals(name)) {
|
||||||
this.uuidMap.remove(name);
|
System.out.println("Remove " + name);
|
||||||
|
this.uuidMap.remove (name);
|
||||||
this.uuidMap.put(name, uuid);
|
this.uuidMap.put(name, uuid);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} catch (Exception ignored) {
|
} catch (Exception ignored) {
|
||||||
BiMap<UUID, StringWrapper> inverse = this.nameMap;
|
BiMap<UUID, StringWrapper> inverse = this.uuidMap.inverse();
|
||||||
if (inverse.containsKey(uuid)) {
|
if (inverse.containsKey(uuid)) {
|
||||||
if (this.uuidMap.containsKey(name)) {
|
if (this.uuidMap.containsKey(name)) {
|
||||||
return false;
|
return false;
|
||||||
@ -216,7 +216,7 @@ public abstract class UUIDHandlerImplementation {
|
|||||||
if (uuid == null) {
|
if (uuid == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
StringWrapper name = this.nameMap.get(uuid);
|
StringWrapper name = this.uuidMap.inverse().get(uuid);
|
||||||
if (name != null) {
|
if (name != null) {
|
||||||
return name.value;
|
return name.value;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user