From 09114dd308561ef4116f018144baab7c4284ceef Mon Sep 17 00:00:00 2001 From: nossr50 Date: Thu, 9 Dec 2010 20:45:39 -0800 Subject: [PATCH] Fixed a few Array out of bounds errors, added confirmation messages for name color and prefix changes. --- vMinecraftCommands.java | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/vMinecraftCommands.java b/vMinecraftCommands.java index 6c92cdb8d..a14cc22ac 100644 --- a/vMinecraftCommands.java +++ b/vMinecraftCommands.java @@ -230,21 +230,23 @@ public class vMinecraftCommands{ player.sendMessage(Colors.DarkPurple + "Example: /prefix e ^0[^a<3^0]"); vMinecraftChat.sendMessage(player, player, Colors.DarkPurple + "This would produce a name like... " + Colors.Black + "[" + Colors.LightGreen + "<3" + Colors.Black + "]" + Colors.Yellow + player.getName()); return EXIT_SUCCESS; + } + //Name color + if(args.length >= 1 && args[0] != null){ + player.setPrefix(args[0]); + player.sendMessage(Colors.Rose + "Name color changed"); } - - //Check if the prefix is too long + //Prefix + if(args.length >= 2 && args[1] != null){ + //Check if the prefix is too long if(args[1].length() > 15) { vMinecraftChat.sendMessage(player, player, Colors.Rose + "The prefix you entered was too long."); return EXIT_SUCCESS; } - - if(args.length >= 1 && args[0] != null){ - player.setPrefix(args[1]); - } - if(args.length >= 2 && args[1] != null){ - vMinecraftUsers.players.findProfile(player).setTag(args[2]); + vMinecraftUsers.players.findProfile(player).setTag(args[1]); + player.sendMessage(Colors.LightGreen + "Prefix changed"); } return EXIT_SUCCESS; }