/plugins DOES NOT WORK! PLEASE HELP

Discussion in 'Plugin Development' started by PoweredByRage, Feb 18, 2014.

Thread Status:
Not open for further replies.
  1. Offline

    PoweredByRage

    Hello, so what the situation is that I am trying to make a pluign which disables people to use the commands /pl & /plugins, I also want them to receive a message saying "Insufficient rank." However I make the two commands and /pl works and /plugins doesn't and it still shows other people the plugins on my server. I always wanted to make a plugin like this. I also put both of the commands on plugin.yml (Code for the plugin & plugin.yml are down BELOW!)

    PLUGIN.YML: http://pastebin.com/sQ5ZanMs
    PLUGIN ECLIPSE CODE: http://pastebin.com/BjiVbmF6

    The problem is that when ever I do /pl the server sends me the right information however when I do /plugins it does not work. Please someone help me!
     
  2. Offline

    random_username

    /plugins is overriden by Bukkit. You can use the PlayerCommandPreProccess event and cancell it when the command is /plugins. Then do your in there :)

    Edit:
    If I'm right, you can use Commands.yml for Bukkit 17.2-R0.3 :p If you're using another version of bukkit, use the method above. Also if I'm right, I think Commands.yml is a file from the server, so you'd need the plugin user the modify it to give your plugin priority. I'd just go with the method above.
     
  3. Offline

    PoweredByRage

    I am not quite good at coding! Can you maybe like help me?
     
  4. Offline

    Garris0n

    If he's using another version of bukkit what he did should work fine.

    That said,
    1. Use JavaPlugin.getLogger() instead of Logger.getLogger("Minecraft").
    2. You don't need to print enable/disable messages, the server does that for you already.
    3. You're casting the sender to a player without checking if the sender is a player. That will lead to a ClassCastException when the console or a command block runs a command.
    4. You should use cmd.getName() instead of commandLabel.
    5. You really shouldn't have a static variable with an instance of your class, but, in this case, you're not even setting it to anything, so it's literally pointless.
     
    random_username likes this.
  5. Offline

    PoweredByRage

    You got Skype or something? I just started so I am soo confused :D
     
  6. Offline

    random_username

    This might give you an idea:
    Code:
    @EventHandler(priority=EventPriority.LOWEST)
        public void onCommandPreProcess(PlayerCommandPreprocessEvent event)
        {
            if (event.getMessage().toLowerCase().startsWith("/plugins"))
            {
                //code
            }
        }
     
  7. Offline

    Garris0n

    Creating a command with the same name should override it just fine, that's not necessary.

    @OP What bukkit version is running on the server?
     
  8. Offline

    PoweredByRage

    I get an error: void is an invalid type for the variable onCommandPreProcess

    Latest one.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 6, 2016
Thread Status:
Not open for further replies.

Share This Page