diff --git a/core/src/main/java/me/filoghost/holographicdisplays/core/CoreGlobalConfig.java b/core/src/main/java/me/filoghost/holographicdisplays/core/CoreGlobalConfig.java index e03250d7..1ae9ddd4 100644 --- a/core/src/main/java/me/filoghost/holographicdisplays/core/CoreGlobalConfig.java +++ b/core/src/main/java/me/filoghost/holographicdisplays/core/CoreGlobalConfig.java @@ -8,5 +8,6 @@ package me.filoghost.holographicdisplays.core; public class CoreGlobalConfig { public static double spaceBetweenLines; + public static int maxViewRange; } diff --git a/core/src/main/java/me/filoghost/holographicdisplays/core/HolographicDisplaysCore.java b/core/src/main/java/me/filoghost/holographicdisplays/core/HolographicDisplaysCore.java index 648ab479..abece00f 100644 --- a/core/src/main/java/me/filoghost/holographicdisplays/core/HolographicDisplaysCore.java +++ b/core/src/main/java/me/filoghost/holographicdisplays/core/HolographicDisplaysCore.java @@ -89,6 +89,10 @@ public class HolographicDisplaysCore { } } + public void setMaxViewRange(int maxViewRange) { + CoreGlobalConfig.maxViewRange = maxViewRange; + } + public void disable() { if (lineTrackerManager != null) { lineTrackerManager.resetViewersAndSendDestroyPackets(); diff --git a/core/src/main/java/me/filoghost/holographicdisplays/core/tick/TickingTask.java b/core/src/main/java/me/filoghost/holographicdisplays/core/tick/TickingTask.java index e75f90a8..56f5cc13 100644 --- a/core/src/main/java/me/filoghost/holographicdisplays/core/tick/TickingTask.java +++ b/core/src/main/java/me/filoghost/holographicdisplays/core/tick/TickingTask.java @@ -6,6 +6,7 @@ package me.filoghost.holographicdisplays.core.tick; import me.filoghost.fcommons.logging.Log; +import me.filoghost.holographicdisplays.core.CoreGlobalConfig; import me.filoghost.holographicdisplays.core.listener.LineClickListener; import me.filoghost.holographicdisplays.core.placeholder.tracking.ActivePlaceholderTracker; import me.filoghost.holographicdisplays.core.tracking.LineTrackerManager; @@ -75,6 +76,9 @@ public class TickingTask implements Runnable { // Holograms need to disappear before chunks (code taken from Bukkit) int maxViewRange = (Bukkit.getViewDistance() - 1) * 16; + if (maxViewRange > CoreGlobalConfig.maxViewRange) { + maxViewRange = CoreGlobalConfig.maxViewRange; + } try { lineTrackerManager.update(onlinePlayers, movedPlayers, maxViewRange); diff --git a/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/HolographicDisplays.java b/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/HolographicDisplays.java index 7b14fa83..f8260efc 100644 --- a/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/HolographicDisplays.java +++ b/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/HolographicDisplays.java @@ -128,6 +128,7 @@ public class HolographicDisplays extends FCommonsPlugin { configManager.reloadMainSettings(errorCollector); core.setSpaceBetweenHologramLines(Settings.spaceBetweenLines); + core.setMaxViewRange(Settings.viewRange); AnimationPlaceholderFactory animationPlaceholderFactory = configManager.loadAnimations(errorCollector); DefaultPlaceholders.resetAndRegister(api, animationPlaceholderFactory, bungeeServerTracker); diff --git a/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/config/Settings.java b/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/config/Settings.java index fea3a0fe..d357ae44 100644 --- a/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/config/Settings.java +++ b/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/config/Settings.java @@ -20,6 +20,7 @@ import java.util.Map; public class Settings { public static double spaceBetweenLines; + public static int viewRange; public static boolean quickEditCommands; public static DateTimeFormatter timeFormat; public static boolean updateNotification; @@ -42,6 +43,7 @@ public class Settings { public static void load(SettingsModel config, ErrorCollector errorCollector) { spaceBetweenLines = config.spaceBetweenLines; + viewRange = config.viewRange; quickEditCommands = config.quickEditCommands; timeFormat = parseTimeFormatter(config.timeFormat, config.timeZone, errorCollector); updateNotification = config.updateNotification; diff --git a/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/config/SettingsModel.java b/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/config/SettingsModel.java index 9d19b64c..81a07264 100644 --- a/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/config/SettingsModel.java +++ b/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/config/SettingsModel.java @@ -18,6 +18,9 @@ public class SettingsModel implements MappedConfig { @Path("space-between-lines") double spaceBetweenLines = 0.02; + @Path("holograms-view-range") + int viewRange = 48; + @Path("quick-edit-commands") boolean quickEditCommands = true;