Essentials
Essentials copied to clipboard
Fire SignChangeEvent on /editsign
Information
This lets the /editsign command fire a SignChangeEvent when it's being executed, based on a new config option. It also contains a new translation key for when a plugin cancels the event.
Details
Proposed feature:
Currently essentials doesn't allow the /editsign command to interface with functional signs of other plugins like Craftbook, because they use the SignChangeEvent for recognizing when a sign is created. This adds a config option to let essentials fire this event and make other plugins aware of the change on the sign.
Environments tested:
OS: Windows Java version: OpenJdk 17
- [x] Most recent Paper version (1.18.1, git-Paper-216)
- [x] CraftBukkit/Spigot 1.12.2
- [x] CraftBukkit 1.8.8
Demonstration:
Test setup
I wrote a small plugin that has a 50% probability of cancelling the SignChangeEvent and that prints the lines that the event is trying to write in chat.
Tests
With the config option set to true and the event being let through:

With the config option set to true and the event being cancelled ("cancelling event" message is from the test plugin):

With the config option set to false:

(sorry that the essentials locale is set to german in the test setup)
Right 🤦 I did see that Paper has backward compatible versions of the constructor and a method to query the components in string form. The reason I implemented it the way I did is that I was concerned with what would happen when someone for example added a click event to one of the lines when the sign is created, using the paper api. Since that wouldn't be convertible to a string, the event would get lost when we apply the component from the event to the sign using the string methods.
If the above is not a big concern, I'll gladly change it in the way you suggested :)
Right 🤦 I did see that Paper has backward compatible versions of the constructor and a method to query the components in string form. The reason I implemented it the way I did is that I was concerned with what would happen when someone for example added a click event to one of the lines when the sign is created, using the paper api. Since that wouldn't be convertible to a string, the event would get lost when we apply the component from the event to the sign using the string methods.
If the above is not a big concern, I'll gladly change it in the way you suggested :)
The sign block is passed to the event so the click event would be checked by plugins that way
@RodneyMKay any progress on this?
@RodneyMKay do you still intend to make the proposed changes?
Superseded by #5304