mirror of
https://github.com/songoda/SongodaCore.git
synced 2024-11-30 14:03:23 +01:00
More hologram support.
This commit is contained in:
parent
bb148ba046
commit
95288fd8b0
@ -87,7 +87,12 @@ public class HologramManager {
|
|||||||
return Collections.unmodifiableCollection(registeredHolograms.values());
|
return Collections.unmodifiableCollection(registeredHolograms.values());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void add(Location location, ArrayList<String> lines) {
|
public static void add(Location location, String line) {
|
||||||
|
if (defaultHolo != null)
|
||||||
|
defaultHolo.add(location, line);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void add(Location location, List<String> lines) {
|
||||||
if (defaultHolo != null)
|
if (defaultHolo != null)
|
||||||
defaultHolo.add(location, lines);
|
defaultHolo.add(location, lines);
|
||||||
}
|
}
|
||||||
@ -97,7 +102,12 @@ public class HologramManager {
|
|||||||
defaultHolo.remove(location);
|
defaultHolo.remove(location);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void update(Location location, ArrayList<String> lines) {
|
public static void update(Location location, String line) {
|
||||||
|
if (defaultHolo != null)
|
||||||
|
defaultHolo.update(location, line);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void update(Location location, List<String> lines) {
|
||||||
if (defaultHolo != null)
|
if (defaultHolo != null)
|
||||||
defaultHolo.update(location, lines);
|
defaultHolo.update(location, lines);
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,8 @@ package com.songoda.core.library.hologram.holograms;
|
|||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public abstract class Hologram {
|
public abstract class Hologram {
|
||||||
|
|
||||||
@ -26,11 +27,19 @@ public abstract class Hologram {
|
|||||||
|
|
||||||
public abstract String getName();
|
public abstract String getName();
|
||||||
|
|
||||||
public abstract void add(Location location, ArrayList<String> lines);
|
public void add(Location location, String line) {
|
||||||
|
add(location, Collections.singletonList(line));
|
||||||
|
}
|
||||||
|
|
||||||
|
public abstract void add(Location location, List<String> lines);
|
||||||
|
|
||||||
public abstract void remove(Location location);
|
public abstract void remove(Location location);
|
||||||
|
|
||||||
public abstract void update(Location location, ArrayList<String> lines);
|
public void update(Location location, String line) {
|
||||||
|
update(location, Collections.singletonList(line));
|
||||||
|
}
|
||||||
|
|
||||||
|
public abstract void update(Location location, List<String> lines);
|
||||||
|
|
||||||
void fixLocation(Location location) {
|
void fixLocation(Location location) {
|
||||||
location.add(x, y, z);
|
location.add(x, y, z);
|
||||||
|
@ -4,7 +4,7 @@ import com.gmail.filoghost.holographicdisplays.api.HologramsAPI;
|
|||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.List;
|
||||||
|
|
||||||
public class HolographicDisplaysHologram extends Hologram {
|
public class HolographicDisplaysHologram extends Hologram {
|
||||||
|
|
||||||
@ -18,7 +18,7 @@ public class HolographicDisplaysHologram extends Hologram {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void add(Location location, ArrayList<String> lines) {
|
public void add(Location location, List<String> lines) {
|
||||||
fixLocation(location);
|
fixLocation(location);
|
||||||
|
|
||||||
com.gmail.filoghost.holographicdisplays.api.Hologram hologram = HologramsAPI.createHologram(plugin, location);
|
com.gmail.filoghost.holographicdisplays.api.Hologram hologram = HologramsAPI.createHologram(plugin, location);
|
||||||
@ -39,7 +39,7 @@ public class HolographicDisplaysHologram extends Hologram {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void update(Location location, ArrayList<String> lines) {
|
public void update(Location location, List<String> lines) {
|
||||||
for (com.gmail.filoghost.holographicdisplays.api.Hologram hologram : HologramsAPI.getHolograms(plugin)) {
|
for (com.gmail.filoghost.holographicdisplays.api.Hologram hologram : HologramsAPI.getHolograms(plugin)) {
|
||||||
if (hologram.getX() != location.getX()
|
if (hologram.getX() != location.getX()
|
||||||
|| hologram.getY() != location.getY()
|
|| hologram.getY() != location.getY()
|
||||||
|
Loading…
Reference in New Issue
Block a user