diff --git a/Changelog.txt b/Changelog.txt
index 871c4681f..2942292a3 100644
--- a/Changelog.txt
+++ b/Changelog.txt
@@ -1,20 +1,25 @@
Version 2.2.006
+ Added new config custom_item_support.yml
Added support for hex color codes in the locale file, uses the format RRGGBB (see notes)
+ Added setting to disable repair on items with custom models, this is not on by default
Fixed a bug where sometimes the locale name of a skill would get lowercased
+ Fixed a bug where JSON text components did not get colored properly some of the time
Fixed en_US locale string 'Commands.Skill.Leaderboard' not being colored properly
Fixed skill commands incorrectly telling you to use their locale name, this isn't currently possible
Updated outdated wiki URLs in commands to point to the new wiki
Removed the msg about skills being migrated to a new system when using /mmoinfo command
- Added new config custom_item_support.yml
- Added setting to disable repair on items with custom models, this is not on by default
Added new locale entry 'Anvil.Repair.Reject.CustomModelData'
Added new locale entry 'Anvil.Salvage.Reject.CustomModelData'
+ Updated en_US locale entry 'JSON.DescriptionHeader'
+ (API/Codebase) Added some util methods and basic unit tests for LocaleLoader
NOTES:
Hex Color support in locale files is here!
The hex color code format for the locale files is RRGGBB
An example entry applying yellow as a hex color code would look like this:
Axes.SkillName=FFFF00Axes
+ In general, JSON locale entries will either not work with hex color codes or will have the color code stripped out, in the future I will add support for the JSON components to use hex colors from the locale
+
Let me know in detail what kind of support you'd like to see in mcMMO regarding custom items, I'm open to suggestions.
This update adds a new config file to allow server owners to disable repair or salvage on items with custom models,
This prevention mechanism is not enabled by default, change the settings in custom_item_support.yml if you want to enable it.
diff --git a/pom.xml b/pom.xml
index 711d57778..23cf31b89 100644
--- a/pom.xml
+++ b/pom.xml
@@ -2,7 +2,7 @@
4.0.0
com.gmail.nossr50.mcMMO
mcMMO
- 2.2.006-SNAPSHOT
+ 2.2.006
mcMMO
https://github.com/mcMMO-Dev/mcMMO
diff --git a/src/main/java/com/gmail/nossr50/util/commands/CommandRegistrationManager.java b/src/main/java/com/gmail/nossr50/util/commands/CommandRegistrationManager.java
index 69256e1a2..0946b4cc5 100644
--- a/src/main/java/com/gmail/nossr50/util/commands/CommandRegistrationManager.java
+++ b/src/main/java/com/gmail/nossr50/util/commands/CommandRegistrationManager.java
@@ -20,7 +20,6 @@ import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.text.StringUtils;
-import org.bukkit.Bukkit;
import org.bukkit.command.PluginCommand;
import java.util.ArrayList;
diff --git a/src/main/java/com/gmail/nossr50/util/experience/ExperienceBarWrapper.java b/src/main/java/com/gmail/nossr50/util/experience/ExperienceBarWrapper.java
index 898d36a05..185026ed9 100644
--- a/src/main/java/com/gmail/nossr50/util/experience/ExperienceBarWrapper.java
+++ b/src/main/java/com/gmail/nossr50/util/experience/ExperienceBarWrapper.java
@@ -4,7 +4,6 @@ import com.gmail.nossr50.config.experience.ExperienceConfig;
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
import com.gmail.nossr50.locale.LocaleLoader;
-import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.player.PlayerLevelUtils;
import com.gmail.nossr50.util.text.StringUtils;
import org.bukkit.boss.BarColor;
diff --git a/src/main/java/com/gmail/nossr50/util/text/TextComponentFactory.java b/src/main/java/com/gmail/nossr50/util/text/TextComponentFactory.java
index 6ba0fc622..89981bb85 100644
--- a/src/main/java/com/gmail/nossr50/util/text/TextComponentFactory.java
+++ b/src/main/java/com/gmail/nossr50/util/text/TextComponentFactory.java
@@ -19,6 +19,7 @@ import net.kyori.adventure.text.event.HoverEvent;
import net.kyori.adventure.text.format.NamedTextColor;
import net.kyori.adventure.text.format.TextColor;
import net.kyori.adventure.text.format.TextDecoration;
+import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;
@@ -235,8 +236,8 @@ public class TextComponentFactory {
}
private static Component getSubSkillTextComponent(Player player, SubSkillType subSkillType) {
- //Get skill name
- final String skillName = subSkillType.getLocaleName();
+ //Get skill name and strip it of color
+ final String skillName = ChatColor.stripColor(subSkillType.getLocaleName());
boolean skillUnlocked = RankUtils.hasUnlockedSubskill(player, subSkillType);
@@ -290,11 +291,6 @@ public class TextComponentFactory {
return textComponent;
}
- private static TextComponent.Builder detectLegacyColors(String msg) {
- // TODO: Impl
- return null;
- }
-
private static Component getSubSkillHoverComponent(Player player, AbstractSubSkill abstractSubSkill) {
return getSubSkillHoverEventJSON(abstractSubSkill, player);
}
@@ -311,7 +307,7 @@ public class TextComponentFactory {
* @return the hover basecomponent object for this subskill
*/
private static Component getSubSkillHoverEventJSON(AbstractSubSkill abstractSubSkill, Player player) {
- String skillName = abstractSubSkill.getNiceName();
+ String skillName = ChatColor.stripColor(abstractSubSkill.getNiceName());
/*
* Hover Event BaseComponent color table
@@ -404,7 +400,8 @@ public class TextComponentFactory {
}
private static Component getSubSkillHoverEventJSON(SubSkillType subSkillType, Player player) {
- String skillName = subSkillType.getLocaleName();
+ // Get skill name and strip it of color
+ String skillName = ChatColor.stripColor(subSkillType.getLocaleName());
/*
* Hover Event BaseComponent color table
@@ -438,11 +435,9 @@ public class TextComponentFactory {
}
componentBuilder.append(Component.newline());
- componentBuilder.append(Component.text(LocaleLoader.getString("JSON.DescriptionHeader")));
- componentBuilder.color(ccDescriptionHeader);
+ componentBuilder.append(Component.text(LocaleLoader.getString("JSON.DescriptionHeader")).color(ccDescriptionHeader));
componentBuilder.append(Component.newline());
- componentBuilder.append(Component.text(subSkillType.getLocaleDescription()));
- componentBuilder.color(ccDescription);
+ componentBuilder.append(Component.text(ChatColor.stripColor(subSkillType.getLocaleDescription())).color(ccDescription));
}
return componentBuilder.build();
diff --git a/src/main/resources/locale/locale_en_US.properties b/src/main/resources/locale/locale_en_US.properties
index 2a8081761..11e550b20 100644
--- a/src/main/resources/locale/locale_en_US.properties
+++ b/src/main/resources/locale/locale_en_US.properties
@@ -1,10 +1,5 @@
-#I'm going to try to normalize our locale file, forgive the mess for now.
-# TODO: Update JSON to support hex
-
-#DO NOT USE COLOR CODES IN THE JSON KEYS
-#COLORS ARE DEFINED IN advanced.yml IF YOU WISH TO CHANGE THEM
JSON.Rank=Rank
-JSON.DescriptionHeader=Description
+JSON.DescriptionHeader=Description:
JSON.JWrapper.Header=Details
JSON.Type.Passive=Passive
JSON.Type.Active=Active
diff --git a/src/test/java/com/gmail/nossr50/locale/LocaleLoaderTest.java b/src/test/java/com/gmail/nossr50/locale/LocaleLoaderTest.java
index cd3ca90dd..d7db4bee3 100644
--- a/src/test/java/com/gmail/nossr50/locale/LocaleLoaderTest.java
+++ b/src/test/java/com/gmail/nossr50/locale/LocaleLoaderTest.java
@@ -10,7 +10,6 @@ import org.junit.jupiter.params.provider.ValueSource;
import java.util.List;
import static org.assertj.core.api.Assertions.assertThat;
-import static org.junit.jupiter.api.Assertions.*;
class LocaleLoaderTest {