onChat hook error fixed

This commit is contained in:
nossr50 2011-01-09 13:36:09 -08:00
parent 621fe2279b
commit ce6c242cf2
3 changed files with 6 additions and 14 deletions

View File

@ -335,13 +335,6 @@ private static HashMap<String, Player> hidden = new HashMap<String, Player>();
} }
return EXIT_FAIL; return EXIT_FAIL;
} }
//=====================================================================
//Function: prefix (/prefix)
//Input: Player player: The player using the command
// String[] args: The name of the player
//Output: int: Exit Code
//Use: Freezes a player in place
//=====================================================================
public static int freeze(Player player, String[] args){ public static int freeze(Player player, String[] args){
if(player.canUseCommand("/freeze") && vConfig.getInstance().freeze()){ if(player.canUseCommand("/freeze") && vConfig.getInstance().freeze()){
if (args.length < 1){ if (args.length < 1){
@ -407,7 +400,6 @@ private static HashMap<String, Player> hidden = new HashMap<String, Player>();
return EXIT_SUCCESS; return EXIT_SUCCESS;
} }
//Check if the prefix is too long //Check if the prefix is too long
if(vChat.msgLength(args[1]) > 60) if(vChat.msgLength(args[1]) > 60)
{ {
@ -425,8 +417,10 @@ private static HashMap<String, Player> hidden = new HashMap<String, Player>();
if(args.length >= 3 && args[1] != null) if(args.length >= 3 && args[1] != null)
{ {
vUsers.players.findProfile(other).setTag(args[2]); String tagbag = etc.combineSplit(2, args, "");
vUsers.players.findProfile(other).setTag(tagbag);
player.sendMessage(Colors.LightGreen + "Prefix changed"); player.sendMessage(Colors.LightGreen + "Prefix changed");
log.log(Level.INFO, player + " changed their prefix to " + tagbag);
} }
return EXIT_SUCCESS; return EXIT_SUCCESS;
} }

View File

@ -1,5 +1,4 @@
import java.io.*; import java.io.*;
import java.util.ArrayList;
import java.util.logging.Level; import java.util.logging.Level;
import java.util.logging.Logger; import java.util.logging.Logger;
public class vmc { public class vmc {
@ -45,7 +44,7 @@ String location = "groups.txt";
String groups[] = player.getGroups(); String groups[] = player.getGroups();
String groupline[] = null; String groupline[] = null;
String prefix = Colors.White; String prefix = Colors.White;
if(vConfig.getInstance().groupcoloredbrackets()){ if(vConfig.getInstance().groupcoloredbrackets() && groups[0].toString().length() > 0){
//Read the file //Read the file
properties = new PropertiesFile(location); properties = new PropertiesFile(location);
try { try {
@ -54,10 +53,9 @@ String location = "groups.txt";
log.log(Level.SEVERE, "Exception while loading " + location, e); log.log(Level.SEVERE, "Exception while loading " + location, e);
} }
//Grab the line with the same group as the player //Grab the line with the same group as the player
if(!groups[0].isEmpty())
groupline = properties.getString(groups[0]).split(":"); groupline = properties.getString(groups[0]).split(":");
//Check if the prefix is null or not //Check if the prefix is null or not
if(groupline[0] != null) if(!groupline[0].isEmpty())
{ {
//vChat.colorChange(groupline[0].charAt(0)); //vChat.colorChange(groupline[0].charAt(0));
prefix = groupline[0]; prefix = groupline[0];