jaylawl / jNBT

Provides NBT usages within Skript
GNU General Public License v3.0
0 stars 2 forks source link

Set nbt of {_var} to #3

Open ghost opened 6 years ago

ghost commented 6 years ago

Hi jaylawl!

Thanks again for this addon! But since you removed the expression "%item% with custom nbt %string%", I converted all my lines with this:

set {_0} to paper
set nbt of {_0} to "{here is the nbt}"

But I get this error:

[14:50:47 ERROR]: #!#! Stack trace:
[14:50:47 ERROR]: #!#! java.lang.NullPointerException
[14:50:47 ERROR]: #!#!     at de.jaylawl.jnbt.elements.expressions.ExprTileEntityNBT.change(ExprTileEntityNBT.java:48)
[14:50:47 ERROR]: #!#!     at ch.njol.skript.effects.EffChange.execute(EffChange.java:271)
[14:50:47 ERROR]: #!#!     at ch.njol.skript.lang.Effect.run(Effect.java:52)
[14:50:47 ERROR]: #!#!     at ch.njol.skript.lang.TriggerItem.walk(TriggerItem.java:61)
[14:50:47 ERROR]: #!#!     at ch.njol.skript.lang.TriggerItem.walk(TriggerItem.java:89)
[14:50:47 ERROR]: #!#!     at ch.njol.skript.lang.Trigger.execute(Trigger.java:55)
[14:50:47 ERROR]: #!#!     at ch.njol.skript.command.ScriptCommand.execute2(ScriptCommand.java:285)
[14:50:47 ERROR]: #!#!     at ch.njol.skript.command.ScriptCommand.execute(ScriptCommand.java:242)
[14:50:47 ERROR]: #!#!     at ch.njol.skript.command.Commands.handleCommand(Commands.java:257)
[14:50:47 ERROR]: #!#!     at ch.njol.skript.command.Commands$1.onPlayerCommand(Commands.java:172)
[14:50:47 ERROR]: #!#!     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[14:50:47 ERROR]: #!#!     at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
[14:50:47 ERROR]: #!#!     at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
[14:50:47 ERROR]: #!#!     at java.lang.reflect.Method.invoke(Unknown Source)
[14:50:47 ERROR]: #!#!     at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:302)
[14:50:47 ERROR]: #!#!     at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:62)
[14:50:47 ERROR]: #!#!     at org.bukkit.plugin.SimplePluginManager.fireEvent(SimplePluginManager.java:500)
[14:50:47 ERROR]: #!#!     at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:485)
[14:50:47 ERROR]: #!#!     at net.minecraft.server.v1_12_R1.PlayerConnection.handleCommand(PlayerConnection.java:1389)
[14:50:47 ERROR]: #!#!     at net.minecraft.server.v1_12_R1.PlayerConnection.a(PlayerConnection.java:1232)
[14:50:47 ERROR]: #!#!     at net.minecraft.server.v1_12_R1.PacketPlayInChat.a(PacketPlayInChat.java:45)
[14:50:47 ERROR]: #!#!     at net.minecraft.server.v1_12_R1.PacketPlayInChat.a(PacketPlayInChat.java:1)
[14:50:47 ERROR]: #!#!     at net.minecraft.server.v1_12_R1.PlayerConnectionUtils$1.run(SourceFile:13)
[14:50:47 ERROR]: #!#!     at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
[14:50:47 ERROR]: #!#!     at java.util.concurrent.FutureTask.run(Unknown Source)
[14:50:47 ERROR]: #!#!     at net.minecraft.server.v1_12_R1.SystemUtils.a(SourceFile:46)
[14:50:47 ERROR]: #!#!     at net.minecraft.server.v1_12_R1.MinecraftServer.D(MinecraftServer.java:748)
[14:50:47 ERROR]: #!#!     at net.minecraft.server.v1_12_R1.DedicatedServer.D(DedicatedServer.java:406)
[14:50:47 ERROR]: #!#!     at net.minecraft.server.v1_12_R1.MinecraftServer.C(MinecraftServer.java:679)
[14:50:47 ERROR]: #!#!     at net.minecraft.server.v1_12_R1.MinecraftServer.run(MinecraftServer.java:577)
[14:50:47 ERROR]: #!#!     at java.lang.Thread.run(Unknown Source)
[14:50:47 ERROR]: #!#!
[14:50:47 ERROR]: #!#! Version Information:
[14:50:47 ERROR]: #!#!   Skript: 2.2-dev36
[14:50:47 ERROR]: #!#!   Bukkit: 1.12.2-R0.1-SNAPSHOT
[14:50:47 ERROR]: #!#!   Minecraft: 1.12.2
[14:50:47 ERROR]: #!#!   Java: 1.8.0_171 (Java HotSpot(TM) 64-Bit Server VM 25.171-b11)
[14:50:47 ERROR]: #!#!   OS: Windows 10 amd64 10.0
[14:50:47 ERROR]: #!#!
[14:50:47 ERROR]: #!#! Server platform: Spigot
[14:50:47 ERROR]: #!#!
[14:50:47 ERROR]: #!#! Current node: null
[14:50:47 ERROR]: #!#! Current item: set the tile entity nbt of {_0}(as org.bukkit.block.Block) to "{texture:"but_quit", display:{Name:"ºbQuitter le menu"}}"
[14:50:47 ERROR]: #!#! Current trigger: command /newnbt (simple event) (Test.sk, line -1)
[14:50:47 ERROR]: #!#!
[14:50:47 ERROR]: #!#! Thread: Server thread
[14:50:47 ERROR]: #!#!
[14:50:47 ERROR]: #!#! Language: english
[14:50:47 ERROR]: #!#! Link parse mode: DISABLED
[14:50:47 ERROR]: #!#!
[14:50:47 ERROR]: #!#! End of Error.
[14:50:47 ERROR]: #!#!

Surprisingly, this works:

set nbt of player's tool to "{here is the nbt}"

Thank you for help and keep going ❤️

jaylawl commented 6 years ago

First off, i recommend using set {_item} to "paper" parsed as item if you're encountering issues. (Emphasis parsed as item) There are currently some things going wrong with items in skript: https://github.com/SkriptLang/Skript/issues/1484

But that's not the problem here. See this line of the stack trace:

[14:50:47 ERROR]: #!#!     at de.jaylawl.jnbt.elements.expressions.ExprTileEntityNBT.change(ExprTileEntityNBT.java:48)

It thinks you're trying to change tile-entity nbt. That's because i made three different expressions which can be specified: item-nbt, entity-nbt and tileentity-nbt. Your issue will be fixed by using this:

set item-nbt of {_0} to "{here is the nbt}"

This still needs to be fixed on my side though. You're not the first person to have this issue, and of course i want to make my plugin more intuitive. Thanks for reporting and your kind words

ghost commented 6 years ago

Hi jaylawl!

Thank your for your complete answer! Specify item/entity or tileentity is not a problem for me. Use only them in the documentation (not nbt alone), and it's intuitive I think :)

set item-nbt of {_0} to "{here is the nbt}"

Works perfectly (only if I parse the "item in text" as item like you recommend).

Thank you! :)