From d332603fb468603b72066c9bfb18a1fcc3f396a7 Mon Sep 17 00:00:00 2001 From: Phoenix616 Date: Mon, 13 Nov 2017 15:11:22 +0100 Subject: [PATCH] Do not automatically color config strings (Fixes BUKKIT-1241) This is necessary so that we still store the messages with the & code internally as they would get saved back to the config file using the converted color code (section sign) which could lead to encoding issues on different operating systems. (It also fixes issues with strings that contain an and sign that isn't supposed to be a color code) Instead we load the real string and color messages via the prefix method which should get called in every instance where a message is send. --- .../java/com/Acrobot/Breeze/Configuration/ValueParser.java | 2 -- .../java/com/Acrobot/ChestShop/Configuration/Messages.java | 4 ++-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/Acrobot/Breeze/Configuration/ValueParser.java b/src/main/java/com/Acrobot/Breeze/Configuration/ValueParser.java index dbe8a77..d711986 100644 --- a/src/main/java/com/Acrobot/Breeze/Configuration/ValueParser.java +++ b/src/main/java/com/Acrobot/Breeze/Configuration/ValueParser.java @@ -39,8 +39,6 @@ public class ValueParser { } return map; - } else if (object instanceof String) { - return Configuration.getColoured((String) object); } else { return object; } diff --git a/src/main/java/com/Acrobot/ChestShop/Configuration/Messages.java b/src/main/java/com/Acrobot/ChestShop/Configuration/Messages.java index 01b4583..12b3000 100644 --- a/src/main/java/com/Acrobot/ChestShop/Configuration/Messages.java +++ b/src/main/java/com/Acrobot/ChestShop/Configuration/Messages.java @@ -1,7 +1,7 @@ package com.Acrobot.ChestShop.Configuration; import com.Acrobot.Breeze.Configuration.Annotations.PrecededBySpace; -import org.bukkit.ChatColor; +import com.Acrobot.Breeze.Configuration.Configuration; /** * @author Acrobot @@ -73,6 +73,6 @@ public class Messages { public static String TOGGLE_MESSAGES_ON = "You will now receive messages from your shop(s)."; public static String prefix(String message) { - return prefix + message; + return Configuration.getColoured( prefix + message); } }