mirror of
https://github.com/EngineHub/WorldGuard.git
synced 2025-02-18 13:21:46 +01:00
Fix unmarshalling of region group flags.
Fixes WORLDGUARD-3708.
This commit is contained in:
parent
ab55137f59
commit
e0df194ff2
@ -20,10 +20,8 @@
|
|||||||
package com.sk89q.worldguard.protection.flags;
|
package com.sk89q.worldguard.protection.flags;
|
||||||
|
|
||||||
import com.google.common.collect.Iterators;
|
import com.google.common.collect.Iterators;
|
||||||
import com.sk89q.worldguard.bukkit.WorldGuardPlugin;
|
|
||||||
import com.sk89q.worldguard.protection.FlagValueCalculator;
|
import com.sk89q.worldguard.protection.FlagValueCalculator;
|
||||||
import com.sk89q.worldguard.protection.flags.registry.FlagRegistry;
|
import com.sk89q.worldguard.protection.flags.registry.FlagRegistry;
|
||||||
import org.bukkit.command.CommandSender;
|
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
@ -115,7 +115,13 @@ public Map<Flag<?>, Object> unmarshal(Map<String, Object> rawValues, boolean cre
|
|||||||
checkNotNull(rawValues, "rawValues");
|
checkNotNull(rawValues, "rawValues");
|
||||||
|
|
||||||
ConcurrentMap<Flag<?>, Object> values = Maps.newConcurrentMap();
|
ConcurrentMap<Flag<?>, Object> values = Maps.newConcurrentMap();
|
||||||
|
ConcurrentMap<String, Object> regionFlags = Maps.newConcurrentMap();
|
||||||
|
|
||||||
for (Entry<String, Object> entry : rawValues.entrySet()) {
|
for (Entry<String, Object> entry : rawValues.entrySet()) {
|
||||||
|
if (entry.getKey().endsWith("-group")) {
|
||||||
|
regionFlags.put(entry.getKey(), entry.getValue());
|
||||||
|
continue;
|
||||||
|
}
|
||||||
Flag<?> flag = createUnknown ? getOrCreate(entry.getKey()) : get(entry.getKey());
|
Flag<?> flag = createUnknown ? getOrCreate(entry.getKey()) : get(entry.getKey());
|
||||||
|
|
||||||
if (flag != null) {
|
if (flag != null) {
|
||||||
@ -132,6 +138,15 @@ public Map<Flag<?>, Object> unmarshal(Map<String, Object> rawValues, boolean cre
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
for (Entry<String, Object> entry : regionFlags.entrySet()) {
|
||||||
|
String parentName = entry.getKey().replaceAll("-group", "");
|
||||||
|
Flag<?> parent = get(parentName);
|
||||||
|
if (parent == null || parent instanceof UnknownFlag) {
|
||||||
|
forceRegister(new UnknownFlag(entry.getKey()));
|
||||||
|
} else {
|
||||||
|
parent.getRegionGroupFlag().unmarshal(entry.getValue());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return values;
|
return values;
|
||||||
}
|
}
|
||||||
|
@ -19,11 +19,9 @@
|
|||||||
|
|
||||||
package com.sk89q.worldguard.protection.managers.storage;
|
package com.sk89q.worldguard.protection.managers.storage;
|
||||||
|
|
||||||
import com.sk89q.worldguard.protection.flags.Flag;
|
|
||||||
import com.sk89q.worldguard.protection.regions.ProtectedRegion;
|
import com.sk89q.worldguard.protection.regions.ProtectedRegion;
|
||||||
import com.sk89q.worldguard.protection.regions.ProtectedRegion.CircularInheritanceException;
|
import com.sk89q.worldguard.protection.regions.ProtectedRegion.CircularInheritanceException;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user