diff --git a/common/src/main/java/me/filoghost/holographicdisplays/common/hologram/StandardHologram.java b/common/src/main/java/me/filoghost/holographicdisplays/common/hologram/StandardHologram.java deleted file mode 100644 index 09132888..00000000 --- a/common/src/main/java/me/filoghost/holographicdisplays/common/hologram/StandardHologram.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright (C) filoghost and contributors - * - * SPDX-License-Identifier: GPL-3.0-or-later - */ -package me.filoghost.holographicdisplays.common.hologram; - -import org.bukkit.entity.Player; -import org.bukkit.plugin.Plugin; - -import java.util.List; - -public interface StandardHologram extends StandardHologramComponent { - - List getLines(); - - int getLineCount(); - - Plugin getCreatorPlugin(); - - boolean isVisibleTo(Player player); - -} diff --git a/common/src/main/java/me/filoghost/holographicdisplays/common/hologram/StandardHologramComponent.java b/common/src/main/java/me/filoghost/holographicdisplays/common/hologram/StandardHologramComponent.java deleted file mode 100644 index e3b4cd8b..00000000 --- a/common/src/main/java/me/filoghost/holographicdisplays/common/hologram/StandardHologramComponent.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (C) filoghost and contributors - * - * SPDX-License-Identifier: GPL-3.0-or-later - */ -package me.filoghost.holographicdisplays.common.hologram; - -import org.bukkit.World; - -public interface StandardHologramComponent { - - World getWorld(); - - double getX(); - - double getY(); - - double getZ(); - - int getChunkX(); - - int getChunkZ(); - - boolean isDeleted(); - - void setDeleted(); - -} diff --git a/common/src/main/java/me/filoghost/holographicdisplays/common/hologram/StandardHologramLine.java b/common/src/main/java/me/filoghost/holographicdisplays/common/hologram/StandardHologramLine.java deleted file mode 100644 index c222ff52..00000000 --- a/common/src/main/java/me/filoghost/holographicdisplays/common/hologram/StandardHologramLine.java +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Copyright (C) filoghost and contributors - * - * SPDX-License-Identifier: GPL-3.0-or-later - */ -package me.filoghost.holographicdisplays.common.hologram; - -import org.bukkit.World; -import org.bukkit.entity.Player; - -public interface StandardHologramLine extends StandardHologramComponent { - - void setLocation(World world, double x, double y, double z); - - double getHeight(); - - void setChanged(); - - boolean isVisibleTo(Player player); - -} diff --git a/common/src/main/java/me/filoghost/holographicdisplays/common/hologram/StandardItemLine.java b/common/src/main/java/me/filoghost/holographicdisplays/common/hologram/StandardItemLine.java deleted file mode 100644 index 27eaaddd..00000000 --- a/common/src/main/java/me/filoghost/holographicdisplays/common/hologram/StandardItemLine.java +++ /dev/null @@ -1,17 +0,0 @@ -/* - * Copyright (C) filoghost and contributors - * - * SPDX-License-Identifier: GPL-3.0-or-later - */ -package me.filoghost.holographicdisplays.common.hologram; - -import org.bukkit.entity.Player; -import org.bukkit.inventory.ItemStack; - -public interface StandardItemLine extends StandardTouchableLine { - - ItemStack getItemStack(); - - void onPickup(Player player); - -} diff --git a/common/src/main/java/me/filoghost/holographicdisplays/common/hologram/StandardTextLine.java b/common/src/main/java/me/filoghost/holographicdisplays/common/hologram/StandardTextLine.java deleted file mode 100644 index a0614032..00000000 --- a/common/src/main/java/me/filoghost/holographicdisplays/common/hologram/StandardTextLine.java +++ /dev/null @@ -1,14 +0,0 @@ -/* - * Copyright (C) filoghost and contributors - * - * SPDX-License-Identifier: GPL-3.0-or-later - */ -package me.filoghost.holographicdisplays.common.hologram; - -public interface StandardTextLine extends StandardTouchableLine { - - String getText(); - - boolean isAllowPlaceholders(); - -} diff --git a/common/src/main/java/me/filoghost/holographicdisplays/common/hologram/StandardTouchableLine.java b/common/src/main/java/me/filoghost/holographicdisplays/common/hologram/StandardTouchableLine.java deleted file mode 100644 index 281e611f..00000000 --- a/common/src/main/java/me/filoghost/holographicdisplays/common/hologram/StandardTouchableLine.java +++ /dev/null @@ -1,16 +0,0 @@ -/* - * Copyright (C) filoghost and contributors - * - * SPDX-License-Identifier: GPL-3.0-or-later - */ -package me.filoghost.holographicdisplays.common.hologram; - -import org.bukkit.entity.Player; - -public interface StandardTouchableLine extends StandardHologramLine { - - void onTouch(Player player); - - boolean hasTouchHandler(); - -} diff --git a/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/hologram/api/APIHologramLine.java b/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/hologram/api/APIHologramLine.java index 3d21a14b..41a5a652 100644 --- a/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/hologram/api/APIHologramLine.java +++ b/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/hologram/api/APIHologramLine.java @@ -6,15 +6,17 @@ package me.filoghost.holographicdisplays.plugin.hologram.api; import me.filoghost.holographicdisplays.api.hologram.HologramLine; -import me.filoghost.holographicdisplays.common.hologram.StandardHologramLine; +import me.filoghost.holographicdisplays.plugin.hologram.base.EditableHologramLine; import me.filoghost.holographicdisplays.plugin.api.v2.V2HologramLineAdapter; import org.jetbrains.annotations.NotNull; -public interface APIHologramLine extends HologramLine, StandardHologramLine { +public interface APIHologramLine extends HologramLine, EditableHologramLine { @Override @NotNull APIHologram getParent(); + void setChanged(); + @Override default void removeLine() { getParent().removeLine(this); diff --git a/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/hologram/base/BaseHologram.java b/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/hologram/base/BaseHologram.java index 90225254..824d2fbc 100644 --- a/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/hologram/base/BaseHologram.java +++ b/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/hologram/base/BaseHologram.java @@ -6,12 +6,12 @@ package me.filoghost.holographicdisplays.plugin.hologram.base; import me.filoghost.fcommons.Preconditions; -import me.filoghost.holographicdisplays.common.hologram.StandardHologram; -import me.filoghost.holographicdisplays.common.hologram.StandardHologramLine; import me.filoghost.holographicdisplays.plugin.disk.Settings; import me.filoghost.holographicdisplays.plugin.hologram.tracking.LineTrackerManager; import org.bukkit.Location; import org.bukkit.World; +import org.bukkit.entity.Player; +import org.bukkit.plugin.Plugin; import org.jetbrains.annotations.NotNull; import java.util.ArrayList; @@ -19,7 +19,7 @@ import java.util.Collections; import java.util.Iterator; import java.util.List; -public abstract class BaseHologram extends BaseHologramComponent implements StandardHologram { +public abstract class BaseHologram extends BaseHologramComponent { private final LineTrackerManager lineTrackerManager; private final List lines; @@ -33,11 +33,14 @@ public abstract class BaseHologram extends BaseH this.unmodifiableLinesView = Collections.unmodifiableList(lines); } + protected abstract boolean isVisibleTo(Player player); + + public abstract Plugin getCreatorPlugin(); + protected final LineTrackerManager getTrackerManager() { return lineTrackerManager; } - @Override public List getLines() { return unmodifiableLinesView; } @@ -115,7 +118,6 @@ public abstract class BaseHologram extends BaseH } } - @Override public int getLineCount() { return lines.size(); } diff --git a/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/hologram/base/BaseHologramComponent.java b/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/hologram/base/BaseHologramComponent.java index f3f91dcf..22c60897 100644 --- a/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/hologram/base/BaseHologramComponent.java +++ b/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/hologram/base/BaseHologramComponent.java @@ -6,13 +6,12 @@ package me.filoghost.holographicdisplays.plugin.hologram.base; import me.filoghost.fcommons.Preconditions; -import me.filoghost.holographicdisplays.common.hologram.StandardHologramComponent; import org.bukkit.Location; import org.bukkit.World; import org.jetbrains.annotations.MustBeInvokedByOverriders; import org.jetbrains.annotations.NotNull; -public abstract class BaseHologramComponent implements StandardHologramComponent { +public abstract class BaseHologramComponent { private World world; private double x, y, z; @@ -43,43 +42,35 @@ public abstract class BaseHologramComponent implements StandardHologramComponent return Location.locToBlock(locationCoord) >> 4; } - @Override public final World getWorld() { return world; } - @Override public final double getX() { return x; } - @Override public final double getY() { return y; } - @Override public final double getZ() { return z; } - @Override public final int getChunkX() { return chunkX; } - @Override public final int getChunkZ() { return chunkZ; } - @Override public final boolean isDeleted() { return deleted; } @MustBeInvokedByOverriders - @Override public void setDeleted() { deleted = true; } diff --git a/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/hologram/base/BaseHologramLine.java b/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/hologram/base/BaseHologramLine.java index e2b2dd22..3675722f 100644 --- a/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/hologram/base/BaseHologramLine.java +++ b/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/hologram/base/BaseHologramLine.java @@ -6,14 +6,13 @@ package me.filoghost.holographicdisplays.plugin.hologram.base; import me.filoghost.fcommons.Preconditions; -import me.filoghost.holographicdisplays.common.hologram.StandardHologram; -import me.filoghost.holographicdisplays.common.hologram.StandardHologramLine; import me.filoghost.holographicdisplays.plugin.hologram.tracking.LineTracker; import me.filoghost.holographicdisplays.plugin.hologram.tracking.LineTrackerManager; import org.bukkit.World; import org.bukkit.entity.Player; +import org.bukkit.plugin.Plugin; -public abstract class BaseHologramLine extends BaseHologramComponent implements StandardHologramLine { +public abstract class BaseHologramLine extends BaseHologramComponent implements EditableHologramLine { private final BaseHologram hologram; private final LineTracker tracker; @@ -26,11 +25,6 @@ public abstract class BaseHologramLine extends BaseHologramComponent implements protected abstract LineTracker createTracker(LineTrackerManager trackerManager); - protected final StandardHologram getHologram() { - return hologram; - } - - @Override public final void setChanged() { tracker.setLineChanged(); } @@ -45,9 +39,12 @@ public abstract class BaseHologramLine extends BaseHologramComponent implements setChanged(); } - @Override - public boolean isVisibleTo(Player player) { + public final boolean isVisibleTo(Player player) { return hologram.isVisibleTo(player); } + public final Plugin getCreatorPlugin() { + return hologram.getCreatorPlugin(); + } + } diff --git a/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/hologram/base/BaseHologramManager.java b/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/hologram/base/BaseHologramManager.java index 82a14150..590ee973 100644 --- a/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/hologram/base/BaseHologramManager.java +++ b/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/hologram/base/BaseHologramManager.java @@ -5,14 +5,12 @@ */ package me.filoghost.holographicdisplays.plugin.hologram.base; -import me.filoghost.holographicdisplays.common.hologram.StandardHologram; - import java.util.ArrayList; import java.util.Collections; import java.util.Iterator; import java.util.List; -public abstract class BaseHologramManager { +public abstract class BaseHologramManager> { private final List holograms = new ArrayList<>(); private final List unmodifiableHologramsView = Collections.unmodifiableList(holograms); diff --git a/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/hologram/base/BaseItemLine.java b/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/hologram/base/BaseItemLine.java index 528d52ce..81dc5d51 100644 --- a/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/hologram/base/BaseItemLine.java +++ b/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/hologram/base/BaseItemLine.java @@ -8,7 +8,6 @@ package me.filoghost.holographicdisplays.plugin.hologram.base; import me.filoghost.fcommons.Preconditions; import me.filoghost.fcommons.logging.Log; import me.filoghost.holographicdisplays.api.hologram.PickupHandler; -import me.filoghost.holographicdisplays.common.hologram.StandardItemLine; import me.filoghost.holographicdisplays.plugin.hologram.tracking.ItemLineTracker; import me.filoghost.holographicdisplays.plugin.hologram.tracking.LineTrackerManager; import org.bukkit.GameMode; @@ -17,7 +16,7 @@ import org.bukkit.inventory.ItemStack; import org.jetbrains.annotations.MustBeInvokedByOverriders; import org.jetbrains.annotations.Nullable; -public abstract class BaseItemLine extends BaseTouchableLine implements StandardItemLine { +public abstract class BaseItemLine extends BaseTouchableLine { private ItemStack itemStack; private PickupHandler pickupHandler; @@ -32,7 +31,6 @@ public abstract class BaseItemLine extends BaseTouchableLine implements Standard return trackerManager.startTracking(this); } - @Override public void onPickup(Player player) { if (isDeleted() || !player.isOnline() @@ -46,7 +44,7 @@ public abstract class BaseItemLine extends BaseTouchableLine implements Standard try { pickupHandler.onPickup(player); } catch (Throwable t) { - Log.warning("The plugin " + getHologram().getCreatorPlugin().getName() + " generated an exception" + Log.warning("The plugin " + getCreatorPlugin().getName() + " generated an exception" + " when the player " + player.getName() + " picked up an item from a hologram.", t); } } @@ -60,7 +58,6 @@ public abstract class BaseItemLine extends BaseTouchableLine implements Standard this.pickupHandler = pickupHandler; } - @Override public @Nullable ItemStack getItemStack() { return clone(itemStack); } diff --git a/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/hologram/base/BaseTextLine.java b/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/hologram/base/BaseTextLine.java index ae9e70a1..2fc9edec 100644 --- a/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/hologram/base/BaseTextLine.java +++ b/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/hologram/base/BaseTextLine.java @@ -5,12 +5,11 @@ */ package me.filoghost.holographicdisplays.plugin.hologram.base; -import me.filoghost.holographicdisplays.common.hologram.StandardTextLine; import me.filoghost.holographicdisplays.plugin.hologram.tracking.LineTrackerManager; import me.filoghost.holographicdisplays.plugin.hologram.tracking.TextLineTracker; import org.jetbrains.annotations.Nullable; -public abstract class BaseTextLine extends BaseTouchableLine implements StandardTextLine { +public abstract class BaseTextLine extends BaseTouchableLine { private String text; @@ -19,12 +18,13 @@ public abstract class BaseTextLine extends BaseTouchableLine implements Standard setText(text); } + public abstract boolean isAllowPlaceholders(); + @Override protected TextLineTracker createTracker(LineTrackerManager trackerManager) { return trackerManager.startTracking(this); } - @Override public @Nullable String getText() { return text; } diff --git a/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/hologram/base/BaseTouchableLine.java b/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/hologram/base/BaseTouchableLine.java index ee37f01f..9393fad7 100644 --- a/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/hologram/base/BaseTouchableLine.java +++ b/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/hologram/base/BaseTouchableLine.java @@ -7,7 +7,6 @@ package me.filoghost.holographicdisplays.plugin.hologram.base; import me.filoghost.fcommons.logging.Log; import me.filoghost.holographicdisplays.api.hologram.TouchHandler; -import me.filoghost.holographicdisplays.common.hologram.StandardTouchableLine; import org.bukkit.GameMode; import org.bukkit.entity.Player; import org.jetbrains.annotations.MustBeInvokedByOverriders; @@ -20,7 +19,7 @@ import java.util.WeakHashMap; * Useful class that implements StandardTouchableLine. The downside is that subclasses must extend this, and cannot extend other classes. * But all the current items are touchable. */ -public abstract class BaseTouchableLine extends BaseHologramLine implements StandardTouchableLine { +public abstract class BaseTouchableLine extends BaseHologramLine { private static final Map lastClickByPlayer = new WeakHashMap<>(); @@ -30,7 +29,6 @@ public abstract class BaseTouchableLine extends BaseHologramLine implements Stan super(hologram); } - @Override public void onTouch(Player player) { if (isDeleted() || !player.isOnline() @@ -52,14 +50,13 @@ public abstract class BaseTouchableLine extends BaseHologramLine implements Stan try { touchHandler.onTouch(player); } catch (Throwable t) { - Log.warning("The plugin " + getHologram().getCreatorPlugin().getName() + " generated an exception" + Log.warning("The plugin " + getCreatorPlugin().getName() + " generated an exception" + " when the player " + player.getName() + " touched a hologram.", t); } } - @Override - public boolean hasTouchHandler() { - return touchHandler != null; + public @Nullable TouchHandler getTouchHandler() { + return touchHandler; } @MustBeInvokedByOverriders @@ -68,8 +65,4 @@ public abstract class BaseTouchableLine extends BaseHologramLine implements Stan setChanged(); } - public @Nullable TouchHandler getTouchHandler() { - return touchHandler; - } - } diff --git a/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/hologram/base/EditableHologramLine.java b/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/hologram/base/EditableHologramLine.java new file mode 100644 index 00000000..868b1336 --- /dev/null +++ b/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/hologram/base/EditableHologramLine.java @@ -0,0 +1,18 @@ +/* + * Copyright (C) filoghost and contributors + * + * SPDX-License-Identifier: GPL-3.0-or-later + */ +package me.filoghost.holographicdisplays.plugin.hologram.base; + +import org.bukkit.World; + +public interface EditableHologramLine { + + void setLocation(World world, double x, double y, double z); + + double getHeight(); + + void setDeleted(); + +} diff --git a/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/hologram/internal/InternalHologramLine.java b/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/hologram/internal/InternalHologramLine.java index 5cafa319..b223b16b 100644 --- a/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/hologram/internal/InternalHologramLine.java +++ b/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/hologram/internal/InternalHologramLine.java @@ -5,9 +5,9 @@ */ package me.filoghost.holographicdisplays.plugin.hologram.internal; -import me.filoghost.holographicdisplays.common.hologram.StandardHologramLine; +import me.filoghost.holographicdisplays.plugin.hologram.base.EditableHologramLine; -public interface InternalHologramLine extends StandardHologramLine { +public interface InternalHologramLine extends EditableHologramLine { String getSerializedConfigValue(); diff --git a/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/hologram/tracking/ItemLineTracker.java b/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/hologram/tracking/ItemLineTracker.java index a5fb1729..efeb00ba 100644 --- a/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/hologram/tracking/ItemLineTracker.java +++ b/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/hologram/tracking/ItemLineTracker.java @@ -5,16 +5,16 @@ */ package me.filoghost.holographicdisplays.plugin.hologram.tracking; -import me.filoghost.holographicdisplays.common.hologram.StandardItemLine; import me.filoghost.holographicdisplays.common.nms.EntityID; import me.filoghost.holographicdisplays.common.nms.NMSManager; import me.filoghost.holographicdisplays.common.nms.NMSPacketList; +import me.filoghost.holographicdisplays.plugin.hologram.base.BaseItemLine; import org.bukkit.inventory.ItemStack; import org.jetbrains.annotations.MustBeInvokedByOverriders; import java.util.Objects; -public class ItemLineTracker extends TouchableLineTracker { +public class ItemLineTracker extends TouchableLineTracker { private final EntityID vehicleEntityID; private final EntityID itemEntityID; @@ -25,7 +25,7 @@ public class ItemLineTracker extends TouchableLineTracker { private boolean spawnItemEntities; private boolean spawnItemEntitiesChanged; - public ItemLineTracker(StandardItemLine line, NMSManager nmsManager, LineTouchListener lineTouchListener) { + public ItemLineTracker(BaseItemLine line, NMSManager nmsManager, LineTouchListener lineTouchListener) { super(line, nmsManager, lineTouchListener); this.vehicleEntityID = nmsManager.newEntityID(); this.itemEntityID = nmsManager.newEntityID(); diff --git a/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/hologram/tracking/LineTouchListener.java b/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/hologram/tracking/LineTouchListener.java index 63eb3022..ca0ea57f 100644 --- a/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/hologram/tracking/LineTouchListener.java +++ b/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/hologram/tracking/LineTouchListener.java @@ -5,9 +5,9 @@ */ package me.filoghost.holographicdisplays.plugin.hologram.tracking; -import me.filoghost.holographicdisplays.common.hologram.StandardTouchableLine; import me.filoghost.holographicdisplays.common.nms.EntityID; import me.filoghost.holographicdisplays.common.nms.PacketListener; +import me.filoghost.holographicdisplays.plugin.hologram.base.BaseTouchableLine; import org.bukkit.entity.Player; import java.util.HashSet; @@ -17,7 +17,7 @@ import java.util.concurrent.ConcurrentMap; public class LineTouchListener implements PacketListener { - private final ConcurrentMap linesByEntityID; + private final ConcurrentMap linesByEntityID; // It is necessary to queue async touch events to process them from the main thread. // Use a set to avoid duplicate touch events to the same line. @@ -30,7 +30,7 @@ public class LineTouchListener implements PacketListener { @Override public boolean onAsyncEntityInteract(Player player, int entityID) { - StandardTouchableLine line = linesByEntityID.get(entityID); + BaseTouchableLine line = linesByEntityID.get(entityID); if (line != null) { queuedTouchEvents.add(new TouchEvent(player, line)); return true; @@ -46,7 +46,7 @@ public class LineTouchListener implements PacketListener { queuedTouchEvents.clear(); } - public void registerLine(EntityID touchableEntityID, StandardTouchableLine line) { + public void registerLine(EntityID touchableEntityID, BaseTouchableLine line) { linesByEntityID.put(touchableEntityID.getNumericID(), line); } @@ -60,9 +60,9 @@ public class LineTouchListener implements PacketListener { private static class TouchEvent { private final Player player; - private final StandardTouchableLine line; + private final BaseTouchableLine line; - TouchEvent(Player player, StandardTouchableLine line) { + TouchEvent(Player player, BaseTouchableLine line) { this.player = player; this.line = line; } diff --git a/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/hologram/tracking/LineTracker.java b/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/hologram/tracking/LineTracker.java index ffde8fc4..0386bd59 100644 --- a/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/hologram/tracking/LineTracker.java +++ b/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/hologram/tracking/LineTracker.java @@ -5,9 +5,9 @@ */ package me.filoghost.holographicdisplays.plugin.hologram.tracking; -import me.filoghost.holographicdisplays.common.hologram.StandardHologramLine; import me.filoghost.holographicdisplays.common.nms.NMSManager; import me.filoghost.holographicdisplays.common.nms.NMSPacketList; +import me.filoghost.holographicdisplays.plugin.hologram.base.BaseHologramLine; import org.bukkit.Chunk; import org.bukkit.entity.Player; import org.jetbrains.annotations.MustBeInvokedByOverriders; @@ -16,7 +16,7 @@ import java.util.Collection; import java.util.HashSet; import java.util.Set; -public abstract class LineTracker { +public abstract class LineTracker { protected final T line; private final Set trackedPlayers; diff --git a/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/hologram/tracking/LineTrackerManager.java b/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/hologram/tracking/LineTrackerManager.java index bb3b1fc5..26d2ca58 100644 --- a/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/hologram/tracking/LineTrackerManager.java +++ b/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/hologram/tracking/LineTrackerManager.java @@ -5,9 +5,9 @@ */ package me.filoghost.holographicdisplays.plugin.hologram.tracking; -import me.filoghost.holographicdisplays.common.hologram.StandardItemLine; -import me.filoghost.holographicdisplays.common.hologram.StandardTextLine; import me.filoghost.holographicdisplays.common.nms.NMSManager; +import me.filoghost.holographicdisplays.plugin.hologram.base.BaseItemLine; +import me.filoghost.holographicdisplays.plugin.hologram.base.BaseTextLine; import me.filoghost.holographicdisplays.plugin.placeholder.tracking.PlaceholderTracker; import org.bukkit.Bukkit; import org.bukkit.Chunk; @@ -31,13 +31,13 @@ public class LineTrackerManager { this.lineTrackers = new LinkedList<>(); } - public TextLineTracker startTracking(StandardTextLine line) { + public TextLineTracker startTracking(BaseTextLine line) { TextLineTracker tracker = new TextLineTracker(line, nmsManager, lineTouchListener, placeholderTracker); lineTrackers.add(tracker); return tracker; } - public ItemLineTracker startTracking(StandardItemLine line) { + public ItemLineTracker startTracking(BaseItemLine line) { ItemLineTracker tracker = new ItemLineTracker(line, nmsManager, lineTouchListener); lineTrackers.add(tracker); return tracker; diff --git a/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/hologram/tracking/LocationBasedLineTracker.java b/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/hologram/tracking/LocationBasedLineTracker.java index 70e55d00..982efc45 100644 --- a/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/hologram/tracking/LocationBasedLineTracker.java +++ b/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/hologram/tracking/LocationBasedLineTracker.java @@ -5,16 +5,16 @@ */ package me.filoghost.holographicdisplays.plugin.hologram.tracking; -import me.filoghost.holographicdisplays.common.hologram.StandardHologramLine; import me.filoghost.holographicdisplays.common.nms.NMSManager; import me.filoghost.holographicdisplays.common.nms.NMSPacketList; +import me.filoghost.holographicdisplays.plugin.hologram.base.BaseHologramLine; import org.bukkit.Chunk; import org.bukkit.Location; import org.bukkit.World; import org.bukkit.entity.Player; import org.jetbrains.annotations.MustBeInvokedByOverriders; -abstract class LocationBasedLineTracker extends LineTracker { +abstract class LocationBasedLineTracker extends LineTracker { private static final int ENTITY_VIEW_RANGE = 64; diff --git a/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/hologram/tracking/TextLineTracker.java b/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/hologram/tracking/TextLineTracker.java index bdbf1974..a61d3f2e 100644 --- a/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/hologram/tracking/TextLineTracker.java +++ b/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/hologram/tracking/TextLineTracker.java @@ -5,16 +5,16 @@ */ package me.filoghost.holographicdisplays.plugin.hologram.tracking; -import me.filoghost.holographicdisplays.common.hologram.StandardTextLine; import me.filoghost.holographicdisplays.common.nms.EntityID; import me.filoghost.holographicdisplays.common.nms.NMSManager; import me.filoghost.holographicdisplays.common.nms.NMSPacketList; +import me.filoghost.holographicdisplays.plugin.hologram.base.BaseTextLine; import me.filoghost.holographicdisplays.plugin.placeholder.tracking.PlaceholderTracker; import org.jetbrains.annotations.MustBeInvokedByOverriders; import java.util.Objects; -public class TextLineTracker extends TouchableLineTracker { +public class TextLineTracker extends TouchableLineTracker { private final EntityID armorStandEntityID; @@ -23,7 +23,7 @@ public class TextLineTracker extends TouchableLineTracker { private boolean allowPlaceholders; public TextLineTracker( - StandardTextLine line, + BaseTextLine line, NMSManager nmsManager, LineTouchListener lineTouchListener, PlaceholderTracker placeholderTracker) { diff --git a/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/hologram/tracking/TouchableLineTracker.java b/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/hologram/tracking/TouchableLineTracker.java index f8eda2de..5543142b 100644 --- a/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/hologram/tracking/TouchableLineTracker.java +++ b/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/hologram/tracking/TouchableLineTracker.java @@ -5,13 +5,13 @@ */ package me.filoghost.holographicdisplays.plugin.hologram.tracking; -import me.filoghost.holographicdisplays.common.hologram.StandardTouchableLine; import me.filoghost.holographicdisplays.common.nms.EntityID; import me.filoghost.holographicdisplays.common.nms.NMSManager; import me.filoghost.holographicdisplays.common.nms.NMSPacketList; +import me.filoghost.holographicdisplays.plugin.hologram.base.BaseTouchableLine; import org.jetbrains.annotations.MustBeInvokedByOverriders; -public abstract class TouchableLineTracker extends LocationBasedLineTracker { +public abstract class TouchableLineTracker extends LocationBasedLineTracker { private static final double SLIME_HEIGHT = 0.5; @@ -41,7 +41,7 @@ public abstract class TouchableLineTracker exte protected void detectChanges() { super.detectChanges(); - boolean spawnSlimeEntities = line.hasTouchHandler(); + boolean spawnSlimeEntities = line.getTouchHandler() != null; if (this.spawnSlimeEntities != spawnSlimeEntities) { this.spawnSlimeEntities = spawnSlimeEntities; this.spawnSlimeEntitiesChanged = true;