Search in sources :

Example 1 with IMixinClickEvent

use of org.spongepowered.common.interfaces.text.IMixinClickEvent in project SpongeCommon by SpongePowered.

the class SpongeClickAction method getHandle.

public static ClickEvent getHandle(ClickAction<?> action) {
    final String text;
    if (action instanceof ClickAction.ExecuteCallback) {
        UUID callbackId = SpongeCallbackHolder.getInstance().getOrCreateIdForCallback(((ClickAction.ExecuteCallback) action).getResult());
        text = SpongeCallbackHolder.CALLBACK_COMMAND_QUALIFIED + " " + callbackId;
    } else {
        text = action.getResult().toString();
    }
    ClickEvent event = new ClickEvent(getType(action), text);
    ((IMixinClickEvent) event).setHandle(action);
    return event;
}
Also used : ClickAction(org.spongepowered.api.text.action.ClickAction) IMixinClickEvent(org.spongepowered.common.interfaces.text.IMixinClickEvent) ClickEvent(net.minecraft.util.text.event.ClickEvent) IMixinClickEvent(org.spongepowered.common.interfaces.text.IMixinClickEvent) UUID(java.util.UUID)

Aggregations

UUID (java.util.UUID)1 ClickEvent (net.minecraft.util.text.event.ClickEvent)1 ClickAction (org.spongepowered.api.text.action.ClickAction)1 IMixinClickEvent (org.spongepowered.common.interfaces.text.IMixinClickEvent)1