mirror of
https://github.com/lucko/LuckPerms.git
synced 2025-09-09 13:50:52 +02:00
Fix issues with *-combined file storage methods (#1793)
This commit is contained in:
@@ -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;
|
||||
|
@@ -1,3 +1,28 @@
|
||||
/*
|
||||
* This file is part of LuckPerms, licensed under the MIT License.
|
||||
*
|
||||
* Copyright (c) lucko (Luck) <luck@lucko.me>
|
||||
* 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;
|
||||
|
@@ -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()) {
|
||||
|
@@ -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();
|
||||
|
Reference in New Issue
Block a user