mirror of
https://github.com/filoghost/HolographicDisplays.git
synced 2024-11-13 06:03:59 +01:00
Move spaceBetweenLines to separate class
This commit is contained in:
parent
0449fe65ca
commit
0e98b2f89a
@ -0,0 +1,12 @@
|
||||
/*
|
||||
* Copyright (C) filoghost and contributors
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*/
|
||||
package me.filoghost.holographicdisplays.core;
|
||||
|
||||
public class CoreGlobalConfig {
|
||||
|
||||
public static double spaceBetweenLines;
|
||||
|
||||
}
|
@ -16,7 +16,6 @@ import me.filoghost.holographicdisplays.core.api.current.DefaultHolographicDispl
|
||||
import me.filoghost.holographicdisplays.core.api.v2.V2HologramManager;
|
||||
import me.filoghost.holographicdisplays.core.api.v2.V2HologramsAPIProvider;
|
||||
import me.filoghost.holographicdisplays.core.base.BaseHologram;
|
||||
import me.filoghost.holographicdisplays.core.base.BaseHologramLines;
|
||||
import me.filoghost.holographicdisplays.core.listener.ChunkListener;
|
||||
import me.filoghost.holographicdisplays.core.listener.LineClickListener;
|
||||
import me.filoghost.holographicdisplays.core.listener.PlayerListener;
|
||||
@ -81,7 +80,7 @@ public class HolographicDisplaysCore {
|
||||
}
|
||||
|
||||
public void setSpaceBetweenHologramLines(double spaceBetweenLines) {
|
||||
BaseHologramLines.spaceBetweenLines = spaceBetweenLines;
|
||||
CoreGlobalConfig.spaceBetweenLines = spaceBetweenLines;
|
||||
for (BaseHologram hologram : apiHologramManager.getHolograms()) {
|
||||
hologram.getLines().updatePositions();
|
||||
}
|
||||
|
@ -6,6 +6,7 @@
|
||||
package me.filoghost.holographicdisplays.core.base;
|
||||
|
||||
import me.filoghost.holographicdisplays.api.Position;
|
||||
import me.filoghost.holographicdisplays.core.CoreGlobalConfig;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@ -15,8 +16,6 @@ import java.util.List;
|
||||
|
||||
public class BaseHologramLines<T extends EditableHologramLine> implements Iterable<T> {
|
||||
|
||||
public static double spaceBetweenLines;
|
||||
|
||||
private final BaseHologram hologram;
|
||||
private final List<T> lines;
|
||||
private final List<T> unmodifiableLinesView;
|
||||
@ -98,7 +97,7 @@ public class BaseHologramLines<T extends EditableHologramLine> implements Iterab
|
||||
|
||||
currentLineY -= line.getHeight();
|
||||
if (i > 0) {
|
||||
currentLineY -= spaceBetweenLines;
|
||||
currentLineY -= CoreGlobalConfig.spaceBetweenLines;
|
||||
}
|
||||
|
||||
line.setCoordinates(hologramPosition.getX(), currentLineY, hologramPosition.getZ());
|
||||
@ -116,7 +115,7 @@ public class BaseHologramLines<T extends EditableHologramLine> implements Iterab
|
||||
height += line.getHeight();
|
||||
}
|
||||
|
||||
height += spaceBetweenLines * (lines.size() - 1);
|
||||
height += CoreGlobalConfig.spaceBetweenLines * (lines.size() - 1);
|
||||
return height;
|
||||
}
|
||||
|
||||
|
@ -127,6 +127,8 @@ public class HolographicDisplays extends FCommonsPlugin {
|
||||
configManager.reloadStaticReplacements(errorCollector);
|
||||
configManager.reloadMainSettings(errorCollector);
|
||||
|
||||
core.setSpaceBetweenHologramLines(Settings.spaceBetweenLines);
|
||||
|
||||
AnimationPlaceholderFactory animationPlaceholderFactory = configManager.loadAnimations(errorCollector);
|
||||
DefaultPlaceholders.resetAndRegister(api, animationPlaceholderFactory, bungeeServerTracker);
|
||||
|
||||
@ -144,8 +146,6 @@ public class HolographicDisplays extends FCommonsPlugin {
|
||||
errorCollector.add(e, "error while loading hologram \"" + hologramConfig.getName() + "\"");
|
||||
}
|
||||
}
|
||||
|
||||
core.setSpaceBetweenHologramLines(Settings.spaceBetweenLines);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Loading…
Reference in New Issue
Block a user