Skip to content

Commit 5c44c05

Browse files
committed
Add restart message for config options that only applies after a server restart
1 parent 1699a47 commit 5c44c05

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

src/main/java/org/mvplugins/multiverse/core/config/CoreConfigNodes.java

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import io.vavr.control.Try;
55
import jakarta.inject.Inject;
66
import jakarta.inject.Provider;
7+
import org.bukkit.ChatColor;
78
import org.bukkit.command.CommandSender;
89
import org.bukkit.event.EventPriority;
910
import org.bukkit.plugin.PluginManager;
@@ -139,17 +140,25 @@ private <N extends Node> N node(N node) {
139140
.comment("Sets whether Multiverse will apply the world's entity `tick-rate` config in worlds.yml.")
140141
.comment("If disabled, the `tick-rate` config in worlds.yml will be ignored.")
141142
.comment("Disable this if you want paper-world.yml or another plugin to handle entity spawn rate per world.")
143+
.comment("!!!NOTE: This will only apply after a server restart!")
142144
.defaultValue(true)
143145
.name("apply-entity-spawn-rate")
146+
.onChange(((sender, oldValue, newValue) ->
147+
sender.sendMessage(ChatColor.YELLOW + "'apply-entity-spawn-rate' config option will only take " +
148+
"full effect after a server restart.")))
144149
.build());
145150

146151
final ConfigNode<Boolean> applyEntitySpawnLimit = node(ConfigNode.builder("world.apply-entity-spawn-limit", Boolean.class)
147152
.comment("")
148153
.comment("Sets whether Multiverse will apply the world's entity `spawn-limit` config when a world is loaded.")
149154
.comment("If disabled, the `spawn-limit` config in worlds.yml will be ignored.")
150155
.comment("Disable this if you want paper-world.yml or another plugin to handle entity limits per world.")
156+
.comment("!!!NOTE: This will only apply after a server restart!")
151157
.defaultValue(true)
152158
.name("apply-entity-spawn-limit")
159+
.onChange(((sender, oldValue, newValue) ->
160+
sender.sendMessage(ChatColor.YELLOW + "'apply-entity-spawn-limit' config option will only take" +
161+
" full effect after a server restart.")))
153162
.build());
154163

155164
final ConfigNode<Boolean> autoPurgeEntities = node(ConfigNode.builder("world.auto-purge-entities", Boolean.class)
@@ -478,6 +487,9 @@ private <N extends Node> N node(N node) {
478487
.name("event-priority-player-portal")
479488
.onLoadAndChange((oldValue, newValue) ->
480489
eventPriorityMapper.get().setPriority("mvcore-player-portal", newValue))
490+
.onChange(((sender, oldValue, newValue) ->
491+
sender.sendMessage(ChatColor.YELLOW + "'event-priority.player-portal' config option will only take " +
492+
"full effect after a server restart.")))
481493
.build());
482494

483495
final ConfigNode<EventPriority> eventPriorityPlayerRespawn = node(ConfigNode.builder("event-priority.player-respawn", EventPriority.class)
@@ -487,6 +499,9 @@ private <N extends Node> N node(N node) {
487499
.comment("This config option defines the priority for the PlayerRespawnEvent.")
488500
.onLoadAndChange((oldValue, newValue) ->
489501
eventPriorityMapper.get().setPriority("mvcore-player-respawn", newValue))
502+
.onChange((sender, oldValue, newValue) ->
503+
sender.sendMessage(ChatColor.YELLOW + "'event-priority.player-respawn' config option will only take " +
504+
"full effect after a server restart."))
490505
.build());
491506

492507
final ConfigNode<EventPriority> eventPriorityPlayerSpawnLocation = node(ConfigNode.builder("event-priority.player-spawn-location", EventPriority.class)
@@ -496,6 +511,9 @@ private <N extends Node> N node(N node) {
496511
.name("event-priority-player-spawn-location")
497512
.onLoadAndChange((oldValue, newValue) ->
498513
eventPriorityMapper.get().setPriority("mvcore-player-spawn-location", newValue))
514+
.onChange((sender, oldValue, newValue) ->
515+
sender.sendMessage(ChatColor.YELLOW + "'event-priority.player-spawn-location' config option will only take " +
516+
"full effect after a server restart."))
499517
.build());
500518

501519
final ConfigNode<EventPriority> eventPriorityPlayerTeleport = node(ConfigNode.builder("event-priority.player-teleport", EventPriority.class)
@@ -505,6 +523,9 @@ private <N extends Node> N node(N node) {
505523
.comment("This config option defines the priority for the PlayerTeleportEvent.")
506524
.onLoadAndChange((oldValue, newValue) ->
507525
eventPriorityMapper.get().setPriority("mvcore-player-teleport", newValue))
526+
.onChange((sender, oldValue, newValue) ->
527+
sender.sendMessage(ChatColor.YELLOW + "'event-priority.player-teleport' config option will only take " +
528+
"full effect after a server restart."))
508529
.build());
509530

510531
private final ConfigHeaderNode miscHeader = node(ConfigHeaderNode.builder("misc")
@@ -517,6 +538,9 @@ private <N extends Node> N node(N node) {
517538
.comment("Note: this config option needs a server restart to take effect.")
518539
.defaultValue("bukkit.yml")
519540
.name("bukkit-yml-path")
541+
.onChange(((sender, oldValue, newValue) ->
542+
sender.sendMessage(ChatColor.YELLOW + "'bukkit-yml-path' config option will only take " +
543+
"full effect after a server restart.")))
520544
.build());
521545

522546
final ConfigNode<String> serverPropertiesPath = node(ConfigNode.builder("misc.server-properties-path", String.class)
@@ -525,6 +549,9 @@ private <N extends Node> N node(N node) {
525549
.comment("Note: this config option needs a server restart to take effect.")
526550
.defaultValue("server.properties")
527551
.name("server-properties-path")
552+
.onChange(((sender, oldValue, newValue) ->
553+
sender.sendMessage(ChatColor.YELLOW + "'server-properties-path' config option will only take " +
554+
"full effect after a server restart.")))
528555
.build());
529556

530557
final ConfigNode<Boolean> autoDetectGeneratorPlugins = node(ConfigNode.builder("misc.auto-detect-generator-plugins", Boolean.class)

0 commit comments

Comments
 (0)