Skip to content

[Bug] not work on mohist 1.20.1 #27

Description

@adamejzak

API version

2.5.0

Server software and version

Mohist 1.20.1 banner-1.20.1-800

Steps to reproduce

When I use SignGui on Mohist, I get an error, but when I use it on Spigot, everything works.

Expected behaviour

that it would work

What is actually happening?

[19:10:46] [Server thread/INFO]: ajzak_ issued server command: /testowanko
[19:10:47] [Server thread/ERROR]: null
org.bukkit.command.CommandException: Unhandled exception executing command 'testowanko' in plugin ajzakSMP v1.0-SNAPSHOT
        at org.bukkit.command.PluginCommand.execute(PluginCommand.java:48) ~[banner-api-1.20.1-800-bc9e50a9c613117a.jar:?]
        at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:149) ~[banner-api-1.20.1-800-bc9e50a9c613117a.jar:?]
        at org.bukkit.craftbukkit.v1_20_R1.CraftServer.dispatchCommand(CraftServer.java:900) ~[1.20.1-800.jar:?]
        at org.bukkit.craftbukkit.v1_20_R1.command.BukkitCommandWrapper.run(BukkitCommandWrapper.java:51) ~[1.20.1-800.jar:?]
        at com.mojang.brigadier.CommandDispatcher.execute(CommandDispatcher.java:841) ~[brigadier-1.1.8.jar:?]
        at net.minecraft.commands.Commands.performCommand(Commands.java:287) ~[server-intermediary.jar:?]
        at net.minecraft.server.network.ServerGamePacketListenerImpl.performChatCommand(ServerGamePacketListenerImpl.java:3135) ~[server-intermediary.jar:?]
        at net.minecraft.server.network.ServerGamePacketListenerImpl.lambda$handleChatCommand$11(ServerGamePacketListenerImpl.java:1321) ~[server-intermediary.jar:?]
        at net.minecraft.util.thread.BlockableEventLoop.lambda$submitAsync$0(BlockableEventLoop.java:67) ~[server-intermediary.jar:?]
        at java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1768) ~[?:?]
        at net.minecraft.server.TickTask.run(TickTask.java:18) ~[server-intermediary.jar:?]
        at net.minecraft.util.thread.BlockableEventLoop.doRunTask(BlockableEventLoop.java:156) ~[server-intermediary.jar:?]
        at net.minecraft.util.thread.ReentrantBlockableEventLoop.doRunTask(ReentrantBlockableEventLoop.java:23) ~[server-intermediary.jar:?]
        at net.minecraft.server.MinecraftServer.doRunTask(MinecraftServer.java:782) ~[server-intermediary.jar:?]
        at net.minecraft.server.MinecraftServer.doRunTask(MinecraftServer.java:164) ~[server-intermediary.jar:?]
        at net.minecraft.util.thread.BlockableEventLoop.pollTask(BlockableEventLoop.java:130) ~[server-intermediary.jar:?]
        at net.minecraft.server.MinecraftServer.pollTaskInternal(MinecraftServer.java:764) ~[server-intermediary.jar:?]
        at net.minecraft.server.MinecraftServer.pollTask(MinecraftServer.java:758) ~[server-intermediary.jar:?]
        at net.minecraft.util.thread.BlockableEventLoop.managedBlock(BlockableEventLoop.java:139) ~[server-intermediary.jar:?]
        at net.minecraft.server.MinecraftServer.waitUntilNextTick(MinecraftServer.java:743) ~[server-intermediary.jar:?]
        at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:2106) ~[server-intermediary.jar:?]
        at net.minecraft.server.MinecraftServer.lambda$spin$2(MinecraftServer.java:265) ~[server-intermediary.jar:?]
        at java.lang.Thread.run(Thread.java:1583) ~[?:?]
Caused by: java.lang.NoSuchMethodError: 'net.minecraft.network.protocol.game.ClientboundBlockEntityDataPacket net.minecraft.world.level.block.entity.SignBlockEntity.getUpdatePacket()'
        at de.rapha149.signgui.version.Wrapper1_20_R1.lambda$openSignEditor$0(Wrapper1_20_R1.java:101) ~[?:?]
        at de.rapha149.signgui.version.Wrapper1_20_R1.openSignEditor(Wrapper1_20_R1.java:136) ~[?:?]
        at de.rapha149.signgui.SignGUI.open(SignGUI.java:70) ~[?:?]
        at pl.ajzak.smp.commands.TestowankoCommand.onCommand(TestowankoCommand.java:81) ~[?:?]
        at org.bukkit.command.PluginCommand.execute(PluginCommand.java:46) ~[banner-api-1.20.1-800-bc9e50a9c613117a.jar:?]
        ... 22 more

Code snippets


import de.rapha149.signgui.SignGUI;
import de.rapha149.signgui.SignGUIAction;
import org.bukkit.Bukkit;
import org.bukkit.DyeColor;
import org.bukkit.Material;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import pl.ajzak.smp.ajzakSMP;
import pl.ajzak.smp.utils.VirtualSign;

import java.util.Collections;
import java.util.List;

public class TestowankoCommand implements CommandExecutor {
    private final ajzakSMP plugin;

    public TestowankoCommand(ajzakSMP plugin) {
        this.plugin = plugin;
    }

    @Override
    public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
        if (!(sender instanceof Player player)) {
            sender.sendMessage("§cTylko gracze mogą używać tej komendy!");
            return true;
        }

        try {
            SignGUI gui = SignGUI.builder()
                // set lines
                .setLines("§6Line 1", null, "§6Line 3")

                // set specific line, starting index is 0
                .setLine(3, "Line 4")

                // set the sign type
                .setType(Material.DARK_OAK_SIGN)

                // set the sign color
                .setColor(DyeColor.YELLOW)

                // set the handler/listener (called when the player finishes editing)
                .setHandler((p, result) -> {
                    // get a speficic line, starting index is 0
                    String line0 = result.getLine(0);

                    // get a specific line without color codes
                    String line1 = result.getLineWithoutColor(1);

                    // get all lines
                    String[] lines = result.getLines();

                    // get all lines without color codes
                    String[] linesWithoutColor = result.getLinesWithoutColor();

                    if (line1.isEmpty()) {
                        // The user has not entered anything on line 2, so we open the sign again
                        return List.of(SignGUIAction.displayNewLines("§6Line 1", null, "§6Line 3", "Line 4"));
                    }

                    if (line1.equals("inv")) {
                        // close the sign and open an inventory
                        return List.of(
                                // "this" = your JavaPlugin instance
                                SignGUIAction.openInventory(ajzakSMP.getInstance(), Bukkit.createInventory(player, 27)),
                                SignGUIAction.run(() -> player.sendMessage("Inventory opened!"))
                        );
                    }

                    // Just close the sign by not returning any actions
                    return Collections.emptyList();
                })

                // build the SignGUI
                .build();

            gui.open(player);
        } catch (de.rapha149.signgui.exception.SignGUIVersionException e) {
            player.sendMessage("§cNiepowodzenie: obsługa GUI nie jest obsługiwana w tej wersji!");
            e.printStackTrace();
        }


        return true;
    }
    
}```

### Any additional comments?

_No response_

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions