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

java.lang.NullPointerException #809

Closed
luanmenglei opened this issue Apr 8, 2020 · 4 comments
Closed

java.lang.NullPointerException #809

luanmenglei opened this issue Apr 8, 2020 · 4 comments

Comments

@luanmenglei
Copy link

Describe the bug
WrappedBlockData.createData(Material.SIGN_POST) I use this to create a BlockData
and here are the errors:

Caused by: java.lang.NullPointerException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_241]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_241]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_241]
at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_241]
at com.comphenix.protocol.reflect.accessors.DefaultMethodAccessor.invoke(DefaultMethodAccessor.java:16) ~[?:?]
at com.comphenix.protocol.wrappers.WrappedBlockData$OldBlockData.createOldData(WrappedBlockData.java:238) ~[?:?]
at com.comphenix.protocol.wrappers.WrappedBlockData$OldBlockData.access$400(WrappedBlockData.java:164) ~[?:?]
at com.comphenix.protocol.wrappers.WrappedBlockData.createData(WrappedBlockData.java:300) ~[?:?]

Version Info
ProtocolLib 4.4 & ProtocolLib 4.5

@luanmenglei
Copy link
Author

It's works perfectly on ProtocolLib4.3

@hugo4715
Copy link

hugo4715 commented Apr 9, 2020

I was going to post the same bug so i guess i'll post it here to avoid the spam

Describe the bug
I am getting a NullPointerException while trying to call an api method;
WrappedBlockData.createData(Material.WALL_SIGN);
Error log:

[14:52:20 WARN]: Caused by: java.lang.NullPointerException
[14:52:20 WARN]:        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[14:52:20 WARN]:        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
[14:52:20 WARN]:        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
[14:52:20 WARN]:        at java.lang.reflect.Method.invoke(Unknown Source)
[14:52:20 WARN]:        at com.comphenix.protocol.reflect.accessors.DefaultMethodAccessor.invoke(DefaultMethodAccessor.java:16)
[14:52:20 WARN]:        at com.comphenix.protocol.wrappers.WrappedBlockData$OldBlockData.createOldData(WrappedBlockData.java:238)
[14:52:20 WARN]:        at com.comphenix.protocol.wrappers.WrappedBlockData$OldBlockData.access$400(WrappedBlockData.java:164)
[14:52:20 WARN]:        at com.comphenix.protocol.wrappers.WrappedBlockData.createData(WrappedBlockData.java:300)
[14:52:20 WARN]:        at fr.hugo4715.spigot.util.gui.SignInputManager.open(SignInputManager.java:44)
[14:52:20 WARN]:        at fr.hugo4715.spigot.commands.impl.staff.TestCommand.onTest(TestCommand.java:15)
[14:52:20 WARN]:        ... 22 more

To Reproduce
Call WrappedBlockData.createData(Material.WALL_SIGN);

Expected behavior
I excepted a WrappedBlockData to be created.

Screenshots
Not applicable

Version Info
https://pastebin.com/5rahu2en

Additional context
I am trying to open the sign gui for a player to input text.

        WrapperPlayServerBlockChange blockChangePacket = new WrapperPlayServerBlockChange();
        WrappedBlockData blockData = WrappedBlockData.createData(Material.WALL_SIGN);
        blockChangePacket.setBlockData(blockData);
        blockChangePacket.setLocation(pos);
        blockChangePacket.sendPacket(player);

@dmulloy2
Copy link
Owner

dmulloy2 commented Apr 11, 2020

@luanmenglei @hugo4715 as a debug step, can you try calling WrappedBlockData.createData(Material.WALL_SIGN, 0); instead and see if that works?

@hugo4715
Copy link

@luanmenglei @hugo4715 as a debug step, can you try calling WrappedBlockData.createData(Material.WALL_SIGN, 0); instead and see if that works?

It works perfectly with that fix 🥇
Thanks

NahuLD added a commit to NahuLD/item-shop that referenced this issue Jan 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants