mirror of
https://github.com/EngineHub/WorldGuard.git
synced 2025-02-23 07:41:30 +01:00
Handle non-existent region group flags smarter
This commit is contained in:
parent
36d4483353
commit
1901692178
@ -24,7 +24,10 @@
|
||||
import com.google.common.collect.Maps;
|
||||
import com.sk89q.worldguard.protection.flags.Flag;
|
||||
import com.sk89q.worldguard.protection.flags.Flags;
|
||||
import com.sk89q.worldguard.protection.flags.RegionGroup;
|
||||
import com.sk89q.worldguard.protection.flags.RegionGroupFlag;
|
||||
import com.sk89q.worldguard.protection.flags.StateFlag;
|
||||
import com.sk89q.worldguard.protection.flags.StateFlag.State;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.Collection;
|
||||
@ -167,6 +170,18 @@ public Map<Flag<?>, Object> unmarshal(Map<String, Object> rawValues, boolean cre
|
||||
|
||||
if (regionGroupFlag != null) {
|
||||
values.put(regionGroupFlag, regionGroupFlag.unmarshal(entry.getValue()));
|
||||
} else {
|
||||
log.warning("Found non-existent region group flag '" + entry.getKey() + "' with value '" + entry.getValue() + "' for flag '" + parent.getName() + "'");
|
||||
log.warning("The region group flag '" + entry.getKey() + "' with value '" + entry.getValue() + "' will be removed");
|
||||
regionGroupFlag = new RegionGroupFlag("dummy", RegionGroup.ALL);
|
||||
RegionGroup regionGroup = regionGroupFlag.unmarshal(entry.getValue());
|
||||
|
||||
if (regionGroup != null && regionGroup != RegionGroup.ALL) {
|
||||
if (!(parent instanceof StateFlag) || values.get(parent) == State.ALLOW) {
|
||||
log.warning("For safety reasons the flag '" + parent.getName() + "' with value '" + values.get(parent) + "' will also be removed");
|
||||
values.remove(parent);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user