mirror of
https://github.com/filoghost/HolographicDisplays.git
synced 2024-11-22 10:25:41 +01:00
Make holograms view range configurable
This commit is contained in:
parent
0e98b2f89a
commit
39f0a02412
@ -8,5 +8,6 @@ package me.filoghost.holographicdisplays.core;
|
||||
public class CoreGlobalConfig {
|
||||
|
||||
public static double spaceBetweenLines;
|
||||
public static int maxViewRange;
|
||||
|
||||
}
|
||||
|
@ -89,6 +89,10 @@ public class HolographicDisplaysCore {
|
||||
}
|
||||
}
|
||||
|
||||
public void setMaxViewRange(int maxViewRange) {
|
||||
CoreGlobalConfig.maxViewRange = maxViewRange;
|
||||
}
|
||||
|
||||
public void disable() {
|
||||
if (lineTrackerManager != null) {
|
||||
lineTrackerManager.resetViewersAndSendDestroyPackets();
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user