Strange lines error on console

Discussion in 'Plugin Development' started by Sammy, Mar 12, 2011.

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

    Sammy

    I'm getting a strange error on the chat since I started using the CommandExecutor.


    Code:
      rpgmod:
        description: SyDeckRPGmod admin console.
        usage: |
               /<command> - Admin help.
               /<command> guild - Guild managemnt.
               /<command> perm - Guild permissions.

    some of the usages apear in two lines on the console for exemple


    /rpg
    mod perm - guild permissions.

    or

    /<command> quests
    - Shows guilds agended quests.

    Sorry if this is mine error not bukkit's but I have been battling with this for a week now:(
     
  2. Offline

    Plague

    I can'T really imagine that, since you use<command> which clearly shout not be seen in game, could you post a screenshot?
     
  3. Offline

    Sammy

    [​IMG]

    I already deleted all the .minecraft folder and this still happens, a friend of mine is doing a plugin too and the same happens to him.


    Sorry <command> doesn't appear in game i forgot to change it to the command on the other post

    EDIT:
    Some of my code:
    Code:
    getCommand("money").setExecutor(new sdCCmds(this));
    Code:
        private boolean moneyMethod(CommandSender sender, String[] string) {
            String[] args = string;
            Player ply = (Player) sender;
            if (!sender.isOp()) {
                if (args.length <= 0) {
                    sender.sendMessage("Your pocket contains: " + ChatColor.GOLD + CH.GetMoney(ply) + " " + CurrencyProperties.Currency);
    
                } else if (args[0].equalsIgnoreCase("pay") && args.length >= 3) {
                    if (CH.HasMoney(ply, Integer.parseInt(args[2]))) {
                        try {
                            int amount = Integer.parseInt(args[2]);
                            Player receiver = (Player) sender.getServer().getPlayer(args[1]);
                            CH.SetMoney(receiver, CH.GetMoney(receiver) + amount);
                            CH.SetMoney(ply, CH.GetMoney(ply) - amount);
                        } catch (Exception e) {
                            sender.sendMessage(ChatColor.RED + "That player isn't available at this moment.");
                        }
                    }
    
                } else if (args[0].equalsIgnoreCase("help")) {
                    return false;
    
                } else {
                    return false;
                }
            } else if (!sender.isOp()) {
                Player receiver = (Player) sender.getServer().getPlayer(args[1]);
                sender.sendMessage(receiver.getName() + " pocket contains: " + ChatColor.GOLD + CH.GetMoney(receiver) + " " + CurrencyProperties.Currency);
            }
            return true;
        }
     
  4. Offline

    Plague

    if the "/money ...." text is the usage from plugin.yml, it looks like the function returned false, which it should not when looking at your code.,

    But you also have "if (!op) else if (!op)" so maybe the compiler is out of his mind because of that?
     
  5. Offline

    Sammy

    It didn't, sorry my bad.
    First I did:
    /money and got the "Your pocket as 100 dinnars"
    them
    /money help and that returned false so I can see the usage that is in the yml.
    That !op is gone by now, it was a bad copy paste from my side ^^

    This is happening to be in all my new plugins, simple or not. so I thing my problem must be on the yml file.

    Here is my new code

    Code:
        private boolean moneyMethod(CommandSender sender, String[] string) {
            String[] args = string;
            Player ply = (Player) sender;
            if (args.length <= 0) {
                sender.sendMessage(ChatColor.DARK_AQUA + "Your pocket contains: " + ChatColor.GOLD + CH.GetMoney(ply) + " " + CurrencyProperties.Currency);
                return true;
    
            } else if (ply.isOp() && args[0].equalsIgnoreCase("get")) {
                try {
                    Player receiver = (Player) sender.getServer().getPlayer(args[1]);
                    sender.sendMessage(ChatColor.DARK_AQUA + receiver.getName() + "'s pocket contains: " + ChatColor.GOLD + CH.GetMoney(receiver) + " " + CurrencyProperties.Currency);
                    return true;
                } catch (Exception e) {
                    sender.sendMessage(ChatColor.RED + "Player not available at this moment.");
                }
    
            } else if (args[0].equalsIgnoreCase("pay") && args.length >= 3) {
                if (CH.HasMoney(ply, Integer.parseInt(args[2]))) {
                    try {
                        int amount = Integer.parseInt(args[2]);
                        Player receiver = (Player) sender.getServer().getPlayer(args[1]);
                        CH.SetMoney(receiver, CH.GetMoney(receiver) + amount);
                        CH.SetMoney(ply, CH.GetMoney(ply) - amount);
                        sender.sendMessage(ChatColor.GOLD + "You sent " + amount + " " + CH.GetCurrency() + " to " + receiver.getName());
                        receiver.sendMessage(ChatColor.GOLD + "You received " + amount + " " + CH.GetCurrency() + " from " + ply.getName());
                        return true;
                    } catch (Exception e) {
                        sender.sendMessage(ChatColor.RED + "Player not available at this moment.");
                    }
                } else {
                    sender.sendMessage(ChatColor.RED + "You don't have that much money.");
                    return true;
                }
    
            } else if (args[0].equalsIgnoreCase("help")) {
                return false;
            }
            return true;
        }
     
  6. Offline

    Plague

    Oh now I think I get it, the problem is that the line is broken prematurely into two lines :)
    What's more interesting is that it does not do it for some lines...

    Dunno, but when I use return false, the help is written red, not white. Do you have some old CB or some plugin changing that?
     
  7. Offline

    Sammy

    New server with no plugins, new craftbukkit and new bukkit and still the same error. =/
    [MERGETIME="1300127485"][/MERGETIME]
    Still having the same problem, please someone put a end to my misery ^^
    [MERGETIME="1300197478"][/MERGETIME]
    Giving eternal gratitude to the code guru with the solution ! ^^
    Free supply of karmic energy !!!
     
Thread Status:
Not open for further replies.

Share This Page