Skip to content
Browse files

Added null checks when parsing creatures and players in config

  • Loading branch information...
1 parent b996455 commit e97fcbcf8e21091e5dee4925f05429c87a583ce1 @brad811 committed May 20, 2011
Showing with 21 additions and 9 deletions.
  1. +1 −1 plugin.yml
  2. +20 −8 src/com/bradsproject/com/bradsproject/BradleyJewell/bZone/bZone.java
View
2 plugin.yml
@@ -1,6 +1,6 @@
name: bZone
main: com.bradsproject.BradleyJewell.bZone.bZone
-version: 1.1
+version: 1.1.1
description: Control independent zones of your world!
authors:
- Brad811
View
28 src/com/bradsproject/com/bradsproject/BradleyJewell/bZone/bZone.java
@@ -139,15 +139,21 @@ public void parseConfig()
wild.hurting = Boolean.parseBoolean(value.get("hurting").toString());
List<String> playersNode = (List<String>) value.get("players");
- for(String player : playersNode)
+ if(playersNode != null)
{
- wild.players.add(player);
+ for(String player : playersNode)
+ {
+ wild.players.add(player);
+ }
}
List<String> monstersNode = (List<String>) value.get("creatures");
- for(String monster : monstersNode)
+ if(monstersNode != null)
{
- wild.creatures.add(monster);
+ for(String monster : monstersNode)
+ {
+ wild.creatures.add(monster);
+ }
}
Map<String,Object> protectionNode = (Map<String,Object>) value.get("protection");
@@ -179,15 +185,21 @@ public void parseConfig()
zone.healing = Boolean.parseBoolean(value.get("healing").toString());
List<String> playersNode = (List<String>) value.get("players");
- for(String player : playersNode)
+ if(playersNode != null)
{
- zone.players.add(player);
+ for(String player : playersNode)
+ {
+ zone.players.add(player);
+ }
}
List<String> monstersNode = (List<String>) value.get("creatures");
- for(String monster : monstersNode)
+ if(monstersNode != null)
{
- zone.creatures.add(monster);
+ for(String monster : monstersNode)
+ {
+ zone.creatures.add(monster);
+ }
}
Map<String,Object> protectionNode = (Map<String,Object>) value.get("protection");

0 comments on commit e97fcbc

Please sign in to comment.
Something went wrong with that request. Please try again.