Added check to make sure chatTagInsertIndex is valid, to prevent triggering an exception, commented out a bit of debug output

This commit is contained in:
Brettflan 2011-04-25 20:29:47 -05:00
parent 3820b53d29
commit 8a4463b599
2 changed files with 8 additions and 4 deletions

View File

@ -95,7 +95,7 @@ public class Factions extends JavaPlugin {
log("=== INIT START ===");
long timeInitStart = System.currentTimeMillis();
log("asdfasdas"+MiscUtil.range(-1, 1));
// log("asdfasdas"+MiscUtil.range(-1, 1));
// Add the commands
commands.add(new FCommandHelp());

View File

@ -66,8 +66,12 @@ public class FactionsPlayerListener extends PlayerListener{
return;
}
String formatStart = event.getFormat().substring(0, Conf.chatTagInsertIndex);
String formatEnd = event.getFormat().substring(Conf.chatTagInsertIndex);
int InsertIndex = Conf.chatTagInsertIndex;
if (InsertIndex > event.getFormat().length())
return;
String formatStart = event.getFormat().substring(0, InsertIndex);
String formatEnd = event.getFormat().substring(InsertIndex);
String nonColoredMsgFormat = formatStart + me.getChatTag() + formatEnd;