mirror of
https://github.com/filoghost/HolographicDisplays.git
synced 2025-02-07 23:51:33 +01:00
Make names more consistent
This commit is contained in:
parent
4e028efb27
commit
b9d55363c6
@ -23,7 +23,7 @@ import me.filoghost.holographicdisplays.plugin.disk.Settings;
|
|||||||
import me.filoghost.holographicdisplays.plugin.disk.upgrade.LegacySymbolsUpgrade;
|
import me.filoghost.holographicdisplays.plugin.disk.upgrade.LegacySymbolsUpgrade;
|
||||||
import me.filoghost.holographicdisplays.plugin.hologram.api.APIHologramManager;
|
import me.filoghost.holographicdisplays.plugin.hologram.api.APIHologramManager;
|
||||||
import me.filoghost.holographicdisplays.plugin.hologram.internal.InternalHologramManager;
|
import me.filoghost.holographicdisplays.plugin.hologram.internal.InternalHologramManager;
|
||||||
import me.filoghost.holographicdisplays.plugin.hologram.tracking.LineTouchListener;
|
import me.filoghost.holographicdisplays.plugin.hologram.tracking.LineClickListener;
|
||||||
import me.filoghost.holographicdisplays.plugin.hologram.tracking.LineTrackerManager;
|
import me.filoghost.holographicdisplays.plugin.hologram.tracking.LineTrackerManager;
|
||||||
import me.filoghost.holographicdisplays.plugin.listener.ChunkListener;
|
import me.filoghost.holographicdisplays.plugin.listener.ChunkListener;
|
||||||
import me.filoghost.holographicdisplays.plugin.listener.PlayerListener;
|
import me.filoghost.holographicdisplays.plugin.listener.PlayerListener;
|
||||||
@ -101,8 +101,8 @@ public class HolographicDisplays extends FCommonsPlugin {
|
|||||||
placeholderRegistry = new PlaceholderRegistry();
|
placeholderRegistry = new PlaceholderRegistry();
|
||||||
TickClock tickClock = new TickClock();
|
TickClock tickClock = new TickClock();
|
||||||
PlaceholderTracker placeholderTracker = new PlaceholderTracker(placeholderRegistry, tickClock);
|
PlaceholderTracker placeholderTracker = new PlaceholderTracker(placeholderRegistry, tickClock);
|
||||||
LineTouchListener lineTouchListener = new LineTouchListener();
|
LineClickListener lineClickListener = new LineClickListener();
|
||||||
lineTrackerManager = new LineTrackerManager(nmsManager, placeholderTracker, lineTouchListener);
|
lineTrackerManager = new LineTrackerManager(nmsManager, placeholderTracker, lineClickListener);
|
||||||
internalHologramManager = new InternalHologramManager(lineTrackerManager);
|
internalHologramManager = new InternalHologramManager(lineTrackerManager);
|
||||||
APIHologramManager apiHologramManager = new APIHologramManager(lineTrackerManager);
|
APIHologramManager apiHologramManager = new APIHologramManager(lineTrackerManager);
|
||||||
|
|
||||||
@ -118,16 +118,16 @@ public class HolographicDisplays extends FCommonsPlugin {
|
|||||||
PlaceholderAPIHook.setup();
|
PlaceholderAPIHook.setup();
|
||||||
|
|
||||||
for (Player player : Bukkit.getOnlinePlayers()) {
|
for (Player player : Bukkit.getOnlinePlayers()) {
|
||||||
nmsManager.injectPacketListener(player, lineTouchListener);
|
nmsManager.injectPacketListener(player, lineClickListener);
|
||||||
}
|
}
|
||||||
|
|
||||||
TickingTask tickingTask = new TickingTask(tickClock, lineTrackerManager, lineTouchListener);
|
TickingTask tickingTask = new TickingTask(tickClock, lineTrackerManager, lineClickListener);
|
||||||
Bukkit.getScheduler().scheduleSyncRepeatingTask(this, tickingTask, 0, 1);
|
Bukkit.getScheduler().scheduleSyncRepeatingTask(this, tickingTask, 0, 1);
|
||||||
|
|
||||||
HologramCommandManager commandManager = new HologramCommandManager(this, internalHologramManager, configManager);
|
HologramCommandManager commandManager = new HologramCommandManager(this, internalHologramManager, configManager);
|
||||||
commandManager.register(this);
|
commandManager.register(this);
|
||||||
|
|
||||||
registerListener(new PlayerListener(nmsManager, lineTrackerManager, lineTouchListener));
|
registerListener(new PlayerListener(nmsManager, lineTrackerManager, lineClickListener));
|
||||||
registerListener(new ChunkListener(this, lineTrackerManager));
|
registerListener(new ChunkListener(this, lineTrackerManager));
|
||||||
UpdateNotificationListener updateNotificationListener = new UpdateNotificationListener();
|
UpdateNotificationListener updateNotificationListener = new UpdateNotificationListener();
|
||||||
registerListener(updateNotificationListener);
|
registerListener(updateNotificationListener);
|
||||||
|
@ -14,17 +14,17 @@ import org.jetbrains.annotations.Nullable;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.WeakHashMap;
|
import java.util.WeakHashMap;
|
||||||
|
|
||||||
public abstract class BaseTouchableLine extends BaseHologramLine {
|
public abstract class BaseClickableLine extends BaseHologramLine {
|
||||||
|
|
||||||
private static final Map<Player, Long> lastClickByPlayer = new WeakHashMap<>();
|
private static final Map<Player, Long> lastClickByPlayer = new WeakHashMap<>();
|
||||||
|
|
||||||
private ClickListener clickListener;
|
private ClickListener clickListener;
|
||||||
|
|
||||||
protected BaseTouchableLine(BaseHologram<?> hologram) {
|
protected BaseClickableLine(BaseHologram<?> hologram) {
|
||||||
super(hologram);
|
super(hologram);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onTouch(Player player) {
|
public void onClick(Player player) {
|
||||||
if (clickListener == null || !canInteract(player)) {
|
if (clickListener == null || !canInteract(player)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -41,7 +41,7 @@ public abstract class BaseTouchableLine extends BaseHologramLine {
|
|||||||
clickListener.onClick(player);
|
clickListener.onClick(player);
|
||||||
} catch (Throwable t) {
|
} catch (Throwable t) {
|
||||||
Log.warning("The plugin " + getCreatorPlugin().getName() + " generated an exception"
|
Log.warning("The plugin " + getCreatorPlugin().getName() + " generated an exception"
|
||||||
+ " when the player " + player.getName() + " touched a hologram.", t);
|
+ " when the player " + player.getName() + " clicked a hologram.", t);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -15,7 +15,7 @@ import org.bukkit.inventory.ItemStack;
|
|||||||
import org.jetbrains.annotations.MustBeInvokedByOverriders;
|
import org.jetbrains.annotations.MustBeInvokedByOverriders;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
public abstract class BaseItemLine extends BaseTouchableLine {
|
public abstract class BaseItemLine extends BaseClickableLine {
|
||||||
|
|
||||||
private ItemStack itemStack;
|
private ItemStack itemStack;
|
||||||
private PickupListener pickupListener;
|
private PickupListener pickupListener;
|
||||||
|
@ -9,7 +9,7 @@ import me.filoghost.holographicdisplays.plugin.hologram.tracking.LineTrackerMana
|
|||||||
import me.filoghost.holographicdisplays.plugin.hologram.tracking.TextLineTracker;
|
import me.filoghost.holographicdisplays.plugin.hologram.tracking.TextLineTracker;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
public abstract class BaseTextLine extends BaseTouchableLine {
|
public abstract class BaseTextLine extends BaseClickableLine {
|
||||||
|
|
||||||
private String text;
|
private String text;
|
||||||
|
|
||||||
|
@ -8,32 +8,32 @@ package me.filoghost.holographicdisplays.plugin.hologram.tracking;
|
|||||||
import me.filoghost.holographicdisplays.common.nms.EntityID;
|
import me.filoghost.holographicdisplays.common.nms.EntityID;
|
||||||
import me.filoghost.holographicdisplays.common.nms.NMSManager;
|
import me.filoghost.holographicdisplays.common.nms.NMSManager;
|
||||||
import me.filoghost.holographicdisplays.common.nms.NMSPacketList;
|
import me.filoghost.holographicdisplays.common.nms.NMSPacketList;
|
||||||
import me.filoghost.holographicdisplays.plugin.hologram.base.BaseTouchableLine;
|
import me.filoghost.holographicdisplays.plugin.hologram.base.BaseClickableLine;
|
||||||
import org.jetbrains.annotations.MustBeInvokedByOverriders;
|
import org.jetbrains.annotations.MustBeInvokedByOverriders;
|
||||||
|
|
||||||
public abstract class TouchableLineTracker<T extends BaseTouchableLine> extends LocationBasedLineTracker<T> {
|
public abstract class ClickableLineTracker<T extends BaseClickableLine> extends LocationBasedLineTracker<T> {
|
||||||
|
|
||||||
private static final double SLIME_HEIGHT = 0.5;
|
private static final double SLIME_HEIGHT = 0.5;
|
||||||
|
|
||||||
private final LineTouchListener lineTouchListener;
|
private final LineClickListener lineClickListener;
|
||||||
private final EntityID vehicleEntityID;
|
private final EntityID vehicleEntityID;
|
||||||
private final EntityID slimeEntityID;
|
private final EntityID slimeEntityID;
|
||||||
|
|
||||||
private boolean spawnSlimeEntities;
|
private boolean spawnSlimeEntities;
|
||||||
private boolean spawnSlimeEntitiesChanged;
|
private boolean spawnSlimeEntitiesChanged;
|
||||||
|
|
||||||
public TouchableLineTracker(T line, NMSManager nmsManager, LineTouchListener lineTouchListener) {
|
public ClickableLineTracker(T line, NMSManager nmsManager, LineClickListener lineClickListener) {
|
||||||
super(line, nmsManager);
|
super(line, nmsManager);
|
||||||
this.vehicleEntityID = nmsManager.newEntityID();
|
this.vehicleEntityID = nmsManager.newEntityID();
|
||||||
this.slimeEntityID = nmsManager.newEntityID();
|
this.slimeEntityID = nmsManager.newEntityID();
|
||||||
this.lineTouchListener = lineTouchListener;
|
this.lineClickListener = lineClickListener;
|
||||||
}
|
}
|
||||||
|
|
||||||
@MustBeInvokedByOverriders
|
@MustBeInvokedByOverriders
|
||||||
@Override
|
@Override
|
||||||
public void onRemoval() {
|
public void onRemoval() {
|
||||||
super.onRemoval();
|
super.onRemoval();
|
||||||
lineTouchListener.unregisterLine(slimeEntityID);
|
lineClickListener.unregisterLine(slimeEntityID);
|
||||||
}
|
}
|
||||||
|
|
||||||
@MustBeInvokedByOverriders
|
@MustBeInvokedByOverriders
|
||||||
@ -46,9 +46,9 @@ public abstract class TouchableLineTracker<T extends BaseTouchableLine> extends
|
|||||||
this.spawnSlimeEntities = spawnSlimeEntities;
|
this.spawnSlimeEntities = spawnSlimeEntities;
|
||||||
this.spawnSlimeEntitiesChanged = true;
|
this.spawnSlimeEntitiesChanged = true;
|
||||||
if (spawnSlimeEntities) {
|
if (spawnSlimeEntities) {
|
||||||
lineTouchListener.registerLine(slimeEntityID, line);
|
lineClickListener.registerLine(slimeEntityID, line);
|
||||||
} else {
|
} else {
|
||||||
lineTouchListener.unregisterLine(slimeEntityID);
|
lineClickListener.unregisterLine(slimeEntityID);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -14,7 +14,7 @@ import org.jetbrains.annotations.MustBeInvokedByOverriders;
|
|||||||
|
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
public class ItemLineTracker extends TouchableLineTracker<BaseItemLine> {
|
public class ItemLineTracker extends ClickableLineTracker<BaseItemLine> {
|
||||||
|
|
||||||
private final EntityID vehicleEntityID;
|
private final EntityID vehicleEntityID;
|
||||||
private final EntityID itemEntityID;
|
private final EntityID itemEntityID;
|
||||||
@ -25,8 +25,8 @@ public class ItemLineTracker extends TouchableLineTracker<BaseItemLine> {
|
|||||||
private boolean spawnItemEntities;
|
private boolean spawnItemEntities;
|
||||||
private boolean spawnItemEntitiesChanged;
|
private boolean spawnItemEntitiesChanged;
|
||||||
|
|
||||||
public ItemLineTracker(BaseItemLine line, NMSManager nmsManager, LineTouchListener lineTouchListener) {
|
public ItemLineTracker(BaseItemLine line, NMSManager nmsManager, LineClickListener lineClickListener) {
|
||||||
super(line, nmsManager, lineTouchListener);
|
super(line, nmsManager, lineClickListener);
|
||||||
this.vehicleEntityID = nmsManager.newEntityID();
|
this.vehicleEntityID = nmsManager.newEntityID();
|
||||||
this.itemEntityID = nmsManager.newEntityID();
|
this.itemEntityID = nmsManager.newEntityID();
|
||||||
}
|
}
|
||||||
|
@ -7,7 +7,7 @@ package me.filoghost.holographicdisplays.plugin.hologram.tracking;
|
|||||||
|
|
||||||
import me.filoghost.holographicdisplays.common.nms.EntityID;
|
import me.filoghost.holographicdisplays.common.nms.EntityID;
|
||||||
import me.filoghost.holographicdisplays.common.nms.PacketListener;
|
import me.filoghost.holographicdisplays.common.nms.PacketListener;
|
||||||
import me.filoghost.holographicdisplays.plugin.hologram.base.BaseTouchableLine;
|
import me.filoghost.holographicdisplays.plugin.hologram.base.BaseClickableLine;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
@ -15,54 +15,55 @@ import java.util.Set;
|
|||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.concurrent.ConcurrentMap;
|
import java.util.concurrent.ConcurrentMap;
|
||||||
|
|
||||||
public class LineTouchListener implements PacketListener {
|
public class LineClickListener implements PacketListener {
|
||||||
|
|
||||||
private final ConcurrentMap<Integer, BaseTouchableLine> linesByEntityID;
|
private final ConcurrentMap<Integer, BaseClickableLine> linesByEntityID;
|
||||||
|
|
||||||
// It is necessary to queue async touch events to process them from the main thread.
|
// It is necessary to queue async click events to process them from the main thread.
|
||||||
// Use a set to avoid duplicate touch events to the same line.
|
// Use a set to avoid duplicate click events to the same line.
|
||||||
private final Set<TouchEvent> queuedTouchEvents;
|
private final Set<ClickEvent> queuedClickEvents;
|
||||||
|
|
||||||
public LineTouchListener() {
|
public LineClickListener() {
|
||||||
linesByEntityID = new ConcurrentHashMap<>();
|
linesByEntityID = new ConcurrentHashMap<>();
|
||||||
queuedTouchEvents = new HashSet<>();
|
queuedClickEvents = new HashSet<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onAsyncEntityInteract(Player player, int entityID) {
|
public boolean onAsyncEntityInteract(Player player, int entityID) {
|
||||||
BaseTouchableLine line = linesByEntityID.get(entityID);
|
BaseClickableLine line = linesByEntityID.get(entityID);
|
||||||
if (line != null) {
|
if (line != null) {
|
||||||
queuedTouchEvents.add(new TouchEvent(player, line));
|
queuedClickEvents.add(new ClickEvent(player, line));
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void processQueuedTouchEvents() {
|
// This method is called from the main thread
|
||||||
for (TouchEvent touchEvent : queuedTouchEvents) {
|
public void processQueuedClickEvents() {
|
||||||
touchEvent.line.onTouch(touchEvent.player);
|
for (ClickEvent clickEvent : queuedClickEvents) {
|
||||||
|
clickEvent.line.onClick(clickEvent.player);
|
||||||
}
|
}
|
||||||
queuedTouchEvents.clear();
|
queuedClickEvents.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void registerLine(EntityID touchableEntityID, BaseTouchableLine line) {
|
public void registerLine(EntityID clickableEntityID, BaseClickableLine line) {
|
||||||
linesByEntityID.put(touchableEntityID.getNumericID(), line);
|
linesByEntityID.put(clickableEntityID.getNumericID(), line);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void unregisterLine(EntityID touchableEntityID) {
|
public void unregisterLine(EntityID clickableEntityID) {
|
||||||
if (touchableEntityID.hasInitializedNumericID()) {
|
if (clickableEntityID.hasInitializedNumericID()) {
|
||||||
linesByEntityID.remove(touchableEntityID.getNumericID());
|
linesByEntityID.remove(clickableEntityID.getNumericID());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private static class TouchEvent {
|
private static class ClickEvent {
|
||||||
|
|
||||||
private final Player player;
|
private final Player player;
|
||||||
private final BaseTouchableLine line;
|
private final BaseClickableLine line;
|
||||||
|
|
||||||
TouchEvent(Player player, BaseTouchableLine line) {
|
ClickEvent(Player player, BaseClickableLine line) {
|
||||||
this.player = player;
|
this.player = player;
|
||||||
this.line = line;
|
this.line = line;
|
||||||
}
|
}
|
||||||
@ -76,8 +77,7 @@ public class LineTouchListener implements PacketListener {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
TouchEvent other = (TouchEvent) obj;
|
ClickEvent other = (ClickEvent) obj;
|
||||||
|
|
||||||
return this.player.equals(other.player) && this.line.equals(other.line);
|
return this.player.equals(other.player) && this.line.equals(other.line);
|
||||||
}
|
}
|
||||||
|
|
@ -21,24 +21,24 @@ public class LineTrackerManager {
|
|||||||
|
|
||||||
private final NMSManager nmsManager;
|
private final NMSManager nmsManager;
|
||||||
private final PlaceholderTracker placeholderTracker;
|
private final PlaceholderTracker placeholderTracker;
|
||||||
private final LineTouchListener lineTouchListener;
|
private final LineClickListener lineClickListener;
|
||||||
private final Collection<LineTracker<?>> lineTrackers;
|
private final Collection<LineTracker<?>> lineTrackers;
|
||||||
|
|
||||||
public LineTrackerManager(NMSManager nmsManager, PlaceholderTracker placeholderTracker, LineTouchListener lineTouchListener) {
|
public LineTrackerManager(NMSManager nmsManager, PlaceholderTracker placeholderTracker, LineClickListener lineClickListener) {
|
||||||
this.nmsManager = nmsManager;
|
this.nmsManager = nmsManager;
|
||||||
this.placeholderTracker = placeholderTracker;
|
this.placeholderTracker = placeholderTracker;
|
||||||
this.lineTouchListener = lineTouchListener;
|
this.lineClickListener = lineClickListener;
|
||||||
this.lineTrackers = new LinkedList<>();
|
this.lineTrackers = new LinkedList<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public TextLineTracker startTracking(BaseTextLine line) {
|
public TextLineTracker startTracking(BaseTextLine line) {
|
||||||
TextLineTracker tracker = new TextLineTracker(line, nmsManager, lineTouchListener, placeholderTracker);
|
TextLineTracker tracker = new TextLineTracker(line, nmsManager, lineClickListener, placeholderTracker);
|
||||||
lineTrackers.add(tracker);
|
lineTrackers.add(tracker);
|
||||||
return tracker;
|
return tracker;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ItemLineTracker startTracking(BaseItemLine line) {
|
public ItemLineTracker startTracking(BaseItemLine line) {
|
||||||
ItemLineTracker tracker = new ItemLineTracker(line, nmsManager, lineTouchListener);
|
ItemLineTracker tracker = new ItemLineTracker(line, nmsManager, lineClickListener);
|
||||||
lineTrackers.add(tracker);
|
lineTrackers.add(tracker);
|
||||||
return tracker;
|
return tracker;
|
||||||
}
|
}
|
||||||
|
@ -14,7 +14,7 @@ import org.jetbrains.annotations.MustBeInvokedByOverriders;
|
|||||||
|
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
public class TextLineTracker extends TouchableLineTracker<BaseTextLine> {
|
public class TextLineTracker extends ClickableLineTracker<BaseTextLine> {
|
||||||
|
|
||||||
private final EntityID armorStandEntityID;
|
private final EntityID armorStandEntityID;
|
||||||
|
|
||||||
@ -25,9 +25,9 @@ public class TextLineTracker extends TouchableLineTracker<BaseTextLine> {
|
|||||||
public TextLineTracker(
|
public TextLineTracker(
|
||||||
BaseTextLine line,
|
BaseTextLine line,
|
||||||
NMSManager nmsManager,
|
NMSManager nmsManager,
|
||||||
LineTouchListener lineTouchListener,
|
LineClickListener lineClickListener,
|
||||||
PlaceholderTracker placeholderTracker) {
|
PlaceholderTracker placeholderTracker) {
|
||||||
super(line, nmsManager, lineTouchListener);
|
super(line, nmsManager, lineClickListener);
|
||||||
this.armorStandEntityID = nmsManager.newEntityID();
|
this.armorStandEntityID = nmsManager.newEntityID();
|
||||||
this.displayText = new DisplayText(placeholderTracker);
|
this.displayText = new DisplayText(placeholderTracker);
|
||||||
}
|
}
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
package me.filoghost.holographicdisplays.plugin.listener;
|
package me.filoghost.holographicdisplays.plugin.listener;
|
||||||
|
|
||||||
import me.filoghost.holographicdisplays.common.nms.NMSManager;
|
import me.filoghost.holographicdisplays.common.nms.NMSManager;
|
||||||
import me.filoghost.holographicdisplays.plugin.hologram.tracking.LineTouchListener;
|
import me.filoghost.holographicdisplays.plugin.hologram.tracking.LineClickListener;
|
||||||
import me.filoghost.holographicdisplays.plugin.hologram.tracking.LineTrackerManager;
|
import me.filoghost.holographicdisplays.plugin.hologram.tracking.LineTrackerManager;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
@ -18,18 +18,18 @@ public class PlayerListener implements Listener {
|
|||||||
|
|
||||||
private final NMSManager nmsManager;
|
private final NMSManager nmsManager;
|
||||||
private final LineTrackerManager lineTrackerManager;
|
private final LineTrackerManager lineTrackerManager;
|
||||||
private final LineTouchListener lineTouchListener;
|
private final LineClickListener lineClickListener;
|
||||||
|
|
||||||
public PlayerListener(NMSManager nmsManager, LineTrackerManager lineTrackerManager, LineTouchListener lineTouchListener) {
|
public PlayerListener(NMSManager nmsManager, LineTrackerManager lineTrackerManager, LineClickListener lineClickListener) {
|
||||||
this.nmsManager = nmsManager;
|
this.nmsManager = nmsManager;
|
||||||
this.lineTrackerManager = lineTrackerManager;
|
this.lineTrackerManager = lineTrackerManager;
|
||||||
this.lineTouchListener = lineTouchListener;
|
this.lineClickListener = lineClickListener;
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onPlayerJoin(PlayerJoinEvent event) {
|
public void onPlayerJoin(PlayerJoinEvent event) {
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
nmsManager.injectPacketListener(player, lineTouchListener);
|
nmsManager.injectPacketListener(player, lineClickListener);
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
|
@ -6,21 +6,21 @@
|
|||||||
package me.filoghost.holographicdisplays.plugin.placeholder;
|
package me.filoghost.holographicdisplays.plugin.placeholder;
|
||||||
|
|
||||||
import me.filoghost.fcommons.logging.Log;
|
import me.filoghost.fcommons.logging.Log;
|
||||||
import me.filoghost.holographicdisplays.plugin.hologram.tracking.LineTouchListener;
|
import me.filoghost.holographicdisplays.plugin.hologram.tracking.LineClickListener;
|
||||||
import me.filoghost.holographicdisplays.plugin.hologram.tracking.LineTrackerManager;
|
import me.filoghost.holographicdisplays.plugin.hologram.tracking.LineTrackerManager;
|
||||||
|
|
||||||
public class TickingTask implements Runnable {
|
public class TickingTask implements Runnable {
|
||||||
|
|
||||||
private final TickClock tickClock;
|
private final TickClock tickClock;
|
||||||
private final LineTrackerManager lineTrackerManager;
|
private final LineTrackerManager lineTrackerManager;
|
||||||
private final LineTouchListener lineTouchListener;
|
private final LineClickListener lineClickListener;
|
||||||
|
|
||||||
private long lastErrorLogTick;
|
private long lastErrorLogTick;
|
||||||
|
|
||||||
public TickingTask(TickClock tickClock, LineTrackerManager lineTrackerManager, LineTouchListener lineTouchListener) {
|
public TickingTask(TickClock tickClock, LineTrackerManager lineTrackerManager, LineClickListener lineClickListener) {
|
||||||
this.tickClock = tickClock;
|
this.tickClock = tickClock;
|
||||||
this.lineTrackerManager = lineTrackerManager;
|
this.lineTrackerManager = lineTrackerManager;
|
||||||
this.lineTouchListener = lineTouchListener;
|
this.lineClickListener = lineClickListener;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -38,7 +38,7 @@ public class TickingTask implements Runnable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
lineTouchListener.processQueuedTouchEvents();
|
lineClickListener.processQueuedClickEvents();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
package me.filoghost.holographicdisplays.plugin.test;
|
package me.filoghost.holographicdisplays.plugin.test;
|
||||||
|
|
||||||
import me.filoghost.holographicdisplays.plugin.hologram.api.APIHologramManager;
|
import me.filoghost.holographicdisplays.plugin.hologram.api.APIHologramManager;
|
||||||
import me.filoghost.holographicdisplays.plugin.hologram.tracking.LineTouchListener;
|
import me.filoghost.holographicdisplays.plugin.hologram.tracking.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.PlaceholderTracker;
|
||||||
|
|
||||||
@ -15,7 +15,7 @@ import static org.mockito.Mockito.*;
|
|||||||
public class TestAPIHologramManager extends APIHologramManager {
|
public class TestAPIHologramManager extends APIHologramManager {
|
||||||
|
|
||||||
public TestAPIHologramManager() {
|
public TestAPIHologramManager() {
|
||||||
super(new LineTrackerManager(new TestNMSManager(), mock(PlaceholderTracker.class), new LineTouchListener()));
|
super(new LineTrackerManager(new TestNMSManager(), mock(PlaceholderTracker.class), new LineClickListener()));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user