I tried to test the library but putting it to show the player when entering simply crashes the game.
// Why is it breaking :(
Time: 03/11/22 10:45 PM
Description: Ticking entity
java.lang.ClassCastException: java.lang.Byte cannot be cast to dc
at pz.h(DataWatcher.java:149)
at um.t_(SourceFile:538)
at adm.a(SourceFile:1408)
at adm.g(SourceFile:1386)
at adm.i(SourceFile:1279)
at ave.s(SourceFile:1850)
at ave.av(SourceFile:889)
at ave.a(SourceFile:325)
at net.minecraft.client.main.Main.main(SourceFile:124)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at net.minecraft.launchwrapper.Launch.launch(Launch.java:135)
at net.minecraft.launchwrapper.Launch.main(Launch.java:28)
A detailed walkthrough of the error, its code path and all known details is as follows:
---------------------------------------------------------------------------------------
-- Head --
Stacktrace:
at pz.h(DataWatcher.java:149)
at um.t_(SourceFile:538)
at adm.a(SourceFile:1408)
at adm.g(SourceFile:1386)
-- Entity being ticked --
Details:
Entity Type: ArmorStand (um)
Entity ID: -2146099896
Entity Name: Hello World!
Entity's Exact location: 0,84, 88,88, 0,38
Entity's Block location: 0,00,88,00,0,00 - World: (0,88,0), Chunk: (at 0,5,0 in 0,0; contains blocks 0,0,0 to 15,255,15), Region: (0,0; contains chunks 0,0 to 31,31, blocks 0,0,0 to 511,255,511)
Entity's Momentum: 0,00, 0,00, 0,00
Entity's Rider: ~~ERROR~~ NullPointerException: null
Entity's Vehicle: ~~ERROR~~ NullPointerException: null
Stacktrace:
at adm.i(SourceFile:1279)
public class ExampleHolograms implements Listener {
private final Plugin plugin;
private final HologramPool hologramPool;
public ExampleHolograms(Plugin plugin) {
this.plugin = plugin;
this.hologramPool = new HologramPool(plugin, 70, 0.5f, 5f);
Bukkit.getPluginManager().registerEvents(this, plugin);
}
/**
* Appends a new Hologram to the pool.
*
* @param location The location the Hologram will be spawned at
* @param excludedPlayer A player which will not see the Hologram for 10
* seconds
*/
public void appendHOLO(Location location, Player excludedPlayer) {
Hologram hologram = Hologram.builder()
.location(location)
.addLine("Hello World!", false)
.addLine("Using Hologram-Lib", false)
.addLine("Hello %%player%%", true)
.addLine(new ItemStack(Material.IRON_BLOCK))
.addPlaceholder("%%player%%", Player::getName)
.build(hologramPool);
hologram.getLines().get(3).setAnimation(Animation.AnimationType.CIRCLE);
if (excludedPlayer != null) {
// adding the excluded player which will not see the Hologram
hologram.addExcludedPlayer(excludedPlayer);
// shows 10 seconds after theHologram
Bukkit.getScheduler().runTaskLater(plugin, () -> hologram.removeExcludedPlayer(excludedPlayer), 20L * 10);
}
}
@EventHandler
public void onPlayerJoin(PlayerJoinEvent event) {
Player player = event.getPlayer();
appendHOLO(player.getLocation(), null);
}
@EventHandler
public void onHologramInteract(PlayerHologramInteractEvent e) {
Player player = e.getPlayer();
TextLine line = e.getLine();
player.sendMessage("Click at " + line.parse(player));
}
}