mirror of
https://github.com/filoghost/HolographicDisplays.git
synced 2025-01-04 15:17:50 +01:00
Rename subclasses
This commit is contained in:
parent
ed803fc4f6
commit
2ddb972128
@ -10,11 +10,11 @@ import com.gmail.filoghost.holographicdisplays.api.handler.TouchHandler;
|
|||||||
import com.gmail.filoghost.holographicdisplays.api.line.ItemLine;
|
import com.gmail.filoghost.holographicdisplays.api.line.ItemLine;
|
||||||
import me.filoghost.holographicdisplays.api.hologram.line.ClickListener;
|
import me.filoghost.holographicdisplays.api.hologram.line.ClickListener;
|
||||||
import me.filoghost.holographicdisplays.api.hologram.line.PickupListener;
|
import me.filoghost.holographicdisplays.api.hologram.line.PickupListener;
|
||||||
import me.filoghost.holographicdisplays.plugin.hologram.base.BaseItemLine;
|
import me.filoghost.holographicdisplays.plugin.hologram.base.BaseItemHologramLine;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
public class V2ItemLine extends BaseItemLine implements ItemLine, V2HologramLine {
|
public class V2ItemLine extends BaseItemHologramLine implements ItemLine, V2HologramLine {
|
||||||
|
|
||||||
private final V2Hologram parent;
|
private final V2Hologram parent;
|
||||||
|
|
||||||
|
@ -8,10 +8,10 @@ package me.filoghost.holographicdisplays.plugin.api.v2;
|
|||||||
import com.gmail.filoghost.holographicdisplays.api.handler.TouchHandler;
|
import com.gmail.filoghost.holographicdisplays.api.handler.TouchHandler;
|
||||||
import com.gmail.filoghost.holographicdisplays.api.line.TextLine;
|
import com.gmail.filoghost.holographicdisplays.api.line.TextLine;
|
||||||
import me.filoghost.holographicdisplays.api.hologram.line.ClickListener;
|
import me.filoghost.holographicdisplays.api.hologram.line.ClickListener;
|
||||||
import me.filoghost.holographicdisplays.plugin.hologram.base.BaseTextLine;
|
import me.filoghost.holographicdisplays.plugin.hologram.base.BaseTextHologramLine;
|
||||||
|
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
public class V2TextLine extends BaseTextLine implements TextLine, V2HologramLine {
|
public class V2TextLine extends BaseTextHologramLine implements TextLine, V2HologramLine {
|
||||||
|
|
||||||
private final V2Hologram parent;
|
private final V2Hologram parent;
|
||||||
|
|
||||||
|
@ -16,7 +16,7 @@ import me.filoghost.holographicdisplays.plugin.event.InternalHologramChangeEvent
|
|||||||
import me.filoghost.holographicdisplays.plugin.format.ColorScheme;
|
import me.filoghost.holographicdisplays.plugin.format.ColorScheme;
|
||||||
import me.filoghost.holographicdisplays.plugin.format.DisplayFormat;
|
import me.filoghost.holographicdisplays.plugin.format.DisplayFormat;
|
||||||
import me.filoghost.holographicdisplays.plugin.hologram.internal.InternalHologram;
|
import me.filoghost.holographicdisplays.plugin.hologram.internal.InternalHologram;
|
||||||
import me.filoghost.holographicdisplays.plugin.hologram.internal.InternalTextLine;
|
import me.filoghost.holographicdisplays.plugin.hologram.internal.InternalTextHologramLine;
|
||||||
import me.filoghost.holographicdisplays.plugin.image.ImageMessage;
|
import me.filoghost.holographicdisplays.plugin.image.ImageMessage;
|
||||||
import me.filoghost.holographicdisplays.plugin.image.ImageReadException;
|
import me.filoghost.holographicdisplays.plugin.image.ImageReadException;
|
||||||
import me.filoghost.holographicdisplays.plugin.image.ImageReader;
|
import me.filoghost.holographicdisplays.plugin.image.ImageReader;
|
||||||
@ -103,7 +103,7 @@ public class ReadImageCommand extends LineEditingCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ImageMessage imageMessage = new ImageMessage(image, width);
|
ImageMessage imageMessage = new ImageMessage(image, width);
|
||||||
List<InternalTextLine> newLines = new ArrayList<>();
|
List<InternalTextHologramLine> newLines = new ArrayList<>();
|
||||||
for (String newLine : imageMessage.getLines()) {
|
for (String newLine : imageMessage.getLines()) {
|
||||||
newLines.add(hologram.createTextLine(newLine, Colors.uncolorize(newLine)));
|
newLines.add(hologram.createTextLine(newLine, Colors.uncolorize(newLine)));
|
||||||
}
|
}
|
||||||
|
@ -7,6 +7,6 @@ package me.filoghost.holographicdisplays.plugin.hologram.api;
|
|||||||
|
|
||||||
import me.filoghost.holographicdisplays.api.hologram.line.ClickableHologramLine;
|
import me.filoghost.holographicdisplays.api.hologram.line.ClickableHologramLine;
|
||||||
|
|
||||||
public interface APIClickableLine extends ClickableHologramLine, APIHologramLine {
|
public interface APIClickableHologramLine extends ClickableHologramLine, APIHologramLine {
|
||||||
|
|
||||||
}
|
}
|
@ -28,7 +28,7 @@ public class APIHologramLines extends BaseHologramLines<APIHologramLine> impleme
|
|||||||
public @NotNull TextHologramLine appendText(@Nullable String text) {
|
public @NotNull TextHologramLine appendText(@Nullable String text) {
|
||||||
checkNotDeleted();
|
checkNotDeleted();
|
||||||
|
|
||||||
APITextLine line = new APITextLine(hologram, text);
|
APITextHologramLine line = new APITextHologramLine(hologram, text);
|
||||||
super.add(line);
|
super.add(line);
|
||||||
return line;
|
return line;
|
||||||
}
|
}
|
||||||
@ -38,7 +38,7 @@ public class APIHologramLines extends BaseHologramLines<APIHologramLine> impleme
|
|||||||
Preconditions.notNull(itemStack, "itemStack");
|
Preconditions.notNull(itemStack, "itemStack");
|
||||||
checkNotDeleted();
|
checkNotDeleted();
|
||||||
|
|
||||||
APIItemLine line = new APIItemLine(hologram, itemStack);
|
APIItemHologramLine line = new APIItemHologramLine(hologram, itemStack);
|
||||||
super.add(line);
|
super.add(line);
|
||||||
return line;
|
return line;
|
||||||
}
|
}
|
||||||
@ -47,7 +47,7 @@ public class APIHologramLines extends BaseHologramLines<APIHologramLine> impleme
|
|||||||
public @NotNull TextHologramLine insertText(int beforeIndex, @Nullable String text) {
|
public @NotNull TextHologramLine insertText(int beforeIndex, @Nullable String text) {
|
||||||
checkNotDeleted();
|
checkNotDeleted();
|
||||||
|
|
||||||
APITextLine line = new APITextLine(hologram, text);
|
APITextHologramLine line = new APITextHologramLine(hologram, text);
|
||||||
super.insert(beforeIndex, line);
|
super.insert(beforeIndex, line);
|
||||||
return line;
|
return line;
|
||||||
}
|
}
|
||||||
@ -57,7 +57,7 @@ public class APIHologramLines extends BaseHologramLines<APIHologramLine> impleme
|
|||||||
Preconditions.notNull(itemStack, "itemStack");
|
Preconditions.notNull(itemStack, "itemStack");
|
||||||
checkNotDeleted();
|
checkNotDeleted();
|
||||||
|
|
||||||
APIItemLine line = new APIItemLine(hologram, itemStack);
|
APIItemHologramLine line = new APIItemHologramLine(hologram, itemStack);
|
||||||
super.insert(beforeIndex, line);
|
super.insert(beforeIndex, line);
|
||||||
return line;
|
return line;
|
||||||
}
|
}
|
||||||
|
@ -6,12 +6,12 @@
|
|||||||
package me.filoghost.holographicdisplays.plugin.hologram.api;
|
package me.filoghost.holographicdisplays.plugin.hologram.api;
|
||||||
|
|
||||||
import me.filoghost.holographicdisplays.api.hologram.line.ItemHologramLine;
|
import me.filoghost.holographicdisplays.api.hologram.line.ItemHologramLine;
|
||||||
import me.filoghost.holographicdisplays.plugin.hologram.base.BaseItemLine;
|
import me.filoghost.holographicdisplays.plugin.hologram.base.BaseItemHologramLine;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
public class APIItemLine extends BaseItemLine implements ItemHologramLine, APIClickableLine {
|
public class APIItemHologramLine extends BaseItemHologramLine implements ItemHologramLine, APIClickableHologramLine {
|
||||||
|
|
||||||
public APIItemLine(APIHologram parent, ItemStack itemStack) {
|
public APIItemHologramLine(APIHologram parent, ItemStack itemStack) {
|
||||||
super(parent, itemStack);
|
super(parent, itemStack);
|
||||||
}
|
}
|
||||||
|
|
@ -6,13 +6,13 @@
|
|||||||
package me.filoghost.holographicdisplays.plugin.hologram.api;
|
package me.filoghost.holographicdisplays.plugin.hologram.api;
|
||||||
|
|
||||||
import me.filoghost.holographicdisplays.api.hologram.line.TextHologramLine;
|
import me.filoghost.holographicdisplays.api.hologram.line.TextHologramLine;
|
||||||
import me.filoghost.holographicdisplays.plugin.hologram.base.BaseTextLine;
|
import me.filoghost.holographicdisplays.plugin.hologram.base.BaseTextHologramLine;
|
||||||
|
|
||||||
public class APITextLine extends BaseTextLine implements TextHologramLine, APIClickableLine {
|
public class APITextHologramLine extends BaseTextHologramLine implements TextHologramLine, APIClickableHologramLine {
|
||||||
|
|
||||||
private final APIHologram parent;
|
private final APIHologram parent;
|
||||||
|
|
||||||
public APITextLine(APIHologram parent, String text) {
|
public APITextHologramLine(APIHologram parent, String text) {
|
||||||
super(parent, text);
|
super(parent, text);
|
||||||
this.parent = parent;
|
this.parent = parent;
|
||||||
}
|
}
|
@ -13,11 +13,11 @@ import org.bukkit.entity.Player;
|
|||||||
import org.jetbrains.annotations.MustBeInvokedByOverriders;
|
import org.jetbrains.annotations.MustBeInvokedByOverriders;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
public abstract class BaseClickableLine extends BaseHologramLine {
|
public abstract class BaseClickableHologramLine extends BaseHologramLine {
|
||||||
|
|
||||||
private ClickListener clickListener;
|
private ClickListener clickListener;
|
||||||
|
|
||||||
protected BaseClickableLine(BaseHologram hologram) {
|
protected BaseClickableHologramLine(BaseHologram hologram) {
|
||||||
super(hologram);
|
super(hologram);
|
||||||
}
|
}
|
||||||
|
|
@ -16,12 +16,12 @@ 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 BaseClickableLine {
|
public abstract class BaseItemHologramLine extends BaseClickableHologramLine {
|
||||||
|
|
||||||
private ItemStack itemStack;
|
private ItemStack itemStack;
|
||||||
private PickupListener pickupListener;
|
private PickupListener pickupListener;
|
||||||
|
|
||||||
public BaseItemLine(BaseHologram hologram, ItemStack itemStack) {
|
public BaseItemHologramLine(BaseHologram hologram, ItemStack itemStack) {
|
||||||
super(hologram);
|
super(hologram);
|
||||||
setItemStack(itemStack);
|
setItemStack(itemStack);
|
||||||
}
|
}
|
@ -10,11 +10,11 @@ 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 BaseClickableLine {
|
public abstract class BaseTextHologramLine extends BaseClickableHologramLine {
|
||||||
|
|
||||||
private String text;
|
private String text;
|
||||||
|
|
||||||
public BaseTextLine(BaseHologram hologram, String text) {
|
public BaseTextHologramLine(BaseHologram hologram, String text) {
|
||||||
super(hologram);
|
super(hologram);
|
||||||
setText(text);
|
setText(text);
|
||||||
}
|
}
|
@ -30,12 +30,12 @@ public class InternalHologram extends BaseHologram {
|
|||||||
return lines;
|
return lines;
|
||||||
}
|
}
|
||||||
|
|
||||||
public InternalTextLine createTextLine(String text, String serializedConfigValue) {
|
public InternalTextHologramLine createTextLine(String text, String serializedConfigValue) {
|
||||||
return new InternalTextLine(this, text, serializedConfigValue);
|
return new InternalTextHologramLine(this, text, serializedConfigValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
public InternalItemLine createItemLine(ItemStack icon, String serializedConfigValue) {
|
public InternalItemHologramLine createItemLine(ItemStack icon, String serializedConfigValue) {
|
||||||
return new InternalItemLine(this, icon, serializedConfigValue);
|
return new InternalItemHologramLine(this, icon, serializedConfigValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getName() {
|
public String getName() {
|
||||||
|
@ -5,14 +5,14 @@
|
|||||||
*/
|
*/
|
||||||
package me.filoghost.holographicdisplays.plugin.hologram.internal;
|
package me.filoghost.holographicdisplays.plugin.hologram.internal;
|
||||||
|
|
||||||
import me.filoghost.holographicdisplays.plugin.hologram.base.BaseItemLine;
|
import me.filoghost.holographicdisplays.plugin.hologram.base.BaseItemHologramLine;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
public class InternalItemLine extends BaseItemLine implements InternalHologramLine {
|
public class InternalItemHologramLine extends BaseItemHologramLine implements InternalHologramLine {
|
||||||
|
|
||||||
private final String serializedConfigValue;
|
private final String serializedConfigValue;
|
||||||
|
|
||||||
protected InternalItemLine(InternalHologram hologram, ItemStack itemStack, String serializedConfigValue) {
|
protected InternalItemHologramLine(InternalHologram hologram, ItemStack itemStack, String serializedConfigValue) {
|
||||||
super(hologram, itemStack);
|
super(hologram, itemStack);
|
||||||
this.serializedConfigValue = serializedConfigValue;
|
this.serializedConfigValue = serializedConfigValue;
|
||||||
}
|
}
|
@ -5,13 +5,13 @@
|
|||||||
*/
|
*/
|
||||||
package me.filoghost.holographicdisplays.plugin.hologram.internal;
|
package me.filoghost.holographicdisplays.plugin.hologram.internal;
|
||||||
|
|
||||||
import me.filoghost.holographicdisplays.plugin.hologram.base.BaseTextLine;
|
import me.filoghost.holographicdisplays.plugin.hologram.base.BaseTextHologramLine;
|
||||||
|
|
||||||
public class InternalTextLine extends BaseTextLine implements InternalHologramLine {
|
public class InternalTextHologramLine extends BaseTextHologramLine implements InternalHologramLine {
|
||||||
|
|
||||||
private final String serializedConfigValue;
|
private final String serializedConfigValue;
|
||||||
|
|
||||||
protected InternalTextLine(InternalHologram hologram, String text, String serializedConfigValue) {
|
protected InternalTextHologramLine(InternalHologram hologram, String text, String serializedConfigValue) {
|
||||||
super(hologram, text);
|
super(hologram, text);
|
||||||
this.serializedConfigValue = serializedConfigValue;
|
this.serializedConfigValue = serializedConfigValue;
|
||||||
}
|
}
|
@ -9,11 +9,11 @@ import me.filoghost.holographicdisplays.common.Position;
|
|||||||
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.common.nms.entity.ClickableNMSPacketEntity;
|
import me.filoghost.holographicdisplays.common.nms.entity.ClickableNMSPacketEntity;
|
||||||
import me.filoghost.holographicdisplays.plugin.hologram.base.BaseClickableLine;
|
import me.filoghost.holographicdisplays.plugin.hologram.base.BaseClickableHologramLine;
|
||||||
import me.filoghost.holographicdisplays.plugin.listener.LineClickListener;
|
import me.filoghost.holographicdisplays.plugin.listener.LineClickListener;
|
||||||
import org.jetbrains.annotations.MustBeInvokedByOverriders;
|
import org.jetbrains.annotations.MustBeInvokedByOverriders;
|
||||||
|
|
||||||
public abstract class ClickableLineTracker<T extends BaseClickableLine> extends PositionBasedLineTracker<T> {
|
public abstract class ClickableLineTracker<T extends BaseClickableHologramLine> extends PositionBasedLineTracker<T> {
|
||||||
|
|
||||||
private final ClickableNMSPacketEntity clickableEntity;
|
private final ClickableNMSPacketEntity clickableEntity;
|
||||||
private final double positionOffsetY;
|
private final double positionOffsetY;
|
||||||
|
@ -8,7 +8,7 @@ package me.filoghost.holographicdisplays.plugin.hologram.tracking;
|
|||||||
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.common.nms.entity.ItemNMSPacketEntity;
|
import me.filoghost.holographicdisplays.common.nms.entity.ItemNMSPacketEntity;
|
||||||
import me.filoghost.holographicdisplays.plugin.hologram.base.BaseItemLine;
|
import me.filoghost.holographicdisplays.plugin.hologram.base.BaseItemHologramLine;
|
||||||
import me.filoghost.holographicdisplays.plugin.listener.LineClickListener;
|
import me.filoghost.holographicdisplays.plugin.listener.LineClickListener;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
@ -17,7 +17,7 @@ import org.jetbrains.annotations.MustBeInvokedByOverriders;
|
|||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
public class ItemLineTracker extends ClickableLineTracker<BaseItemLine> {
|
public class ItemLineTracker extends ClickableLineTracker<BaseItemHologramLine> {
|
||||||
|
|
||||||
private final ItemNMSPacketEntity itemEntity;
|
private final ItemNMSPacketEntity itemEntity;
|
||||||
|
|
||||||
@ -27,7 +27,7 @@ public class ItemLineTracker extends ClickableLineTracker<BaseItemLine> {
|
|||||||
private boolean spawnItemEntity;
|
private boolean spawnItemEntity;
|
||||||
private boolean spawnItemEntityChanged;
|
private boolean spawnItemEntityChanged;
|
||||||
|
|
||||||
public ItemLineTracker(BaseItemLine line, NMSManager nmsManager, LineClickListener lineClickListener) {
|
public ItemLineTracker(BaseItemHologramLine line, NMSManager nmsManager, LineClickListener lineClickListener) {
|
||||||
super(line, nmsManager, lineClickListener);
|
super(line, nmsManager, lineClickListener);
|
||||||
this.itemEntity = nmsManager.newItemPacketEntity();
|
this.itemEntity = nmsManager.newItemPacketEntity();
|
||||||
}
|
}
|
||||||
|
@ -6,8 +6,8 @@
|
|||||||
package me.filoghost.holographicdisplays.plugin.hologram.tracking;
|
package me.filoghost.holographicdisplays.plugin.hologram.tracking;
|
||||||
|
|
||||||
import me.filoghost.holographicdisplays.common.nms.NMSManager;
|
import me.filoghost.holographicdisplays.common.nms.NMSManager;
|
||||||
import me.filoghost.holographicdisplays.plugin.hologram.base.BaseItemLine;
|
import me.filoghost.holographicdisplays.plugin.hologram.base.BaseItemHologramLine;
|
||||||
import me.filoghost.holographicdisplays.plugin.hologram.base.BaseTextLine;
|
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.PlaceholderTracker;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
@ -31,13 +31,13 @@ public class LineTrackerManager {
|
|||||||
this.lineTrackers = new LinkedList<>();
|
this.lineTrackers = new LinkedList<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public TextLineTracker startTracking(BaseTextLine line) {
|
public TextLineTracker startTracking(BaseTextHologramLine line) {
|
||||||
TextLineTracker tracker = new TextLineTracker(line, nmsManager, lineClickListener, 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(BaseItemHologramLine line) {
|
||||||
ItemLineTracker tracker = new ItemLineTracker(line, nmsManager, lineClickListener);
|
ItemLineTracker tracker = new ItemLineTracker(line, nmsManager, lineClickListener);
|
||||||
lineTrackers.add(tracker);
|
lineTrackers.add(tracker);
|
||||||
return tracker;
|
return tracker;
|
||||||
|
@ -8,14 +8,14 @@ package me.filoghost.holographicdisplays.plugin.hologram.tracking;
|
|||||||
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.common.nms.entity.TextNMSPacketEntity;
|
import me.filoghost.holographicdisplays.common.nms.entity.TextNMSPacketEntity;
|
||||||
import me.filoghost.holographicdisplays.plugin.hologram.base.BaseTextLine;
|
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.PlaceholderTracker;
|
||||||
import org.jetbrains.annotations.MustBeInvokedByOverriders;
|
import org.jetbrains.annotations.MustBeInvokedByOverriders;
|
||||||
|
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
public class TextLineTracker extends ClickableLineTracker<BaseTextLine> {
|
public class TextLineTracker extends ClickableLineTracker<BaseTextHologramLine> {
|
||||||
|
|
||||||
private final TextNMSPacketEntity textEntity;
|
private final TextNMSPacketEntity textEntity;
|
||||||
|
|
||||||
@ -24,7 +24,7 @@ public class TextLineTracker extends ClickableLineTracker<BaseTextLine> {
|
|||||||
private boolean allowPlaceholders;
|
private boolean allowPlaceholders;
|
||||||
|
|
||||||
public TextLineTracker(
|
public TextLineTracker(
|
||||||
BaseTextLine line,
|
BaseTextHologramLine line,
|
||||||
NMSManager nmsManager,
|
NMSManager nmsManager,
|
||||||
LineClickListener lineClickListener,
|
LineClickListener lineClickListener,
|
||||||
PlaceholderTracker placeholderTracker) {
|
PlaceholderTracker placeholderTracker) {
|
||||||
|
@ -7,7 +7,7 @@ package me.filoghost.holographicdisplays.plugin.listener;
|
|||||||
|
|
||||||
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.BaseClickableLine;
|
import me.filoghost.holographicdisplays.plugin.hologram.base.BaseClickableHologramLine;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
@ -17,7 +17,7 @@ import java.util.concurrent.ConcurrentMap;
|
|||||||
|
|
||||||
public class LineClickListener implements PacketListener {
|
public class LineClickListener implements PacketListener {
|
||||||
|
|
||||||
private final ConcurrentMap<Integer, BaseClickableLine> linesByEntityID;
|
private final ConcurrentMap<Integer, BaseClickableHologramLine> linesByEntityID;
|
||||||
|
|
||||||
// It is necessary to queue async click 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 click events to the same line.
|
// Use a set to avoid duplicate click events to the same line.
|
||||||
@ -30,7 +30,7 @@ public class LineClickListener implements PacketListener {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onAsyncEntityInteract(Player player, int entityID) {
|
public boolean onAsyncEntityInteract(Player player, int entityID) {
|
||||||
BaseClickableLine line = linesByEntityID.get(entityID);
|
BaseClickableHologramLine line = linesByEntityID.get(entityID);
|
||||||
if (line != null) {
|
if (line != null) {
|
||||||
queuedClickEvents.add(new ClickEvent(player, line));
|
queuedClickEvents.add(new ClickEvent(player, line));
|
||||||
return true;
|
return true;
|
||||||
@ -47,7 +47,7 @@ public class LineClickListener implements PacketListener {
|
|||||||
queuedClickEvents.clear();
|
queuedClickEvents.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void registerLine(EntityID clickableEntityID, BaseClickableLine line) {
|
public void registerLine(EntityID clickableEntityID, BaseClickableHologramLine line) {
|
||||||
linesByEntityID.put(clickableEntityID.getNumericID(), line);
|
linesByEntityID.put(clickableEntityID.getNumericID(), line);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -61,9 +61,9 @@ public class LineClickListener implements PacketListener {
|
|||||||
private static class ClickEvent {
|
private static class ClickEvent {
|
||||||
|
|
||||||
private final Player player;
|
private final Player player;
|
||||||
private final BaseClickableLine line;
|
private final BaseClickableHologramLine line;
|
||||||
|
|
||||||
ClickEvent(Player player, BaseClickableLine line) {
|
ClickEvent(Player player, BaseClickableHologramLine line) {
|
||||||
this.player = player;
|
this.player = player;
|
||||||
this.line = line;
|
this.line = line;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user