mirror of
https://github.com/HangarMC/Hangar.git
synced 2024-11-27 06:01:08 +08:00
Fixes, update test data
This commit is contained in:
parent
dc7641a17d
commit
34f2c4ee25
@ -30,20 +30,19 @@ public class BBCodeConverter {
|
||||
REPLACERS.put("user", (tag, tagArg, content) -> content);
|
||||
REPLACERS.put("list", (tag, tagArg, content) -> content);
|
||||
|
||||
REPLACERS.put("spoiler", (tag, tagArg, content) -> {
|
||||
return "<details>\n" +
|
||||
" <summary>" + removeQuotes(tagArg) + "</summary>\n" +
|
||||
" " + content + "\n" +
|
||||
"</details>\n";
|
||||
});
|
||||
REPLACERS.put("spoiler", (tag, tagArg, content) -> "<details>\n<summary>%s</summary>\n\n%s\n</details>\n".formatted(removeQuotes(tagArg), content));
|
||||
REPLACERS.put("b", (tag, tagArg, content) -> "**" + content + "**");
|
||||
REPLACERS.put("i", (tag, tagArg, content) -> "*" + content + "*");
|
||||
REPLACERS.put("s", (tag, tagArg, content) -> "~~" + content + "~~");
|
||||
REPLACERS.put("img", (tag, tagArg, content) -> "![" + content + "](" + content + ")");
|
||||
REPLACERS.put("media", (tag, tagArg, content) -> "youtube".equals(tagArg) ? "@[YouTube](https://youtu.be/" + content + ")" : null);
|
||||
REPLACERS.put("size", (tag, tagArg, content) -> {
|
||||
if (content.isBlank()) {
|
||||
return content;
|
||||
}
|
||||
|
||||
Integer size = Ints.tryParse(tagArg);
|
||||
if (size == null) {
|
||||
if (size == null || size == 4) { // 4 is the default size
|
||||
return content;
|
||||
}
|
||||
|
||||
@ -177,7 +176,7 @@ public class BBCodeConverter {
|
||||
TagReplacer replacer = REPLACERS.get(currentTag);
|
||||
if (replacer != null && replacer.appendNewline()) {
|
||||
int lastChar = s.length() - 1;
|
||||
if (s.lastIndexOf("\n") == lastChar) {
|
||||
if (s.lastIndexOf('\n') == lastChar) {
|
||||
return s.substring(0, lastChar);
|
||||
}
|
||||
}
|
||||
@ -309,7 +308,7 @@ public class BBCodeConverter {
|
||||
if (s.length() > 2) {
|
||||
final char c = s.charAt(0);
|
||||
if ((c == '\'' || c == '"') && c == s.charAt(s.length() - 1)) {
|
||||
return s.substring(0, s.length() - 1);
|
||||
return s.substring(1, s.length() - 1);
|
||||
}
|
||||
}
|
||||
return s;
|
||||
|
@ -27,7 +27,7 @@ IMPORTANT: If using the plugin on a Spigot server, the plugin **[ProtocolLib](ht
|
||||
|
||||
![https://www.spigotmc.org/attachments/401279](https://www.spigotmc.org/attachments/401279)
|
||||
|
||||
Did you find a bug? Use the [**issue tracker**](https://github.com/kennytv/maintenance/issues)
|
||||
### Did you find a bug? Use the [**issue tracker**](https://github.com/kennytv/maintenance/issues)
|
||||
Other questions or problems? Click the wonderful icon below ✨
|
||||
|
||||
[![https://www.spigotmc.org/attachments/401277](https://www.spigotmc.org/attachments/401277)](https://discord.gg/vgcuzhq)
|
||||
@ -72,6 +72,9 @@ config-version: 4
|
||||
|
||||
```
|
||||
|
||||
<details>
|
||||
<summary>language-en.yml</summary>
|
||||
|
||||
```
|
||||
noPermission: "&cYou do not have the permission to execute that command."
|
||||
kickmessage: "&cThe server is currently under maintenance!%NEWLINE%&cTry again later!"
|
||||
@ -79,6 +82,8 @@ kickmessage: "&cThe server is currently under maintenance!%NEWLINE%&cTry again l
|
||||
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
|
||||
![https://www.spigotmc.org/attachments/401278](https://www.spigotmc.org/attachments/401278)
|
||||
If you have the ServerListPlus plugin on your BungeeCord/Spigot server, Maintenance will toggle its status. If you enable maintenance, the ServerListPlus motd will be disabled and then reenabled, when you disable maintenance to prevent any issues with them overriding each other.
|
||||
|
Loading…
Reference in New Issue
Block a user