Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NullPointerException #67

Closed
tgross03 opened this issue Oct 29, 2024 · 5 comments
Closed

NullPointerException #67

tgross03 opened this issue Oct 29, 2024 · 5 comments
Labels
bug Something isn't working

Comments

@tgross03
Copy link

tgross03 commented Oct 29, 2024

Hey, I am using holoeasy-core 4.1.0 via Maven and I am getting the following Exception:

[19:45:02] [Craft Scheduler Thread - 3 - Parcour/WARN]: [Parcour] Plugin Parcour v1.0.0-RELEASE generated an exception while executing task 22
java.lang.NullPointerException: constructor
	at com.google.common.base.Preconditions.checkNotNull(Preconditions.java:907) ~[guava-31.1-jre.jar:?]
	at com.comphenix.protocol.reflect.accessors.MethodHandleHelper.getConstructorAccessor(MethodHandleHelper.java:70) ~[ProtocolLib.jar:?]
	at com.comphenix.protocol.reflect.accessors.Accessors.getConstructorAccessor(Accessors.java:167) ~[ProtocolLib.jar:?]
	at com.comphenix.protocol.reflect.accessors.Accessors.getConstructorAccessor(Accessors.java:145) ~[ProtocolLib.jar:?]
	at com.comphenix.protocol.wrappers.LegacyDataWatcher.newHandle(LegacyDataWatcher.java:113) ~[ProtocolLib.jar:?]
	at com.comphenix.protocol.wrappers.LegacyDataWatcher.<init>(LegacyDataWatcher.java:108) ~[ProtocolLib.jar:?]
	at com.comphenix.protocol.wrappers.LegacyDataWatcher.<init>(LegacyDataWatcher.java:85) ~[ProtocolLib.jar:?]
	at com.comphenix.protocol.wrappers.WrappedDataWatcher.<init>(WrappedDataWatcher.java:86) ~[ProtocolLib.jar:?]
	at org.holoeasy.packet.metadata.text.MetadataTextPacketD.metadata(MetadataTextPacketD.kt:18) ~[parcour-1.0.0-RELEASE.jar:?]
	at org.holoeasy.packet.metadata.text.IMetadataTextPacket$DefaultImpls.metadata$default(IMetadataTextPacket.kt:8) ~[parcour-1.0.0-RELEASE.jar:?]
	at org.holoeasy.line.TextLine$pvt$1.show(TextLine.kt:93) ~[parcour-1.0.0-RELEASE.jar:?]
	at org.holoeasy.hologram.Hologram.show(Hologram.kt:103) ~[parcour-1.0.0-RELEASE.jar:?]
	at org.holoeasy.pool.HologramPool.hologramTick$lambda$4(HologramPool.kt:71) ~[parcour-1.0.0-RELEASE.jar:?]
	at org.bukkit.craftbukkit.v1_19_R3.scheduler.CraftTask.run(CraftTask.java:101) ~[paper-1.19.4.jar:git-Paper-550]
	at org.bukkit.craftbukkit.v1_19_R3.scheduler.CraftAsyncTask.run(CraftAsyncTask.java:57) ~[paper-1.19.4.jar:git-Paper-550]
	at com.destroystokyo.paper.ServerSchedulerReportingWrapper.run(ServerSchedulerReportingWrapper.java:22) ~[paper-1.19.4.jar:?]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144) ~[?:?]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642) ~[?:?]
	at java.lang.Thread.run(Thread.java:1575) ~[?:?]
