Skip to content

Commit

Permalink
Fix some component bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
fullwall committed Dec 20, 2022
1 parent df4877c commit eb96177
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 15 deletions.
11 changes: 0 additions & 11 deletions src/main/java/net/citizensnpcs/api/npc/NPC.java
Expand Up @@ -3,7 +3,6 @@
import java.util.UUID;
import java.util.function.Supplier;

import org.bukkit.ChatColor;
import org.bukkit.Location;
import org.bukkit.block.Block;
import org.bukkit.command.CommandSender;
Expand Down Expand Up @@ -429,11 +428,6 @@ public enum Metadata {
* Whether the NPC is currently glowing. Boolean.
*/
GLOWING("glowing"),
/**
* The color to glow using Minecraft's scoreboard glowing feature. Should be a {@link ChatColor#name()}.
* DEPRECATED: use ScoreboardTrait instead
*/
GLOWING_COLOR("glowing-color"),
/**
* The Minecraft sound to play when hurt. String - Minecraft sound name.
*/
Expand Down Expand Up @@ -606,11 +600,6 @@ public String getKey() {
* Whether the NPC is 'flyable' i.e. will fly when pathfinding. Boolean.
*/
public static final String FLYABLE_METADATA = "flyable";
/**
* The color to glow using Minecraft's scoreboard glowing feature. Should be a {@link ChatColor#name()}. DEPRECATED:
* use ScoreboardTrait instead
*/
public static final String GLOWING_COLOR_METADATA = "glowing-color";
/**
* Whether the NPC is currently glowing. Boolean.
*/
Expand Down
5 changes: 3 additions & 2 deletions src/main/java/net/citizensnpcs/api/util/Messaging.java
Expand Up @@ -176,9 +176,10 @@ private static String prettify(String message) {
message = messageColour + message;
}
}
message = CHAT_NEWLINE.matcher(message).replaceAll("<reset><br>]]");
message = HIGHLIGHT_MATCHER.matcher(message).replaceAll("<" + HIGHLIGHT_COLOUR + ">");
message = ERROR_MATCHER.matcher(message).replaceAll(ERROR_COLOUR);
return CHAT_NEWLINE.matcher(message).replaceAll("<br>]]").replace("]]", "</" + HIGHLIGHT_COLOUR + ">");
return message.replace("]]", MESSAGE_COLOUR);
}

public static void send(CommandSender sender, Object... msg) {
Expand Down Expand Up @@ -293,7 +294,7 @@ public static String tryTranslate(Object possible) {
COLORCODE_CONVERTER.put("k", "<obf>");
COLORCODE_CONVERTER.put("o", "<i>");
COLORCODE_CONVERTER.put("l", "<b>");
COLORCODE_CONVERTER.put("r", "<r>");
COLORCODE_CONVERTER.put("r", "<reset>");
try {
MINIMESSAGE_COLORCODE_MATCHER = Pattern
.compile(
Expand Down
3 changes: 1 addition & 2 deletions src/main/java/net/citizensnpcs/api/util/Translator.java
Expand Up @@ -252,8 +252,7 @@ public static void setInstance(File dataFolder, Locale preferredLocale) {
}

public static String translate(String key, Locale preferredLocale, Object... msg) {
return Messaging.parseComponents(msg.length == 0 ? instance.translate(key, preferredLocale)
: instance.format(key, preferredLocale, msg));
return msg.length == 0 ? instance.translate(key, preferredLocale) : instance.format(key, preferredLocale, msg);
}

public static String translate(String key, Object... msg) {
Expand Down

0 comments on commit eb96177

Please sign in to comment.