unldenis / holoeasy

a simple and modern Java and Kotlin minecraft hologram library for 1.8-1.20.4 servers.
https://www.spigotmc.org/resources/api-holoeasy.98899/
GNU Lesser General Public License v3.0
87 stars 28 forks source link

error when the hologram is loaded #25

Closed Laxeeee closed 7 months ago

Laxeeee commented 1 year ago

java.lang.NullPointerException: Cannot invoke "java.lang.Class.enumConstantDirectory()" because "enumClass" is null at java.lang.Enum.valueOf(Enum.java:267) ~[?:?] at com.comphenix.protocol.wrappers.EnumWrappers$EnumConverter.getGeneric(EnumWrappers.java:823) ~[ProtocolLib.jar:?] at com.comphenix.protocol.wrappers.EnumWrappers$EnumConverter.getGeneric(EnumWrappers.java:804) ~[ProtocolLib.jar:?] at com.comphenix.protocol.wrappers.BukkitConverters$4.getGeneric(BukkitConverters.java:388) ~[ProtocolLib.jar:?] at com.comphenix.protocol.wrappers.BukkitConverters$4.getGeneric(BukkitConverters.java:385) ~[ProtocolLib.jar:?] at com.comphenix.protocol.wrappers.Converters$1.getGeneric(Converters.java:48) ~[ProtocolLib.jar:?] at com.comphenix.protocol.wrappers.BukkitConverters.getGenericList(BukkitConverters.java:303) ~[ProtocolLib.jar:?] at com.comphenix.protocol.wrappers.BukkitConverters.access$100(BukkitConverters.java:91) ~[ProtocolLib.jar:?] at com.comphenix.protocol.wrappers.BukkitConverters$3.getGeneric(BukkitConverters.java:370) ~[ProtocolLib.jar:?] at com.comphenix.protocol.wrappers.BukkitConverters$3.getGeneric(BukkitConverters.java:362) ~[ProtocolLib.jar:?] at com.comphenix.protocol.wrappers.Converters$1.getGeneric(Converters.java:48) ~[ProtocolLib.jar:?] at com.comphenix.protocol.reflect.StructureModifier.writeInternal(StructureModifier.java:331) ~[ProtocolLib.jar:?] at com.comphenix.protocol.reflect.StructureModifier.write(StructureModifier.java:295) ~[ProtocolLib.jar:?] at com.github.unldenis.hologram.packet.IPackets$PacketsV1_9V1_18.equipmentPacket(IPackets.java:212) ~[TestPlugin.jar:?] at com.github.unldenis.hologram.line.ItemLine.update(ItemLine.java:50) ~[TestPlugin.jar:?] at com.github.unldenis.hologram.line.ItemLine.show(ItemLine.java:44) ~[TestPlugin.jar:?] at com.github.unldenis.hologram.Hologram.show(Hologram.java:144) ~[TestPlugin.jar:?] at com.github.unldenis.hologram.HologramPool.lambda$hologramTick$5(HologramPool.java:167) ~[TestPlugin.jar:?] at org.bukkit.craftbukkit.v1_19_R1.scheduler.CraftTask.run(CraftTask.java:101) ~[paper-1.19.2.jar:git-Paper-113] at org.bukkit.craftbukkit.v1_19_R1.scheduler.CraftAsyncTask.run(CraftAsyncTask.java:57) ~[paper-1.19.2.jar:git-Paper-113] at com.destroystokyo.paper.ServerSchedulerReportingWrapper.run(ServerSchedulerReportingWrapper.java:22) ~[paper-1.19.2.jar:?] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) ~[?:?] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) ~[?:?] at java.lang.Thread.run(Thread.java:833) ~[?:?]

    ------------

    Server version: paper 1.19.2
    Protocol version: 5.0.0 snapshot b606
unldenis commented 1 year ago

Try the latest release and let me know if it still gives you the same error.

msqll commented 1 year ago

Try the latest release and let me know if it still gives you the same error.

yes

unldenis commented 1 year ago

Try the latest release and let me know if it still gives you the same error.

yes

still?

Laxeeee commented 1 year ago

now it's working, how can I update the hologram lines? Because i'm trying to add a counter on the hologram and i want to update it. I have tried with line.update(player) but it doesn't work

unldenis commented 1 year ago
public void updateTextLine(Hologram hologram) {
  /* You have four ways to manage lines:
   1) keep ILine<?>.
   2) cast ILine<?> to the ITextLine.
   3) cast directly to the implementation(impl could be TextLine, ClickableTextLine or TextALine).
   If you don't know the type you have the various getType and getEType methods of ILine interface.
  */
  ITextLine line = (ITextLine) hologram.getLines().get(0);

  // update the text.
  line.setObj("Updated");

  // now you need to update this hologram line for all seeing players of the hologram.
  line.update(hologram.getSeeingPlayers());
}

I hope I have clarified any doubts.