mirror of
https://github.com/Shiewk/SModeration.git
synced 2026-04-28 05:54:16 +02:00
Add comments to config file
This commit is contained in:
+1
-1
@@ -30,7 +30,7 @@ runPaper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
runServer {
|
runServer {
|
||||||
minecraftVersion("1.21.10")
|
minecraftVersion("1.21.11")
|
||||||
downloadPlugins {
|
downloadPlugins {
|
||||||
// for testing from other client versions
|
// for testing from other client versions
|
||||||
modrinth("ViaVersion", "5.5.1")
|
modrinth("ViaVersion", "5.5.1")
|
||||||
|
|||||||
@@ -28,7 +28,10 @@ import org.bukkit.plugin.java.JavaPlugin;
|
|||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.io.InputStreamReader;
|
import java.io.InputStreamReader;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
import static de.shiewk.smoderation.paper.command.VanishCommand.isVanished;
|
import static de.shiewk.smoderation.paper.command.VanishCommand.isVanished;
|
||||||
import static de.shiewk.smoderation.paper.command.VanishCommand.toggleVanish;
|
import static de.shiewk.smoderation.paper.command.VanishCommand.toggleVanish;
|
||||||
@@ -181,14 +184,29 @@ public final class SModerationPaper extends JavaPlugin {
|
|||||||
|
|
||||||
boolean changedSomething = false;
|
boolean changedSomething = false;
|
||||||
for (String key : defaultConfig.getKeys(true)) {
|
for (String key : defaultConfig.getKeys(true)) {
|
||||||
if (!config.contains(key)) { // There's a new key in the default config
|
if (!config.contains(key)) {
|
||||||
|
// There's a new key in the default config
|
||||||
config.set(key, defaultConfig.get(key));
|
config.set(key, defaultConfig.get(key));
|
||||||
changedSomething = true;
|
changedSomething = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
List<String> defaultComments = new ArrayList<>(defaultConfig.getComments(key));
|
||||||
|
List<String> comments = new ArrayList<>(config.getComments(key));
|
||||||
|
defaultComments.removeIf(Objects::isNull);
|
||||||
|
comments.removeIf(Objects::isNull);
|
||||||
|
|
||||||
|
if (!defaultComments.equals(comments)) {
|
||||||
|
// Comments changed
|
||||||
|
config.setComments(key, defaultConfig.getComments(key));
|
||||||
|
changedSomething = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Save the updated configuration file
|
// Save the updated configuration file
|
||||||
if (changedSomething) saveConfig();
|
if (changedSomething){
|
||||||
|
LOGGER.info("Changing config file to add new options/documentation");
|
||||||
|
saveConfig();
|
||||||
|
}
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw new RuntimeException("Could not update config", e);
|
throw new RuntimeException("Could not update config", e);
|
||||||
|
|||||||
@@ -1,3 +1,27 @@
|
|||||||
|
# If enabled, punishments can no longer be issued without providing a reason.
|
||||||
|
force-reason: false
|
||||||
|
|
||||||
|
# Allows you to toggle specific plugin features.
|
||||||
|
features:
|
||||||
|
# Should punishments be tracked and executed?
|
||||||
|
# Note that disabling this will also disable the SMod menu and
|
||||||
|
# /modlogs command since their only use is viewing punishments
|
||||||
|
punishments: true
|
||||||
|
# Should commands for opening the SMod menu be registered?
|
||||||
|
smodmenu: true
|
||||||
|
# Should commands for viewing player inventories be registered?
|
||||||
|
invsee: true
|
||||||
|
# Should commands for viewing player ender chests be registered?
|
||||||
|
enderchestsee: true
|
||||||
|
# Should commands for teleporting to offline players be registered?
|
||||||
|
offlinetp: true
|
||||||
|
# Should commands for viewing other players' messaging commands be registered?
|
||||||
|
socialspy: true
|
||||||
|
# Should players be able to enable vanish mode?
|
||||||
|
vanish: true
|
||||||
|
|
||||||
|
# A list of commands which will be captured and broadcast
|
||||||
|
# to players which have SocialSpy enabled (/socialspy).
|
||||||
socialspy-commands:
|
socialspy-commands:
|
||||||
- w
|
- w
|
||||||
- tell
|
- tell
|
||||||
@@ -9,7 +33,8 @@ socialspy-commands:
|
|||||||
- minecraft:msg
|
- minecraft:msg
|
||||||
- minecraft:teammsg
|
- minecraft:teammsg
|
||||||
- minecraft:tm
|
- minecraft:tm
|
||||||
force-reason: false
|
|
||||||
|
# A list of commands which muted players will not be able to run.
|
||||||
muted-forbidden-commands:
|
muted-forbidden-commands:
|
||||||
- w
|
- w
|
||||||
- tell
|
- tell
|
||||||
@@ -23,11 +48,3 @@ muted-forbidden-commands:
|
|||||||
- minecraft:teammsg
|
- minecraft:teammsg
|
||||||
- minecraft:tm
|
- minecraft:tm
|
||||||
- minecraft:me
|
- minecraft:me
|
||||||
features:
|
|
||||||
punishments: true
|
|
||||||
smodmenu: true
|
|
||||||
invsee: true
|
|
||||||
enderchestsee: true
|
|
||||||
offlinetp: true
|
|
||||||
socialspy: true
|
|
||||||
vanish: true
|
|
||||||
Reference in New Issue
Block a user