Skip to content

Commit

Permalink
add update interval option to built-in layers
Browse files Browse the repository at this point in the history
  • Loading branch information
granny committed Nov 9, 2023
1 parent 969d47f commit aa6a252
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,11 @@ public final class PlayersLayerConfig extends AbstractConfig {
Should spectators be hidden from the map.""")
public static boolean HIDE_SPECTATORS = true;

@Key("settings.layer.update-interval")
@Comment("""
How often (in seconds) to update the marker.
Setting to 0 is the same as setting it to 1.""")
public static int UPDATE_INTERVAL = 0;
@Key("settings.layer.show-controls")
@Comment("""
Whether the players layer control shows up in the layers list or not.""")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@ public final class SpawnLayerConfig extends AbstractConfig {
Show spawn icon on the map.""")
public static boolean ENABLED = true;

@Key("settings.layer.update-interval")
@Comment("""
How often (in seconds) to update the marker.
Setting to 0 is the same as setting it to 1.""")
public static int UPDATE_INTERVAL = 30;
@Key("settings.layer.show-controls")
@Comment("""
Whether the spawn layer control shows up in the layers list or not.""")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@ public final class WorldBorderLayerConfig extends AbstractConfig {
Shows vanilla world border on the map.""")
public static boolean ENABLED = true;

@Key("settings.layer.update-interval")
@Comment("""
How often (in seconds) to update the marker.
Setting to 0 is the same as setting it to 1.""")
public static int UPDATE_INTERVAL = 30;
@Key("settings.layer.show-controls")
@Comment("""
Whether the vanilla world border layer control shows up in the layers list or not.""")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public class PlayersLayer extends WorldLayer {
*/
public PlayersLayer(@NotNull World world) {
this(KEY, world, () -> Lang.UI_LAYER_PLAYERS);
setUpdateInterval(0);
setUpdateInterval(PlayersLayerConfig.UPDATE_INTERVAL);
setShowControls(PlayersLayerConfig.SHOW_CONTROLS);
setDefaultHidden(PlayersLayerConfig.DEFAULT_HIDDEN);
setPriority(PlayersLayerConfig.PRIORITY);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public SpawnLayer(@NotNull World world) {
throw new RuntimeException(e);
}

setUpdateInterval(30);
setUpdateInterval(SpawnLayerConfig.UPDATE_INTERVAL);
setShowControls(SpawnLayerConfig.SHOW_CONTROLS);
setDefaultHidden(SpawnLayerConfig.DEFAULT_HIDDEN);
setPriority(SpawnLayerConfig.PRIORITY);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public class WorldBorderLayer extends WorldLayer {
*/
public WorldBorderLayer(@NotNull World world) {
this(KEY, world, () -> Lang.UI_LAYER_WORLDBORDER);
setUpdateInterval(30);
setUpdateInterval(WorldBorderLayerConfig.UPDATE_INTERVAL);
setShowControls(WorldBorderLayerConfig.SHOW_CONTROLS);
setDefaultHidden(WorldBorderLayerConfig.DEFAULT_HIDDEN);
setPriority(WorldBorderLayerConfig.PRIORITY);
Expand Down

0 comments on commit aa6a252

Please sign in to comment.