Solved I have no clue how to fix this

Discussion in 'Spigot Plugin Development' started by Lars_HD44, Jun 23, 2021.

Thread Status:
Not open for further replies.
  1. Im having trouble with a SudoCommand can anybody hel me?
    Code (Java):
    Player player = (Player) sender;
                    if (args.length == 0) {
                        player.sendMessage("§7[§aM§bu§5l§2t§6i§7] §cArgs: §a/sudo §b+ §4SpielerName §b+ §aNachicht oder Befehl");
                    } else if (args.length == 1) {
                        Player target = Bukkit.getPlayerExact(args[0]);
                        String message = args[1];
                        if (target == null) {
                            sender.sendMessage("§7[§aM§bu§5l§2t§6i§7]§4 Der Spieler §c" + args[0] + " §4ist nicht online!");
                        } else {

                            target.chat(message);
                            player.sendMessage("§7[§aM§bu§5l§2t§6i§7]§a Der Spieler §c" + args[0] + " §ahat den Befehl §c" + args[1] + " §aausgeführt!");
                        }
                    }
    I mean the this:
    String message = args[1];
     
  2. args[1] is the second argument. Instead of checking length == 1, check length >= 2
     
    • Like Like x 1
  3. OMG Big thanks for helping me fix this
     
Thread Status:
Not open for further replies.