Skip to content

Commit

Permalink
Return raw null even more
Browse files Browse the repository at this point in the history
Yay more for fallbacks
  • Loading branch information
mcmonkey4eva committed Nov 2, 2014
1 parent ca5fc40 commit 2b09f10
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,7 @@ public String getAttribute(Attribute attribute) {
return new dPlayer((OfflinePlayer) ((Tameable) entity.getBukkitEntity()).getOwner())
.getAttribute(attribute.fulfill(1));
else
return Element.NULL
.getAttribute(attribute.fulfill(1));
return null;
}

return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ public String getAttribute(Attribute attribute) {
// -->
if (attribute.startsWith("with_lore")) {
// Must specify lore to check
if (!attribute.hasContext(1)) return Element.NULL.getAttribute(attribute.fulfill(1));
if (!attribute.hasContext(1)) return null;
String lore = attribute.getContext(1);
attribute.fulfill(1);
// <--[tag]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ public String getAttribute(Attribute attribute) {
// -->
if (attribute.startsWith("id_holder")) {
if (holder == null)
return Element.NULL.getAttribute(attribute.fulfill(1));
return null;
return holder.getAttribute(attribute.fulfill(1));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -882,7 +882,7 @@ else if (script_entries.size() > 0) {
dB.echoError(this, "Can't determine a linked NPC.");
}
if (npc == null)
return Element.NULL.getAttribute(attribute.fulfill(1));
return null;
else
return npc.getAttribute(attribute.fulfill(1));
}
Expand All @@ -905,7 +905,7 @@ else if (script_entries.size() > 0) {
dB.echoError(this, "Can't determine a linked player.");
}
if (player == null)
return Element.NULL.getAttribute(attribute.fulfill(1));
return null;
else
return player.getAttribute(attribute.fulfill(1));
}
Expand All @@ -920,7 +920,7 @@ else if (script_entries.size() > 0) {
// -->
if (attribute.startsWith("determination")) {
if (reqId < 0 || !DetermineCommand.hasOutcome(reqId))
return Element.NULL.getAttribute(attribute.fulfill(1));
return null;
else
return ObjectFetcher.pickObjectFor(DetermineCommand.readOutcome(reqId)).getAttribute(attribute.fulfill(1));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public void queueTag(ReplaceableTagEvent event) {

if (event.hasNameContext()) {
if (ScriptQueue._queueExists(event.getNameContext()))
event.setReplaced(Element.NULL.getAttribute(attribute.fulfill(1)));
return;
else
event.setReplaced(ScriptQueue._getExistingQueue(event.getNameContext())
.getAttribute(attribute.fulfill(1)));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ else if (event.getScriptEntry().hasObject("script"))
Attribute attribute = new Attribute(event.raw_tag, event.getScriptEntry());

// Check if location is null, return null if it is
if (script == null) { event.setReplaced(Element.NULL.getAttribute(attribute.fulfill(1))); return; }
if (script == null) { return; }

// Else, get the attribute from the script
event.setReplaced(script.getAttribute(attribute.fulfill(1)));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ public void serverTag(ReplaceableTagEvent event) {
NPC npc = ((Citizens) Bukkit.getPluginManager().getPlugin("Citizens"))
.getNPCSelector().getSelected(Bukkit.getConsoleSender());
if (npc == null)
event.setReplaced(Element.NULL.getAttribute(attribute.fulfill(1)));
return;
else
event.setReplaced(new dNPC(npc).getAttribute(attribute.fulfill(1)));
return;
Expand Down

0 comments on commit 2b09f10

Please sign in to comment.