#TheJimmyJ57 8993 JonsStuff 8658 Please

1 messages · Page 1 of 1 (latest)

delicate perch
#

Alr got a thread here

#

Yeah so using v1.19.4 of spigot-api. I can't seem to get the persistentDataContainer from a sign

jagged jay
#

alrighty, please paste the whole class where you try to use getPersistentDataContainer()

#

?paste

delicate perch
jagged jay
#

th

#

x

delicate perch
#

no, thank you! haha

tepid arch
#

Wrong sign import

#

org.bukkit.block.sign

jagged jay
#

yeah you are suppoed to import "org.bukkit.block.Sign"

#

change line 8 to "import org.bukkit.block.Sign"

delicate perch
#

ohhh i see. I imported org.bukkit.block.data.type.Sign;

#

How do they differ?

jagged jay
#

the one you used is the outdated import from <1.13

#

(i think)

delicate perch
#

Okay good to know. Thank you!

jagged jay
#

are you using maven?

delicate perch
#

Yup

jagged jay
#

please paste your pom.xml file

tepid arch
#

No

jagged jay
#

looks like you have the old spigot version in your pom, that's why your IDE shows you the wrong imports

tepid arch
#

The one you used is for block data

jagged jay
#

ooh ok

delicate perch
#

It suggested two imports and I just chose the wrong one

#

It works now with the correct one 🙂

jagged jay
#

does it also work ingame?

delicate perch
#

Will let you know shortly when I build it

#

But it has been working fine if thats what you mean

jagged jay
#

alrighty. if not, the issue is that you're confusing BlockData with BlockStates - but that's an easy fix

#

so yeah just try it out, and if it doesn't work, let us know

tepid arch
#

Doesn’t help that Spigot has them reversed

#

BlockData handles what Mojang calls the states of blocks

#

And BlockState is what Mojang calls IBlockData

delicate perch
#

I got a follow up question. So I am setting some PDC data to the block during a SignChangeEvent. But then in a PlayerInteractEvent on that sign I can't retrieve the same PersistentDataContainer data. Thoughts?

tepid arch
#

You may have to delay the update call 1 tick in the sign change event

delicate perch
#

I can try that. But I think it might lose them when it runs the getstate cast to Sign. See here https://paste.md-5.net/bozominiso.cpp. The sign2 that tries to retrieve the keys right after they were set doesn't return anything. If I do sign#getPersistentDataContainer() from the same object it works tho

tepid arch
#

You need to update the state once you make changes

#

sign.update