Closed Qveshn closed 2 years ago
Hmm... just noticed...
If I insert the first component as text without hover and click events, then everything works fine 😕 Example 1:
[
"",
{
"text": "<<< Previous <<<",
"color": "gray",
"clickEvent": {
"action": "run_command",
"value": "/{MainCommand} {SubCommand} {PrevPage}"
},
"hoverEvent": {
"action": "show_text",
"value": "/{MainCommand} {SubCommand} {PrevPage}"
}
},
{
"text": " Showing page {CurrentPage}/{MaxPage} ",
"color": "gold"
},
{
"text": ">>> Next >>>",
"color": "gray",
"clickEvent": {
"action": "run_command",
"value": "/{MainCommand} {SubCommand} {NextPage}"
},
"hoverEvent": {
"action": "show_text",
"value": "/{MainCommand} {SubCommand} {NextPage}"
}
}
]
Example 2:
[
{
"text": ""
},
{
"text": "<<< Previous <<<",
"color": "gray",
"clickEvent": {
"action": "run_command",
"value": "/{MainCommand} {SubCommand} {PrevPage}"
},
"hoverEvent": {
"action": "show_text",
"value": "/{MainCommand} {SubCommand} {PrevPage}"
}
},
{
"text": " Showing page {CurrentPage}/{MaxPage} ",
"color": "gold"
},
{
"text": ">>> Next >>>",
"color": "gray",
"clickEvent": {
"action": "run_command",
"value": "/{MainCommand} {SubCommand} {NextPage}"
},
"hoverEvent": {
"action": "show_text",
"value": "/{MainCommand} {SubCommand} {NextPage}"
}
}
]
Also I have done some experiments and found out next: If one of the message components does not contain "clickEvent" or "hoverEvent", then it will be taken from the first component of the message 😕 😕 😕
Is this client or plugin bug? Can you check what json message is sent to client exactly?
If this is client bug, then I advise you to insert additionally to all "json" messages at the beginning of its array the first component as text "" (empty string), if it is missing
Thanks for the info. Looks like Mojang changed the behavior of this (used to only carry over formatting, not the events), I will update the bundled yml files accordingly.
Thanks
Information
Environment information Plugin + server version info:
Online mode: no
BungeeCord: yes
Server/crash log
Plugin config (optional)
Details
Description
When I use
/marry list
, then it shows the list and the footer like:<<< Previous <<< Showing page ../.. >>> Next >>>
But The second part of the message "Showing page ../.." contains hover text and click event from the first part. 😟Steps to reproduce
/marry list
You will see the list in chat and the footer:
<<< Previous <<< Showing page ../.. >>> Next >>>
Expected behavior
I expected not to see any hover text and click event in the second part of the message, because "Footer" parameter in en.yml does not contain it.
Other information (more details)
en.yml
contains:The en.yml was not modified. It is come from plugin jar-file.
The "footer" message is a json object. I have formated it here to make easy to read it:
As we see, there are 3 main sections (previous, current, next) The second section (current) does not contain "clickEvent" and "hoverEvent" components. Therefore I expected to see 3 parts of the message with next functionality:
But I see the second part "Showing page ../.." also with hover and click event from the first part 😟
IMHO: I think there is a bug with parsing json from the string. As I understood "PluginLib" from your jar-file do it using predefined schema for chat message. And it does not clear the previous component attributes while parsing the next one. If I set "clickEvent" and "hoverEvent" in the second section with properly formed values, then I will see them on the client. If I set "clickEvent" and "hoverEvent" to null values, then I see the exception like:
com.google.gson.JsonSyntaxException: Expected clickEvent to be a JsonObject, was null (json)
if I delete "clickEvent" and "hoverEvent" (as in original en.yml) or set them to empty object likeclickEvent: {}
then I will see them again with values from the first part of the message