Skip to content

Commit

Permalink
deprecate pointless text tags
Browse files Browse the repository at this point in the history
  • Loading branch information
mcmonkey4eva committed Aug 19, 2019
1 parent 8956f48 commit c6a31c8
Showing 1 changed file with 43 additions and 92 deletions.
Expand Up @@ -6,6 +6,7 @@
import com.denizenscript.denizencore.tags.ReplaceableTagEvent;
import com.denizenscript.denizencore.tags.TagManager;
import com.denizenscript.denizencore.utilities.CoreUtilities;
import com.denizenscript.denizencore.utilities.Deprecations;
import org.bukkit.ChatColor;

public class TextTagBase {
Expand Down Expand Up @@ -349,26 +350,66 @@ public void specialCharacterTags(ReplaceableTagEvent event) {
String lower = CoreUtilities.toLowerCase(event.getName());
Attribute attribute = event.getAttributes();

// TODO: Handle case-sensitivity stuff better here!

if (event.getName().equals("&auml")) {
Deprecations.pointlessTextTags.warn(event.getScriptEntry());
event.setReplaced(new ElementTag("ä").getAttribute(attribute.fulfill(1)));
}
else if (event.getName().equals("&Auml")) {
Deprecations.pointlessTextTags.warn(event.getScriptEntry());
event.setReplaced(new ElementTag("Ä").getAttribute(attribute.fulfill(1)));
}
else if (event.getName().equals("&ouml")) {
Deprecations.pointlessTextTags.warn(event.getScriptEntry());
event.setReplaced(new ElementTag("ö").getAttribute(attribute.fulfill(1)));
}
else if (event.getName().equals("&Ouml")) {
Deprecations.pointlessTextTags.warn(event.getScriptEntry());
event.setReplaced(new ElementTag("Ö").getAttribute(attribute.fulfill(1)));
}
else if (event.getName().equals("&uuml")) {
Deprecations.pointlessTextTags.warn(event.getScriptEntry());
event.setReplaced(new ElementTag("ü").getAttribute(attribute.fulfill(1)));
}
else if (event.getName().equals("&Uuml")) {
Deprecations.pointlessTextTags.warn(event.getScriptEntry());
event.setReplaced(new ElementTag("Ü").getAttribute(attribute.fulfill(1)));
}
else if (lower.equals("&amp")) {
Deprecations.pointlessTextTags.warn(event.getScriptEntry());
event.setReplaced(new ElementTag("&").getAttribute(attribute.fulfill(1)));
}
else if (lower.equals("&cm")) {
Deprecations.pointlessTextTags.warn(event.getScriptEntry());
event.setReplaced(new ElementTag(",").getAttribute(attribute.fulfill(1)));
}
else if (lower.equals("&sc")) {
Deprecations.pointlessTextTags.warn(event.getScriptEntry());
event.setReplaced(new ElementTag(String.valueOf((char) 0x2011)).getAttribute(attribute.fulfill(1)));
}
else if (lower.equals("&pc")) {
Deprecations.pointlessTextTags.warn(event.getScriptEntry());
event.setReplaced(new ElementTag("%").getAttribute(attribute.fulfill(1)));
}
else if (lower.equals("&pipe")) {
Deprecations.pointlessTextTags.warn(event.getScriptEntry());
event.setReplaced(new ElementTag("|").getAttribute(attribute.fulfill(1)));
}
else if (lower.equals("&ds")) {
Deprecations.pointlessTextTags.warn(event.getScriptEntry());
event.setReplaced(new ElementTag("$").getAttribute(attribute.fulfill(1)));
}
else if (lower.equals("&at")) {
Deprecations.pointlessTextTags.warn(event.getScriptEntry());
event.setReplaced(new ElementTag("@").getAttribute(attribute.fulfill(1)));
}
else if (lower.equals("&dot")) {
Deprecations.pointlessTextTags.warn(event.getScriptEntry());
event.setReplaced(new ElementTag(".").getAttribute(attribute.fulfill(1)));
}
else if (lower.equals("&hrt")) {
Deprecations.pointlessTextTags.warn(event.getScriptEntry());
event.setReplaced(new ElementTag("\u2665").getAttribute(attribute.fulfill(1)));
}

// <--[tag]
// @attribute <&nl>
Expand All @@ -380,26 +421,6 @@ else if (event.getName().equals("&Uuml")) {
event.setReplaced(new ElementTag("\n").getAttribute(attribute.fulfill(1)));
}

// <--[tag]
// @attribute <&amp>
// @returns ElementTag
// @description
// Returns an ampersand symbol: &
// -->
else if (lower.equals("&amp")) {
event.setReplaced(new ElementTag("&").getAttribute(attribute.fulfill(1)));
}

// <--[tag]
// @attribute <&cm>
// @returns ElementTag
// @description
// Returns a comma symbol: ,
// -->
else if (lower.equals("&cm")) {
event.setReplaced(new ElementTag(",").getAttribute(attribute.fulfill(1)));
}

// <--[tag]
// @attribute <&ss>
// @returns ElementTag
Expand Down Expand Up @@ -460,16 +481,6 @@ else if (lower.equals("&co")) {
event.setReplaced(new ElementTag(":").getAttribute(attribute.fulfill(1)));
}

// <--[tag]
// @attribute <&sc>
// @returns ElementTag
// @description
// Returns a semicolon symbol: ;
// -->
else if (lower.equals("&sc")) {
event.setReplaced(new ElementTag(String.valueOf((char) 0x2011)).getAttribute(attribute.fulfill(1)));
}

// <--[tag]
// @attribute <&rb>
// @returns ElementTag
Expand Down Expand Up @@ -520,36 +531,6 @@ else if (lower.equals("&ns")) {
event.setReplaced(new ElementTag("#").getAttribute(attribute.fulfill(1)));
}

// <--[tag]
// @attribute <&pc>
// @returns ElementTag
// @description
// Returns a percent symbol: %
// -->
else if (lower.equals("&pc")) {
event.setReplaced(new ElementTag("%").getAttribute(attribute.fulfill(1)));
}

// <--[tag]
// @attribute <&pipe>
// @returns ElementTag
// @description
// Returns a pipe symbol: |
// -->
else if (lower.equals("&pipe")) {
event.setReplaced(new ElementTag("|").getAttribute(attribute.fulfill(1)));
}

// <--[tag]
// @attribute <&ds>
// @returns ElementTag
// @description
// Returns a dollar sign: $
// -->
else if (lower.equals("&ds")) {
event.setReplaced(new ElementTag("$").getAttribute(attribute.fulfill(1)));
}

// <--[tag]
// @attribute <&lt>
// @returns ElementTag
Expand Down Expand Up @@ -580,36 +561,6 @@ else if (lower.equals("&bs")) {
event.setReplaced(new ElementTag("\\").getAttribute(attribute.fulfill(1)));
}

// <--[tag]
// @attribute <&at>
// @returns ElementTag
// @description
// Returns an at symbol: @
// -->
else if (lower.equals("&at")) {
event.setReplaced(new ElementTag("@").getAttribute(attribute.fulfill(1)));
}

// <--[tag]
// @attribute <&dot>
// @returns ElementTag
// @description
// Returns a dot symbol: .
// -->
else if (lower.equals("&dot")) {
event.setReplaced(new ElementTag(".").getAttribute(attribute.fulfill(1)));
}

// <--[tag]
// @attribute <&hrt>
// @returns ElementTag
// @description
// Returns a heart symbol: ♥
// -->
else if (lower.equals("&hrt")) {
event.setReplaced(new ElementTag("\u2665").getAttribute(attribute.fulfill(1)));
}

// <--[tag]
// @attribute <&chr[<character>]>
// @returns ElementTag
Expand Down

0 comments on commit c6a31c8

Please sign in to comment.