[MECH] Unknown Command v1.7 - Returns "Unknown Command" messages [818]

Discussion in 'Inactive/Unsupported Plugins' started by LRFLEW, Jan 23, 2011.

  1. Offline

    LRFLEW

    Unknown Command - Returns "Unknown Command" messages

    As of a recent build, CraftBukkit had an "Unknown Command" message (although there are two of them). As of UC 1.2, this plugin now instead allows for custom UC messages to be sent to the player. All you have to do is run the plugin once, and edit the file at /plugins/UC/Messages.txt. You can have more than one message (separated by lines) and it will randomly choose which one to say to the player. Here is an example of that.

    Features:
    • Returns custom "Unknown Command" from a txt file whenever a command doesn't exist.
    Download (to all my projects and source):
    http://lrflew.ismywebsite.com/bukkit.html
    Mirror:
    http://dl.dropbox.com/u/22202470/UC.jar
    Source: http://dl.dropbox.com/u/22202470/UC.zip

    *Licence Notice*
    There has been some confusion about what kinds of permissions I'm giving for this, particularly with @544nick101 trying to make a branch. From here on out, Unknown Command is licensed under the Creative Commons - Attribution license with attribution being linking back to this forum thread and mentioning my username LRFLEW.

    Changelog:
    • 1.7: Removed redundant source code hidden in the jar file
    • 1.6: "\g" now returns the command used and fixed bug with commands with '/' in them (special thanks to Cutch)
    • 1.5: Set universally to getDataFolder() to fix any errors
    • 1.4: added ebean dependency
    • 1.3: Now Messages.txt allows colors with "\[0-F]" ("\\" makes a backslash). This should help unicode errors. Also includes small coding changes.
    • 1.2: Now has another file at "plugins/UC/Messages.txt" to put custom messages. To prevent the default message from appearing, I have to cancel missing commands, so any unruly commands not in "plugins/UC/Commands.txt" may not run at all and the console will no longer say "LRFLEW issued server command: apple". If requested, I'll make it return it again.
    • 1.1: As per request, the file with default commands has been moved from "UC.txt" to "plugins/UC/Commands.txt". You happy now?
    • 1.0: Added a txt file that will install itself to the server's folder containing the default commands of CraftBukkit. You can add any commands not properly working with this in that file and reload the file even while running the server with "/uc reload" (no "/" if ran from the console; OPs are the only players that can run this command)
    • 0.6: Added missing CraftBukkit commands and created a static TreeSet for faster command checking.
    • 0.5: Added an Enum to check if the command is a command built into CraftBukkit itself.
    • 0.4: uses onPlayerCommandPreproccess() and server.getPluginCommand() to find unknown commands.
    • 0.3: now uses short call (0.2 works on latest build with warning, but 0.3 won't work with old builds)
    • 0.2.1: ACTUALLY changed the package, both the actual one and the one in plugin.yml :p
    • 0.2: changed package name to comply with EvilSeth's request
    • 0.1: First Itteration (note: some plugins don't cancel their events, making this plugin say "Unknown Command" to actuall commands. It's not my fault)
     
  2. Offline

    Pythros

    The file doesn't exist so I'm creating it. Does each line to be as such?
    Code:
    /staff
    /g
    /etc
     
  3. Offline

    LRFLEW

    It should exist if you have run the plugin before :p. See if you can find the file in "plugins/UC/" or something. That file will have the default craftbukkit commands in it and you should follow that pattern.

    Besides, it's:
    Code:
    staff
    g
    ect
     
  4. Offline

    Pythros

    Well it didn't.... nor did it create the messages.txt. I had to create them. :p
    And that works! Thanks.
     
  5. Offline

    MacG32

    Works great with CB #678. :)
     
  6. works fine with #733 :)
     
  7. Offline

    link2110

    Not sure if this is a known error but i get this
    Code:
    2011-05-03 06:22:03 [SEVERE] Could not pass event PLAYER_COMMAND_PREPROCESS to Unknown Command
    java.lang.NullPointerException
    	at com.LRFLEW.bukkit.UC.PlayerEvents.onPlayerCommandPreprocess(PlayerEvents.java:213)
    	at org.bukkit.plugin.java.JavaPluginLoader$5.execute(JavaPluginLoader.java:230)
    	at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:59)
    	at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:257)
    	at net.minecraft.server.NetServerHandler.handleCommand(NetServerHandler.java:667)
    	at net.minecraft.server.NetServerHandler.chat(NetServerHandler.java:638)
    	at net.minecraft.server.NetServerHandler.a(NetServerHandler.java:632)
    	at net.minecraft.server.Packet3Chat.a(Packet3Chat.java:32)
    	at net.minecraft.server.NetworkManager.a(NetworkManager.java:195)
    	at net.minecraft.server.NetServerHandler.a(NetServerHandler.java:74)
    	at net.minecraft.server.NetworkListenThread.a(SourceFile:100)
    	at net.minecraft.server.MinecraftServer.h(MinecraftServer.java:370)
    	at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:285)
    	at net.minecraft.server.ThreadServerApplication.run(SourceFile:394)
    
    CB740 Unknown command 1.6
     
  8. Offline

    LRFLEW

    I can't find onCommandPreproccess() in the javadocs anymore. If they removed it, I will be SO angry, as this breaks both Unknown Command and Commands Logging.

    I'm looking into it...
     
  9. Offline

    xZise

    On my server (CB 740) it is working on my server. And as you see you get a NPE there, so CB740 could trigger this event and then your plugin “crashed”.

    I have one question: How could I reload the messages.txt file? Or does it reload automatically.

    And maybe you could update the directories in your OP, as CraftBukkit is using “plugins/<plugin name>/” since some version. Before it was “plugins/<plugin file name w/o extension>” (and you already fixed this).

    Fabian
     
  10. Offline

    LRFLEW

    Possibly, but where did onCommandPreproccess() go in the javadocs?

    On a reload (of the server or plugin), it reloads the file, but you can also just use "/uc reload" (no / for the server terminal) to reload the file without restarting the entire plugin.

    I use getDataFolder() + File.separator + "..." so that should automatically happen :p.
     
  11. Offline

    xZise

    Here?

    Okay I want to prevent reloading my server every second because I only changed one setting ;)

    Maybe list this command in the OP.

    Yep in your code, but I meant in the OP:
    And thanks for this plugin :) One player said, that a plugin isn't working, but in fact he only typed the wrong command :) But with this plugin it is also visible for the player and not only for the log!

    Fabian
     
  12. Offline

    jmcneely

    When I click on the download like it takes me to a page saying:
    This Website Has Been Suspended
    If you are the owner of this website
    Please email [email protected] to appeal for this website.

    Please fix this, I really want to try this plugin.
     
  13. Offline

    LRFLEW

    I have had issues with ismywebsite.com for a long time. I will see what's going on here, but in the mean time, try the mirror directly below it.
     
  14. Offline

    Pythros

    :confused:

    I can't use /about, /reload

    If I disabled UC, the commands work fine.

    I put these in the exception file and it works. I don't think I should had to put these in there?

    Nothing shows in the logs. On build 737
     
  15. Offline

    xZise

    Okay I was getting a strange error:
    Code:
    16:42:21 [SEVERE] Could not pass event PLAYER_COMMAND_PREPROCESS to Unknown Command
    java.lang.StringIndexOutOfBoundsException: String index out of range: 3
            at java.lang.String.charAt(String.java:686)
            at java.util.regex.Matcher.appendReplacement(Matcher.java:703)
            at java.util.regex.Matcher.replaceAll(Matcher.java:813)
            at java.lang.String.replaceAll(String.java:2189)
            at com.LRFLEW.bukkit.UC.PlayerEvents.onPlayerCommandPreprocess(PlayerEvents.java:213)
            at org.bukkit.plugin.java.JavaPluginLoader$5.execute(JavaPluginLoader.java:256)
            at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:59)
            at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:289)
            at net.minecraft.server.NetServerHandler.handleCommand(NetServerHandler.java:674)
            at net.minecraft.server.NetServerHandler.chat(NetServerHandler.java:645)
            at net.minecraft.server.NetServerHandler.a(NetServerHandler.java:639)
            at net.minecraft.server.Packet3Chat.a(Packet3Chat.java:32)
            at net.minecraft.server.NetworkManager.a(NetworkManager.java:196)
            at net.minecraft.server.NetServerHandler.a(NetServerHandler.java:75)
            at net.minecraft.server.NetworkListenThread.a(SourceFile:100)
            at net.minecraft.server.MinecraftServer.h(MinecraftServer.java:372)
            at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:287)
            at net.minecraft.server.ThreadServerApplication.run(SourceFile:394)
    16:42:21 [INFO] …Somebody… tried command: o\
    
    Running CraftBukkit 766 & UC 1.6.

    Fabian
     
  16. Offline

    LRFLEW

    Actually, as of a version (I can't remember which), this is normal :p. I thought I added /reload to the file, but I must have forgot /about. I'll add to the description of this plugin as to why this happens.

    This appears to be some sort of error related to the command being called without a command name :p. I'll look into it after finals week ends.
     
  17. Offline

    kahlilnc

    So does this work with CB build 766?
     
  18. Offline

    Plague

    cb 674 - inactive
     
  19. Offline

    xZise

    Yep. Why don't try it on your own?

    Fabian
     
  20. Offline

    kahlilnc

    Maybe because it is inactive.
     
  21. Offline

    cjc343

    It wasn't marked inactive when you first posted.
     
  22. Offline

    kahlilnc

    lol IK but it also says 674. And I really didnt want my server to crash.
     
  23. Offline

    xZise

    But afaik since 670 there was no API break. So what runs with 670 runs with any RB > 670. Only in the other direction it could make problems. And why is it inactive? I mean here is nothing, because here has to be nothing to discuss. It is working at the moment with the newest RBs. And the last post of an official is only 7 days old.

    And to prevent to crash your server, you could setup a test server.

    Could it be marked as active, as it runs with 733, 740 and 766? (All tested on my server)

    Fabian
     
  24. Offline

    MacG32

    Works perfect with CB #798 as well.
     
  25. Offline

    Jandalf

    the dev must report his OP, then it will get active again i think...
     
  26. Offline

    MonsieurApple

    Marked as active.
     
  27. Offline

    kahlilnc

    Wonder if this works with the newest RB? I will test
     
  28. Offline

    Inertjerk

    EVERY TIME I OPEN MY SERVER WITH BUKKIT IT USED TO SAY "Welcome name here TO THE SERVER" AND NOW NONE OF MY COMMANDS WORK AND IT DOESNT SAY THATS ANYMORE PLEASE HELP ME THIS AHS BEEN HAPPENING DAY LIKE 4 OR 5 I DONT REMEMBER BUT PLEASE HELP ME!!!
     
  29. Offline

    darkhelmet

    I'm trying to find a tool that can be used to solve a serious issues where an unknown command wound up bound to a tool of mine. I've been through every single bind-unbind command we have in our server but it still occurs. I tried usin this plugin but it seems that it will only capture the invalid commands typed from an account, and not the commands bound to a tool. Is there a way I can make that work? Is there any suggestions you have? It's driving me insane.
     
  30. Offline

    544nick101

    i made mine say Could Not Find Command :D

    LRIFLEW keep up the good work :)

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 6, 2016
  31. Offline

    Shooty

    Need an update :(
     

Share This Page