From d4b8800fb1732199fa5f78dff5272e283923962d Mon Sep 17 00:00:00 2001 From: Marc Baloup Date: Sat, 24 Jan 2015 03:46:25 -0500 Subject: [PATCH] =?UTF-8?q?Prise=20en=20charge=20des=20code=20couleurs=20e?= =?UTF-8?q?t=20du=20retour=20=C3=A0=20la=20ligne=20dans=20les=20messages?= =?UTF-8?q?=20automatiques?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/plugin/pandacraftutils/ConfigManager.java | 6 +++--- .../plugin/pandacraftutils/modules/AutoMessagesManager.java | 3 ++- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/net/mc_pandacraft/java/plugin/pandacraftutils/ConfigManager.java b/src/net/mc_pandacraft/java/plugin/pandacraftutils/ConfigManager.java index df0c86a..4fa173a 100644 --- a/src/net/mc_pandacraft/java/plugin/pandacraftutils/ConfigManager.java +++ b/src/net/mc_pandacraft/java/plugin/pandacraftutils/ConfigManager.java @@ -91,6 +91,7 @@ public class ConfigManager { // TODO ajouter les valeurs par défaut dans config.yml // TODO gérer les codes de coloration; + ServerMessages_defaultColor = ChatColor.YELLOW.toString(); ServerMessages_prefix = ChatColor.YELLOW+"["+ChatColor.WHITE+"Pandacraft"+ChatColor.YELLOW+"] "; //configFile.getString("server_messages_prefix"); @@ -144,7 +145,6 @@ public class ConfigManager { private void initAutomessages() { Automessages_messages = new ArrayList>(); - String default_color = ChatColor.YELLOW.toString(); Map message; @@ -154,7 +154,7 @@ public class ConfigManager { Automessages_messages.add(message); message = new HashMap(); - message.put("message", "WorldEdit disponible en &bCréatif"+default_color+" avec le grade &f[&eUltimate&f]"+default_color+". Profitez en vite :D%n&f &a http://mc-pandacraft.net/?p=ultimate"); + message.put("message", "WorldEdit disponible en &bCréatif"+ServerMessages_defaultColor+" avec le grade &f[&eUltimate&f]"+ServerMessages_defaultColor+". Profitez en vite :D%n &a http://mc-pandacraft.net/?p=ultimate"); message.put("permissions", "*"); Automessages_messages.add(message); @@ -339,7 +339,7 @@ public class ConfigManager { public List CuboCommand_worlds = new ArrayList(); public String ServerMessages_prefix; - + public String ServerMessages_defaultColor; diff --git a/src/net/mc_pandacraft/java/plugin/pandacraftutils/modules/AutoMessagesManager.java b/src/net/mc_pandacraft/java/plugin/pandacraftutils/modules/AutoMessagesManager.java index 7cfeb6c..93d44b7 100644 --- a/src/net/mc_pandacraft/java/plugin/pandacraftutils/modules/AutoMessagesManager.java +++ b/src/net/mc_pandacraft/java/plugin/pandacraftutils/modules/AutoMessagesManager.java @@ -11,6 +11,7 @@ import net.mc_pandacraft.java.plugin.pandacraftutils.PandacraftUtils; import net.mc_pandacraft.java.plugin.pandacraftutils.players.OnlinePlayer; import net.mc_pandacraft.java.plugin.pandacraftutils.players.OnlinePlayerManager; +import org.bukkit.ChatColor; import org.bukkit.entity.Player; import org.bukkit.scheduler.BukkitRunnable; @@ -81,7 +82,7 @@ public class AutoMessagesManager extends BukkitRunnable { ArrayList ret = new ArrayList(); for (Map message : ConfigManager.getInstance().Automessages_messages) - ret.add(new AutoMessage(message.get("message"), message.get("permissions"))); + ret.add(new AutoMessage(ChatColor.translateAlternateColorCodes('&', message.get("message").replace("%n", "\n")), message.get("permissions"))); return ret; }