[19:45:02] [Craft Scheduler Thread - 1 - Parcour/WARN]: [Parcour] Plugin Parcour v1.0.0-RELEASE generated an exception while executing task 22
java.lang.NullPointerException: constructor
	at com.google.common.base.Preconditions.checkNotNull(Preconditions.java:907) ~[guava-31.1-jre.jar:?]
	at com.comphenix.protocol.reflect.accessors.MethodHandleHelper.getConstructorAccessor(MethodHandleHelper.java:70) ~[ProtocolLib.jar:?]
	at com.comphenix.protocol.reflect.accessors.Accessors.getConstructorAccessor(Accessors.java:167) ~[ProtocolLib.jar:?]
	at com.comphenix.protocol.reflect.accessors.Accessors.getConstructorAccessor(Accessors.java:145) ~[ProtocolLib.jar:?]
	at com.comphenix.protocol.wrappers.LegacyDataWatcher.newHandle(LegacyDataWatcher.java:113) ~[ProtocolLib.jar:?]
	at com.comphenix.protocol.wrappers.LegacyDataWatcher.<init>(LegacyDataWatcher.java:108) ~[ProtocolLib.jar:?]
	at com.comphenix.protocol.wrappers.LegacyDataWatcher.<init>(LegacyDataWatcher.java:85) ~[ProtocolLib.jar:?]
	at com.comphenix.protocol.wrappers.WrappedDataWatcher.<init>(WrappedDataWatcher.java:86) ~[ProtocolLib.jar:?]
	at org.holoeasy.packet.metadata.text.MetadataTextPacketD.metadata(MetadataTextPacketD.kt:18) ~[parcour-1.0.0-RELEASE.jar:?]
	at org.holoeasy.packet.metadata.text.IMetadataTextPacket$DefaultImpls.metadata$default(IMetadataTextPacket.kt:8) ~[parcour-1.0.0-RELEASE.jar:?]
	at org.holoeasy.line.TextLine$pvt$1.show(TextLine.kt:93) ~[parcour-1.0.0-RELEASE.jar:?]
	at org.holoeasy.hologram.Hologram.show(Hologram.kt:103) ~[parcour-1.0.0-RELEASE.jar:?]
	at org.holoeasy.pool.HologramPool.hologramTick$lambda$4(HologramPool.kt:71) ~[parcour-1.0.0-RELEASE.jar:?]
	at org.bukkit.craftbukkit.v1_19_R3.scheduler.CraftTask.run(CraftTask.java:101) ~[paper-1.19.4.jar:git-Paper-550]
	at org.bukkit.craftbukkit.v1_19_R3.scheduler.CraftAsyncTask.run(CraftAsyncTask.java:57) ~[paper-1.19.4.jar:git-Paper-550]
	at com.destroystokyo.paper.ServerSchedulerReportingWrapper.run(ServerSchedulerReportingWrapper.java:22) ~[paper-1.19.4.jar:?]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144) ~[?:?]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642) ~[?:?]
	at java.lang.Thread.run(Thread.java:1575) ~[?:?]

I am using ProtocolLib 5.3.0 on a Paper 1.19.4 server. The class I use to inherit from Hologram is the following:

    public static class CheckpointHologram extends Hologram {

        ITextLine firstLine = null;
        ITextLine secondLine = null;
        ITextLine thirdLine = null;


        public CheckpointHologram(@NotNull Location location, Course course, Checkpoint checkpoint) {
            super(location);

            switch (checkpoint.getType()) {
                case START -> {
                    firstLine = textLine("§b§l> START <");
                    secondLine = textLine("§7Parkour: §e{}", new TextLineModifiers().args(course.getName()));
                    thirdLine = textLine("§7Schwierigkeit: {}",
                            new TextLineModifiers().args(Parcour.getColoredText(course.getDifficulty().getChatColor(),
                                    course.getDifficulty().getTitle())));
                }
                case FINISH -> {
                    firstLine = textLine("§a§l > ZIEL <");
                    secondLine = textLine("§7Parkour: §e{}", new TextLineModifiers().args(course.getName()));
                }
                case CHECKPOINT -> {
                    firstLine = textLine("§e§l> CHECKPOINT §6§l{} §r§e§l<", new TextLineModifiers().args(checkpoint.getIndex()));
                }
            }
        }

    }
@unldenis unldenis added the bug Something isn't working label Oct 31, 2024
@unldenis
Copy link
Owner

unldenis commented Oct 31, 2024

I am using ProtocolLib 5.3.0 on a Paper 1.19.4 server.

Have you tried using latest ProtocolLib build?

As soon as I can I'll try to test it too, it seems like a ProtocolLib error, unless they've changed something radically about the API.

@tgross03
Copy link
Author

Have you tried using latest ProtocolLib build?

I originally used the latest release but it still does not work using the last build #735.

Is it possible that a conflict with another plugin causes those kind of problems?

@unldenis
Copy link
Owner

unldenis commented Nov 3, 2024

Hi @tgross03 ,

in the meantime I receive a response in my issue, HoloEasy with version 4.2.0 adds PacketEvents support.

You can read more in the documentation.

@tgross03
Copy link
Author

tgross03 commented Nov 3, 2024

Hey @unldenis,

thanks for your quick response! I tried the variant with PacketEvents and the Holograms now work again
with the exception that custom Colors (net.md_5.bungee.api.ChatColor) are not shown anymore. Instead a non related
normal Color (e.g. §8) is shown.

Is this a problem with my method or does this variant not support this kind of colors?

My implementation:

TextComponent textComponent = new TextComponent(text);
textComponent.setColor(color);
return textComponent.toLegacyText();

@unldenis
Copy link
Owner

unldenis commented Nov 3, 2024

Since 4.2.1 colors are supported (tested in 1.20.2).

PacketEvents allows you to pass an Adventure TextComponent. This might link into #59.
However in order not to break the api I momentarily parsed a string into a component.

@unldenis unldenis closed this as completed Nov 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants