Add a graphical interface for editing inventory triggers
gerzytet opened this issue ยท 2 comments
The editing interface should do the following:
- Register a /trg i command to open the interface
- Allow removing and placing items, just like a chest!
- When the interface is closed, it should open a prompt in chat asking if they want to save the changes, discard the changes, or keep working (the keep working option enables people to get items from elsewhere, then continue editing once they click the option).
The most tedious part of using trg's inventory triggers isn't coding the trigger, it's usually placing the items, one by one using commands. This is especially true when columns, borders, and large areas of items are used. #187 tried to address this in a simple way, but a more versatile, visual solution would be even better.
Just to be clear, this is NOT the same as #191. That proposes an editing mode for people who trigger an inventory trigger. This issue is about improving on the methods for server operators to permanently edit an inventory trigger.
@wysohn
Implementation details as of eced35c
The command to start the inventory edit is /trg i edititems
The clickable prompt in chat uses these 3 commands:
/trg links inveditsave
/trg links inveditdiscaed
/trg links inveditcontinue
The clickable prompt, however, uses /tellraw from the console to display itself to the player. All other options require other dependencies, which I don't know how to add.
Related:
https://bukkit.org/threads/clickable-text.351984/
https://www.spigotmc.org/threads/clickable-text.54628/
https://www.spigotmc.org/threads/how-do-i-send-a-player-a-json-message.263738/
https://bukkit.org/threads/json-chat-lib-easily-create-and-send-json-messages-to-players.188165/
Perhaps one option is to support it optionally only if JSON message API is available? Take a look at the APISupport class https://github.com/wysohn/TriggerReactor/blob/master/bukkit/latest/src/main/java/io/github/wysohn/triggerreactor/bukkit/manager/trigger/share/api/APISupport.java
I remember Sponge has built in support for Json messages, so it would be easier in sponge.