mirror of
https://github.com/LuckPerms/LuckPerms.git
synced 2024-12-26 19:18:17 +01:00
Fix saving node attributes on non-YAML file storage types (#999)
This commit is contained in:
parent
1e73986c60
commit
45e2b7b12f
@ -101,24 +101,24 @@ public final class StandardStackElements {
|
||||
|
||||
// implementations
|
||||
|
||||
private static final MetaStackElement HIGHEST = FluentMetaStackElement.builder("HighestPriority")
|
||||
public static final MetaStackElement HIGHEST = FluentMetaStackElement.builder("HighestPriority")
|
||||
.with(TYPE_CHECK)
|
||||
.with(HIGHEST_CHECK)
|
||||
.build();
|
||||
|
||||
private static final MetaStackElement HIGHEST_OWN = FluentMetaStackElement.builder("HighestPriorityOwn")
|
||||
public static final MetaStackElement HIGHEST_OWN = FluentMetaStackElement.builder("HighestPriorityOwn")
|
||||
.with(TYPE_CHECK)
|
||||
.with(OWN_CHECK)
|
||||
.with(HIGHEST_CHECK)
|
||||
.build();
|
||||
|
||||
private static final MetaStackElement HIGHEST_INHERITED = FluentMetaStackElement.builder("HighestPriorityInherited")
|
||||
public static final MetaStackElement HIGHEST_INHERITED = FluentMetaStackElement.builder("HighestPriorityInherited")
|
||||
.with(TYPE_CHECK)
|
||||
.with(INHERITED_CHECK)
|
||||
.with(HIGHEST_CHECK)
|
||||
.build();
|
||||
|
||||
private static MetaStackElement highestFromGroupOnTrack(LuckPermsPlugin plugin, String trackName) {
|
||||
public static MetaStackElement highestFromGroupOnTrack(LuckPermsPlugin plugin, String trackName) {
|
||||
return FluentMetaStackElement.builder("HighestPriorityOnTrack")
|
||||
.param("trackName", trackName)
|
||||
.with(TYPE_CHECK)
|
||||
@ -127,7 +127,7 @@ public final class StandardStackElements {
|
||||
.build();
|
||||
}
|
||||
|
||||
private static MetaStackElement highestNotFromGroupOnTrack(LuckPermsPlugin plugin, String trackName) {
|
||||
public static MetaStackElement highestNotFromGroupOnTrack(LuckPermsPlugin plugin, String trackName) {
|
||||
return FluentMetaStackElement.builder("HighestPriorityNotOnTrack")
|
||||
.param("trackName", trackName)
|
||||
.with(TYPE_CHECK)
|
||||
@ -136,7 +136,7 @@ public final class StandardStackElements {
|
||||
.build();
|
||||
}
|
||||
|
||||
private static MetaStackElement highestFromGroup(String groupName) {
|
||||
public static MetaStackElement highestFromGroup(String groupName) {
|
||||
return FluentMetaStackElement.builder("HighestPriorityFromGroup")
|
||||
.param("groupName", groupName)
|
||||
.with(TYPE_CHECK)
|
||||
@ -145,7 +145,7 @@ public final class StandardStackElements {
|
||||
.build();
|
||||
}
|
||||
|
||||
private static MetaStackElement highestNotFromGroup(String groupName) {
|
||||
public static MetaStackElement highestNotFromGroup(String groupName) {
|
||||
return FluentMetaStackElement.builder("HighestPriorityNotFromGroup")
|
||||
.param("groupName", groupName)
|
||||
.with(TYPE_CHECK)
|
||||
@ -154,24 +154,24 @@ public final class StandardStackElements {
|
||||
.build();
|
||||
}
|
||||
|
||||
private static final MetaStackElement LOWEST = FluentMetaStackElement.builder("LowestPriority")
|
||||
public static final MetaStackElement LOWEST = FluentMetaStackElement.builder("LowestPriority")
|
||||
.with(TYPE_CHECK)
|
||||
.with(LOWEST_CHECK)
|
||||
.build();
|
||||
|
||||
private static final MetaStackElement LOWEST_OWN = FluentMetaStackElement.builder("LowestPriorityOwn")
|
||||
public static final MetaStackElement LOWEST_OWN = FluentMetaStackElement.builder("LowestPriorityOwn")
|
||||
.with(TYPE_CHECK)
|
||||
.with(OWN_CHECK)
|
||||
.with(LOWEST_CHECK)
|
||||
.build();
|
||||
|
||||
private static final MetaStackElement LOWEST_INHERITED = FluentMetaStackElement.builder("LowestPriorityInherited")
|
||||
public static final MetaStackElement LOWEST_INHERITED = FluentMetaStackElement.builder("LowestPriorityInherited")
|
||||
.with(TYPE_CHECK)
|
||||
.with(INHERITED_CHECK)
|
||||
.with(LOWEST_CHECK)
|
||||
.build();
|
||||
|
||||
private static MetaStackElement lowestFromGroupOnTrack(LuckPermsPlugin plugin, String trackName) {
|
||||
public static MetaStackElement lowestFromGroupOnTrack(LuckPermsPlugin plugin, String trackName) {
|
||||
return FluentMetaStackElement.builder("LowestPriorityOnTrack")
|
||||
.param("trackName", trackName)
|
||||
.with(TYPE_CHECK)
|
||||
@ -180,7 +180,7 @@ public final class StandardStackElements {
|
||||
.build();
|
||||
}
|
||||
|
||||
private static MetaStackElement lowestNotFromGroupOnTrack(LuckPermsPlugin plugin, String trackName) {
|
||||
public static MetaStackElement lowestNotFromGroupOnTrack(LuckPermsPlugin plugin, String trackName) {
|
||||
return FluentMetaStackElement.builder("LowestPriorityNotOnTrack")
|
||||
.param("trackName", trackName)
|
||||
.with(TYPE_CHECK)
|
||||
@ -189,7 +189,7 @@ public final class StandardStackElements {
|
||||
.build();
|
||||
}
|
||||
|
||||
private static MetaStackElement lowestFromGroup(String groupName) {
|
||||
public static MetaStackElement lowestFromGroup(String groupName) {
|
||||
return FluentMetaStackElement.builder("LowestPriorityFromGroup")
|
||||
.param("groupName", groupName)
|
||||
.with(TYPE_CHECK)
|
||||
@ -198,7 +198,7 @@ public final class StandardStackElements {
|
||||
.build();
|
||||
}
|
||||
|
||||
private static MetaStackElement lowestNotFromGroup(String groupName) {
|
||||
public static MetaStackElement lowestNotFromGroup(String groupName) {
|
||||
return FluentMetaStackElement.builder("LowestPriorityNotFromGroup")
|
||||
.param("groupName", groupName)
|
||||
.with(TYPE_CHECK)
|
||||
|
@ -569,7 +569,7 @@ public abstract class AbstractConfigurateDao extends AbstractDao {
|
||||
if (entry == null) {
|
||||
continue;
|
||||
}
|
||||
nodes.add(readAttributes(entry.getValue(), c -> NodeFactory.metaNode(entry.getKey(), entry.getValue().getNode("value").getString("null"))));
|
||||
nodes.add(readAttributes(entry.getValue(), c -> NodeFactory.metaNode(entry.getKey(), c.getNode("value").getString("null"))));
|
||||
}
|
||||
}
|
||||
|
||||
@ -609,17 +609,13 @@ public abstract class AbstractConfigurateDao extends AbstractDao {
|
||||
private void appendNode(ConfigurationNode base, String key, ConfigurationNode attributes, String keyFieldName) {
|
||||
if (this.loader instanceof YamlLoader) {
|
||||
// create a map node with a single entry of key --> attributes
|
||||
ConfigurationNode appended = SimpleConfigurationNode.root();
|
||||
ConfigurationNode appended = base.getAppendedNode();
|
||||
appended.getNode(key).setValue(attributes);
|
||||
|
||||
base.getAppendedNode().setValue(appended);
|
||||
} else {
|
||||
// include the attributes and key in the same map
|
||||
ConfigurationNode appended = SimpleConfigurationNode.root();
|
||||
ConfigurationNode appended = base.getAppendedNode();
|
||||
appended.getNode(keyFieldName).setValue(key);
|
||||
appended.mergeValuesFrom(appended);
|
||||
|
||||
base.getAppendedNode().setValue(appended);
|
||||
appended.mergeValuesFrom(attributes);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -48,7 +48,7 @@ import java.util.Map;
|
||||
|
||||
public class SubjectCachedData extends AbstractCachedData implements CalculatorFactory {
|
||||
private static final MetaStackDefinition DEFAULT_META_STACK = new SimpleMetaStackDefinition(
|
||||
ImmutableList.of(StandardStackElements.HIGHEST_PRIORITY),
|
||||
ImmutableList.of(StandardStackElements.HIGHEST),
|
||||
"", "", ""
|
||||
);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user