Ensure the backing of LPSubscriptionValueMaps is a WeakHashMap (#1058)

This commit is contained in:
Luck 2018-06-19 23:35:19 +01:00
parent 379eb00b69
commit 5b66436519
No known key found for this signature in database
GPG Key ID: EFA9B3EC5FD90F8B

View File

@ -160,14 +160,15 @@ public final class LPSubscriptionMap extends HashMap<String, Map<Permissible, Bo
private LPSubscriptionValueMap(String permission, Map<Permissible, Boolean> backing) {
this.permission = permission;
this.backing = backing;
this.backing = new WeakHashMap<>(backing);
// remove all players from the map
this.backing.keySet().removeIf(p -> p instanceof Player);
}
public LPSubscriptionValueMap(String permission) {
this(permission, new WeakHashMap<>());
this.permission = permission;
this.backing = new WeakHashMap<>();
}
@Override