Don't allow players to be added to SubscriptionValueMaps
This commit is contained in:
@@ -161,6 +161,9 @@ public final class LPSubscriptionMap extends HashMap<String, Map<Permissible, Bo
|
||||
private LPSubscriptionValueMap(String permission, Map<Permissible, Boolean> backing) {
|
||||
this.permission = permission;
|
||||
this.backing = backing;
|
||||
|
||||
// remove all players from the map
|
||||
this.backing.keySet().removeIf(p -> p instanceof Player);
|
||||
}
|
||||
|
||||
public LPSubscriptionValueMap(String permission) {
|
||||
@@ -197,6 +200,16 @@ public final class LPSubscriptionMap extends HashMap<String, Map<Permissible, Bo
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean put(Permissible key, Boolean value) {
|
||||
// don't allow players to be put into this map
|
||||
if (key instanceof Player) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return this.backing.put(key, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean containsKey(Object key) {
|
||||
// delegate through the get method
|
||||
@@ -241,11 +254,6 @@ public final class LPSubscriptionMap extends HashMap<String, Map<Permissible, Bo
|
||||
|
||||
// just delegate to the backing map
|
||||
|
||||
@Override
|
||||
public Boolean put(Permissible key, Boolean value) {
|
||||
return this.backing.put(key, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean remove(Object key) {
|
||||
return this.backing.remove(key);
|
||||
|
||||
Reference in New Issue
Block a user