fix default perm vals defined in config not applying
This commit is contained in:
parent
5d2c753ef9
commit
297ef35893
|
@ -1,3 +1,8 @@
|
||||||
|
Flan 1.6.6
|
||||||
|
======================
|
||||||
|
- Fix blockentity interaction not working
|
||||||
|
- Fix globalDefaultPerms defined in config not applying to claim on creation
|
||||||
|
|
||||||
Flan 1.6.5
|
Flan 1.6.5
|
||||||
======================
|
======================
|
||||||
- Fix claims below 0 not working
|
- Fix claims below 0 not working
|
||||||
|
|
|
@ -99,6 +99,7 @@ public class Claim implements IPermissionContainer {
|
||||||
this.homePos = this.getInitCenterPos();
|
this.homePos = this.getInitCenterPos();
|
||||||
this.setDirty(true);
|
this.setDirty(true);
|
||||||
PermissionRegistry.getPerms().stream().filter(perm -> perm.defaultVal).forEach(perm -> this.globalPerm.put(perm, true));
|
PermissionRegistry.getPerms().stream().filter(perm -> perm.defaultVal).forEach(perm -> this.globalPerm.put(perm, true));
|
||||||
|
ConfigHandler.config.getGloballyDefinedVals(world).forEach(e -> this.globalPerm.put(e.getKey(), e.getValue().getValue()));
|
||||||
if (setDefaultGroups)
|
if (setDefaultGroups)
|
||||||
ConfigHandler.config.defaultGroups.forEach((s, m) -> m.forEach((perm, bool) -> this.editPerms(null, s, perm, bool ? 1 : 0, true)));
|
ConfigHandler.config.defaultGroups.forEach((s, m) -> m.forEach((perm, bool) -> this.editPerms(null, s, perm, bool ? 1 : 0, true)));
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,6 +22,7 @@ import java.util.LinkedHashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.function.Consumer;
|
import java.util.function.Consumer;
|
||||||
|
import java.util.stream.Stream;
|
||||||
|
|
||||||
public class Config {
|
public class Config {
|
||||||
|
|
||||||
|
@ -334,6 +335,23 @@ public class Config {
|
||||||
return permMap == null ? GlobalType.NONE : permMap.getOrDefault(perm, GlobalType.NONE);
|
return permMap == null ? GlobalType.NONE : permMap.getOrDefault(perm, GlobalType.NONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Stream<Map.Entry<ClaimPermission, GlobalType>> getGloballyDefinedVals(ServerLevel world) {
|
||||||
|
Map<ClaimPermission, GlobalType> allMap = ConfigHandler.config.globalDefaultPerms.get("*");
|
||||||
|
if (allMap != null) {
|
||||||
|
world.getServer().getAllLevels().forEach(w -> {
|
||||||
|
Map<ClaimPermission, GlobalType> wMap = ConfigHandler.config.globalDefaultPerms.getOrDefault(w.dimension().location().toString(), new HashMap<>());
|
||||||
|
allMap.forEach((key, value) -> {
|
||||||
|
if (!wMap.containsKey(key))
|
||||||
|
wMap.put(key, value);
|
||||||
|
});
|
||||||
|
ConfigHandler.config.globalDefaultPerms.put(w.dimension().location().toString(), wMap);
|
||||||
|
});
|
||||||
|
ConfigHandler.config.globalDefaultPerms.remove("*");
|
||||||
|
}
|
||||||
|
Map<ClaimPermission, GlobalType> permMap = ConfigHandler.config.globalDefaultPerms.get(world.dimension().location().toString());
|
||||||
|
return permMap == null ? Stream.empty() : permMap.entrySet().stream().filter(e -> e.getValue().canModify());
|
||||||
|
}
|
||||||
|
|
||||||
public static <V, K> Map<V, K> createHashMap(Consumer<Map<V, K>> cons) {
|
public static <V, K> Map<V, K> createHashMap(Consumer<Map<V, K>> cons) {
|
||||||
Map<V, K> map = new HashMap<>();
|
Map<V, K> map = new HashMap<>();
|
||||||
cons.accept(map);
|
cons.accept(map);
|
||||||
|
|
|
@ -10,7 +10,7 @@ forge_version=38.0.8
|
||||||
loader_version=0.12.8
|
loader_version=0.12.8
|
||||||
|
|
||||||
# Mod Properties
|
# Mod Properties
|
||||||
mod_version=1.6.5
|
mod_version=1.6.6
|
||||||
maven_group=io.github.flemmli97
|
maven_group=io.github.flemmli97
|
||||||
archives_base_name=flan
|
archives_base_name=flan
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user