Closed Guarmanda closed 9 months ago
As a workaround I use your old API in 1.8 lol
private static IHologramPool pool;
//for 1.8
private static HologramPool pool1_8;
private static HologramPool getPool1_8() {
if(pool1_8 == null) {
pool1_8 = new HologramPool((Plugin)Main.getInstance(), 1200);
}
return pool1_8;
}
private static IHologramPool getPool() {
if(pool == null) {
pool = HoloEasy.startPool((Plugin)Main.getInstance(), 1200);
}
return pool;
}
private Hologram hologram;
private com.github.unldenis.hologram.Hologram hologram1_8;
/**
* Kills the hologram
*/
public void remove() {
if(Main.getVersion()>7){
if(runnable != null) {
runnable.cancel();
runnable = null;
}
if(hologram == null && hologram1_8 == null) return;
if(Main.getVersion()>8 && hologram!=null) {
pool.remove(hologram.getKey());
hologram = null;
}
else if(hologram1_8!=null && Main.getVersion()==8) {
getPool1_8().remove(hologram1_8);
hologram1_8 = null;
}
}
}
/**
* @param name The text displayed by the hologram
*/
public void setText(String name) {
if(!NULL_NAME.contains(name)) {
getHologram();
setLine(Utils.color(name));
}else {
remove();
}
}
/**
* Manage hologram lines to display / change its name
* @param name
*/
private void setLine(String name){
// compose a TextLine hologram
if(Main.getVersion()>8) {
TextLine textLine = new TextLine((Plugin)Main.getInstance(), name, null, false);
hologram.load(textLine);
}
else {
Line line = new Line((Plugin)Main.getInstance());
com.github.unldenis.hologram.line.TextLine textLine = new com.github.unldenis.hologram.line.TextLine(line, name, null, false);
hologram1_8.load(textLine);
}
}
/**
* @return Creates the hologram
*/
private Object createHologram() {
if(Main.getVersion()>8){
HologramKey key = new HologramKey(getPool(), chest.getName());
hologram = new Hologram(key, location, new TextSequentialLoader());
return hologram;
}
else {
hologram1_8 = new com.github.unldenis.hologram.Hologram((Plugin)Main.getInstance(), location, new com.github.unldenis.hologram.line.hologram.TextSequentialLoader());
getPool1_8().takeCareOf(hologram1_8);
return hologram1_8;
}
}
/**
* @return The hologram
*/
private Object getHologram() {
if(hologram==null && hologram1_8==null) {
createHologram();
}
if(Main.getVersion()>8)
return hologram;
else
return hologram1_8;
}
Fixed in 3.1.1 .
causes this: