mirror of
https://github.com/darksaid98/HuskHomes.git
synced 2026-12-01 22:16:08 +00:00
Add TITLE and SUBTITLE warmup display options, stop parsing simple inline MineDown formatting, close #210
This commit is contained in:
1 parent
f80261d919
commit
41ce426480
5 files changed
+31
-6
No files matched your search
@@ -1,7 +1,6 @@
|
||||
package net.william278.huskhomes.config;
|
||||
|
||||
import de.themoep.minedown.MineDown;
|
||||
import de.themoep.minedown.Util;
|
||||
import net.william278.annotaml.RootedMap;
|
||||
import net.william278.annotaml.YamlFile;
|
||||
import org.apache.commons.text.StringEscapeUtils;
|
||||
@@ -111,8 +110,7 @@ public class Locales {
|
||||
boolean isEscape = c == '\\';
|
||||
boolean isColorCode = i + 1 < string.length() && (c == 167 || c == '&');
|
||||
boolean isEvent = c == '[' || c == ']' || c == '(' || c == ')';
|
||||
boolean isFormatting = (c == '_' || c == '*' || c == '~' || c == '?' || c == '#') && Util.isDouble(string, i);
|
||||
if (isEscape || isColorCode || isEvent || isFormatting) {
|
||||
if (isEscape || isColorCode || isEvent) {
|
||||
value.append('\\');
|
||||
}
|
||||
|
||||
|
||||
@@ -281,7 +281,8 @@ public class Settings {
|
||||
public enum MessageDisplayType {
|
||||
MESSAGE,
|
||||
ACTION_BAR,
|
||||
SUBTITLE
|
||||
SUBTITLE,
|
||||
TITLE
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -57,6 +57,14 @@ public abstract class OnlineUser extends User {
|
||||
@NotNull
|
||||
public abstract Map<String, Boolean> getPermissions();
|
||||
|
||||
/**
|
||||
* Dispatch a MineDown-formatted title or subtitle to the player
|
||||
*
|
||||
* @param mineDown the parsed {@link MineDown} to send
|
||||
* @param subTitle whether to send the title as a subtitle ({@code true} for a subtitle, {@code false} for a title)
|
||||
*/
|
||||
public abstract void sendTitle(@NotNull MineDown mineDown, boolean subTitle);
|
||||
|
||||
/**
|
||||
* Dispatch a MineDown-formatted action bar message to this player
|
||||
*
|
||||
|
||||
@@ -415,6 +415,8 @@ public class TeleportManager {
|
||||
.ifPresent(message -> {
|
||||
switch (plugin.getSettings().teleportWarmupDisplay) {
|
||||
case ACTION_BAR -> teleport.getPlayer().sendActionBar(message);
|
||||
case SUBTITLE -> teleport.getPlayer().sendTitle(message, true);
|
||||
case TITLE -> teleport.getPlayer().sendTitle(message, false);
|
||||
case MESSAGE -> teleport.getPlayer().sendMessage(message);
|
||||
}
|
||||
});
|
||||
@@ -423,6 +425,8 @@ public class TeleportManager {
|
||||
.ifPresent(message -> {
|
||||
switch (plugin.getSettings().teleportWarmupDisplay) {
|
||||
case ACTION_BAR -> teleport.getPlayer().sendActionBar(message);
|
||||
case SUBTITLE -> teleport.getPlayer().sendTitle(message, true);
|
||||
case TITLE -> teleport.getPlayer().sendTitle(message, false);
|
||||
case MESSAGE -> teleport.getPlayer().sendMessage(message);
|
||||
}
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user