From b2c33b779d7f83cc4f7de2d25fb26bebe7e560b3 Mon Sep 17 00:00:00 2001 From: cerevisiae Date: Wed, 1 Dec 2010 00:47:58 -0600 Subject: [PATCH] Fixed prefixes again --- vMinecraftChat.java | 57 +++++++++++++++++++++++------------------ vMinecraftListener.java | 15 ++++++----- 2 files changed, 40 insertions(+), 32 deletions(-) diff --git a/vMinecraftChat.java b/vMinecraftChat.java index 3f6463855..53bd6affc 100644 --- a/vMinecraftChat.java +++ b/vMinecraftChat.java @@ -79,7 +79,7 @@ public class vMinecraftChat { //and their following color codes for(int x = 0; x " + message); - return true; } - return false; + log.log(Level.INFO, "@" + "<" + getName(player) + + Colors.White +"> " + message); + return true; } + return false; + } //===================================================================== //Function: quote @@ -386,7 +387,7 @@ public class vMinecraftChat { //===================================================================== public static String[] applyColors(String[] message) { - if(message != null && message[0] != null && !message[0].equals("")){ + if(message != null && message[0] != null && !message[0].isEmpty()){ //The color to start the line with String recentColor = Colors.White; @@ -400,8 +401,8 @@ public class vMinecraftChat { //Loop through looking for a color code for(int x = 0; x< msg.length(); x++) { - //If the char is a ^ or � - if(msg.charAt(x) == '^' || msg.charAt(x) == '§') + //If the char is a ^ or § + if(msg.charAt(x) == '^' || msg.charAt(x) == Colors.White.charAt(0)) { if(x != msg.length() - 1) { @@ -419,6 +420,8 @@ public class vMinecraftChat { temp += msg.charAt(x); } //Insert the character + } else { + temp += msg.charAt(x); } } else { temp += msg.charAt(x); @@ -452,7 +455,7 @@ public class vMinecraftChat { //===================================================================== public static String applyColors(String message, String color) { - if(message != null && !message.equals("")) + if(message != null && !message.isEmpty()) { //The color to start the line with if(color == null) @@ -464,8 +467,8 @@ public class vMinecraftChat { //Loop through looking for a color code for(int x = 0; x< message.length(); x++) { - //If the char is a ^ or � - if(message.charAt(x) == '^' || message.charAt(x) == '§') + //If the char is a ^ or '§' + if(message.charAt(x) == '^' || message.charAt(x) == Colors.White.charAt(0)) { if(x != message.length() - 1) { @@ -486,9 +489,13 @@ public class vMinecraftChat { } else { temp += message.charAt(x); } + //Insert the character + } else { + temp += message.charAt(x); } - + } + message = temp; } return message; } diff --git a/vMinecraftListener.java b/vMinecraftListener.java index a89cfda06..3d1aa54d1 100644 --- a/vMinecraftListener.java +++ b/vMinecraftListener.java @@ -81,15 +81,16 @@ public class vMinecraftListener extends PluginListener { //Use: Checks for exploits and runs the commands //===================================================================== public boolean onHealthChange(Player player,int oldValue,int newValue){ - if (player.getHealth() != vMinecraftSettings.getInstance().ezModoHealth() && vMinecraftSettings.getInstance().isEzModo(player.getName())) { - player.setHealth(vMinecraftSettings.getInstance().ezModoHealth()); + if (player.getHealth() != vMinecraftSettings.getInstance().ezModoHealth() + && vMinecraftSettings.getInstance().isEzModo(player.getName())) { + player.setHealth(vMinecraftSettings.getInstance().ezModoHealth()); - } - else if (vMinecraftSettings.getInstance().globalmessages() && player.getHealth() < 1) { - vMinecraftChat.gmsg(Colors.Gray + player.getName() + " " + vMinecraftSettings.randomDeathMsg()); - } - return false; } + else if (vMinecraftSettings.getInstance().globalmessages() && player.getHealth() < 1) { + vMinecraftChat.gmsg(Colors.Gray + player.getName() + " " + vMinecraftSettings.randomDeathMsg()); + } + return false; + } /** Not working yet, I posted the issue to hMod on github though public boolean onDamage(DamageType type, BaseEntity attacker, BaseEntity defender, int amount) {