mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2024-12-22 17:27:38 +00:00
Simplify further as using ConcurrentHashMap
This commit is contained in:
parent
197e08a937
commit
88e64a0632
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user