Skript: on book sign event-itemstack unavailable

Created on 14 Jun 2019  路  12Comments  路  Source: SkriptLang/Skript

Description


When using the on book sign event, supposedly there should be an event value for getting the book, via event-itemstack, but the event value does not exist

Steps to Reproduce

on book sign:
    set {_book} to event-itemstack

Expected Behavior


For event-itemstack to return the book that is being signed

Errors / Screenshots

Can't understand this expression: 'event-itemstack' (test.sk, line 2: set {_book} to event-itemstack')

Server Information

  • Server version/platform: Spigot 1.14.2
  • Skript version: 2.4.1-alpha3

Additional Context


Similar to #2151 ?

completed enhancement lowest

All 12 comments

Technically the PlayerEditBookEvent doesn't support getting the item as far as I can tell, just the meta. It has a getSlot() but it returns the slot index and is deprecated so we shouldn't use it.

You could kinda get around this limitation by getting the event's player and checking which item they're holding (main hand or off hand) is a book and quill and return that, though you could also do that yourself as a user. I'm not really sure Skript itself should be handling that sort of stuff but I'll leave it up to the devs.

But according to skUnity's documentations, there should be an event value for the itemstack available. In this case, Skript flat out doesn't recognize its existence? Regardless of what data type it's returning, it should still be able to fit into a variable

The skUnity docs are incorrect.

Also not sure what you mean by this:

Regardless of what data type it's returning, it should still be able to fit into a variable

What is the "it's" that is returning a data type? The literal Bukkit event itself doesn't have this data available. We cannot implement it directly without a bit of a goofy hack.

I meant to say that event-itemstack truly didn't exist as mentioned in the docs, but since the docs are incorrect then that would make sense... lol

shouldn't player's tool work?

You can be editing a book from your offhand tool.

But it鈥檚 True, event-itemstack is listed in lots of events as a value tho it isn鈥檛 implemented, event-item only does work. It was(or still is) in the inventory click event

Perhaps someone should make a list of broken event-itemstack syntaxes from the docs? Seems quite common

itemstack magically stopped working.

This is how it returns event-item, actually so wrong.. https://github.com/SkriptLang/Skript/blob/master/src/main/java/ch/njol/skript/classes/data/BukkitEventValues.java#L928-L936

We could change how that's done internally and it should work again.

Just re-visited this issue and it seems that it's not entirely wrong, you can use event-item instead of event-itemstack and everything will work fine

Was this page helpful?
0 / 5 - 0 ratings

Related issues

dhgameryt picture dhgameryt  路  3Comments

Anoniempje1234 picture Anoniempje1234  路  3Comments

ghost picture ghost  路  3Comments

GiraffeCubed picture GiraffeCubed  路  3Comments

Snow-Pyon picture Snow-Pyon  路  4Comments