diff --git a/common/src/main/java/me/lucko/luckperms/common/model/PermissionHolderIdentifier.java b/common/src/main/java/me/lucko/luckperms/common/model/PermissionHolderIdentifier.java index d76ad026c..36f7f8101 100644 --- a/common/src/main/java/me/lucko/luckperms/common/model/PermissionHolderIdentifier.java +++ b/common/src/main/java/me/lucko/luckperms/common/model/PermissionHolderIdentifier.java @@ -35,11 +35,6 @@ public final class PermissionHolderIdentifier implements Identifier { private final String type; private final String name; - public PermissionHolderIdentifier(String type, String name) { - this.type = type; - this.name = name; - } - public PermissionHolderIdentifier(HolderType type, String name) { this.type = type == HolderType.USER ? Identifier.USER_TYPE : Identifier.GROUP_TYPE; this.name = name; diff --git a/common/src/main/java/me/lucko/luckperms/common/node/utils/NodeJsonSerializer.java b/common/src/main/java/me/lucko/luckperms/common/node/utils/NodeJsonSerializer.java index 96e08618b..97da59550 100644 --- a/common/src/main/java/me/lucko/luckperms/common/node/utils/NodeJsonSerializer.java +++ b/common/src/main/java/me/lucko/luckperms/common/node/utils/NodeJsonSerializer.java @@ -1,3 +1,28 @@ +/* + * This file is part of LuckPerms, licensed under the MIT License. + * + * Copyright (c) lucko (Luck) + * Copyright (c) contributors + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + package me.lucko.luckperms.common.node.utils; import com.google.gson.JsonArray; diff --git a/common/src/main/java/me/lucko/luckperms/common/storage/implementation/file/AbstractConfigurateStorage.java b/common/src/main/java/me/lucko/luckperms/common/storage/implementation/file/AbstractConfigurateStorage.java index 19c989cc2..be2154059 100644 --- a/common/src/main/java/me/lucko/luckperms/common/storage/implementation/file/AbstractConfigurateStorage.java +++ b/common/src/main/java/me/lucko/luckperms/common/storage/implementation/file/AbstractConfigurateStorage.java @@ -714,7 +714,12 @@ public abstract class AbstractConfigurateStorage implements StorageImplementatio } } - if (permissionsSection.hasListChildren()) { + if (permissionsSection.hasListChildren() || this instanceof CombinedConfigurateStorage) { + // ensure for CombinedConfigurateStorage that there's at least *something* to save to the file + // even if it's just an empty list. + if (!permissionsSection.hasListChildren()) { + permissionsSection.setValue(Collections.emptyList()); + } to.getNode("permissions").setValue(permissionsSection); } if (parentsSection.hasListChildren()) { diff --git a/common/src/main/java/me/lucko/luckperms/common/storage/implementation/file/CombinedConfigurateStorage.java b/common/src/main/java/me/lucko/luckperms/common/storage/implementation/file/CombinedConfigurateStorage.java index 13b3e4660..8875b919f 100644 --- a/common/src/main/java/me/lucko/luckperms/common/storage/implementation/file/CombinedConfigurateStorage.java +++ b/common/src/main/java/me/lucko/luckperms/common/storage/implementation/file/CombinedConfigurateStorage.java @@ -103,15 +103,13 @@ public class CombinedConfigurateStorage extends AbstractConfigurateStorage { this.lock.lock(); try { if (this.node == null || reload) { - recordChange(); - this.node = this.loader.load(); + reload(); } action.accept(this.node); if (save) { - recordChange(); - this.loader.save(this.node); + save(); } } finally { this.lock.unlock();