Add tests, fix two color bugs
- Fix colors with underscores not getting replaced - Fix legacy black color not getting recognized - Add tests that use all colors
This commit is contained in:
1 parent
1d4c7966b1
commit
688752f201
3 files changed
+399
-6
No files matched your search
@@ -4,11 +4,7 @@ import me.wiefferink.interactivemessenger.generators.ConsoleGenerator;
|
||||
import me.wiefferink.interactivemessenger.message.InteractiveMessage;
|
||||
import me.wiefferink.interactivemessenger.message.InteractiveMessagePart;
|
||||
import me.wiefferink.interactivemessenger.message.TextMessagePart;
|
||||
import me.wiefferink.interactivemessenger.message.enums.Control;
|
||||
import me.wiefferink.interactivemessenger.message.enums.Color;
|
||||
import me.wiefferink.interactivemessenger.message.enums.Format;
|
||||
import me.wiefferink.interactivemessenger.message.enums.Click;
|
||||
import me.wiefferink.interactivemessenger.message.enums.Hover;
|
||||
import me.wiefferink.interactivemessenger.message.enums.*;
|
||||
import org.bukkit.ChatColor;
|
||||
|
||||
import java.util.*;
|
||||
@@ -19,7 +15,7 @@ public class YamlParser {
|
||||
|
||||
public static final char ESCAPE_CHAR = '\\';
|
||||
public static final char SIMPLE_FORMAT_RESET_CHAR = 'r';
|
||||
public static final Pattern tagPattern = Pattern.compile("\\[[/a-zA-Z1-9]+\\]|[&"+ChatColor.COLOR_CHAR+"][1-9a-zA-Z]");
|
||||
public static final Pattern tagPattern = Pattern.compile("\\[[/a-zA-Z1-9_]+\\]|[&"+ChatColor.COLOR_CHAR+"][0-9a-zA-Z]");
|
||||
|
||||
// Lookup table for all continuous enums ([<tag>])
|
||||
private static final HashMap<String, Object> BRACKET_TAGS = new HashMap<String, Object>() {{
|
||||
|
||||
+230
@@ -0,0 +1,230 @@
|
||||
&0black, §0black,
|
||||
&1dark_blue, §1dark_blue,
|
||||
&2dark_green, §2dark_green,
|
||||
&3dark_aqua, §3dark_aqua,
|
||||
&4dark_red, §4dark_red,
|
||||
&5dark_purple, §5dark_purple,
|
||||
&6gold, §6gold,
|
||||
&7gray, §7gray,
|
||||
&8dark_gray, §8dark_gray,
|
||||
&9blue, §9blue,
|
||||
&agreen, §agreen,
|
||||
&baqua, §baqua,
|
||||
&cred, §cred,
|
||||
&dlight_purple, §dlight_purple,
|
||||
&eyellow, §eyellow,
|
||||
&fwhite, §fwhite
|
||||
|
||||
[
|
||||
{
|
||||
"text": "",
|
||||
"extra": [
|
||||
{
|
||||
"text": "",
|
||||
"extra": [
|
||||
{
|
||||
"text": "black, ",
|
||||
"color": "black"
|
||||
},
|
||||
{
|
||||
"text": "black,",
|
||||
"color": "black"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"text": "",
|
||||
"extra": [
|
||||
{
|
||||
"text": "dark_blue, ",
|
||||
"color": "dark_blue"
|
||||
},
|
||||
{
|
||||
"text": "dark_blue,",
|
||||
"color": "dark_blue"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"text": "",
|
||||
"extra": [
|
||||
{
|
||||
"text": "dark_green, ",
|
||||
"color": "dark_green"
|
||||
},
|
||||
{
|
||||
"text": "dark_green,",
|
||||
"color": "dark_green"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"text": "",
|
||||
"extra": [
|
||||
{
|
||||
"text": "dark_aqua, ",
|
||||
"color": "dark_aqua"
|
||||
},
|
||||
{
|
||||
"text": "dark_aqua,",
|
||||
"color": "dark_aqua"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"text": "",
|
||||
"extra": [
|
||||
{
|
||||
"text": "dark_red, ",
|
||||
"color": "dark_red"
|
||||
},
|
||||
{
|
||||
"text": "dark_red,",
|
||||
"color": "dark_red"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"text": "",
|
||||
"extra": [
|
||||
{
|
||||
"text": "dark_purple, ",
|
||||
"color": "dark_purple"
|
||||
},
|
||||
{
|
||||
"text": "dark_purple,",
|
||||
"color": "dark_purple"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"text": "",
|
||||
"extra": [
|
||||
{
|
||||
"text": "gold, ",
|
||||
"color": "gold"
|
||||
},
|
||||
{
|
||||
"text": "gold,",
|
||||
"color": "gold"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"text": "",
|
||||
"extra": [
|
||||
{
|
||||
"text": "gray, ",
|
||||
"color": "gray"
|
||||
},
|
||||
{
|
||||
"text": "gray,",
|
||||
"color": "gray"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"text": "",
|
||||
"extra": [
|
||||
{
|
||||
"text": "dark_gray, ",
|
||||
"color": "dark_gray"
|
||||
},
|
||||
{
|
||||
"text": "dark_gray,",
|
||||
"color": "dark_gray"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"text": "",
|
||||
"extra": [
|
||||
{
|
||||
"text": "blue, ",
|
||||
"color": "blue"
|
||||
},
|
||||
{
|
||||
"text": "blue,",
|
||||
"color": "blue"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"text": "",
|
||||
"extra": [
|
||||
{
|
||||
"text": "green, ",
|
||||
"color": "green"
|
||||
},
|
||||
{
|
||||
"text": "green,",
|
||||
"color": "green"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"text": "",
|
||||
"extra": [
|
||||
{
|
||||
"text": "aqua, ",
|
||||
"color": "aqua"
|
||||
},
|
||||
{
|
||||
"text": "aqua,",
|
||||
"color": "aqua"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"text": "",
|
||||
"extra": [
|
||||
{
|
||||
"text": "red, ",
|
||||
"color": "red"
|
||||
},
|
||||
{
|
||||
"text": "red,",
|
||||
"color": "red"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"text": "",
|
||||
"extra": [
|
||||
{
|
||||
"text": "light_purple, ",
|
||||
"color": "light_purple"
|
||||
},
|
||||
{
|
||||
"text": "light_purple,",
|
||||
"color": "light_purple"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"text": "",
|
||||
"extra": [
|
||||
{
|
||||
"text": "yellow, ",
|
||||
"color": "yellow"
|
||||
},
|
||||
{
|
||||
"text": "yellow,",
|
||||
"color": "yellow"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"text": "",
|
||||
"extra": [
|
||||
{
|
||||
"text": "white, "
|
||||
},
|
||||
{
|
||||
"text": "white"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
+167
@@ -0,0 +1,167 @@
|
||||
[black]black,
|
||||
[dark_blue]dark_blue, [darkblue]darkblue,
|
||||
[dark_green]dark_green, [darkgreen]darkgreen,
|
||||
[dark_aqua]dark_aqua, [darkaqua]darkaqua,
|
||||
[dark_red]dark_red, [darkred]darkred,
|
||||
[dark_purple]dark_purple, [darkpurple]darkpurple,
|
||||
[gold]gold,
|
||||
[gray]gray, [grey]grey,
|
||||
[dark_gray]dark_gray, [darkgray]darkgray, [dark_grey]dark_grey, [darkgrey]darkgrey,
|
||||
[blue]blue,
|
||||
[green]green,
|
||||
[aqua]aqua,
|
||||
[red]red,
|
||||
[light_purple]light_purple, [lightpurple]lightpurple,
|
||||
[yellow]yellow,
|
||||
[white]white
|
||||
|
||||
[
|
||||
{
|
||||
"text": "",
|
||||
"extra": [
|
||||
{
|
||||
"text": "black,",
|
||||
"color": "black"
|
||||
},
|
||||
{
|
||||
"text": "",
|
||||
"extra": [
|
||||
{
|
||||
"text": "dark_blue, ",
|
||||
"color": "dark_blue"
|
||||
},
|
||||
{
|
||||
"text": "darkblue,",
|
||||
"color": "dark_blue"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"text": "",
|
||||
"extra": [
|
||||
{
|
||||
"text": "dark_green, ",
|
||||
"color": "dark_green"
|
||||
},
|
||||
{
|
||||
"text": "darkgreen,",
|
||||
"color": "dark_green"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"text": "",
|
||||
"extra": [
|
||||
{
|
||||
"text": "dark_aqua, ",
|
||||
"color": "dark_aqua"
|
||||
},
|
||||
{
|
||||
"text": "darkaqua,",
|
||||
"color": "dark_aqua"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"text": "",
|
||||
"extra": [
|
||||
{
|
||||
"text": "dark_red, ",
|
||||
"color": "dark_red"
|
||||
},
|
||||
{
|
||||
"text": "darkred,",
|
||||
"color": "dark_red"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"text": "",
|
||||
"extra": [
|
||||
{
|
||||
"text": "dark_purple, ",
|
||||
"color": "dark_purple"
|
||||
},
|
||||
{
|
||||
"text": "darkpurple,",
|
||||
"color": "dark_purple"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"text": "gold,",
|
||||
"color": "gold"
|
||||
},
|
||||
{
|
||||
"text": "",
|
||||
"extra": [
|
||||
{
|
||||
"text": "gray, ",
|
||||
"color": "gray"
|
||||
},
|
||||
{
|
||||
"text": "grey,",
|
||||
"color": "gray"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"text": "",
|
||||
"extra": [
|
||||
{
|
||||
"text": "dark_gray, ",
|
||||
"color": "dark_gray"
|
||||
},
|
||||
{
|
||||
"text": "darkgray, ",
|
||||
"color": "dark_gray"
|
||||
},
|
||||
{
|
||||
"text": "dark_grey, ",
|
||||
"color": "dark_gray"
|
||||
},
|
||||
{
|
||||
"text": "darkgrey,",
|
||||
"color": "dark_gray"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"text": "blue,",
|
||||
"color": "blue"
|
||||
},
|
||||
{
|
||||
"text": "green,",
|
||||
"color": "green"
|
||||
},
|
||||
{
|
||||
"text": "aqua,",
|
||||
"color": "aqua"
|
||||
},
|
||||
{
|
||||
"text": "red,",
|
||||
"color": "red"
|
||||
},
|
||||
{
|
||||
"text": "",
|
||||
"extra": [
|
||||
{
|
||||
"text": "light_purple, ",
|
||||
"color": "light_purple"
|
||||
},
|
||||
{
|
||||
"text": "lightpurple,",
|
||||
"color": "light_purple"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"text": "yellow,",
|
||||
"color": "yellow"
|
||||
},
|
||||
{
|
||||
"text": "white"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
Reference in new issue
Block a user