Skip to content

Commit

Permalink
add a lang explanation for denizen text formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
mcmonkey4eva committed Jul 18, 2020
1 parent 27e8f7e commit d31cbf5
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 115 deletions.
Expand Up @@ -671,10 +671,7 @@ public static void registerTags() {
// @returns ElementTag
// @description
// Returns the localized name of the material.
// Note that this is a magic Denizen tool, and unlike other format codes (like 'bold') does not appear in Spigot's API or the old Minecraft chat system.
// This instead generates the special modern Minecraft JSON codes for translatable text through the Denizen message processor.
// As such, it only works when sent through certain Denizen commands (narrate, announce, etc) or mechanisms (like ItemTag.book).
// This will not be valid anywhere that isn't in the chat bar or a book (titles, items, etc. will not work).
// Note that this is a magic Denizen tool - refer to <@link language Denizen Text Formatting>.
// -->
registerTag("translated_name", (attribute, object) -> {
String key = object.material.getKey().getKey();
Expand Down
Expand Up @@ -376,11 +376,7 @@ public static void registerTags() {
// @group text manipulation
// @description
// Adds a hover message to the element, which makes the element display the input hover text when the mouse is left over it.
//
// Note that this is a magic Denizen tool, and unlike other format codes (like 'bold') does not appear in Spigot's API or the old Minecraft chat system.
// This instead generates the special modern Minecraft JSON codes for hoverable text through the Denizen message processor.
// As such, it only works when sent through certain Denizen commands (narrate, announce, etc) or mechanisms (like ItemTag.book).
// This will not be valid anywhere that isn't in the chat bar or a book (titles, items, etc. will not work).
// Note that this is a magic Denizen tool - refer to <@link language Denizen Text Formatting>.
// -->
PropertyParser.<BukkitElementProperties>registerTag("on_hover", (attribute, object) -> {
if (!attribute.hasContext(1)) {
Expand All @@ -397,11 +393,7 @@ public static void registerTags() {
// Adds a hover message to the element, which makes the element display the input hover text when the mouse is left over it.
// Optionally specify the hover type as one of: SHOW_TEXT, SHOW_ACHIEVEMENT, SHOW_ITEM, or SHOW_ENTITY.
// Note: for "SHOW_ITEM", replace the text with a valid ItemTag. For "SHOW_ENTITY", replace the text with a valid spawned EntityTag (requires F3+H to see entities).
//
// Note that this is a magic Denizen tool, and unlike other format codes (like 'bold') does not appear in Spigot's API or the old Minecraft chat system.
// This instead generates the special modern Minecraft JSON codes for hoverable text through the Denizen message processor.
// As such, it only works when sent through certain Denizen commands (narrate, announce, etc) or mechanisms (like ItemTag.book).
// This will not be valid anywhere that isn't in the chat bar or a book (titles, items, etc. will not work).
// Note that this is a magic Denizen tool - refer to <@link language Denizen Text Formatting>.
// -->
if (attribute.startsWith("type", 2)) {
type = attribute.getContext(2);
Expand All @@ -420,11 +412,7 @@ public static void registerTags() {
// To execute a command "/" should be used at the start. Otherwise, it will display as chat.
// For example: - narrate "You can <element[click here].on_click[wow]> to say wow!"
// For example: - narrate "You can <element[click here].on_click[/help]> for help!"
//
// Note that this is a magic Denizen tool, and unlike other format codes (like 'bold') does not appear in Spigot's API or the old Minecraft chat system.
// This instead generates the special modern Minecraft JSON codes for clickable text through the Denizen message processor.
// As such, it only works when sent through certain Denizen commands (narrate, announce, etc) or mechanisms (like ItemTag.book).
// This will not be valid anywhere that isn't in the chat bar or a book (titles, items, etc. will not work).
// Note that this is a magic Denizen tool - refer to <@link language Denizen Text Formatting>.
// -->
PropertyParser.<BukkitElementProperties>registerTag("on_click", (attribute, object) -> {
if (!attribute.hasContext(1)) {
Expand All @@ -441,11 +429,7 @@ public static void registerTags() {
// Adds a click command to the element, which makes the element execute the input command when clicked.
// Optionally specify the hover type as one of: OPEN_URL, OPEN_FILE, RUN_COMMAND, SUGGEST_COMMAND, or CHANGE_PAGE.
// For example: - narrate "You can <element[click here].on_click[https://denizenscript.com].type[OPEN_URL]> to learn about Denizen!"
//
// Note that this is a magic Denizen tool, and unlike other format codes (like 'bold') does not appear in Spigot's API or the old Minecraft chat system.
// This instead generates the special modern Minecraft JSON codes for clickable text through the Denizen message processor.
// As such, it only works when sent through certain Denizen commands (narrate, announce, etc) or mechanisms (like ItemTag.book).
// This will not be valid anywhere that isn't in the chat bar or a book (titles, items, etc. will not work).
// Note that this is a magic Denizen tool - refer to <@link language Denizen Text Formatting>.
// -->
if (attribute.startsWith("type", 2)) {
type = attribute.getContext(2);
Expand All @@ -461,11 +445,7 @@ public static void registerTags() {
// @group text manipulation
// @description
// Adds an insertion message to the element, which makes the element insert the input message to chat when shift-clicked.
//
// Note that this is a magic Denizen tool, and unlike other format codes (like 'bold') does not appear in Spigot's API or the old Minecraft chat system.
// This instead generates the special modern Minecraft JSON codes for insertion text through the Denizen message processor.
// As such, it only works when sent through certain Denizen commands (narrate, announce, etc) or mechanisms (like ItemTag.book).
// This will not be valid anywhere that isn't in the chat bar or a book (titles, items, etc. will not work).
// Note that this is a magic Denizen tool - refer to <@link language Denizen Text Formatting>.
// -->
PropertyParser.<BukkitElementProperties>registerTag("with_insertion", (attribute, object) -> {
if (!attribute.hasContext(1)) {
Expand All @@ -483,10 +463,7 @@ public static void registerTags() {
// @description
// Makes a color code (&0123456789abcdef) not reset other formatting details.
// Use like '<&c.no_reset>' or '<red.no_reset>'.
//
// Note that end_format is a magic Denizen tool, and unlike other format codes (like 'bold') does not appear in Spigot's API or the old Minecraft chat system.
// As such, it only works when sent through certain Denizen commands (narrate, announce, etc) or mechanisms (like ItemTag.book).
// This will not be valid anywhere that isn't in the chat bar or a book (titles, items, etc. will not work).
// Note that this is a magic Denizen tool - refer to <@link language Denizen Text Formatting>.
// -->
PropertyParser.<BukkitElementProperties>registerTag("no_reset", (attribute, object) -> {
if (object.asString().length() == 2 && object.asString().charAt(0) == ChatColor.COLOR_CHAR) {
Expand All @@ -502,10 +479,7 @@ public static void registerTags() {
// @description
// Makes a chat format code (&klmno) be the end of a format, as opposed to the start.
// Use like '<&o.end_format>' or '<italic.end_format>'.
//
// Note that end_format is a magic Denizen tool, and unlike other format codes (like 'bold') does not appear in Spigot's API or the old Minecraft chat system.
// As such, it only works when sent through certain Denizen commands (narrate, announce, etc) or mechanisms (like ItemTag.book).
// This will not be valid anywhere that isn't in the chat bar or a book (titles, items, etc. will not work).
// Note that this is a magic Denizen tool - refer to <@link language Denizen Text Formatting>.
// -->
PropertyParser.<BukkitElementProperties>registerTag("end_format", (attribute, object) -> {
if (object.asString().length() == 2 && object.asString().charAt(0) == ChatColor.COLOR_CHAR) {
Expand All @@ -520,10 +494,7 @@ public static void registerTags() {
// @group text manipulation
// @description
// Makes the input text italic. Equivalent to "<&o><ELEMENT_HERE><&o.end_format>"
//
// Note that end_format is a magic Denizen tool, and unlike other format codes (like 'bold') does not appear in Spigot's API or the old Minecraft chat system.
// As such, it only works when sent through certain Denizen commands (narrate, announce, etc) or mechanisms (like ItemTag.book).
// This will not be valid anywhere that isn't in the chat bar or a book (titles, items, etc. will not work).
// Note that this is a magic Denizen tool - refer to <@link language Denizen Text Formatting>.
// -->
PropertyParser.<BukkitElementProperties>registerTag("italicize", (attribute, object) -> {
return new ElementTag(ChatColor.ITALIC + object.asString() + ChatColor.COLOR_CHAR + "[reset=o]");
Expand All @@ -535,10 +506,7 @@ public static void registerTags() {
// @group text manipulation
// @description
// Makes the input text bold. Equivalent to "<&l><ELEMENT_HERE><&l.end_format>"
//
// Note that end_format is a magic Denizen tool, and unlike other format codes (like 'bold') does not appear in Spigot's API or the old Minecraft chat system.
// As such, it only works when sent through certain Denizen commands (narrate, announce, etc) or mechanisms (like ItemTag.book).
// This will not be valid anywhere that isn't in the chat bar or a book (titles, items, etc. will not work).
// Note that this is a magic Denizen tool - refer to <@link language Denizen Text Formatting>.
// -->
PropertyParser.<BukkitElementProperties>registerTag("bold", (attribute, object) -> {
return new ElementTag(ChatColor.BOLD + object.asString() + ChatColor.COLOR_CHAR + "[reset=l]");
Expand All @@ -550,10 +518,7 @@ public static void registerTags() {
// @group text manipulation
// @description
// Makes the input text underlined. Equivalent to "<&n><ELEMENT_HERE><&n.end_format>"
//
// Note that end_format is a magic Denizen tool, and unlike other format codes (like 'bold') does not appear in Spigot's API or the old Minecraft chat system.
// As such, it only works when sent through certain Denizen commands (narrate, announce, etc) or mechanisms (like ItemTag.book).
// This will not be valid anywhere that isn't in the chat bar or a book (titles, items, etc. will not work).
// Note that this is a magic Denizen tool - refer to <@link language Denizen Text Formatting>.
// -->
PropertyParser.<BukkitElementProperties>registerTag("underline", (attribute, object) -> {
return new ElementTag(ChatColor.UNDERLINE + object.asString() + ChatColor.COLOR_CHAR + "[reset=n]");
Expand All @@ -565,10 +530,7 @@ public static void registerTags() {
// @group text manipulation
// @description
// Makes the input text struck-through. Equivalent to "<&m><ELEMENT_HERE><&m.end_format>"
//
// Note that end_format is a magic Denizen tool, and unlike other format codes (like 'bold') does not appear in Spigot's API or the old Minecraft chat system.
// As such, it only works when sent through certain Denizen commands (narrate, announce, etc) or mechanisms (like ItemTag.book).
// This will not be valid anywhere that isn't in the chat bar or a book (titles, items, etc. will not work).
// Note that this is a magic Denizen tool - refer to <@link language Denizen Text Formatting>.
// -->
PropertyParser.<BukkitElementProperties>registerTag("strikethrough", (attribute, object) -> {
return new ElementTag(ChatColor.STRIKETHROUGH + object.asString() + ChatColor.COLOR_CHAR + "[reset=m]");
Expand All @@ -580,10 +542,7 @@ public static void registerTags() {
// @group text manipulation
// @description
// Makes the input text obfuscated. Equivalent to "<&k><ELEMENT_HERE><&k.end_format>"
//
// Note that end_format is a magic Denizen tool, and unlike other format codes (like 'bold') does not appear in Spigot's API or the old Minecraft chat system.
// As such, it only works when sent through certain Denizen commands (narrate, announce, etc) or mechanisms (like ItemTag.book).
// This will not be valid anywhere that isn't in the chat bar or a book (titles, items, etc. will not work).
// Note that this is a magic Denizen tool - refer to <@link language Denizen Text Formatting>.
// -->
PropertyParser.<BukkitElementProperties>registerTag("obfuscate", (attribute, object) -> {
return new ElementTag(ChatColor.MAGIC + object.asString() + ChatColor.COLOR_CHAR + "[reset=k]");
Expand All @@ -596,10 +555,7 @@ public static void registerTags() {
// @description
// Makes the input text colored by the input color. Equivalent to "<COLOR><ELEMENT_HERE><COLOR.end_format>"
// Color can be a color name, color code, hex, or ColorTag... that is: ".color[gold]", ".color[6]", ".color[#AABB00]", and ".color[co@128,64,0]" are all valid.
//
// Note that end_format is a magic Denizen tool, and unlike other format codes (like 'bold') does not appear in Spigot's API or the old Minecraft chat system.
// As such, it only works when sent through certain Denizen commands (narrate, announce, etc) or mechanisms (like ItemTag.book).
// This will not be valid anywhere that isn't in the chat bar or a book (titles, items, etc. will not work).
// Note that this is a magic Denizen tool - refer to <@link language Denizen Text Formatting>.
// -->
PropertyParser.<BukkitElementProperties>registerTag("color", (attribute, object) -> {
if (!attribute.hasContext(1)) {
Expand Down Expand Up @@ -644,10 +600,7 @@ else if (colorName.startsWith("co@")) {
// @description
// Makes the input text display with the input font name. Equivalent to "<&font[new-font]><ELEMENT_HERE><&font[previous-font]>"
// The default font is "minecraft:default".
//
// Note that font is a magic Denizen tool, and unlike other format codes (like 'bold') does not appear in Spigot's API or the old Minecraft chat system.
// As such, it only works when sent through certain Denizen commands (narrate, announce, etc) or mechanisms (like ItemTag.book).
// This will not be valid anywhere that isn't in the chat bar or a book (titles, items, etc. will not work).
// Note that this is a magic Denizen tool - refer to <@link language Denizen Text Formatting>.
// -->
PropertyParser.<BukkitElementProperties>registerTag("font", (attribute, object) -> {
if (!attribute.hasContext(1)) {
Expand Down

0 comments on commit d31cbf5

Please sign in to comment.