mirror of
https://github.com/filoghost/HolographicDisplays.git
synced 2025-01-19 22:31:21 +01:00
Small refactoring
This commit is contained in:
parent
f474684693
commit
6cc28cc957
@ -77,11 +77,11 @@ public class APIHologram extends BaseHologram<APIHologramLine> implements Hologr
|
||||
}
|
||||
|
||||
private APITextLine createTextLine(String text) {
|
||||
return new APITextLine(this, getNMSManager(), text);
|
||||
return new APITextLine(this, text);
|
||||
}
|
||||
|
||||
private APIItemLine createItemLine(ItemStack itemStack) {
|
||||
return new APIItemLine(this, getNMSManager(), itemStack);
|
||||
return new APIItemLine(this, itemStack);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -1,7 +1,6 @@
|
||||
package me.filoghost.holographicdisplays.object.api;
|
||||
|
||||
import me.filoghost.holographicdisplays.api.line.ItemLine;
|
||||
import me.filoghost.holographicdisplays.core.nms.NMSManager;
|
||||
import me.filoghost.holographicdisplays.object.base.BaseItemLine;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
@ -9,8 +8,8 @@ public class APIItemLine extends BaseItemLine implements ItemLine, APIHologramLi
|
||||
|
||||
private final APIHologram parent;
|
||||
|
||||
public APIItemLine(APIHologram parent, NMSManager nmsManager, ItemStack itemStack) {
|
||||
super(parent, nmsManager, itemStack);
|
||||
public APIItemLine(APIHologram parent, ItemStack itemStack) {
|
||||
super(parent, itemStack);
|
||||
this.parent = parent;
|
||||
}
|
||||
|
||||
|
@ -1,15 +1,14 @@
|
||||
package me.filoghost.holographicdisplays.object.api;
|
||||
|
||||
import me.filoghost.holographicdisplays.api.line.TextLine;
|
||||
import me.filoghost.holographicdisplays.core.nms.NMSManager;
|
||||
import me.filoghost.holographicdisplays.object.base.BaseTextLine;
|
||||
|
||||
public class APITextLine extends BaseTextLine implements TextLine, APIHologramLine {
|
||||
|
||||
private final APIHologram parent;
|
||||
|
||||
public APITextLine(APIHologram parent, NMSManager nmsManager, String text) {
|
||||
super(parent, nmsManager, text);
|
||||
public APITextLine(APIHologram parent, String text) {
|
||||
super(parent, text);
|
||||
this.parent = parent;
|
||||
}
|
||||
|
||||
|
@ -15,15 +15,13 @@ import org.bukkit.World;
|
||||
|
||||
public abstract class BaseHologramLine extends BaseHologramComponent implements StandardHologramLine {
|
||||
|
||||
private final StandardHologram hologram;
|
||||
private final NMSManager nmsManager;
|
||||
private final BaseHologram<?> hologram;
|
||||
|
||||
private boolean isSpawned;
|
||||
|
||||
protected BaseHologramLine(StandardHologram hologram, NMSManager nmsManager) {
|
||||
protected BaseHologramLine(BaseHologram<?> hologram) {
|
||||
Preconditions.notNull(hologram, "parent hologram");
|
||||
this.hologram = hologram;
|
||||
this.nmsManager = nmsManager;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -32,7 +30,7 @@ public abstract class BaseHologramLine extends BaseHologramComponent implements
|
||||
}
|
||||
|
||||
protected final NMSManager getNMSManager() {
|
||||
return nmsManager;
|
||||
return hologram.getNMSManager();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -8,9 +8,7 @@ package me.filoghost.holographicdisplays.object.base;
|
||||
import me.filoghost.fcommons.Preconditions;
|
||||
import me.filoghost.fcommons.logging.Log;
|
||||
import me.filoghost.holographicdisplays.api.handler.PickupHandler;
|
||||
import me.filoghost.holographicdisplays.core.hologram.StandardHologram;
|
||||
import me.filoghost.holographicdisplays.core.hologram.StandardItemLine;
|
||||
import me.filoghost.holographicdisplays.core.nms.NMSManager;
|
||||
import me.filoghost.holographicdisplays.core.nms.SpawnFailedException;
|
||||
import me.filoghost.holographicdisplays.core.nms.entity.NMSArmorStand;
|
||||
import me.filoghost.holographicdisplays.core.nms.entity.NMSItem;
|
||||
@ -28,8 +26,8 @@ public abstract class BaseItemLine extends BaseTouchableLine implements Standard
|
||||
private NMSArmorStand itemVehicleEntity;
|
||||
private PickupHandler pickupHandler;
|
||||
|
||||
public BaseItemLine(StandardHologram hologram, NMSManager nmsManager, ItemStack itemStack) {
|
||||
super(hologram, nmsManager);
|
||||
public BaseItemLine(BaseHologram<?> hologram, ItemStack itemStack) {
|
||||
super(hologram);
|
||||
setItemStack(itemStack);
|
||||
}
|
||||
|
||||
|
@ -5,9 +5,7 @@
|
||||
*/
|
||||
package me.filoghost.holographicdisplays.object.base;
|
||||
|
||||
import me.filoghost.holographicdisplays.core.hologram.StandardHologram;
|
||||
import me.filoghost.holographicdisplays.core.hologram.StandardTextLine;
|
||||
import me.filoghost.holographicdisplays.core.nms.NMSManager;
|
||||
import me.filoghost.holographicdisplays.core.nms.SpawnFailedException;
|
||||
import me.filoghost.holographicdisplays.core.nms.entity.NMSArmorStand;
|
||||
import me.filoghost.holographicdisplays.core.placeholder.RelativePlaceholder;
|
||||
@ -23,8 +21,8 @@ public abstract class BaseTextLine extends BaseTouchableLine implements Standard
|
||||
private String text;
|
||||
private NMSArmorStand textEntity;
|
||||
|
||||
public BaseTextLine(StandardHologram hologram, NMSManager nmsManager, String text) {
|
||||
super(hologram, nmsManager);
|
||||
public BaseTextLine(BaseHologram<?> hologram, String text) {
|
||||
super(hologram);
|
||||
this.relativePlaceholders = new ArrayList<>();
|
||||
setText(text);
|
||||
}
|
||||
|
@ -8,9 +8,7 @@ package me.filoghost.holographicdisplays.object.base;
|
||||
import me.filoghost.fcommons.logging.Log;
|
||||
import me.filoghost.holographicdisplays.api.handler.TouchHandler;
|
||||
import me.filoghost.holographicdisplays.core.DebugLogger;
|
||||
import me.filoghost.holographicdisplays.core.hologram.StandardHologram;
|
||||
import me.filoghost.holographicdisplays.core.hologram.StandardTouchableLine;
|
||||
import me.filoghost.holographicdisplays.core.nms.NMSManager;
|
||||
import me.filoghost.holographicdisplays.core.nms.SpawnFailedException;
|
||||
import me.filoghost.holographicdisplays.core.nms.entity.NMSArmorStand;
|
||||
import me.filoghost.holographicdisplays.core.nms.entity.NMSSlime;
|
||||
@ -37,8 +35,8 @@ public abstract class BaseTouchableLine extends BaseHologramLine implements Stan
|
||||
private NMSArmorStand slimeVehicleEntity;
|
||||
|
||||
|
||||
protected BaseTouchableLine(StandardHologram hologram, NMSManager nmsManager) {
|
||||
super(hologram, nmsManager);
|
||||
protected BaseTouchableLine(BaseHologram<?> hologram) {
|
||||
super(hologram);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -23,11 +23,11 @@ public class InternalHologram extends BaseHologram<InternalHologramLine> {
|
||||
}
|
||||
|
||||
public InternalTextLine createTextLine(String text, String serializedConfigValue) {
|
||||
return new InternalTextLine(this, getNMSManager(), text, serializedConfigValue);
|
||||
return new InternalTextLine(this, text, serializedConfigValue);
|
||||
}
|
||||
|
||||
public InternalItemLine createItemLine(ItemStack icon, String serializedConfigValue) {
|
||||
return new InternalItemLine(this, getNMSManager(), icon, serializedConfigValue);
|
||||
return new InternalItemLine(this, icon, serializedConfigValue);
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
|
@ -5,8 +5,6 @@
|
||||
*/
|
||||
package me.filoghost.holographicdisplays.object.internal;
|
||||
|
||||
import me.filoghost.holographicdisplays.core.hologram.StandardHologram;
|
||||
import me.filoghost.holographicdisplays.core.nms.NMSManager;
|
||||
import me.filoghost.holographicdisplays.object.base.BaseItemLine;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
@ -14,8 +12,8 @@ public class InternalItemLine extends BaseItemLine implements InternalHologramLi
|
||||
|
||||
private final String serializedConfigValue;
|
||||
|
||||
protected InternalItemLine(StandardHologram hologram, NMSManager nmsManager, ItemStack itemStack, String serializedConfigValue) {
|
||||
super(hologram, nmsManager, itemStack);
|
||||
protected InternalItemLine(InternalHologram hologram, ItemStack itemStack, String serializedConfigValue) {
|
||||
super(hologram, itemStack);
|
||||
this.serializedConfigValue = serializedConfigValue;
|
||||
}
|
||||
|
||||
|
@ -5,16 +5,14 @@
|
||||
*/
|
||||
package me.filoghost.holographicdisplays.object.internal;
|
||||
|
||||
import me.filoghost.holographicdisplays.core.hologram.StandardHologram;
|
||||
import me.filoghost.holographicdisplays.core.nms.NMSManager;
|
||||
import me.filoghost.holographicdisplays.object.base.BaseTextLine;
|
||||
|
||||
public class InternalTextLine extends BaseTextLine implements InternalHologramLine {
|
||||
|
||||
private final String serializedConfigValue;
|
||||
|
||||
protected InternalTextLine(StandardHologram hologram, NMSManager nmsManager, String text, String serializedConfigValue) {
|
||||
super(hologram, nmsManager, text);
|
||||
protected InternalTextLine(InternalHologram hologram, String text, String serializedConfigValue) {
|
||||
super(hologram, text);
|
||||
this.serializedConfigValue = serializedConfigValue;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user