Skip to content

Commit

Permalink
Fix entitydamage NPE, some formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
mcmonkey4eva committed Aug 17, 2013
1 parent ea0650f commit 962ce1b
Showing 1 changed file with 4 additions and 4 deletions.
Expand Up @@ -560,7 +560,7 @@ else if (entity.isPlayer()) {
events.add(entityType + " damaged");
events.add(entityType + " damaged by " + cause);

if (isFatal == true) {
if (isFatal) {
events.add("entity killed");
events.add("entity killed by " + cause);
events.add(entityType + " killed");
Expand All @@ -587,7 +587,7 @@ else if (entity.isPlayer()) {
damagerType = "npc";

// If we had no NPC in our regular context, use this one
if (npc == null) npc = subNPC;
npc = subNPC;
}
else if (damager.isPlayer()) {
subPlayer = new dPlayer(damager.getPlayer());
Expand Down Expand Up @@ -622,7 +622,7 @@ else if (damager.isPlayer()) {
subEvents.add(damagerType + " damages entity");
subEvents.add(damagerType + " damages " + entityType);

if (isFatal == true) {
if (isFatal) {
events.add("entity killed by entity");
events.add("entity killed by " + damagerType);
events.add(entityType + " killed by entity");
Expand All @@ -634,7 +634,7 @@ else if (damager.isPlayer()) {
subEvents.add(damagerType + " kills " + entityType);
}

determination = doEvents(subEvents, subNPC, subPlayer.getPlayerEntity(), context);
determination = doEvents(subEvents, subNPC, (subPlayer != null?subPlayer.getPlayerEntity():null), context);

if (determination.toUpperCase().startsWith("CANCELLED"))
event.setCancelled(true);
Expand Down

0 comments on commit 962ce1b

Please sign in to comment.