Skip to content

Add expr to get the show item hover tag for a given item.#8669

Open
sovdeeth wants to merge 4 commits into
SkriptLang:dev/featurefrom
sovdeeth:feature/show_item_tag
Open

Add expr to get the show item hover tag for a given item.#8669
sovdeeth wants to merge 4 commits into
SkriptLang:dev/featurefrom
sovdeeth:feature/show_item_tag

Conversation

@sovdeeth
Copy link
Copy Markdown
Member

Problem

Creating a hover:show_item tag requires the ability to get a string representation of all the necessary components of an item, which is not simple in Skript. See https://docs.papermc.io/adventure/minimessage/format/#hover for details.

Solution

Adds a property expression item hover text of %itemstacks% that automatically produces the tag "<hover:show_item:...>" for those items.
image

Testing Completed

Added simple regression tests.

Supporting Information


Completes: none
Related: none
AI assistance: none

@sovdeeth sovdeeth requested a review from a team as a code owner May 29, 2026 23:09
@sovdeeth sovdeeth requested review from Pesekjak and TheMug06 and removed request for a team May 29, 2026 23:09
@sovdeeth sovdeeth added the feature Pull request adding a new feature. label May 29, 2026
@skriptlang-automation skriptlang-automation Bot added the needs reviews A PR that needs additional reviews label May 29, 2026
@skriptlang-automation skriptlang-automation Bot moved this to In Review in 2.16 Releases May 29, 2026
@bluelhf
Copy link
Copy Markdown
Contributor

bluelhf commented May 29, 2026

Why not an expression that applies the show_item hover action to a Component?

@sovdeeth
Copy link
Copy Markdown
Member Author

Why not an expression that applies the show_item hover action to a Component?

Because that would be rather difficult to put into a string with %%. Could be a separate expression though.

@bluelhf
Copy link
Copy Markdown
Contributor

bluelhf commented May 29, 2026

Why not an expression that applies the show_item hover action to a Component?

Because that would be rather difficult to put into a string with %%. Could be a separate expression though.

Makes sense. I was worried about the hackiness of returning a minimessage string back to the user, but that's now solved! This seems like a pretty good way of providing components to the user in general, assuming that interpolating it into a minimessage string works like you'd expect.

@Fusezion

This comment was marked as resolved.

@Fusezion
Copy link
Copy Markdown
Contributor

Fusezion commented May 30, 2026

nvm I'm just dumb and forgot to use formatted, though I still am concerned about the overall size of the string for this
image

I did eventually get the string to break by adding too much data into it
top portion
image
bottom portion to show it didn't just end
image

and proof it does work with smaller items at larger numbers (this one breaks somewhere around 25)
image

additional notes:
Without proper implementation some oversized items (though purposeful here) do instead just throw an exception into console
where as skbee who uses the more intended design doesn't have this issue (and works)

(Methods ran to cause both)
image

(Console exception thrown from skript)
image

(Hover of skbee)
image

@sovdeeth
Copy link
Copy Markdown
Member Author

This is because you're forcing it back into a string before reformatting. If you used component addition, this likely would not be an issue.

@Fusezion
Copy link
Copy Markdown
Contributor

This is because you're forcing it back into a string before reformatting. If you used component addition, this likely would not be an issue.

Sure, but how often do you see people use x + y when they need to quickly append something?
I understand I did it wrong but 90% of the time when I'm looking over any type of help channel I am not going to see x + y
Especially given the fact skript still doesn't allow {_empty} + "myString"

@sovdeeth
Copy link
Copy Markdown
Member Author

This is because you're forcing it back into a string before reformatting. If you used component addition, this likely would not be an issue.

Sure, but how often do you see people use x + y when they need to quickly append something?
I understand I did it wrong but 90% of the time when I'm looking over any type of help channel I am not going to see x + y
Especially given the fact skript still doesn't allow {_empty} + "myString"

Yeah, my point is that to put it into a string, like you're testing, it has to become a string again, there's no way around that. It would be the same if you attached the component to another like skbee does and then serialized it back into a minimessage string to put in another string. It's just unavoidable with the test you're doing.

Keeping it as a component doesn't have that issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature Pull request adding a new feature. needs reviews A PR that needs additional reviews

Projects

Status: In Review

Development

Successfully merging this pull request may close these issues.

3 participants