#.getTag() returning null (NMS)

1 messages · Page 1 of 1 (latest)

tranquil mason
#

.

reef summit
#

Can you check the type of the item that's causing the null?

tranquil mason
reef summit
#

Is it possible that one of the empty slots that were checked against had air as their type?

tranquil mason
reef summit
#

Not sure, I just always do both a null check and an air check, just in case

#

If that doesn't do it, try running hasTag before the result line, and at that point check what type of item is causing the problem

tranquil mason
#

so if hasTag returns false I just log the ItemStack?

#

gotcha

reef summit
#

Just in case, is the piece of wood the one causing the problem?

tranquil mason
#

I'd have to check, I mean who knows, maybe it really is the empty slots that are causing it

reef summit
#

If you don't mind me asking, are you trying to save the string to somewhere else than a file so that you can get the player item stacks elsewhere?

tranquil mason
#

no, I only need this to save a player's inventory to a file and then load it from the same file whenever I need to

#

it's a .yml file

#

basically containing players.[UUID].inventory entries

#

so my method just returns a string which is then saved to the file basically

reef summit