Skip to content

Commit

Permalink
Don't forget fallbacks exist
Browse files Browse the repository at this point in the history
Shut up with yer errors
  • Loading branch information
mcmonkey4eva committed Jan 3, 2015
1 parent 72c5ac0 commit 83fd52e
Show file tree
Hide file tree
Showing 10 changed files with 14 additions and 16 deletions.
3 changes: 2 additions & 1 deletion src/main/java/net/aufdemrand/denizen/objects/dPlayer.java
Expand Up @@ -1104,8 +1104,9 @@ else if (isOnline())
String permission = attribute.getContext(1);

if (Depends.permissions == null) {
if (!attribute.hasAlternative())
if (!attribute.hasAlternative()) {
dB.echoError("No permission system loaded! Have you installed Vault and a compatible permissions plugin?");
}
return null;
}

Expand Down
Expand Up @@ -30,7 +30,7 @@ public void contextTags(ReplaceableTagEvent event) {

// First, check queue object context.
if (event.getScriptEntry().getResidingQueue().hasContext(object)) {
Attribute attribute = new Attribute(event.raw_tag, event.getScriptEntry());
Attribute attribute = event.getAttributes();
event.setReplaced(event.getScriptEntry().getResidingQueue()
.getContext(object).getAttribute(attribute.fulfill(2)));
return;
Expand Down Expand Up @@ -73,7 +73,7 @@ public void savedEntryTags(ReplaceableTagEvent event) {
// Get the entry_id from name context
String id = event.getNameContext();

Attribute attribute = new Attribute(event.raw_tag, event.getScriptEntry());
Attribute attribute = event.getAttributes();
ScriptEntry held = event.getScriptEntry().getResidingQueue().getHeldScriptEntry(id);
if (held == null) { // Check if the ID is bad
dB.echoDebug(event.getScriptEntry(), "Bad saved entry ID '" + id + "'");
Expand Down
Expand Up @@ -43,7 +43,7 @@ public void npcTags(ReplaceableTagEvent event) {
if (!event.matches("npc") || event.replaced()) return;

// Build a new attribute out of the raw_tag supplied in the script to be fulfilled
Attribute attribute = new Attribute(event.raw_tag, event.getScriptEntry());
Attribute attribute = event.getAttributes();

// NPCTags require a... dNPC!
dNPC n = ((BukkitTagContext)event.getContext()).npc;
Expand Down
Expand Up @@ -40,7 +40,7 @@ public void notableTags(ReplaceableTagEvent event) {

dLocation location = (dLocation) NotableManager.getSavedObject(id);

Attribute attribute = new Attribute(event.raw_tag, event.getScriptEntry());
Attribute attribute = event.getAttributes();
attribute.fulfill(1);
tag = location.getAttribute(attribute);

Expand Down
Expand Up @@ -62,7 +62,7 @@ public void playerTags(ReplaceableTagEvent event) {
if (!event.matches("player", "pl") || event.replaced()) return;

// Build a new attribute out of the raw_tag supplied in the script to be fulfilled
Attribute attribute = new Attribute(event.raw_tag, event.getScriptEntry());
Attribute attribute = event.getAttributes();

// PlayerTags require a... dPlayer!
dPlayer p = ((BukkitTagContext)event.getContext()).player;
Expand Down
Expand Up @@ -26,7 +26,7 @@ public void queueTag(ReplaceableTagEvent event) {

if (!event.matches("queue", "q")) return;

Attribute attribute = new Attribute(event.raw_tag, event.getScriptEntry()).fulfill(1);
Attribute attribute = event.getAttributes().fulfill(1);

// Handle <queue[id]. ...> tags

Expand Down
Expand Up @@ -42,7 +42,7 @@ else if (event.getScriptEntry().hasObject("script"))
script = (dScript) event.getScriptEntry().getObject("script");

// Build and fill attributes
Attribute attribute = new Attribute(event.raw_tag, event.getScriptEntry());
Attribute attribute = event.getAttributes();

// Check if location is null, return null if it is
if (script == null) { return; }
Expand Down
6 changes: 2 additions & 4 deletions src/main/java/net/aufdemrand/denizen/tags/core/TextTags.java
Expand Up @@ -20,8 +20,7 @@ public void foreignCharacterTags(ReplaceableTagEvent event) {


if (!event.getName().startsWith("&")) return;
Attribute attribute =
new Attribute(event.raw_tag, event.getScriptEntry());
Attribute attribute = event.getAttributes();

// <--[tag]
// @attribute <&auml>
Expand Down Expand Up @@ -411,8 +410,7 @@ else if (event.matches("&" + code[i]))
@TagManager.TagEvents
public void specialCharacterTags(ReplaceableTagEvent event) {
if (!event.getName().startsWith("&")) return;
Attribute attribute =
new Attribute(event.raw_tag, event.getScriptEntry());
Attribute attribute = event.getAttributes();

// <--[tag]
// @attribute <&nl>
Expand Down
5 changes: 2 additions & 3 deletions src/main/java/net/aufdemrand/denizen/tags/core/UtilTags.java
Expand Up @@ -97,8 +97,7 @@ public void ternaryTag(ReplaceableTagEvent event) {
@TagManager.TagEvents
public void serverTag(ReplaceableTagEvent event) {
if (!event.matches("server", "svr", "global") || event.replaced()) return;
Attribute attribute =
new Attribute(event.raw_tag, event.getScriptEntry()).fulfill(1);
Attribute attribute = event.getAttributes().fulfill(1);

// <--[tag]
// @attribute <server.has_flag[<flag_name>]>
Expand Down Expand Up @@ -800,7 +799,7 @@ public void utilTag(ReplaceableTagEvent event) {
String subTypeContext = event.getSubTypeContext() != null ? event.getSubTypeContext().toUpperCase() : "";
String specifier = event.getSpecifier() != null ? event.getSpecifier() : "";
String specifierContext = event.getSpecifierContext() != null ? event.getSpecifierContext().toUpperCase() : "";
Attribute attribute = new Attribute(event.raw_tag, event.getScriptEntry()).fulfill(1);
Attribute attribute = event.getAttributes().fulfill(1);

if (type.equalsIgnoreCase("RANDOM")) {

Expand Down
Expand Up @@ -83,7 +83,7 @@ public void constantTags(ReplaceableTagEvent event) {
// code to handle each situation. A full list of attributes can be found
// in Denizen's documentation. First you need to turn the tag into an
// attribute object.
Attribute attribute = new Attribute(event.raw_tag, event.getScriptEntry());
Attribute attribute = event.getAttributes();

// Now to catch up, 2 attributes have been handled already...
// Fulfilling 2 attributes, skills and .for, in <skills.for[player].get[1]>
Expand Down

0 comments on commit 83fd52e

Please sign in to comment.