Skip to content

Commit

Permalink
Fix a dList-related error
Browse files Browse the repository at this point in the history
Also add JavaDocs for TagManager.CleanOutput
and a minor code correctly for dItem.
  • Loading branch information
mcmonkey4eva committed Dec 15, 2013
1 parent 03e7911 commit 3b3c9f8
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 5 deletions.
6 changes: 2 additions & 4 deletions src/main/java/net/aufdemrand/denizen/objects/dItem.java
Expand Up @@ -663,10 +663,8 @@ public String getAttribute(Attribute attribute) {
// Returns whether the item has a custom set display name.
// -->
if (attribute.startsWith("has_display")) {
if (ItemDisplayname.describes(this))
return Element.TRUE.getAttribute(attribute.fulfill(1));
else
return Element.FALSE.getAttribute(attribute.fulfill(1));
return new Element(ItemDisplayname.describes(this))
.getAttribute(attribute.fulfill(1));
}

// <--[tag]
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/net/aufdemrand/denizen/objects/dList.java
Expand Up @@ -210,7 +210,8 @@ public List<dObject> filter(Class<? extends dObject> dClass, ScriptEntry entry)
if (ObjectFetcher.checkMatch(dClass, element)) {

dObject object = ObjectFetcher.getObjectFrom(dClass, element,
entry.getPlayer(), entry.getNPC());
(entry != null ? entry.getPlayer(): null),
(entry != null ? entry.getNPC(): null));

// Only add the object if it is not null, thus filtering useless
// list items
Expand Down
17 changes: 17 additions & 0 deletions src/main/java/net/aufdemrand/denizen/tags/TagManager.java
Expand Up @@ -59,11 +59,28 @@ public void registerCoreTags() {
// 0x05: |
// 0x2011: ;

/**
* Cleans escaped symbols generated within Tag Manager so that
* they can be parsed now.
*
* @param input the potentially escaped input string.
* @return the cleaned output string.
*/
public static String CleanOutput(String input) {
return input.replace((char)0x01, '<').replace((char)0x02, '>')
/*.replace((char)0x2011, ';')*/.replace(dList.internal_escape_char, '|');
}

/**
* Cleans any potential internal escape characters (secret characters
* used to hold the place of symbols that might get parsed weirdly
* like > or | ) back into their proper form. Use this function
* when outputting information that is going to be read by a
* person.
*
* @param input the potentially escaped input string.
* @return the cleaned output string.
*/
public static String CleanOutputFully(String input) {
return input.replace((char)0x01, '<').replace((char)0x02, '>')
.replace((char)0x2011, ';').replace(dList.internal_escape_char, '|');
Expand Down

0 comments on commit 3b3c9f8

Please sign in to comment.