mirror of
https://github.com/filoghost/HolographicDisplays.git
synced 2024-11-18 16:35:13 +01:00
Refactoring
This commit is contained in:
parent
438dcfb1dc
commit
55643651c9
@ -6,15 +6,16 @@
|
||||
package me.filoghost.holographicdisplays.common.hologram;
|
||||
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public interface StandardHologramLine extends StandardHologramComponent {
|
||||
|
||||
StandardHologram getHologram();
|
||||
|
||||
void setLocation(World world, double x, double y, double z);
|
||||
|
||||
double getHeight();
|
||||
|
||||
void setChanged();
|
||||
|
||||
boolean isVisibleTo(Player player);
|
||||
|
||||
}
|
||||
|
@ -107,6 +107,14 @@ public abstract class BaseHologram<T extends StandardHologramLine> extends BaseH
|
||||
// No need to refresh, since there are no lines
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void setDeleted() {
|
||||
super.setDeleted();
|
||||
for (T line : lines) {
|
||||
line.setDeleted();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getLineCount() {
|
||||
return lines.size();
|
||||
|
@ -78,8 +78,9 @@ public abstract class BaseHologramComponent implements StandardHologramComponent
|
||||
return deleted;
|
||||
}
|
||||
|
||||
@MustBeInvokedByOverriders
|
||||
@Override
|
||||
public final void setDeleted() {
|
||||
public void setDeleted() {
|
||||
deleted = true;
|
||||
}
|
||||
|
||||
|
@ -26,8 +26,7 @@ public abstract class BaseHologramLine extends BaseHologramComponent implements
|
||||
|
||||
protected abstract LineTracker<?> createTracker(LineTrackerManager trackerManager);
|
||||
|
||||
@Override
|
||||
public final StandardHologram getHologram() {
|
||||
protected final StandardHologram getHologram() {
|
||||
return hologram;
|
||||
}
|
||||
|
||||
@ -46,4 +45,9 @@ public abstract class BaseHologramLine extends BaseHologramComponent implements
|
||||
setChanged();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isVisibleTo(Player player) {
|
||||
return hologram.isVisibleTo(player);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -33,7 +33,7 @@ public abstract class BaseItemLine extends BaseTouchableLine implements Standard
|
||||
|
||||
@Override
|
||||
public void onPickup(Player player) {
|
||||
if (pickupHandler == null || !getHologram().isVisibleTo(player)) {
|
||||
if (pickupHandler == null || !isVisibleTo(player)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -37,7 +37,7 @@ public abstract class BaseTouchableLine extends BaseHologramLine implements Stan
|
||||
|| !isTrackedPlayer(player)
|
||||
|| player.getGameMode() == GameMode.SPECTATOR
|
||||
|| touchHandler == null
|
||||
|| !getHologram().isVisibleTo(player)) {
|
||||
|| !isVisibleTo(player)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -103,7 +103,7 @@ public abstract class LineTracker<T extends StandardHologramLine> {
|
||||
}
|
||||
|
||||
final boolean shouldBeRemoved() {
|
||||
return line.isDeleted() || line.getHologram().isDeleted();
|
||||
return line.isDeleted();
|
||||
}
|
||||
|
||||
@MustBeInvokedByOverriders
|
||||
|
@ -76,7 +76,7 @@ abstract class LocationBasedLineTracker<T extends StandardHologramLine> extends
|
||||
return playerLocation.getWorld() == world
|
||||
&& diffX <= (double) ENTITY_VIEW_RANGE
|
||||
&& diffZ <= (double) ENTITY_VIEW_RANGE
|
||||
&& line.getHologram().isVisibleTo(player);
|
||||
&& line.isVisibleTo(player);
|
||||
}
|
||||
|
||||
@MustBeInvokedByOverriders
|
||||
|
Loading…
Reference in New Issue
Block a user