WesJD / AnvilGUI

Capture user input in Minecraft through an anvil GUI in under 20 lines of code
MIT License
475 stars 114 forks source link

Problem with example #305

Closed Blandss closed 10 months ago

Blandss commented 10 months ago

Hi, I'm using public repositories for the first time in a long time and I can't solve this problem:

[16:29:21 ERROR]: [modmenu] Failed to register events for class com.blandplugins.ModMenu.BanInventory because net/wesjd/anvilgui/AnvilGUI$StateSnapshot does not exist.

There is my code:


            } else if (clickedItem.getItemMeta().getDisplayName().equals("§f§lBETA §c§lWybierz inną konfigurację kary")) {
                // Otwieranie kowadła dla gracza
                new AnvilGUI.Builder()
                    .onClose(stateSnapshot -> {
                        stateSnapshot.getPlayer().sendMessage("You closed the inventory.");
                    })
                    .onClick((slot, stateSnapshot) -> {
                        if(slot != AnvilGUI.Slot.OUTPUT) {
                            return Collections.emptyList();
                        }

                        if(stateSnapshot.getText().equalsIgnoreCase("you")) {
                            stateSnapshot.getPlayer().sendMessage("You have magical powers!");
                            return Arrays.asList(AnvilGUI.ResponseAction.close());
                        } else {
                            return Arrays.asList(AnvilGUI.ResponseAction.replaceInputText("Try again"));
                        }
                    })
                    .preventClose()                                                    //prevents the inventory from being closed
                    .text("What is the meaning of life?")                              //sets the text the GUI should start with
                    .title("Enter your answer.")                                       //set the title of the GUI (only works in 1.14+)
                    .plugin(plugin)                                          //set the plugin instance
                    .open(player);  
            }

And pom.xml:

    <repositories>
        <!-- This adds the Spigot Maven repository to the build -->
        <repository>
            <id>spigot-repo</id>
            <url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
        </repository>
    <repository>
        <id>codemc-snapshots</id>
        <url>https://repo.codemc.io/repository/maven-snapshots/</url>
    </repository>
    </repositories>

        <dependencies>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.11</version>
            <scope>test</scope>
        </dependency>
        <!--This adds the Spigot API artifact to the build -->
        <dependency>
            <groupId>org.spigotmc</groupId>
            <artifactId>spigot-api</artifactId>
            <version>1.20.1-R0.1-SNAPSHOT</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>net.wesjd</groupId>
            <artifactId>anvilgui</artifactId>
            <version>1.9.0-SNAPSHOT</version>
        </dependency>
    </dependencies>