Skip to content

Cant shift click items into Workbench GUI #101

@RotzRohr

Description

@RotzRohr

Cant shift click items into Workbench GUI
Version 1.19.4 Paper

public final class Test extends JavaPlugin implements Listener
{
    Listener playerClick;
    @EventHandler
    public void onJoin(org.bukkit.event.player.PlayerJoinEvent event)
    {
        event.getPlayer().sendMessage("Welcome to the server!");
        //after 3sec send message "Hello"
        getServer().getScheduler().scheduleSyncDelayedTask(this, () -> CraftingTable.open(event.getPlayer()), 60L);
    }

    @Override
    public void onEnable() {
        // Plugin startup logic
        getServer().getPluginManager().registerEvents(this, this);


    }

    @Override
    public void onDisable() {
        // Plugin shutdown logic
    }
}

public class CraftingTable {
    private static Gui gui = Gui.gui()
            .title(Component.text("Custom Workbench!"))
            .type(GuiType.WORKBENCH).enableAllInteractions()
            .create();
    public static void open(Player player)
    {
        gui.setDefaultClickAction(event -> {
            System.out.println("Clicked in GUI! setDefaultClickAction");
        });
        gui.setCloseGuiAction(event -> {
            System.out.println("Closed GUI! setCloseGuiAction");
        });
        gui.setDefaultTopClickAction(event -> {
            System.out.println("Clicked in GUI! setDefaultTopClickAction");
        });
        gui.setDragAction(event -> {
            System.out.println("Dragged in GUI! setDragAction");
        });
        gui.setOutsideClickAction(event -> {
            System.out.println("Clicked outside GUI! setOutsideClickAction");
        });
        gui.setPlayerInventoryAction(event -> {
            System.out.println("Clicked in GUI! setPlayerInventoryAction");
        });
        gui.setOpenGuiAction(event -> {
            System.out.println("Opened GUI! setOpenGuiAction");
        });

        gui.open(player);
    }
}

Proof Video YouTube

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions