forked from unimatrix/web
Fresh production baseline [skip ci]
This commit is contained in:
commit
0a11a18274
1 changed files with 229644 additions and 0 deletions
|
|
@ -0,0 +1,18 @@
|
|||
package com.dunerealms.gui;
|
||||
import java.lang.reflect.*;
|
||||
import java.util.*;
|
||||
import org.bukkit.*;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
/** Uses the installed DecentHolograms renderer; temporary labels never become saved holograms. */
|
||||
final class HologramBridge {
|
||||
private final Method create,move,lines,remove,hide,unhide;
|
||||
HologramBridge(Plugin dependency)throws ReflectiveOperationException{
|
||||
var api=dependency.getClass().getClassLoader().loadClass("eu.decentsoftware.holograms.api.DHAPI");create=api.getMethod("createHologram",String.class,Location.class,boolean.class,List.class);Class<?> type=create.getReturnType();move=api.getMethod("moveHologram",type,Location.class);lines=api.getMethod("setHologramLines",type,List.class);remove=api.getMethod("removeHologram",String.class);hide=type.getMethod("setHidePlayer",Player.class);unhide=type.getMethod("removeHidePlayer",Player.class);
|
||||
}
|
||||
Object create(String id,Location at,List<String> text)throws ReflectiveOperationException{return create.invoke(null,id,at,false,text);}
|
||||
void move(Object hologram,Location at)throws ReflectiveOperationException{move.invoke(null,hologram,at);}
|
||||
void lines(Object hologram,List<String> text)throws ReflectiveOperationException{lines.invoke(null,hologram,text);}
|
||||
void remove(String id)throws ReflectiveOperationException{remove.invoke(null,id);}
|
||||
void hidden(Object hologram,Player viewer,boolean value)throws ReflectiveOperationException{(value?hide:unhide).invoke(hologram,viewer);}
|
||||
}
|
||||
Loading…
Reference in a new issue

Staff