diff --git a/build.gradle b/build.gradle index 4034d8e..2760119 100644 --- a/build.gradle +++ b/build.gradle @@ -30,7 +30,7 @@ runPaper { } runServer { - minecraftVersion("1.21.10") + minecraftVersion("1.21.11") downloadPlugins { // for testing from other client versions modrinth("ViaVersion", "5.5.1") diff --git a/src/main/java/de/shiewk/smoderation/paper/SModerationPaper.java b/src/main/java/de/shiewk/smoderation/paper/SModerationPaper.java index ddfb723..bf9d470 100644 --- a/src/main/java/de/shiewk/smoderation/paper/SModerationPaper.java +++ b/src/main/java/de/shiewk/smoderation/paper/SModerationPaper.java @@ -28,7 +28,10 @@ import org.bukkit.plugin.java.JavaPlugin; import java.io.File; import java.io.InputStream; import java.io.InputStreamReader; +import java.util.ArrayList; +import java.util.List; 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.toggleVanish; @@ -181,14 +184,29 @@ public final class SModerationPaper extends JavaPlugin { boolean changedSomething = false; 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)); changedSomething = true; } + + List defaultComments = new ArrayList<>(defaultConfig.getComments(key)); + List 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 - if (changedSomething) saveConfig(); + if (changedSomething){ + LOGGER.info("Changing config file to add new options/documentation"); + saveConfig(); + } } catch (Exception e) { throw new RuntimeException("Could not update config", e); diff --git a/src/main/resources/default-config.yml b/src/main/resources/default-config.yml index 30632fd..821895f 100644 --- a/src/main/resources/default-config.yml +++ b/src/main/resources/default-config.yml @@ -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: - w - tell @@ -9,7 +33,8 @@ socialspy-commands: - minecraft:msg - minecraft:teammsg - minecraft:tm -force-reason: false + +# A list of commands which muted players will not be able to run. muted-forbidden-commands: - w - tell @@ -22,12 +47,4 @@ muted-forbidden-commands: - minecraft:msg - minecraft:teammsg - minecraft:tm - - minecraft:me -features: - punishments: true - smodmenu: true - invsee: true - enderchestsee: true - offlinetp: true - socialspy: true - vanish: true \ No newline at end of file + - minecraft:me \ No newline at end of file