NoahBPeterson / BlockTrack

A block tracking plugin for NukkitX
MIT License
1 stars 0 forks source link

ArrayIndexOutOfBounds in /blocktrack #4

Open ghost opened 4 years ago

ghost commented 4 years ago

Run /blocktrack See this in console:

[19.08 19:36:51.598] INFO: [CB-1] 19:36:51 [FATAL] Unbehandelter Fehler beim Ausführen des Kommandos "blocktrack zHypeeHD" in blocktrack: java.lang.ArrayIndexOutOfBoundsException: 145
[19.08 19:36:51.598] INFO: [CB-1]       at com.nbpe.blocktrack.BlockTrack.dbList(BlockTrack.java:216)
[19.08 19:36:51.598] INFO: [CB-1]       at com.nbpe.blocktrack.BlockTrackCommand.playerOverviewExecute(BlockTrackCommand.java:51)
[19.08 19:36:51.598] INFO: [CB-1]       at com.nbpe.blocktrack.BlockTrack.onCommand(BlockTrack.java:108)
[19.08 19:36:51.598] INFO: [CB-1]       at cn.nukkit.command.PluginCommand.execute(PluginCommand.java:33)
[19.08 19:36:51.598] INFO: [CB-1]       at cn.nukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:257)
[19.08 19:36:51.598] INFO: [CB-1]       at cn.nukkit.Server.dispatchCommand(Server.java:764)
[19.08 19:36:51.598] INFO: [CB-1]       at cn.nukkit.Player.handleDataPacket(Player.java:2812)
[19.08 19:36:51.598] INFO: [CB-1]       at cz.creeperface.nukkit.gac.player.NukkitCheatPlayer.handleDataPacket(NukkitCheatPlayer.kt:69)
[19.08 19:36:51.598] INFO: [CB-1]       at java.util.ArrayList.forEach(ArrayList.java:1257)
[19.08 19:36:51.598] INFO: [CB-1]       at cn.nukkit.network.Network.processPackets(Network.java:268)
[19.08 19:36:51.598] INFO: [CB-1]       at cn.nukkit.network.Network.processBatch(Network.java:251)
[19.08 19:36:51.598] INFO: [CB-1]       at cn.nukkit.Player.handleDataPacket(Player.java:2102)
[19.08 19:36:51.598] INFO: [CB-1]       at cz.creeperface.nukkit.gac.player.NukkitCheatPlayer.handleDataPacket(NukkitCheatPlayer.kt:69)
[19.08 19:36:51.598] INFO: [CB-1]       at cn.nukkit.network.RakNetInterface.handleEncapsulated(RakNetInterface.java:156)
[19.08 19:36:51.598] INFO: [CB-1]       at cn.nukkit.raknet.server.ServerHandler.handlePacket(ServerHandler.java:132)
[19.08 19:36:51.598] INFO: [CB-1]       at cn.nukkit.network.RakNetInterface.process(RakNetInterface.java:67)
[19.08 19:36:51.598] INFO: [CB-1]       at cn.nukkit.network.Network.processInterfaces(Network.java:152)
[19.08 19:36:51.598] INFO: [CB-1]       at cn.nukkit.Server.tick(Server.java:1137)
[19.08 19:36:51.598] INFO: [CB-1]       at cn.nukkit.Server.tickProcessor(Server.java:916)
[19.08 19:36:51.598] INFO: [CB-1]       at cn.nukkit.Server.start(Server.java:893)
[19.08 19:36:51.598] INFO: [CB-1]       at cn.nukkit.Server.<init>(Server.java:578)
[19.08 19:36:51.598] INFO: [CB-1]       at cn.nukkit.Nukkit.main(Nukkit.java:112)
[19.08 19:36:51.598] INFO: [CB-1]       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[19.08 19:36:51.598] INFO: [CB-1]       at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
[19.08 19:36:51.598] INFO: [CB-1]       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[19.08 19:36:51.598] INFO: [CB-1]       at java.lang.reflect.Method.invoke(Method.java:498)
[19.08 19:36:51.598] INFO: [CB-1]       at de.dytanic.cloudnet.wrapper.Wrapper.lambda$startApplication$5(Wrapper.java:532)
[19.08 19:36:51.598] INFO: [CB-1]       at java.lang.Thread.run(Thread.java:748)
[19.08 19:36:51.598] INFO: [CB-1] 19:36:51 [ERROR] Throwing
[19.08 19:36:51.598] INFO: [CB-1] java.lang.ArrayIndexOutOfBoundsException: 145
[19.08 19:36:51.598] INFO: [CB-1]       at com.nbpe.blocktrack.BlockTrack.dbList(BlockTrack.java:216) ~[?:?]
[19.08 19:36:51.598] INFO: [CB-1]       at com.nbpe.blocktrack.BlockTrackCommand.playerOverviewExecute(BlockTrackCommand.java:51) ~[?:?]
[19.08 19:36:51.598] INFO: [CB-1]       at com.nbpe.blocktrack.BlockTrack.onCommand(BlockTrack.java:108) ~[?:?]
[19.08 19:36:51.598] INFO: [CB-1]       at cn.nukkit.command.PluginCommand.execute(PluginCommand.java:33) ~[nukkit.jar:?]
[19.08 19:36:51.598] INFO: [CB-1]       at cn.nukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:257) ~[nukkit.jar:?]
[19.08 19:36:51.598] INFO: [CB-1]       at cn.nukkit.Server.dispatchCommand(Server.java:764) ~[nukkit.jar:?]
[19.08 19:36:51.598] INFO: [CB-1]       at cn.nukkit.Player.handleDataPacket(Player.java:2812) ~[nukkit.jar:?]
[19.08 19:36:51.598] INFO: [CB-1]       at cz.creeperface.nukkit.gac.player.NukkitCheatPlayer.handleDataPacket(NukkitCheatPlayer.kt:69) ~[?:?]
[19.08 19:36:51.598] INFO: [CB-1]       at java.util.ArrayList.forEach(ArrayList.java:1257) ~[?:1.8.0_212]
[19.08 19:36:51.598] INFO: [CB-1]       at cn.nukkit.network.Network.processPackets(Network.java:268) ~[nukkit.jar:?]
[19.08 19:36:51.598] INFO: [CB-1]       at cn.nukkit.network.Network.processBatch(Network.java:251) ~[nukkit.jar:?]
[19.08 19:36:51.598] INFO: [CB-1]       at cn.nukkit.Player.handleDataPacket(Player.java:2102) ~[nukkit.jar:?]
[19.08 19:36:51.598] INFO: [CB-1]       at cz.creeperface.nukkit.gac.player.NukkitCheatPlayer.handleDataPacket(NukkitCheatPlayer.kt:69) ~[?:?]
[19.08 19:36:51.598] INFO: [CB-1]       at cn.nukkit.network.RakNetInterface.handleEncapsulated(RakNetInterface.java:156) ~[nukkit.jar:?]
[19.08 19:36:51.598] INFO: [CB-1]       at cn.nukkit.raknet.server.ServerHandler.handlePacket(ServerHandler.java:132) ~[nukkit.jar:?]
[19.08 19:36:51.598] INFO: [CB-1]       at cn.nukkit.network.RakNetInterface.process(RakNetInterface.java:67) ~[nukkit.jar:?]
[19.08 19:36:51.598] INFO: [CB-1]       at cn.nukkit.network.Network.processInterfaces(Network.java:152) ~[nukkit.jar:?]
[19.08 19:36:51.598] INFO: [CB-1]       at cn.nukkit.Server.tick(Server.java:1137) ~[nukkit.jar:?]
[19.08 19:36:51.598] INFO: [CB-1]       at cn.nukkit.Server.tickProcessor(Server.java:916) ~[nukkit.jar:?]
[19.08 19:36:51.598] INFO: [CB-1]       at cn.nukkit.Server.start(Server.java:893) ~[nukkit.jar:?]
[19.08 19:36:51.598] INFO: [CB-1]       at cn.nukkit.Server.<init>(Server.java:578) ~[nukkit.jar:?]
[19.08 19:36:51.598] INFO: [CB-1]       at cn.nukkit.Nukkit.main(Nukkit.java:112) ~[nukkit.jar:?]
[19.08 19:36:51.598] INFO: [CB-1]       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_212]
[19.08 19:36:51.598] INFO: [CB-1]       at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_212]
[19.08 19:36:51.598] INFO: [CB-1]       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_212]
[19.08 19:36:51.598] INFO: [CB-1]       at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_212]
[19.08 19:36:51.598] INFO: [CB-1]       at de.dytanic.cloudnet.wrapper.Wrapper.lambda$startApplication$5(Wrapper.java:532) ~[wrapper.jar:3.4.0-SNAPSHOT-67554e8]
[19.08 19:36:51.598] INFO: [CB-1]       at java.lang.Thread.run(Thread.java:748) [?:1.8.0_212]
NoahBPeterson commented 3 years ago

BlockTrack.java: 216: formatted[i]=TextFormat.GRAY+""+entry.getDestroyed();

Looks like the issue is that I forgot to map the page access indices to the range of the formatted[] array. I just need to change the array access at these lines to formatted[i% (range)].