Skip to content

Commit

Permalink
Fix EventException for <player.location.bed_spawn> when player is onl…
Browse files Browse the repository at this point in the history
…ine and has no bed spawn.
  • Loading branch information
davidcernat committed Mar 7, 2013
1 parent 4bc2c5f commit a59d17b
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
12 changes: 6 additions & 6 deletions README
@@ -1,7 +1,7 @@
Denizen: Helpful Citizens for Bukkit!

Need help using Denizen? Try one of these places:

WIKI: wiki.citizensnpcs.com/Denizen
IRC: irc.esper.net in the channel #citizens or #denizen-dev
Denizen: Helpful Citizens for Bukkit!
Need help using Denizen? Try one of these places:
WIKI: wiki.citizensnpcs.com/Denizen
IRC: irc.esper.net in the channels #denizen-dev or #citizens
BukkitDev: dev.bukkit.org/server-mods/Denizen
Expand Up @@ -27,7 +27,7 @@ public void npcTags(ReplaceableTagEvent event) {
if (!event.matches("npc")) return;

dNPC n = event.getNPC();
if (n == null) return; // to avoid NPE in scripts with no NPC attached
if (n == null) return; // to avoid exceptions in scripts with no NPC attached

String type = event.getType() != null ? event.getType().toUpperCase() : "";
String subType = event.getSubType() != null ? event.getSubType().toUpperCase() : "";
Expand Down
Expand Up @@ -287,7 +287,7 @@ else if (subType.equals("WORLD_SPAWN"))
+ "," + p.getWorld().getSpawnLocation().getBlockY()
+ "," + p.getWorld().getSpawnLocation().getBlockZ()
+ "," + p.getWorld().getName());
else if (subType.equals("BED_SPAWN"))
else if (subType.equals("BED_SPAWN") && p.getBedSpawnLocation() != null)
event.setReplaced(p.getBedSpawnLocation().getBlockX()
+ "," + p.getBedSpawnLocation().getBlockY()
+ "," + p.getBedSpawnLocation().getBlockZ()
Expand Down

0 comments on commit a59d17b

Please sign in to comment.