Global lcase on commands

Discussion in 'Server Gameplay Suggestions' started by flint_the_bard, Apr 3, 2024.

  1. flint_the_bard
    Offline

    flint_the_bard Active Member

    Joined:
    Dec 17, 2018
    Messages:
    35
    Im sure this has already been suggested before but im going to suggest that the server take all commands through lcase so that the server reads them as lower case always. It is silly if you do /FIX it will say its not a command but will activate the cooldown for the command. So you cant use it till cooldowns over even tho it didnt fire before. [​IMG]
     
    • Support Support x 5
    • Agree Agree x 1
    • Cookie Cookie x 1
  2. luka
    Offline

    luka macdondalds Super Moderator Premium

    Joined:
    Apr 10, 2016
    Messages:
    3,144
    IGN:
    Houzo
    Used to work pre 1.19 update. There is a bug report open (has been since 1.19 update) regarding this.
     
  3. CraftWithAbbie
    Offline

    CraftWithAbbie Active Member

    Joined:
    Jul 19, 2022
    Messages:
    579
    IGN:
    CraftWithAbbie
    Having all /commands work either /UPPER CASE /lower case or MiXeD CaSeS should let the command work. They shouldn't be case sensitive lol
     
    Last edited: Apr 4, 2024
  4. Magik
    Offline

    Magik Well-Known Member

    Joined:
    Jan 20, 2013
    Messages:
    1,033
    IGN:
    MagikIsAMush
    Adding a .lower() to a line before executing a command is hard OK? /s

    Now that I think about it, it could probably be doable in the meantime with a mod.

    Pssssst xolt
     
    • Friendly Friendly x 1
  5. xolt
    Offline

    xolt Well-Known Member Premium

    Joined:
    Aug 5, 2017
    Messages:
    62
    IGN:
    xolt
    This is really a problem that should be fixed server-side. There are too many special cases to deal with - simply converting all commands to lower case would be inadequate. For example, the /msg command. This approach would cause all of your messages to be sent in lower case. It could be restricted to just the first argument of the command, but then multi-argument case-sensitive commands would not be fixed. The only plausible solution I can think of is to maintain a list of affected commands, and only target those. But that would be time consuming, and adds to the maintenance load.
     
    • Informative Informative x 2
  6. Pillow
    Offline

    Pillow blanky Premium

    Joined:
    May 27, 2019
    Messages:
    1,726
    IGN:
    Pilberry
  7. xolt
    Offline

    xolt Well-Known Member Premium

    Joined:
    Aug 5, 2017
    Messages:
    62
    IGN:
    xolt
    Well there you go! Thanks for the quick fix. I guess targeting only the first argument is fine as a workaround. Just wouldn’t consider it a “proper” fix since it doesn’t handle all cases.
     
  8. CraftWithAbbie
    Offline

    CraftWithAbbie Active Member

    Joined:
    Jul 19, 2022
    Messages:
    579
    IGN:
    CraftWithAbbie
    This would make sense I guess.


    Is it not possible to just have commands not be case sensitive so they'd work even if typed with capitals? Idk much about how that would work
     
  9. xolt
    Offline

    xolt Well-Known Member Premium

    Joined:
    Aug 5, 2017
    Messages:
    62
    IGN:
    xolt
    Commands like /fix and /warp are handled on the server side, so a change would have to be made there to remove case sensitivity entirely. All the client can do is modify the command before sending it.
     
    • Informative Informative x 1
    Last edited: Apr 5, 2024
  10. xolt
    Offline

    xolt Well-Known Member Premium

    Joined:
    Aug 5, 2017
    Messages:
    62
    IGN:
    xolt
    Upon doing some more research, it looks like Spigot introduced some changes to the command system in 1.19.1. One of the consequences of this was commands becoming case-sensitive (as they are in vanilla). There is some discussion about it here: (1.19.1) Commands are now case-sensitive · Issue #8223 · PaperMC/Paper · GitHub

    Since this is a change made in Spigot, and not a plugin, I doubt we will be seeing a fix for this server-side. So a client workaround may be needed to achieve this after all.
     
    • Cookie Cookie x 1
  11. xolt
    Offline

    xolt Well-Known Member Premium

    Joined:
    Aug 5, 2017
    Messages:
    62
    IGN:
    xolt
    Also, I haven't been able to find any commands where the first argument contains capitals (except for one that does nothing), or where the others are case sensitive, so lowercasing just the first argument should work for all commands at the moment. Would just need to pay attention to any new commands, and whether they contain capitals in the first argument/check case on later arguments.
     
    • Friendly Friendly x 1
  12. Magik
    Offline

    Magik Well-Known Member

    Joined:
    Jan 20, 2013
    Messages:
    1,033
    IGN:
    MagikIsAMush
    I guess you could add a fail safe where you run the command normally and check for its output and if it's the error msg, you lower case it.
     
  13. xolt
    Offline

    xolt Well-Known Member Premium

    Joined:
    Aug 5, 2017
    Messages:
    62
    IGN:
    xolt
    Seems kind of clunky. Would also be pretty easy to get kicked for spam using this unless a delay is added (which would be even clunkier lol)

    What I could do (not sure why I didn't think of this earlier) is just check if the lower case version of the command is present in the command tree (basically a list of the server's commands sent when you join). This way, commands containing capitals will not be affected, since their lowercase version won't be in the tree.
     
    • Informative Informative x 1
  14. Pillow
    Offline

    Pillow blanky Premium

    Joined:
    May 27, 2019
    Messages:
    1,726
    IGN:
    Pilberry
    Are other cases things like "/SHOPS FIND OWNED", and the arguments?
     
    • Agree Agree x 1
  15. xolt
    Offline

    xolt Well-Known Member Premium

    Joined:
    Aug 5, 2017
    Messages:
    62
    IGN:
    xolt
    Yeah, although all of the commands I could find are case insensitive on their secondary arguments, so its not really an issue unless that changes in the future. It was that and commands that are supposed to contain capitals in their first argument (which can be accounted for by doing what I described above). I think with the above fix it should be reliable enough.
     
    • Informative Informative x 1

Share This Page