What's wrong here?

Discussion in 'Plugin Development' started by Urag, Aug 2, 2015.

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

    Urag

  2. Offline

    Tecno_Wizard

    @Urag, you're going to have to give us a lot more info than that. Please post some of the surrounding code and what error you are getting.
     
  3. Offline

    Urag

  4. Offline

    Zombie_Striker

    @Urag
    1. You do not need to log your plugin. If you're using loggers to see if your plugin is enabled/disabled, bukkit already does this for you.
    2. Did you register your command in the plugin.yml (Do you have a line in your plugin.yml that registers the command "a")
    3. Does your plugin even get enabled?
     
  5. Offline

    jthort

    I don't think you need getName() just do cmd.equalsIgnoreCase

    Example:
    Code:
      if (command.equalsIgnoreCase("msg") || command.equalsIgnoreCase("message") || command.equalsIgnoreCase("m")) {
    Edit:
    He is using the logger to change the default messages, maybe he wants a custom one
    As for 2 and 3, he said the error was on that line so of course it's enabled and not a YAML issue.
     
  6. Offline

    bwfcwalshy Retired Staff

    @jthort it's getName().equalsIgnoreCase :p

    @Urag Why are you using a Command from the material package? Remove that import and import org.bukkit.command.Command;
     
    Urag likes this.
  7. Offline

    jthort

    My plugin works and I use this
    Code:
       
          @Override
        public boolean onCommand(CommandSender sender, Command cmnd, String command, String[] args) {
          
            if (command.equalsIgnoreCase("msg") || command.equalsIgnoreCase("message") || command.equalsIgnoreCase("m")) {
                Player player1 = (Player) sender;
                if (args.length == 0) {
                    PrintFormatter.printExplorerError(player1, "Usage: /message <Username> <Message>");
                } else if (args.length == 1) {
                   
                    PrintFormatter.printExplorerError(player1, "Usage: /message <Username> <Message>");
                } else if (args.length > 1) {
                   
                    try {
                        Player player = Bukkit.getPlayer(args[0]);
                        if (sender instanceof Player) {
                            Player user = (Player) sender;
                            if (server.getProfiles().hasPermission(player.getUniqueId(), "me.chat.recieveMessage")) {
                                if (server.getProfiles().hasPermission(user.getUniqueId(), "me.command.message")) {
                                    String message = "";
                                    for (int i = 1; i < args.length; i++) {
                                        message = message.concat(args[i] + " ");
                                    }
                                    if (a(player.getName())) {
                                        playersInConversation.remove(player.getName());
                                    }
                                    playersInConversation.put(sender.getName(), player.getName());
                                    playersInConversation.put(player.getName(), sender.getName());
                                    
     
  8. Offline

    bwfcwalshy Retired Staff

    @jthort Your using the wrong one that's why. You should use cmd.getName() not comamnd or as a lot of others use commandLabel
     
  9. Offline

    jthort

    Ah he is using commandlabel, I didn't see that, why shouldn't i use that one?
     
  10. Offline

    FisheyLP

    When you just check the label it won't work for aliases. cmd.getName() will work for aliases
     
    bwfcwalshy likes this.
  11. Offline

    jthort

    @FisheyLP I guess that explains why I had to use || so many times ;)
     
  12. Offline

    Googlelover1234

    @jthort
    That's because you're using the CommandLabel, not the actual Command.
    Edit: Posted way to late :(
     
  13. Offline

    Urag

  14. Offline

    bwfcwalshy Retired Staff

    @Urag No problem, I'm here to help.
     
    Urag likes this.
  15. Offline

    Zombie_Striker

    @Urag
    It also seems you put the plugin.yml in the wrong location. The plugin.yml should not be in the "src" file.
     
Thread Status:
Not open for further replies.

Share This Page