Andavin / Images

A custom image loading plugin for Spigot.
65 stars 30 forks source link

Suggestion: API & onCustomImageInteractEvent & Image Names #62

Open RandomTomato opened 1 year ago

RandomTomato commented 1 year ago

Hello, My suggestion is to add a basic API implementation, an CustomImageInteractEvent & Image Names that players can utilize. This is so players can listen to player interaction with loaded images in a official way rather having to use unofficial packet listening. (Below is an example of why the CustomImageInteractEvent would be so useful)

Example Event Code:

    @EventHandler
    public void onCustomImageInteract(CustomImageInteractEvent event) {
        if (event.getAction() == Action.RIGHT_CLICK) {
            CustomImage image = CustomImage.get(event.getEntityId()); // I am not too familiar with your get method but this is a substitute
            if (image.getName().equals("Quest Board")) { // If the name of the image is Quest Board
                // Do things here
                // In my case would be open the quest board
            }
        }
    }

In my case, this would allow me to detect when players click on my quest board on my server (which can be seen below)

Quest Board:

alt text

Let me know what you think of these suggestions and I could possibly help with adding these if needed!

Thanks RandomTomato