handle a few random errors that popped up in my server log

This commit is contained in:
Brettflan 2011-03-04 10:42:41 -06:00
parent 775f3a00d5
commit df75afef08
2 changed files with 8 additions and 3 deletions

View File

@ -170,7 +170,12 @@ public class Commands {
if (Conf.aliasHelp.contains(command)) {
int page = 1;
if (tokens.size() > 0) {
page = Integer.parseInt(tokens.get(0));
try {
page = Integer.parseInt(tokens.get(0));
}
catch (NumberFormatException e) {
// wasn't an integer
}
}
help(me, page);
} else if (Conf.aliasLeave.contains(command)) {

View File

@ -43,7 +43,7 @@ public class FactionsBlockListener extends BlockListener {
Coord coord = Coord.parseCoord(block);
Faction otherFaction = Board.get(player.getWorld()).getFactionAt(coord);
if (otherFaction.id == 0) {
if (otherFaction == null || otherFaction.id == 0) {
return true; // This is no faction territory. You may build or break stuff here.
}
@ -92,7 +92,7 @@ public class FactionsBlockListener extends BlockListener {
Coord blockCoord = Coord.from(block.getLocation());
Faction otherFaction = Board.get(player.getWorld()).getFactionAt(blockCoord);
if (otherFaction.id != 0 && myFaction != otherFaction) {
if (otherFaction != null && otherFaction.id != 0 && myFaction != otherFaction) {
me.sendMessage(Conf.colorSystem+"You can't use "+TextUtil.getMaterialName(material)+" in the territory of "+otherFaction.getTag(myFaction));
//otherFaction.sendMessage(me.getNameAndRelevant(otherFaction)+Conf.colorSystem+" tried to use "+TextUtil.getMaterialName(material)+" in your territory");
return false;