geforkt von Mirrors/FastAsyncWorldEdit
Simplify further as using ConcurrentHashMap
Dieser Commit ist enthalten in:
Ursprung
197e08a937
Commit
88e64a0632
@ -19,26 +19,16 @@ public class BukkitPermissionAttachmentManager {
|
|||||||
if (p == null) {
|
if (p == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
PermissionAttachment attachment = attachments.get(p);
|
return attachments.computeIfAbsent(p, k -> k.addAttachment(plugin));
|
||||||
|
|
||||||
if (attachment != null) {
|
|
||||||
return attachment;
|
|
||||||
}
|
|
||||||
|
|
||||||
synchronized (this) {
|
|
||||||
return attachments.computeIfAbsent(p, k -> k.addAttachment(plugin));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void removeAttachment(@Nullable final Player p) {
|
public void removeAttachment(@Nullable final Player p) {
|
||||||
if (p == null || attachments.get(p) == null) {
|
if (p == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
synchronized (this) {
|
PermissionAttachment attach = attachments.remove(p);
|
||||||
PermissionAttachment attach = attachments.remove(p);
|
if (attach != null) {
|
||||||
if (attach != null) {
|
p.removeAttachment(attach);
|
||||||
p.removeAttachment(attach);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren