mirror of
https://github.com/EngineHub/WorldGuard.git
synced 2024-12-25 10:37:41 +01:00
Fix error when group flag existed for non-existent flag.
Probably caused by bad API usage /shrug.
This commit is contained in:
parent
2b854f0d72
commit
f516999087
@ -24,6 +24,8 @@
|
||||
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 javax.annotation.Nullable;
|
||||
import java.util.Collection;
|
||||
@ -149,11 +151,19 @@ public Map<Flag<?>, Object> unmarshal(Map<String, Object> rawValues, boolean cre
|
||||
}
|
||||
}
|
||||
}
|
||||
RegionGroupFlag groupUnmarshaller = new RegionGroupFlag("unmarshaldummy", RegionGroup.NONE);
|
||||
for (Entry<String, Object> entry : regionFlags.entrySet()) {
|
||||
String parentName = entry.getKey().replaceAll("-group", "");
|
||||
Flag<?> parent = get(parentName);
|
||||
if (parent == null || parent instanceof UnknownFlag) {
|
||||
if (createUnknown) forceRegister(new UnknownFlag(entry.getKey()));
|
||||
if (createUnknown && get(entry.getKey()) == null) {
|
||||
final UnknownFlag unknownFlag = new UnknownFlag(entry.getKey());
|
||||
forceRegister(unknownFlag);
|
||||
}
|
||||
Flag<?> unk = get(entry.getKey());
|
||||
if (unk != null) {
|
||||
values.put(unk, groupUnmarshaller.unmarshal(entry.getValue()));
|
||||
}
|
||||
} else {
|
||||
values.put(parent.getRegionGroupFlag(), parent.getRegionGroupFlag().unmarshal(entry.getValue()));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user