Error executing task java.util.concurrent.ExecutionException: TRAP

Discussion in 'Spigot Plugin Development' started by Hocbum01, Aug 14, 2018.

  1. I everyone, i have this error and i think is when i delete an item in a player inventory.

    the error:
    Code (Text):

    Error executing task
    java.util.concurrent.ExecutionException: java.lang.AssertionError: TRAP
            at java.util.concurrent.FutureTask.report(FutureTask.java:122) ~[?:1.8.0_171]
            at java.util.concurrent.FutureTask.get(FutureTask.java:192) ~[?:1.8.0_171]
            at net.minecraft.server.v1_12_R1.SystemUtils.a(SourceFile:47) [spigot-1.12.2.jar:git-Spigot-2cf50f0-2b93d83]
            at net.minecraft.server.v1_12_R1.MinecraftServer.D(MinecraftServer.java:748) [spigot-1.12.2.jar:git-Spigot-2cf50f0-2b93d83]
            at net.minecraft.server.v1_12_R1.DedicatedServer.D(DedicatedServer.java:406) [spigot-1.12.2.jar:git-Spigot-2cf50f0-2b93d83]
            at net.minecraft.server.v1_12_R1.MinecraftServer.C(MinecraftServer.java:679) [spigot-1.12.2.jar:git-Spigot-2cf50f0-2b93d83]
            at net.minecraft.server.v1_12_R1.MinecraftServer.run(MinecraftServer.java:577) [spigot-1.12.2.jar:git-Spigot-2cf50f0-2b93d83]
            at java.lang.Thread.run(Thread.java:748) [?:1.8.0_171]
    Caused by: java.lang.AssertionError: TRAP
            at net.minecraft.server.v1_12_R1.ItemStack.F(ItemStack.java:100) ~[spigot-1.12.2.jar:git-Spigot-2cf50f0-2b93d83]
            at net.minecraft.server.v1_12_R1.ItemStack.setCount(ItemStack.java:839) ~[spigot-1.12.2.jar:git-Spigot-2cf50f0-2b93d83]
            at net.minecraft.server.v1_12_R1.PlayerInteractManager.a(PlayerInteractManager.java:413) ~[spigot-1.12.2.jar:git-Spigot-2cf50f0-2b93d83]
            at net.minecraft.server.v1_12_R1.PlayerConnection.a(PlayerConnection.java:1004) ~[spigot-1.12.2.jar:git-Spigot-2cf50f0-2b93d83]
            at net.minecraft.server.v1_12_R1.PacketPlayInBlockPlace.a(PacketPlayInBlockPlace.java:26) ~[spigot-1.12.2.jar:git-Spigot-2cf50f0-2b93d83]
            at net.minecraft.server.v1_12_R1.PacketPlayInBlockPlace.a(PacketPlayInBlockPlace.java:1) ~[spigot-1.12.2.jar:git-Spigot-2cf50f0-2b93d83]
            at net.minecraft.server.v1_12_R1.PlayerConnectionUtils$1.run(SourceFile:13) ~[spigot-1.12.2.jar:git-Spigot-2cf50f0-2b93d83]
            at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) ~[?:1.8.0_171]
            at java.util.concurrent.FutureTask.run(FutureTask.java:266) ~[?:1.8.0_171]
            at net.minecraft.server.v1_12_R1.SystemUtils.a(SourceFile:46) ~[spigot-1.12.2.jar:git-Spigot-2cf50f0-2b93d83]
            ... 5 more

     
    and the code that generate this error:
    Code (Text):

    public class Menu extends CommandExecute implements Listener, CommandExecutor {

        Plugin plugin = Main.getPlugin(Main.class);

        public Beziada beziada = new Beziada();
        public Zovire zovire = new Zovire();
        public Sabatia sabatia = new Sabatia();
        public Monarca monarca = new Monarca();
        public Chirizia chirizia = new Chirizia();
        public Capitale capitale = new Capitale();
        public Log log = new Log();

        @EventHandler
        public void signClick(PlayerInteractEvent event) {
            Player player = event.getPlayer();
            Block clickedBlock = event.getClickedBlock();
            BlockState state = null;
            if (clickedBlock != null) {
                state = clickedBlock.getState();
            }

            ItemStack Beziada = beziada.Biglietto();
            ItemStack Zovire = zovire.Biglietto();
            ItemStack Sabatia = sabatia.Biglietto();
            ItemStack Monarca = monarca.Biglietto();
            ItemStack Chirizia = chirizia.Biglietto();
            ItemStack Capitale = capitale.Biglietto();

            Action action = event.getAction();
            ItemStack item = event.getItem();

            if (action.equals(Action.RIGHT_CLICK_AIR)) {
                if (item != null && item.getType() == Material.PAPER) {
                    if (item.getItemMeta().getDisplayName().equals(ChatColor.AQUA + "Beziada") && item.getItemMeta()
                            .getLore().get(0).equals(ChatColor.GRAY + "Prezzo: " + ChatColor.RED + "5$")) {
                        player.getInventory().removeItem(Beziada);
                        player.updateInventory();
                        int M = beziada.Estrazione(player);
                        SoldiM(M);
                        log.Usi(player.getName() + " ha usato un biglietto Beziada");
                    } else if (item.getItemMeta().getDisplayName().equals(ChatColor.AQUA + "Zovire") && item.getItemMeta()
                            .getLore().get(0).equals(ChatColor.GRAY + "Prezzo: " + ChatColor.RED + "10$")) {
                        player.getInventory().removeItem(Zovire);
                        player.updateInventory();
                        int M = zovire.Estrazione(player);
                        SoldiM(M);
                        log.Usi(player.getName() + " ha usato un biglietto Zovire");
                    } else if (item.getItemMeta().getDisplayName().equals(ChatColor.AQUA + "Sabatia") && item.getItemMeta()
                            .getLore().get(0).equals(ChatColor.GRAY + "Prezzo: " + ChatColor.RED + "15$")) {
                        player.getInventory().removeItem(Sabatia);
                        player.updateInventory();
                        int M = sabatia.Estrazione(player);
                        SoldiM(M);
                        log.Usi(player.getName() + " ha usato un biglietto Sabatia");
                    } else if (item.getItemMeta().getDisplayName().equals(ChatColor.AQUA + "Monarca") && item.getItemMeta()
                            .getLore().get(0).equals(ChatColor.GRAY + "Prezzo: " + ChatColor.RED + "20$")) {
                        player.getInventory().removeItem(Monarca);
                        player.updateInventory();
                        int M = monarca.Estrazione(player);
                        SoldiM(M);
                        log.Usi(player.getName() + " ha usato un biglietto Monarca");
                    } else if (item.getItemMeta().getDisplayName().equals(ChatColor.AQUA + "Chirizia") && item.getItemMeta()
                            .getLore().get(0).equals(ChatColor.GRAY + "Prezzo: " + ChatColor.RED + "30$")) {
                        player.getInventory().removeItem(Chirizia);
                        player.updateInventory();
                        int M = chirizia.Estrazione(player);
                        SoldiM(M);
                        log.Usi(player.getName() + " ha usato un biglietto Chirizia");
                    } else if (item.getItemMeta().getDisplayName().equals(ChatColor.AQUA + "Capitale") && item.getItemMeta()
                            .getLore().get(0).equals(ChatColor.GRAY + "Prezzo: " + ChatColor.RED + "50$")) {
                        player.getInventory().removeItem(Capitale);
                        player.updateInventory();
                        int M = capitale.Estrazione(player);
                        SoldiM(M);
                        log.Usi(player.getName() + " ha usato un biglietto Capitale");
                    }
                }
            } else if (state instanceof Sign) {
                Sign sign = (Sign) state;
                String line1 = ChatColor.stripColor(sign.getLine(0));
                if (line1.equalsIgnoreCase("[Lotteria]")) {
                    sign.setLine(0, ChatColor.DARK_BLUE + "" + ChatColor.BOLD + "[Lotteria]");
                    sign.update();
                    Lotteria(player);
                }
            }
        }
    }
     
    when i use the paper it gave me the error, please help me! thanks
    (plugin version 1.12.2)