MyCmd v5.7.2 introduces commandname out of range bug #319


  • Defect
  • Waiting
Open
  • L3thalBunny created this issue Jan 2, 2022

    if a command name in the commands .yml file is shorter than 15 characters the following error is thrown:

     

    [12:49:47 WARN]: java.lang.StringIndexOutOfBoundsException: begin 0, end 15, length 8
    [12:49:47 WARN]:        at java.base/java.lang.String.checkBoundsBeginEnd(String.java:4601)
    [12:49:47 WARN]:        at java.base/java.lang.String.substring(String.java:2704)
    [12:49:47 WARN]:        at MyCommand-5.7.2.jar//it.emmerrei.mycommand.execute.types.ScoreBoard.Create_UpdateScoreboard(ScoreBoard.java:274)
    [12:49:47 WARN]:        at MyCommand-5.7.2.jar//it.emmerrei.mycommand.execute.types.ScoreBoard.Send(ScoreBoard.java:121)
    [12:49:47 WARN]:        at MyCommand-5.7.2.jar//it.emmerrei.mycommand.execute.DispatchCommands.ExecuteMyCommandCommands(DispatchCommands.java:490)
    [12:49:47 WARN]:        at MyCommand-5.7.2.jar//it.emmerrei.mycommand.commands.CmdCustomCommands.onCommand(CmdCustomCommands.java:145)
    [12:49:47 WARN]:        at org.bukkit.command.PluginCommand.execute(PluginCommand.java:45)
    [12:49:47 WARN]:        at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:159)
    [12:49:47 WARN]:        at org.bukkit.craftbukkit.v1_18_R1.CraftServer.dispatchCommand(CraftServer.java:897)
    [12:49:47 WARN]:        at net.minecraft.server.network.PlayerConnection.a(PlayerConnection.java:2285)
    [12:49:47 WARN]:        at net.minecraft.server.network.PlayerConnection.a(PlayerConnection.java:2096)
    [12:49:47 WARN]:        at net.minecraft.server.network.PlayerConnection.a(PlayerConnection.java:2077)
    [12:49:47 WARN]:        at net.minecraft.network.protocol.game.PacketPlayInChat.a(PacketPlayInChat.java:46)
    [12:49:47 WARN]:        at net.minecraft.network.protocol.game.PacketPlayInChat.a(PacketPlayInChat.java:6)
    [12:49:47 WARN]:        at net.minecraft.network.protocol.PlayerConnectionUtils.lambda$ensureRunningOnSameThread$1(PlayerConnectionUtils.java:56)
    [12:49:47 WARN]:        at net.minecraft.server.TickTask.run(TickTask.java:18)
    [12:49:47 WARN]:        at net.minecraft.util.thread.IAsyncTaskHandler.c(IAsyncTaskHandler.java:149)
    [12:49:47 WARN]:        at net.minecraft.util.thread.IAsyncTaskHandlerReentrant.c(IAsyncTaskHandlerReentrant.java:23)
    [12:49:47 WARN]:        at net.minecraft.server.MinecraftServer.b(MinecraftServer.java:1413)
    [12:49:47 WARN]:        at net.minecraft.server.MinecraftServer.c(MinecraftServer.java:189)
    [12:49:47 WARN]:        at net.minecraft.util.thread.IAsyncTaskHandler.y(IAsyncTaskHandler.java:122)
    [12:49:47 WARN]:        at net.minecraft.server.MinecraftServer.bf(MinecraftServer.java:1391)
    [12:49:47 WARN]:        at net.minecraft.server.MinecraftServer.y(MinecraftServer.java:1384)
    [12:49:47 WARN]:        at net.minecraft.util.thread.IAsyncTaskHandler.c(IAsyncTaskHandler.java:132)
    [12:49:47 WARN]:        at net.minecraft.server.MinecraftServer.x(MinecraftServer.java:1362)
    [12:49:47 WARN]:        at net.minecraft.server.MinecraftServer.w(MinecraftServer.java:1268)
    [12:49:47 WARN]:        at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:317)
    [12:49:47 WARN]:        at java.base/java.lang.Thread.run(Thread.java:833)

     example command:

    sb_watch:
      command: /watch
      type: SCOREBOARD
      scoreboard_name: "&7Watching %otherplayer_displayname_$arg1%"
      scoreboard_text:
      - "10;&6ip:&e %otherplayer_ip_$arg1%"
      - "9;&6World:&e %otherplayer_world_$arg1%"
      - "8;&6Gamemode:&e %otherplayer_gamemode_$arg1%"
      - "7;&6XYZ:&e %otherplayer_locx_$arg1% / %otherplayer_locy_$arg1% / %otherplayer_locz_$arg1%"
      - "6;&6Level:&e %otherplayer_level_$arg1%"
      - "5;&6Health:&a %otherplayer_health_$arg1%"
      - "4;&6Food:&5 %otherplayer_hunger_$arg1%"
      - "3;&6Oxygen:&3 %otherplayer_oxygen_$arg1%"
      - "2;&6hand:&e %otherplayer_iteminhand_$arg1%"
      - "1;&6Spells:&e %otherplayer_spells_$arg1%"
      - "0;&c/unwatch &7to turn off"
      scoreboard_refresh_ticks: 5
      delaytimer: 0
      required_args: 1
      tab_completer:
        1:
        - $player_list
      error-message: "&c/watch <player>\n&c/unwatch &7 - stops watching"
      permission-required: true
      permission-node: lethals.admin
      register: true

     Note "sb_watch" is only 8 characters, the command fails. changing "sb_watch" to "scoreboard_watch" (16 characters) and the command works.

     

     

    ALSO:

    scoreboard_name: "&7Watching %otherplayer_displayname_$arg1%"

     

    SHOULD return "Watching LethalBunny" but instead it returns  "Watching Lethal" and the rest of my name gets cut off... I believe this is because my displayname is set with a HEX color code.

  • L3thalBunny added the tags Defect Waiting Jan 2, 2022
  • ivanfromitaly posted a comment Jan 2, 2022

    yeee, i don't think it's anything else related to something in your command ecc, and i tell you this it's related only to scoreboard commands. i haven't tested it with a command named shortly and this happen ( i guess). My fault i forgot to prevent that.

     

    about scoreboard_name: i don't know because i didn't touched that part.

     

    to temp fix it you can call you command ("sb_watch") with something with a lenght of 16 or more, as you said.

     

    About cut up title i have to see if i can increase it on newer version of the game. (edit: increased to 128 for the title and 64 the line)


    Edited Jan 2, 2022

To post a comment, please login or register a new account.