-
Bug
-
Resolution: Duplicate
-
Minor
-
None
-
None
-
None
-
Windows 10 Java jdk 14
-
1.16.1
-
StaffCore
-
Yes
It's super weird, because it only happens when it is in the PlayerInteractEvent, otherwise, when i execute the command with the same lines nothing happens, meaning, no errors. But when the event try the same it shuts down:/
The Error:
[00:57:32] [Server thread/ERROR]: Encountered an unexpected exception
java.lang.AssertionError: TRAP
at net.minecraft.server.v1_16_R1.ItemStack.checkEmpty(ItemStack.java:99) ~[spigot-1.16.1.jar:git-Spigot-9639cf7-c3a22e7]
at net.minecraft.server.v1_16_R1.ItemStack.setCount(ItemStack.java:884) ~[spigot-1.16.1.jar:git-Spigot-9639cf7-c3a22e7]
at net.minecraft.server.v1_16_R1.PlayerInteractManager.a(PlayerInteractManager.java:407) ~[spigot-1.16.1.jar:git-Spigot-9639cf7-c3a22e7]
at net.minecraft.server.v1_16_R1.PlayerConnection.a(PlayerConnection.java:1353) ~[spigot-1.16.1.jar:git-Spigot-9639cf7-c3a22e7]
at net.minecraft.server.v1_16_R1.PacketPlayInBlockPlace.a(PacketPlayInBlockPlace.java:28) ~[spigot-1.16.1.jar:git-Spigot-9639cf7-c3a22e7]
at net.minecraft.server.v1_16_R1.PacketPlayInBlockPlace.a(PacketPlayInBlockPlace.java:1) ~[spigot-1.16.1.jar:git-Spigot-9639cf7-c3a22e7]
at net.minecraft.server.v1_16_R1.PlayerConnectionUtils.lambda$0(PlayerConnectionUtils.java:19) ~[spigot-1.16.1.jar:git-Spigot-9639cf7-c3a22e7]
at net.minecraft.server.v1_16_R1.TickTask.run(SourceFile:18) ~[spigot-1.16.1.jar:git-Spigot-9639cf7-c3a22e7]
at net.minecraft.server.v1_16_R1.IAsyncTaskHandler.executeTask(SourceFile:144) ~[spigot-1.16.1.jar:git-Spigot-9639cf7-c3a22e7]
at net.minecraft.server.v1_16_R1.IAsyncTaskHandlerReentrant.executeTask(SourceFile:23) ~[spigot-1.16.1.jar:git-Spigot-9639cf7-c3a22e7]
at net.minecraft.server.v1_16_R1.IAsyncTaskHandler.executeNext(SourceFile:118) ~[spigot-1.16.1.jar:git-Spigot-9639cf7-c3a22e7]
at net.minecraft.server.v1_16_R1.MinecraftServer.aZ(MinecraftServer.java:943) ~[spigot-1.16.1.jar:git-Spigot-9639cf7-c3a22e7]
at net.minecraft.server.v1_16_R1.MinecraftServer.executeNext(MinecraftServer.java:936) ~[spigot-1.16.1.jar:git-Spigot-9639cf7-c3a22e7]
at net.minecraft.server.v1_16_R1.IAsyncTaskHandler.awaitTasks(SourceFile:127) ~[spigot-1.16.1.jar:git-Spigot-9639cf7-c3a22e7]
at net.minecraft.server.v1_16_R1.MinecraftServer.sleepForTick(MinecraftServer.java:920) ~[spigot-1.16.1.jar:git-Spigot-9639cf7-c3a22e7]
at net.minecraft.server.v1_16_R1.MinecraftServer.v(MinecraftServer.java:852) ~[spigot-1.16.1.jar:git-Spigot-9639cf7-c3a22e7]
at net.minecraft.server.v1_16_R1.MinecraftServer.lambda$0(MinecraftServer.java:164) ~[spigot-1.16.1.jar:git-Spigot-9639cf7-c3a22e7]
at java.lang.Thread.run(Thread.java:832) [?:?]
[00:57:32] [Server thread/ERROR]: This crash report has been saved to: C:\Users\barra\Desktop\server Test\.\crash-reports\crash-2020-08-06_00.57.32-server.txt
[00:57:32] [Server thread/INFO]: Stopping server
The code:
@EventHandler
public void onPlayerClicks(PlayerInteractEvent event) {
Player p = event.getPlayer();
Action a = event.getAction();
PersistentDataContainer PlayerData = p.getPersistentDataContainer();
if (event.getHand() == EquipmentSlot.OFF_HAND)
else if (/a.equals(Action.RIGHT_CLICK_AIR) ||/ a.equals(Action.RIGHT_CLICK_BLOCK)) {
if (PlayerData.has(new NamespacedKey(plugin, "staff"), PersistentDataType.STRING)) {
if(event.getItem().getType() == Material.AIR) return;
else if (p.getInventory().getItemInMainHand().getType() == Material.RED_DYE && p.getInventory().getItemInMainHand().getItemMeta().hasLore()) {
/*lore.clear();
p.getInventory().setContents((ItemStack[]) plugin.saveinv.get(p.getName()));
p.getInventory().setArmorContents((ItemStack[]) plugin.savearmor.get(p.getName()));*/
lore.clear();/*
if(p.getInventory().contains(vanishOn))
if(p.getInventory().contains(vanishOn))
{ p.getInventory().remove(vanishOn); }if(p.getInventory().contains(vanishOn))
{ p.getInventory().remove(vanishOff); }*/
p.getInventory().clear();
p.getInventory().setContents((ItemStack[]) plugin.saveinv.get(p.getName()));
p.getInventory().setArmorContents((ItemStack[]) plugin.savearmor.get(p.getName()));
PlayerData.remove(new NamespacedKey(plugin, "staff"));
Bukkit.dispatchCommand(Bukkit.getServer().getConsoleSender(),"v "+p.getName());
return;
}
}
}
}
- duplicates
-
SPIGOT-3020 Exception when set item in main hand to AIR on PlayerInteractEvent
- Resolved