Uploaded image for project: 'Spigot'
  1. Spigot
  2. SPIGOT-6587

Armorstand throw error when get drop change in ArmorContent

    XMLWordPrintable

Details

    • Bug
    • Status: Resolved (View Workflow)
    • Major
    • Resolution: Fixed
    • None
    • None
    • None
    • CraftBukkit version 3156-Spigot-cd36723-1c39efa (MC: 1.17) (Implementing API version 1.17-R0.1-SNAPSHOT)
    • Yes

    Description

      If you try to get the dropchance of any ArmorContent in a ArmorStand the server return a error for cast.

       

      [21:55:00] [Server thread/INFO]: MrDoc94 issued server command: /dtest 1
      [21:55:00] [Server thread/ERROR]: null
      org.bukkit.command.CommandException: Unhandled exception executing command 'dtest' in plugin Test v1.0-SNAPSHOT
              at org.bukkit.command.PluginCommand.execute(PluginCommand.java:47) ~[spigot-1.17.jar:3156-Spigot-cd36723-1c39efa]
              at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:149) ~[spigot-1.17.jar:3156-Spigot-cd36723-1c39efa]
              at org.bukkit.craftbukkit.v1_17_R1.CraftServer.dispatchCommand(CraftServer.java:760) ~[spigot-1.17.jar:3156-Spigot-cd36723-1c39efa]
              at net.minecraft.server.network.PlayerConnection.handleCommand(PlayerConnection.java:1944) ~[spigot-1.17.jar:3156-Spigot-cd36723-1c39efa]
              at net.minecraft.server.network.PlayerConnection.a(PlayerConnection.java:1783) ~[spigot-1.17.jar:3156-Spigot-cd36723-1c39efa]
              at net.minecraft.server.network.PlayerConnection.a(PlayerConnection.java:1764) ~[spigot-1.17.jar:3156-Spigot-cd36723-1c39efa]
              at net.minecraft.network.protocol.game.PacketPlayInChat.a(PacketPlayInChat.java:46) ~[spigot-1.17.jar:3156-Spigot-cd36723-1c39efa]
              at net.minecraft.network.protocol.game.PacketPlayInChat.a(PacketPlayInChat.java:1) ~[spigot-1.17.jar:3156-Spigot-cd36723-1c39efa]
              at net.minecraft.network.protocol.PlayerConnectionUtils.lambda$0(PlayerConnectionUtils.java:30) ~[spigot-1.17.jar:3156-Spigot-cd36723-1c39efa]
              at net.minecraft.server.TickTask.run(SourceFile:18) ~[spigot-1.17.jar:3156-Spigot-cd36723-1c39efa]
              at net.minecraft.util.thread.IAsyncTaskHandler.executeTask(SourceFile:151) ~[spigot-1.17.jar:3156-Spigot-cd36723-1c39efa]
              at net.minecraft.util.thread.IAsyncTaskHandlerReentrant.executeTask(SourceFile:23) ~[spigot-1.17.jar:3156-Spigot-cd36723-1c39efa]
              at net.minecraft.util.thread.IAsyncTaskHandler.executeNext(SourceFile:125) ~[spigot-1.17.jar:3156-Spigot-cd36723-1c39efa]
              at net.minecraft.server.MinecraftServer.bg(MinecraftServer.java:1125) ~[spigot-1.17.jar:3156-Spigot-cd36723-1c39efa]
              at net.minecraft.server.MinecraftServer.executeNext(MinecraftServer.java:1118) ~[spigot-1.17.jar:3156-Spigot-cd36723-1c39efa]
              at net.minecraft.util.thread.IAsyncTaskHandler.awaitTasks(SourceFile:134) ~[spigot-1.17.jar:3156-Spigot-cd36723-1c39efa]
              at net.minecraft.server.MinecraftServer.sleepForTick(MinecraftServer.java:1102) ~[spigot-1.17.jar:3156-Spigot-cd36723-1c39efa]
              at net.minecraft.server.MinecraftServer.x(MinecraftServer.java:1031) ~[spigot-1.17.jar:3156-Spigot-cd36723-1c39efa]
              at net.minecraft.server.MinecraftServer.lambda$0(MinecraftServer.java:307) ~[spigot-1.17.jar:3156-Spigot-cd36723-1c39efa]
              at java.lang.Thread.run(Thread.java:831) [?:?]
      Caused by: java.lang.ClassCastException: class net.minecraft.world.entity.decoration.EntityArmorStand cannot be cast to class net.minecraft.world.entity.EntityInsentient (net.minecraft.world.entity.decoration.EntityArmorStand and net.minecraft.world.entity.EntityInsentient are in unnamed module of loader 'app')
              at org.bukkit.craftbukkit.v1_17_R1.inventory.CraftEntityEquipment.getDropChance(CraftEntityEquipment.java:259) ~[spigot-1.17.jar:3156-Spigot-cd36723-1c39efa]
              at org.bukkit.craftbukkit.v1_17_R1.inventory.CraftEntityEquipment.getItemInMainHandDropChance(CraftEntityEquipment.java:191) ~[spigot-1.17.jar:3156-Spigot-cd36723-1c39efa]
              at test.test.Test.onCommand(Test.java:44) ~[?:?]
              at org.bukkit.command.PluginCommand.execute(PluginCommand.java:45) ~[spigot-1.17.jar:3156-Spigot-cd36723-1c39efa]
              ... 19 more
      [21:56:23] [Server thread/INFO]: MrDoc94 issued server command: /version
      

      Code used:

       

      ArmorStand armorStand = player.getWorld().spawn(player.getLocation(), ArmorStand.class);
      
      player.sendMessage(armorStand.getEquipment().getItemInMainHand().toString());
      player.sendMessage(Float.toString(armorStand.getEquipment().getItemInMainHandDropChance())); //throw error
      

       

      Attachments

        Activity

          People

            Unassigned Unassigned
            MrDoc94 Doc
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: