iSach / UltraCosmetics

Lightweight, Fun and Easy-to-Use Spigot Cosmetics plugin. (Gadgets, etc)
https://www.spigotmc.org/resources/ultra-cosmetics-halloween-update.10905/
GNU Affero General Public License v3.0
165 stars 155 forks source link

Console Error when opening TreasureChest #590

Closed Chris6ix closed 2 years ago

Chris6ix commented 2 years ago

Check if the issue is fixed in dev builds

What steps will reproduce the issue?

  1. Open a Treasure Chest?

What was supposed to happen?

Treasure Chest opening on the first click and no Error

What happened instead?

One of my Players has an issue with opening Treasure Chests... When he clicks on it to open it, an Error (Pasted below) comes in the console and the chest opens, but gives no items....when he then clicks that chest again, the item comes...

It is weird because literally only one of my players have this issue...on all the other players it works perfectly without any errors...

I looked at it and that player does exactly what the others do...

This issue was also there with 2.6.1-DEV-b4, but I did not report it because I didn't use the latest version (Because I couldn't update my Server to 1.18.2) and thought that maybe a newer version would fix it...but I updated today to 1.18.2 and the latest UC version and the issue is still present

What version of UltraCosmetics are you using? Do not say 'latest'.

2.6.1-DEV-b11

What server distribution (Spigot, Paper, etc.) and what version are you using? Do not say 'latest'.

Paper version git-Paper-267 (MC: 1.18.2) (Implementing API version 1.18.2-R0.1-SNAPSHOT) (Git: e7d928a)

What plugins do you have installed?

Plugins (49): ArmoredElytra, BackToTheRoots, BetterConcrete, BetterTridents, BigDoors, Bookshelf, BreakingSlab, ClientDetector, CommandCooldown, DeluxeMenus, Duels, DynamicShop, dynmap, Essentials, EssentialsChat, ExecutableItems, FlyPerms, GSit, HolographicDisplays, HoloMobHealth, HomeGUI, InteractionVisualizer, JoinRules, KittenForever, LightAPI, LinkedPortals, LinksPlus, LuckPerms, Multiverse-Core, Multiverse-Inventories, NotTooExpensive, PL-Hide, PlaceholderAPI, PlayerPortal, PlayerWarps, Playtimes, ProtocolLib, QuickShop, RotationWrench, SCore, SilkSpawners, TAB, UltimateCatcher, UltimateTimber, UltraCosmetics, Vault, WorldEdit, WorldEditSelectionVisualizer, WorldGuard

Are there any errors in the console or in logs?

[20:51:50 ERROR]: Could not pass event PlayerInteractEvent to UltraCosmetics v2.6.1-DEV-b11 java.lang.IllegalArgumentException: bound must be positive at java.util.Random.nextInt(Random.java:322) ~[?:?] at java.util.concurrent.ThreadLocalRandom.nextInt(ThreadLocalRandom.java:449) ~[?:?] at be.isach.ultracosmetics.util.WeightedSet.getRandom(WeightedSet.java:19) ~[UltraCosmetics-2.6.1-DEV-b11.jar:?] at be.isach.ultracosmetics.treasurechests.TreasureRandomizer.giveRandomCosmetic(TreasureRandomizer.java:235) ~[UltraCosmetics-2.6.1-DEV-b11.jar:?] at be.isach.ultracosmetics.treasurechests.TreasureRandomizer.giveRandomThing(TreasureRandomizer.java:160) ~[UltraCosmetics-2.6.1-DEV-b11.jar:?] at be.isach.ultracosmetics.treasurechests.TreasureChest.onInter(TreasureChest.java:404) ~[UltraCosmetics-2.6.1-DEV-b11.jar:?] at com.destroystokyo.paper.event.executor.asm.generated.GeneratedEventExecutor798.execute(Unknown Source) ~[?:?] at org.bukkit.plugin.EventExecutor.lambda$create$1(EventExecutor.java:75) ~[paper-api-1.18.2-R0.1-SNAPSHOT.jar:?] at co.aikar.timings.TimedEventExecutor.execute(TimedEventExecutor.java:80) ~[paper-api-1.18.2-R0.1-SNAPSHOT.jar:git-Paper-267] at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:70) ~[paper-api-1.18.2-R0.1-SNAPSHOT.jar:?] at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:629) ~[paper-api-1.18.2-R0.1-SNAPSHOT.jar:?] at org.bukkit.craftbukkit.v1_18_R2.event.CraftEventFactory.callPlayerInteractEvent(CraftEventFactory.java:544) ~[paper-1.18.2.jar:git-Paper-267] at net.minecraft.server.level.ServerPlayerGameMode.useItemOn(ServerPlayerGameMode.java:552) ~[?:?] at net.minecraft.server.network.ServerGamePacketListenerImpl.handleUseItemOn(ServerGamePacketListenerImpl.java:1851) ~[?:?] at net.minecraft.network.protocol.game.ServerboundUseItemOnPacket.handle(ServerboundUseItemOnPacket.java:33) ~[?:?] at net.minecraft.network.protocol.game.ServerboundUseItemOnPacket.a(ServerboundUseItemOnPacket.java:9) ~[?:?] at net.minecraft.network.protocol.PacketUtils.lambda$ensureRunningOnSameThread$1(PacketUtils.java:51) ~[?:?] at net.minecraft.server.TickTask.run(TickTask.java:18) ~[paper-1.18.2.jar:git-Paper-267] at net.minecraft.util.thread.BlockableEventLoop.doRunTask(BlockableEventLoop.java:153) ~[?:?] at net.minecraft.util.thread.ReentrantBlockableEventLoop.doRunTask(ReentrantBlockableEventLoop.java:23) ~[?:?] at net.minecraft.server.MinecraftServer.doRunTask(MinecraftServer.java:1399) ~[paper-1.18.2.jar:git-Paper-267] at net.minecraft.server.MinecraftServer.d(MinecraftServer.java:188) ~[paper-1.18.2.jar:git-Paper-267] at net.minecraft.util.thread.BlockableEventLoop.pollTask(BlockableEventLoop.java:126) ~[?:?] at net.minecraft.server.MinecraftServer.pollTaskInternal(MinecraftServer.java:1376) ~[paper-1.18.2.jar:git-Paper-267] at net.minecraft.server.MinecraftServer.pollTask(MinecraftServer.java:1369) ~[paper-1.18.2.jar:git-Paper-267] at net.minecraft.util.thread.BlockableEventLoop.managedBlock(BlockableEventLoop.java:136) ~[?:?] at net.minecraft.server.MinecraftServer.waitUntilNextTick(MinecraftServer.java:1347) ~[paper-1.18.2.jar:git-Paper-267] at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1229) ~[paper-1.18.2.jar:git-Paper-267] at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:315) ~[paper-1.18.2.jar:git-Paper-267]

Additional information that could be helpful in fixing the problem

Nope

JAHMCR commented 2 years ago

It usually happens during the first chest openings of a player, when he does not have or have just a few of the item permissions

Chris6ix commented 2 years ago

It usually happens during the first chest openings of a player, when he does not have or have just a few of the item permissions

Well that is very funny because its literally the player with the most playtime on my server and has all of the cosmetics unlocked since a long time...he only opens them to get free money :)

But the thing is that he's not the only one that has all of them unlocked...but the only one that has that issue

datatags commented 2 years ago

I'm not sure if I've completely identified the issue, so please try out this build to make sure it's fixed

Chris6ix commented 2 years ago

I just tried this build and it makes the problem worse...now it doesnt open on the 2nd click but the player has to spam click the chest like 10 times now...which gives this Error each time he clicks:

