3
0
Mirror von https://github.com/IntellectualSites/FastAsyncWorldEdit.git synchronisiert 2024-12-24 01:50:06 +01:00

Simplify further as using ConcurrentHashMap

Dieser Commit ist enthalten in:
dordsor21 2020-10-01 17:08:29 +01:00
Ursprung 197e08a937
Commit 88e64a0632
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 1E53E88969FFCF0B

Datei anzeigen

@ -19,26 +19,16 @@ public class BukkitPermissionAttachmentManager {
if (p == null) {
return null;
}
PermissionAttachment attachment = attachments.get(p);
if (attachment != null) {
return attachment;
}
synchronized (this) {
return attachments.computeIfAbsent(p, k -> k.addAttachment(plugin));
}
return attachments.computeIfAbsent(p, k -> k.addAttachment(plugin));
}
public void removeAttachment(@Nullable final Player p) {
if (p == null || attachments.get(p) == null) {
if (p == null) {
return;
}
synchronized (this) {
PermissionAttachment attach = attachments.remove(p);
if (attach != null) {
p.removeAttachment(attach);
}
PermissionAttachment attach = attachments.remove(p);
if (attach != null) {
p.removeAttachment(attach);
}
}
}