Rename classes

This commit is contained in:
filoghost 2021-09-22 21:05:34 +02:00
parent d97751100e
commit b7b922fb37
11 changed files with 41 additions and 41 deletions

View File

@ -37,7 +37,7 @@ import me.filoghost.holographicdisplays.plugin.listener.UpdateNotificationListen
import me.filoghost.holographicdisplays.plugin.log.PrintableErrorCollector; import me.filoghost.holographicdisplays.plugin.log.PrintableErrorCollector;
import me.filoghost.holographicdisplays.plugin.tick.TickClock; import me.filoghost.holographicdisplays.plugin.tick.TickClock;
import me.filoghost.holographicdisplays.plugin.placeholder.registry.PlaceholderRegistry; import me.filoghost.holographicdisplays.plugin.placeholder.registry.PlaceholderRegistry;
import me.filoghost.holographicdisplays.plugin.placeholder.tracking.PlaceholderTracker; import me.filoghost.holographicdisplays.plugin.placeholder.tracking.ActivePlaceholderTracker;
import me.filoghost.holographicdisplays.plugin.tick.TickingTask; import me.filoghost.holographicdisplays.plugin.tick.TickingTask;
import me.filoghost.holographicdisplays.plugin.util.NMSVersion; import me.filoghost.holographicdisplays.plugin.util.NMSVersion;
import me.filoghost.holographicdisplays.plugin.util.NMSVersion.OutdatedVersionException; import me.filoghost.holographicdisplays.plugin.util.NMSVersion.OutdatedVersionException;
@ -104,7 +104,7 @@ public class HolographicDisplays extends FCommonsPlugin {
bungeeServerTracker = new BungeeServerTracker(this); bungeeServerTracker = new BungeeServerTracker(this);
placeholderRegistry = new PlaceholderRegistry(); placeholderRegistry = new PlaceholderRegistry();
TickClock tickClock = new TickClock(); TickClock tickClock = new TickClock();
PlaceholderTracker placeholderTracker = new PlaceholderTracker(placeholderRegistry, tickClock); ActivePlaceholderTracker placeholderTracker = new ActivePlaceholderTracker(placeholderRegistry, tickClock);
LineClickListener lineClickListener = new LineClickListener(); LineClickListener lineClickListener = new LineClickListener();
lineTrackerManager = new LineTrackerManager(nmsManager, placeholderTracker, lineClickListener); lineTrackerManager = new LineTrackerManager(nmsManager, placeholderTracker, lineClickListener);
internalHologramManager = new InternalHologramManager(lineTrackerManager); internalHologramManager = new InternalHologramManager(lineTrackerManager);

View File

@ -9,7 +9,7 @@ import me.filoghost.fcommons.Preconditions;
import me.filoghost.holographicdisplays.plugin.bridge.placeholderapi.PlaceholderAPIHook; import me.filoghost.holographicdisplays.plugin.bridge.placeholderapi.PlaceholderAPIHook;
import me.filoghost.holographicdisplays.plugin.placeholder.parsing.PlaceholderOccurrence; import me.filoghost.holographicdisplays.plugin.placeholder.parsing.PlaceholderOccurrence;
import me.filoghost.holographicdisplays.plugin.placeholder.parsing.StringWithPlaceholders; import me.filoghost.holographicdisplays.plugin.placeholder.parsing.StringWithPlaceholders;
import me.filoghost.holographicdisplays.plugin.placeholder.tracking.PlaceholderTracker; import me.filoghost.holographicdisplays.plugin.placeholder.tracking.ActivePlaceholderTracker;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
@ -19,7 +19,7 @@ import java.util.Objects;
class DisplayText { class DisplayText {
private final PlaceholderTracker placeholderTracker; private final ActivePlaceholderTracker placeholderTracker;
private @Nullable StringWithPlaceholders unreplacedText; private @Nullable StringWithPlaceholders unreplacedText;
private boolean allowPlaceholders; private boolean allowPlaceholders;
@ -28,7 +28,7 @@ class DisplayText {
private @Nullable Boolean containsIndividualPlaceholders; private @Nullable Boolean containsIndividualPlaceholders;
private long lastPlaceholderRegistryVersion; private long lastPlaceholderRegistryVersion;
DisplayText(PlaceholderTracker placeholderTracker) { DisplayText(ActivePlaceholderTracker placeholderTracker) {
this.placeholderTracker = placeholderTracker; this.placeholderTracker = placeholderTracker;
} }

View File

@ -9,7 +9,7 @@ import me.filoghost.holographicdisplays.nms.common.NMSManager;
import me.filoghost.holographicdisplays.plugin.hologram.base.BaseItemHologramLine; import me.filoghost.holographicdisplays.plugin.hologram.base.BaseItemHologramLine;
import me.filoghost.holographicdisplays.plugin.hologram.base.BaseTextHologramLine; import me.filoghost.holographicdisplays.plugin.hologram.base.BaseTextHologramLine;
import me.filoghost.holographicdisplays.plugin.listener.LineClickListener; import me.filoghost.holographicdisplays.plugin.listener.LineClickListener;
import me.filoghost.holographicdisplays.plugin.placeholder.tracking.PlaceholderTracker; import me.filoghost.holographicdisplays.plugin.placeholder.tracking.ActivePlaceholderTracker;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -20,11 +20,11 @@ import java.util.LinkedList;
public class LineTrackerManager { public class LineTrackerManager {
private final NMSManager nmsManager; private final NMSManager nmsManager;
private final PlaceholderTracker placeholderTracker; private final ActivePlaceholderTracker placeholderTracker;
private final LineClickListener lineClickListener; private final LineClickListener lineClickListener;
private final Collection<LineTracker<?>> lineTrackers; private final Collection<LineTracker<?>> lineTrackers;
public LineTrackerManager(NMSManager nmsManager, PlaceholderTracker placeholderTracker, LineClickListener lineClickListener) { public LineTrackerManager(NMSManager nmsManager, ActivePlaceholderTracker placeholderTracker, LineClickListener lineClickListener) {
this.nmsManager = nmsManager; this.nmsManager = nmsManager;
this.placeholderTracker = placeholderTracker; this.placeholderTracker = placeholderTracker;
this.lineClickListener = lineClickListener; this.lineClickListener = lineClickListener;

View File

@ -10,7 +10,7 @@ import me.filoghost.holographicdisplays.nms.common.NMSManager;
import me.filoghost.holographicdisplays.nms.common.entity.TextNMSPacketEntity; import me.filoghost.holographicdisplays.nms.common.entity.TextNMSPacketEntity;
import me.filoghost.holographicdisplays.plugin.hologram.base.BaseTextHologramLine; import me.filoghost.holographicdisplays.plugin.hologram.base.BaseTextHologramLine;
import me.filoghost.holographicdisplays.plugin.listener.LineClickListener; import me.filoghost.holographicdisplays.plugin.listener.LineClickListener;
import me.filoghost.holographicdisplays.plugin.placeholder.tracking.PlaceholderTracker; import me.filoghost.holographicdisplays.plugin.placeholder.tracking.ActivePlaceholderTracker;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.jetbrains.annotations.MustBeInvokedByOverriders; import org.jetbrains.annotations.MustBeInvokedByOverriders;
@ -28,7 +28,7 @@ public class TextLineTracker extends ClickableLineTracker<TextLineViewer> {
BaseTextHologramLine line, BaseTextHologramLine line,
NMSManager nmsManager, NMSManager nmsManager,
LineClickListener lineClickListener, LineClickListener lineClickListener,
PlaceholderTracker placeholderTracker) { ActivePlaceholderTracker placeholderTracker) {
super(line, nmsManager, lineClickListener); super(line, nmsManager, lineClickListener);
this.line = line; this.line = line;
this.textEntity = nmsManager.newTextPacketEntity(); this.textEntity = nmsManager.newTextPacketEntity();

View File

@ -10,11 +10,11 @@ import me.filoghost.holographicdisplays.plugin.placeholder.registry.PlaceholderE
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
abstract class TrackedPlaceholder { abstract class ActivePlaceholder {
private final @Nullable PlaceholderExpansion source; private final @Nullable PlaceholderExpansion source;
TrackedPlaceholder(@Nullable PlaceholderExpansion source) { ActivePlaceholder(@Nullable PlaceholderExpansion source) {
this.source = source; this.source = source;
} }

View File

@ -19,7 +19,7 @@ import org.jetbrains.annotations.Nullable;
import java.util.Objects; import java.util.Objects;
import java.util.WeakHashMap; import java.util.WeakHashMap;
public class PlaceholderTracker { public class ActivePlaceholderTracker {
private final PlaceholderRegistry registry; private final PlaceholderRegistry registry;
private final TickClock tickClock; private final TickClock tickClock;
@ -27,11 +27,11 @@ public class PlaceholderTracker {
// Use WeakHashMap to ensure that when a PlaceholderOccurrence is no longer referenced in other objects // Use WeakHashMap to ensure that when a PlaceholderOccurrence is no longer referenced in other objects
// the corresponding entry is removed from the map automatically. // the corresponding entry is removed from the map automatically.
private final WeakHashMap<PlaceholderOccurrence, TrackedPlaceholder> activePlaceholders; private final WeakHashMap<PlaceholderOccurrence, ActivePlaceholder> activePlaceholders;
private long lastRegistryVersion; private long lastRegistryVersion;
public PlaceholderTracker(PlaceholderRegistry registry, TickClock tickClock) { public ActivePlaceholderTracker(PlaceholderRegistry registry, TickClock tickClock) {
this.registry = registry; this.registry = registry;
this.tickClock = tickClock; this.tickClock = tickClock;
this.exceptionHandler = new PlaceholderExceptionHandler(tickClock); this.exceptionHandler = new PlaceholderExceptionHandler(tickClock);
@ -57,11 +57,11 @@ public class PlaceholderTracker {
public @Nullable String updateAndGetGlobalReplacement(PlaceholderOccurrence placeholderOccurrence) { public @Nullable String updateAndGetGlobalReplacement(PlaceholderOccurrence placeholderOccurrence) {
try { try {
TrackedPlaceholder trackedPlaceholder = getTrackedPlaceholder(placeholderOccurrence); ActivePlaceholder activePlaceholder = trackAndGetPlaceholder(placeholderOccurrence);
if (trackedPlaceholder.isIndividual()) { if (activePlaceholder.isIndividual()) {
return null; return null;
} }
return trackedPlaceholder.updateAndGetReplacement(null, tickClock.getCurrentTick()); return activePlaceholder.updateAndGetReplacement(null, tickClock.getCurrentTick());
} catch (PlaceholderException e) { } catch (PlaceholderException e) {
exceptionHandler.handle(e); exceptionHandler.handle(e);
return "[Error]"; return "[Error]";
@ -70,26 +70,26 @@ public class PlaceholderTracker {
public @Nullable String updateAndGetReplacement(PlaceholderOccurrence placeholderOccurrence, Player player) { public @Nullable String updateAndGetReplacement(PlaceholderOccurrence placeholderOccurrence, Player player) {
try { try {
TrackedPlaceholder trackedPlaceholder = getTrackedPlaceholder(placeholderOccurrence); ActivePlaceholder activePlaceholder = trackAndGetPlaceholder(placeholderOccurrence);
return trackedPlaceholder.updateAndGetReplacement(player, tickClock.getCurrentTick()); return activePlaceholder.updateAndGetReplacement(player, tickClock.getCurrentTick());
} catch (PlaceholderException e) { } catch (PlaceholderException e) {
exceptionHandler.handle(e); exceptionHandler.handle(e);
return "[Error]"; return "[Error]";
} }
} }
private @NotNull TrackedPlaceholder getTrackedPlaceholder(PlaceholderOccurrence placeholderOccurrence) throws PlaceholderException { private @NotNull ActivePlaceholder trackAndGetPlaceholder(PlaceholderOccurrence placeholderOccurrence) throws PlaceholderException {
TrackedPlaceholder trackedPlaceholder = activePlaceholders.get(placeholderOccurrence); ActivePlaceholder activePlaceholder = activePlaceholders.get(placeholderOccurrence);
if (trackedPlaceholder == null) { if (activePlaceholder == null) {
trackedPlaceholder = createTrackedPlaceholder(placeholderOccurrence); activePlaceholder = createActivePlaceholder(placeholderOccurrence);
activePlaceholders.put(placeholderOccurrence, trackedPlaceholder); activePlaceholders.put(placeholderOccurrence, activePlaceholder);
} }
return trackedPlaceholder; return activePlaceholder;
} }
private TrackedPlaceholder createTrackedPlaceholder(PlaceholderOccurrence placeholderOccurrence) throws PlaceholderException { private ActivePlaceholder createActivePlaceholder(PlaceholderOccurrence placeholderOccurrence) throws PlaceholderException {
PlaceholderExpansion placeholderExpansion = registry.find(placeholderOccurrence); PlaceholderExpansion placeholderExpansion = registry.find(placeholderOccurrence);
StandardPlaceholder placeholder; StandardPlaceholder placeholder;
@ -100,11 +100,11 @@ public class PlaceholderTracker {
} }
if (placeholder == null) { if (placeholder == null) {
return new TrackedNullPlaceholder(placeholderExpansion); return new NullActivePlaceholder(placeholderExpansion);
} else if (placeholder.isIndividual()) { } else if (placeholder.isIndividual()) {
return new TrackedIndividualPlaceholder(placeholder, placeholderOccurrence); return new IndividualActivePlaceholder(placeholder, placeholderOccurrence);
} else { } else {
return new TrackedGlobalPlaceholder(placeholder, placeholderOccurrence); return new GlobalActivePlaceholder(placeholder, placeholderOccurrence);
} }
} }

View File

@ -12,11 +12,11 @@ import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
class TrackedGlobalPlaceholder extends TrackedPlaceholder { class GlobalActivePlaceholder extends ActivePlaceholder {
private final ReplacementHolder replacementHolder; private final ReplacementHolder replacementHolder;
TrackedGlobalPlaceholder(@NotNull StandardPlaceholder placeholder, @NotNull PlaceholderOccurrence placeholderOccurrence) { GlobalActivePlaceholder(@NotNull StandardPlaceholder placeholder, @NotNull PlaceholderOccurrence placeholderOccurrence) {
super(placeholder.getSource()); super(placeholder.getSource());
this.replacementHolder = new ReplacementHolder(placeholder, placeholderOccurrence); this.replacementHolder = new ReplacementHolder(placeholder, placeholderOccurrence);
} }

View File

@ -14,13 +14,13 @@ import org.jetbrains.annotations.Nullable;
import java.util.WeakHashMap; import java.util.WeakHashMap;
class TrackedIndividualPlaceholder extends TrackedPlaceholder { class IndividualActivePlaceholder extends ActivePlaceholder {
private final @NotNull StandardPlaceholder placeholder; private final @NotNull StandardPlaceholder placeholder;
private final @NotNull PlaceholderOccurrence placeholderOccurrence; private final @NotNull PlaceholderOccurrence placeholderOccurrence;
private final WeakHashMap<Player, ReplacementHolder> replacementHolderByPlayer; private final WeakHashMap<Player, ReplacementHolder> replacementHolderByPlayer;
TrackedIndividualPlaceholder(@NotNull StandardPlaceholder placeholder, @NotNull PlaceholderOccurrence placeholderOccurrence) { IndividualActivePlaceholder(@NotNull StandardPlaceholder placeholder, @NotNull PlaceholderOccurrence placeholderOccurrence) {
super(placeholder.getSource()); super(placeholder.getSource());
this.placeholder = placeholder; this.placeholder = placeholder;
this.placeholderOccurrence = placeholderOccurrence; this.placeholderOccurrence = placeholderOccurrence;

View File

@ -9,9 +9,9 @@ import me.filoghost.holographicdisplays.plugin.placeholder.registry.PlaceholderE
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
class TrackedNullPlaceholder extends TrackedPlaceholder { class NullActivePlaceholder extends ActivePlaceholder {
TrackedNullPlaceholder(@Nullable PlaceholderExpansion placeholderExpansion) { NullActivePlaceholder(@Nullable PlaceholderExpansion placeholderExpansion) {
super(placeholderExpansion); super(placeholderExpansion);
} }

View File

@ -8,12 +8,12 @@ package me.filoghost.holographicdisplays.plugin.tick;
import me.filoghost.fcommons.logging.Log; import me.filoghost.fcommons.logging.Log;
import me.filoghost.holographicdisplays.plugin.listener.LineClickListener; import me.filoghost.holographicdisplays.plugin.listener.LineClickListener;
import me.filoghost.holographicdisplays.plugin.hologram.tracking.LineTrackerManager; import me.filoghost.holographicdisplays.plugin.hologram.tracking.LineTrackerManager;
import me.filoghost.holographicdisplays.plugin.placeholder.tracking.PlaceholderTracker; import me.filoghost.holographicdisplays.plugin.placeholder.tracking.ActivePlaceholderTracker;
public class TickingTask implements Runnable { public class TickingTask implements Runnable {
private final TickClock tickClock; private final TickClock tickClock;
private final PlaceholderTracker placeholderTracker; private final ActivePlaceholderTracker placeholderTracker;
private final LineTrackerManager lineTrackerManager; private final LineTrackerManager lineTrackerManager;
private final LineClickListener lineClickListener; private final LineClickListener lineClickListener;
@ -21,7 +21,7 @@ public class TickingTask implements Runnable {
public TickingTask( public TickingTask(
TickClock tickClock, TickClock tickClock,
PlaceholderTracker placeholderTracker, ActivePlaceholderTracker placeholderTracker,
LineTrackerManager lineTrackerManager, LineTrackerManager lineTrackerManager,
LineClickListener lineClickListener) { LineClickListener lineClickListener) {
this.tickClock = tickClock; this.tickClock = tickClock;

View File

@ -8,14 +8,14 @@ package me.filoghost.holographicdisplays.plugin.test;
import me.filoghost.holographicdisplays.plugin.api.v2.V2HologramManager; import me.filoghost.holographicdisplays.plugin.api.v2.V2HologramManager;
import me.filoghost.holographicdisplays.plugin.hologram.tracking.LineTrackerManager; import me.filoghost.holographicdisplays.plugin.hologram.tracking.LineTrackerManager;
import me.filoghost.holographicdisplays.plugin.listener.LineClickListener; import me.filoghost.holographicdisplays.plugin.listener.LineClickListener;
import me.filoghost.holographicdisplays.plugin.placeholder.tracking.PlaceholderTracker; import me.filoghost.holographicdisplays.plugin.placeholder.tracking.ActivePlaceholderTracker;
import static org.mockito.Mockito.*; import static org.mockito.Mockito.*;
public class TestV2HologramManager extends V2HologramManager { public class TestV2HologramManager extends V2HologramManager {
public TestV2HologramManager() { public TestV2HologramManager() {
super(new LineTrackerManager(new TestNMSManager(), mock(PlaceholderTracker.class), new LineClickListener())); super(new LineTrackerManager(new TestNMSManager(), mock(ActivePlaceholderTracker.class), new LineClickListener()));
} }
} }