[11:39:51 ERROR]: Could not pass event PlayerInteractEvent to UltraCosmetics v2.6.1-DEV-b11 java.lang.NullPointerException: Cannot invoke "be.isach.ultracosmetics.cosmetics.type.CosmeticType.getName()" because "cosmetic" is null at be.isach.ultracosmetics.treasurechests.TreasureRandomizer.giveRandomCosmetic(TreasureRandomizer.java:244) ~[UltraCosmetics-2.6.1-DEV-b11.jar:?] at be.isach.ultracosmetics.treasurechests.TreasureRandomizer.giveRandomThing(TreasureRandomizer.java:162) ~[UltraCosmetics-2.6.1-DEV-b11.jar:?] at be.isach.ultracosmetics.treasurechests.TreasureChest.onInter(TreasureChest.java:404) ~[UltraCosmetics-2.6.1-DEV-b11.jar:?] at com.destroystokyo.paper.event.executor.asm.generated.GeneratedEventExecutor798.execute(Unknown Source) ~[?:?] at org.bukkit.plugin.EventExecutor.lambda$create$1(EventExecutor.java:75) ~[paper-api-1.18.2-R0.1-SNAPSHOT.jar:?] at co.aikar.timings.TimedEventExecutor.execute(TimedEventExecutor.java:80) ~[paper-api-1.18.2-R0.1-SNAPSHOT.jar:git-Paper-267] at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:70) ~[paper-api-1.18.2-R0.1-SNAPSHOT.jar:?] at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:629) ~[paper-api-1.18.2-R0.1-SNAPSHOT.jar:?] at org.bukkit.craftbukkit.v1_18_R2.event.CraftEventFactory.callPlayerInteractEvent(CraftEventFactory.java:544) ~[paper-1.18.2.jar:git-Paper-267] at net.minecraft.server.level.ServerPlayerGameMode.useItemOn(ServerPlayerGameMode.java:552) ~[?:?] at net.minecraft.server.network.ServerGamePacketListenerImpl.handleUseItemOn(ServerGamePacketListenerImpl.java:1851) ~[?:?] at net.minecraft.network.protocol.game.ServerboundUseItemOnPacket.handle(ServerboundUseItemOnPacket.java:33) ~[?:?] at net.minecraft.network.protocol.game.ServerboundUseItemOnPacket.a(ServerboundUseItemOnPacket.java:9) ~[?:?] at net.minecraft.network.protocol.PacketUtils.lambda$ensureRunningOnSameThread$1(PacketUtils.java:51) ~[?:?] at net.minecraft.server.TickTask.run(TickTask.java:18) ~[paper-1.18.2.jar:git-Paper-267] at net.minecraft.util.thread.BlockableEventLoop.doRunTask(BlockableEventLoop.java:153) ~[?:?] at net.minecraft.util.thread.ReentrantBlockableEventLoop.doRunTask(ReentrantBlockableEventLoop.java:23) ~[?:?] at net.minecraft.server.MinecraftServer.doRunTask(MinecraftServer.java:1399) ~[paper-1.18.2.jar:git-Paper-267] at net.minecraft.server.MinecraftServer.d(MinecraftServer.java:188) ~[paper-1.18.2.jar:git-Paper-267] at net.minecraft.util.thread.BlockableEventLoop.pollTask(BlockableEventLoop.java:126) ~[?:?] at net.minecraft.server.MinecraftServer.pollTaskInternal(MinecraftServer.java:1376) ~[paper-1.18.2.jar:git-Paper-267] at net.minecraft.server.MinecraftServer.pollTask(MinecraftServer.java:1369) ~[paper-1.18.2.jar:git-Paper-267] at net.minecraft.util.thread.BlockableEventLoop.managedBlock(BlockableEventLoop.java:136) ~[?:?] at net.minecraft.server.MinecraftServer.waitUntilNextTick(MinecraftServer.java:1347) ~[paper-1.18.2.jar:git-Paper-267] at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1229) ~[paper-1.18.2.jar:git-Paper-267] at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:315) ~[paper-1.18.2.jar:git-Paper-267] at java.lang.Thread.run(Thread.java:833) ~[?:?]

datatags commented 2 years ago

@Chris6ix I'm really not sure what could be going on here, would it be possible for you to compile a list of UC-related permissions this player has and send them to me along with your config?

datatags commented 2 years ago

I went over the code again and found a typo, could you try this build: https://github.com/iSach/UltraCosmetics/actions/runs/2045558216

datatags commented 2 years ago

Fixed another bug related to ammo, please try this build or the one in #beta-testing in Discord.