Skip to content

ShopDelete & ShopCreate SSE #43

@Iliuyux

Description

@Iliuyux

It would be great to add ShopCreate and ShopDelete events. Right now there is no way to get real-time updates without waiting out the one hour cooldown on the shop endpoint. Something like this:

    @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
    public void onShopCreate(ShopCreateEvent event) {
        Shop shop = event.shop().orElse(null);
        if (shop == null) {
            return;
        }
        UUID owner = shop.getOwner().getUniqueId();
        if (owner == null ) {
            return;
        }

        JsonObject message = new JsonObject();
        message.add("shop", EndpointUtils.getShopObject(shop));
        sse.sendEvent("ShopCreated", message, owner);
    }

    @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
    public void onShopDelete(ShopDeleteEvent event) {
        Shop shop = event.shop().orElse(null);
        if (shop == null) {
            return;
        }
        UUID owner = shop.getOwner().getUniqueId();
        if (owner == null ) {
            return;
        }

        JsonObject message = new JsonObject();
        message.add("shop", EndpointUtils.getShopObject(shop));
        sse.sendEvent("ShopDeleted", message, owner);
    }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions