ArtFect / BlockHighlight

https://www.spigotmc.org/resources/blockhighlight.91087/
MIT License
10 stars 1 forks source link

Using float numbers for opacity prints error #2

Open Andre601 opened 3 years ago

Andre601 commented 3 years ago

Using any kind of float number (i.e. 100.5) for the opacity/alpha causes the below error to be printed on reload.

The plugin should have some measurement in place to either deny the loading of such invalid numbers or correct them (i.e. round them to the next whole number)

Error:

[23:43:27 INFO]: Andre_601 issued server command: /bh reload
[23:43:27 ERROR]: null
org.bukkit.command.CommandException: Unhandled exception executing command 'bh' in plugin BlockHighlight v1.0
        at org.bukkit.command.PluginCommand.execute(PluginCommand.java:47) ~[patched_1.16.5.jar:git-Paper-584]
        at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:159) ~[patched_1.16.5.jar:git-Paper-584]
        at org.bukkit.craftbukkit.v1_16_R3.CraftServer.dispatchCommand(CraftServer.java:810) ~[patched_1.16.5.jar:git-Paper-584]
        at net.minecraft.server.v1_16_R3.PlayerConnection.handleCommand(PlayerConnection.java:2168) ~[patched_1.16.5.jar:git-Paper-584]
        at net.minecraft.server.v1_16_R3.PlayerConnection.c(PlayerConnection.java:1983) ~[patched_1.16.5.jar:git-Paper-584]
        at net.minecraft.server.v1_16_R3.PlayerConnection.a(PlayerConnection.java:1936) ~[patched_1.16.5.jar:git-Paper-584]
        at net.minecraft.server.v1_16_R3.PacketPlayInChat.a(PacketPlayInChat.java:50) ~[patched_1.16.5.jar:git-Paper-584]
        at net.minecraft.server.v1_16_R3.PacketPlayInChat.a(PacketPlayInChat.java:8) ~[patched_1.16.5.jar:git-Paper-584]
        at net.minecraft.server.v1_16_R3.PlayerConnectionUtils.lambda$ensureMainThread$1(PlayerConnectionUtils.java:35) ~[patched_1.16.5.jar:git-Paper-584]
        at net.minecraft.server.v1_16_R3.TickTask.run(SourceFile:18) ~[patched_1.16.5.jar:git-Paper-584]
        at net.minecraft.server.v1_16_R3.IAsyncTaskHandler.executeTask(IAsyncTaskHandler.java:136) ~[patched_1.16.5.jar:git-Paper-584]
        at net.minecraft.server.v1_16_R3.IAsyncTaskHandlerReentrant.executeTask(SourceFile:23) ~[patched_1.16.5.jar:git-Paper-584]
        at net.minecraft.server.v1_16_R3.IAsyncTaskHandler.executeNext(IAsyncTaskHandler.java:109) ~[patched_1.16.5.jar:git-Paper-584]
        at net.minecraft.server.v1_16_R3.MinecraftServer.bb(MinecraftServer.java:1252) ~[patched_1.16.5.jar:git-Paper-584]
        at net.minecraft.server.v1_16_R3.MinecraftServer.executeNext(MinecraftServer.java:1245) ~[patched_1.16.5.jar:git-Paper-584]
        at net.minecraft.server.v1_16_R3.IAsyncTaskHandler.awaitTasks(IAsyncTaskHandler.java:119) ~[patched_1.16.5.jar:git-Paper-584]
        at net.minecraft.server.v1_16_R3.MinecraftServer.sleepForTick(MinecraftServer.java:1206) ~[patched_1.16.5.jar:git-Paper-584]
        at net.minecraft.server.v1_16_R3.MinecraftServer.w(MinecraftServer.java:1120) ~[patched_1.16.5.jar:git-Paper-584]
        at net.minecraft.server.v1_16_R3.MinecraftServer.lambda$a$0(MinecraftServer.java:289) ~[patched_1.16.5.jar:git-Paper-584]
        at java.lang.Thread.run(Thread.java:834) [?:?]
Caused by: java.lang.NumberFormatException: For input string: "127.5"
        at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65) ~[?:?]
        at java.lang.Integer.parseInt(Integer.java:652) ~[?:?]
        at java.lang.Integer.parseInt(Integer.java:770) ~[?:?]
        at ru.fiw.blockhighlight.Config.loadConfig(Config.java:60) ~[?:?]
        at ru.fiw.blockhighlight.BHCommand.onCommand(BHCommand.java:26) ~[?:?]
        at org.bukkit.command.PluginCommand.execute(PluginCommand.java:45) ~[patched_1.16.5.jar:git-Paper-584]
        ... 19 more
ArtFect commented 3 years ago

Currently there are no checks for the correctness of the config. The error can be caused in any point of the config most likely. Maybe I'll add checks later