Lorenzo0111 / QualityArmory

A quality gun plugin similar to CrackShot.
GNU General Public License v3.0
96 stars 50 forks source link

[Bug]: I met some problem when I try to use ironsight #594

Open python123flask opened 2 hours ago

python123flask commented 2 hours ago

Confirmations

What happened?

When I use it , I found that sometimes the ironsight would not work .

Expected Behaviour

[QualityArmory] Task #1210992 for QualityArmory v2.0.15 generated an exception java.lang.IllegalArgumentException: Cannot drop air at com.google.common.base.Preconditions.checkArgument(Preconditions.java:145) ~[guava-31.1-jre.jar:?] at net.minecraft.world.entity.item.EntityItem.a(EntityItem.java:488) ~[spigot-1.20.1-R0.1-SNAPSHOT.jar:3844-Spigot-b41c46d-c335a55] at net.minecraft.world.entity.item.EntityItem.(EntityItem.java:73) ~[spigot-1.20.1-R0.1-SNAPSHOT.jar:3844-Spigot-b41c46d-c335a55] at net.minecraft.world.entity.item.EntityItem.(EntityItem.java:66) ~[spigot-1.20.1-R0.1-SNAPSHOT.jar:3844-Spigot-b41c46d-c335a55] at org.bukkit.craftbukkit.v1_20_R1.CraftWorld.dropItem(CraftWorld.java:495) ~[spigot-1.20.1-R0.1-SNAPSHOT.jar:3844-Spigot-b41c46d-c335a55] at org.bukkit.craftbukkit.v1_20_R1.CraftWorld.dropItem(CraftWorld.java:487) ~[spigot-1.20.1-R0.1-SNAPSHOT.jar:3844-Spigot-b41c46d-c335a55] at me.zombie_striker.qg.handlers.IronsightsHandler.aim(IronsightsHandler.java:26) ~[?:?] at me.zombie_striker.qg.guns.utils.GunRefillerRunnable$1.run(GunRefillerRunnable.java:143) ~[?:?] at org.bukkit.craftbukkit.v1_20_R1.scheduler.CraftTask.run(CraftTask.java:82) ~[spigot-1.20.1-R0.1-SNAPSHOT.jar:3844-Spigot-b41c46d-c335a55] at org.bukkit.craftbukkit.v1_20_R1.scheduler.CraftScheduler.mainThreadHeartbeat(CraftScheduler.java:415) ~[spigot-1.20.1-R0.1-SNAPSHOT.jar:3844-Spigot-b41c46d-c335a55] at net.minecraft.server.MinecraftServer.b(MinecraftServer.java:1257) ~[spigot-1.20.1-R0.1-SNAPSHOT.jar:3844-Spigot-b41c46d-c335a55] at net.minecraft.server.dedicated.DedicatedServer.b(DedicatedServer.java:388) ~[spigot-1.20.1-R0.1-SNAPSHOT.jar:3844-Spigot-b41c46d-c335a55] at net.minecraft.server.MinecraftServer.a(MinecraftServer.java:1198) ~[spigot-1.20.1-R0.1-SNAPSHOT.jar:3844-Spigot-b41c46d-c335a55] at net.minecraft.server.MinecraftServer.w(MinecraftServer.java:1015) ~[spigot-1.20.1-R0.1-SNAPSHOT.jar:3844-Spigot-b41c46d-c335a55] at net.minecraft.server.MinecraftServer.lambda$0(MinecraftServer.java:304) ~[spigot-1.20.1-R0.1-SNAPSHOT.jar:3844-Spigot-b41c46d-c335a55] at java.lang.Thread.run(Thread.java:833) ~[?:?]

Plugins

plugin

Server Version

/1.20.1

Relevant log output

[QualityArmory] Task #1210992 for QualityArmory v2.0.15 generated an exception
java.lang.IllegalArgumentException: Cannot drop air
        at com.google.common.base.Preconditions.checkArgument(Preconditions.java:145) ~[guava-31.1-jre.jar:?]
        at net.minecraft.world.entity.item.EntityItem.a(EntityItem.java:488) ~[spigot-1.20.1-R0.1-SNAPSHOT.jar:3844-Spigot-b41c46d-c335a55]
        at net.minecraft.world.entity.item.EntityItem.<init>(EntityItem.java:73) ~[spigot-1.20.1-R0.1-SNAPSHOT.jar:3844-Spigot-b41c46d-c335a55]
        at net.minecraft.world.entity.item.EntityItem.<init>(EntityItem.java:66) ~[spigot-1.20.1-R0.1-SNAPSHOT.jar:3844-Spigot-b41c46d-c335a55]
        at org.bukkit.craftbukkit.v1_20_R1.CraftWorld.dropItem(CraftWorld.java:495) ~[spigot-1.20.1-R0.1-SNAPSHOT.jar:3844-Spigot-b41c46d-c335a55]
        at org.bukkit.craftbukkit.v1_20_R1.CraftWorld.dropItem(CraftWorld.java:487) ~[spigot-1.20.1-R0.1-SNAPSHOT.jar:3844-Spigot-b41c46d-c335a55]
        at me.zombie_striker.qg.handlers.IronsightsHandler.aim(IronsightsHandler.java:26) ~[?:?]
        at me.zombie_striker.qg.guns.utils.GunRefillerRunnable$1.run(GunRefillerRunnable.java:143) ~[?:?]
        at org.bukkit.craftbukkit.v1_20_R1.scheduler.CraftTask.run(CraftTask.java:82) ~[spigot-1.20.1-R0.1-SNAPSHOT.jar:3844-Spigot-b41c46d-c335a55]
        at org.bukkit.craftbukkit.v1_20_R1.scheduler.CraftScheduler.mainThreadHeartbeat(CraftScheduler.java:415) ~[spigot-1.20.1-R0.1-SNAPSHOT.jar:3844-Spigot-b41c46d-c335a55]
        at net.minecraft.server.MinecraftServer.b(MinecraftServer.java:1257) ~[spigot-1.20.1-R0.1-SNAPSHOT.jar:3844-Spigot-b41c46d-c335a55]
        at net.minecraft.server.dedicated.DedicatedServer.b(DedicatedServer.java:388) ~[spigot-1.20.1-R0.1-SNAPSHOT.jar:3844-Spigot-b41c46d-c335a55]
        at net.minecraft.server.MinecraftServer.a(MinecraftServer.java:1198) ~[spigot-1.20.1-R0.1-SNAPSHOT.jar:3844-Spigot-b41c46d-c335a55]
        at net.minecraft.server.MinecraftServer.w(MinecraftServer.java:1015) ~[spigot-1.20.1-R0.1-SNAPSHOT.jar:3844-Spigot-b41c46d-c335a55]
        at net.minecraft.server.MinecraftServer.lambda$0(MinecraftServer.java:304) ~[spigot-1.20.1-R0.1-SNAPSHOT.jar:3844-Spigot-b41c46d-c335a55]
        at java.lang.Thread.run(Thread.java:833) ~[?:?]
python123flask commented 2 hours ago

I think add this will help .thanks for your early reply. if (itemStack != null && itemStack.getType() != Material.AIR) { world.dropItem(itemStack); }