Skip to content

Commit

Permalink
Return AIR not NULL for empty equip slots
Browse files Browse the repository at this point in the history
  • Loading branch information
mcmonkey4eva committed Oct 26, 2015
1 parent 21b89e9 commit 79bb720
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
Expand Up @@ -409,7 +409,7 @@ public void sleeping(CommandContext args, CommandSender sender, NPC npc) throws
if (args.hasValueFlag("location")) {
String[] argsArray = args.getFlag("location").split(",");
if (argsArray.length != 4) {
Messaging.sendError(sender, "Usage: /npc sit --location x,y,z,world");
Messaging.sendError(sender, "Usage: /npc sleep --location x,y,z,world");
return;
}
trait.toSleep(dLocation.valueOf(argsArray[0] + "," + argsArray[1] + "," + argsArray[2] + "," + argsArray[3]));
Expand Down
Expand Up @@ -7,6 +7,7 @@
import net.aufdemrand.denizencore.objects.dObject;
import net.aufdemrand.denizencore.objects.properties.Property;
import net.aufdemrand.denizencore.tags.Attribute;
import org.bukkit.Material;
import org.bukkit.entity.LivingEntity;
import org.bukkit.inventory.ItemStack;

Expand Down Expand Up @@ -71,6 +72,10 @@ public String getAttribute(Attribute attribute) {
return new dItem(entity.getLivingEntity().getEquipment().getBoots())
.getAttribute(attribute.fulfill(2));
}
else {
return new dItem(Material.AIR)
.getAttribute(attribute.fulfill(2));
}
}

// <--[tag]
Expand All @@ -87,6 +92,10 @@ else if (attribute.startsWith("equipment.chestplate") ||
return new dItem(entity.getLivingEntity().getEquipment().getChestplate())
.getAttribute(attribute.fulfill(2));
}
else {
return new dItem(Material.AIR)
.getAttribute(attribute.fulfill(2));
}
}

// <--[tag]
Expand All @@ -103,6 +112,10 @@ else if (attribute.startsWith("equipment.helmet") ||
return new dItem(entity.getLivingEntity().getEquipment().getHelmet())
.getAttribute(attribute.fulfill(2));
}
else {
return new dItem(Material.AIR)
.getAttribute(attribute.fulfill(2));
}
}

// <--[tag]
Expand All @@ -119,6 +132,10 @@ else if (attribute.startsWith("equipment.leggings") ||
return new dItem(entity.getLivingEntity().getEquipment().getLeggings())
.getAttribute(attribute.fulfill(2));
}
else {
return new dItem(Material.AIR)
.getAttribute(attribute.fulfill(2));
}
}

// <--[tag]
Expand Down

0 comments on commit 79bb720

Please sign in to comment.