diff --git a/vMinecraftChat.java b/vMinecraftChat.java index 67a029c99..799ee068a 100644 --- a/vMinecraftChat.java +++ b/vMinecraftChat.java @@ -65,7 +65,7 @@ public class vMinecraftChat { //Split each word apart ArrayList split = new ArrayList(); for(String in : msg.split(" ")) - split.add(in); + split.add(in); //Create an arraylist for the output ArrayList out = new ArrayList(); @@ -86,7 +86,7 @@ public class vMinecraftChat { if(wordLength > lineLength) { String[] tempArray = wordCut(len, split.remove(0)); - words.add(tempArray[0]); + words.add(tempArray[0]); split.add(tempArray[1]); } @@ -97,7 +97,7 @@ public class vMinecraftChat { } //Merge them and add them to the output array. out.add( etc.combineSplit(0, - words.toArray(new String[out.size()]), " ") ); + words.toArray(new String[words.size()]), " ") + " " ); } //Convert to an array and return return out.toArray(new String[out.size()]); @@ -141,8 +141,12 @@ public class vMinecraftChat { int len = charLength(str.charAt(x)); if( len > 0) length += len; + else + x++; x++; } + if(x > str.length()) + x = str.length(); //Add the substring to the output after cutting it output[0] = str.substring(0, x); //Add the last of the string to the output. @@ -166,7 +170,7 @@ public class vMinecraftChat { return 4; else if("fk{}<>\"*()".indexOf(x) != -1) return 5; - else if("abcdeghjmnopqrsuvwxyzABCDEFGHJKLMNOPQRSTUVWXYZ1234567890\\/#?$%-=_+&".indexOf(x) != -1) + else if("abcdeghjmnopqrsuvwxyzABCDEFGHJKLMNOPQRSTUVWXYZ1234567890\\/#?$%-=_+&^".indexOf(x) != -1) return 6; else if("@~".indexOf(x) != -1) return 7; diff --git a/vMinecraftListener.java b/vMinecraftListener.java index c44a0e6b4..f99465876 100644 --- a/vMinecraftListener.java +++ b/vMinecraftListener.java @@ -104,59 +104,40 @@ public class vMinecraftListener extends PluginListener { } public boolean onDamage(PluginLoader.DamageType type, BaseEntity attacker, BaseEntity defender, int amount) { if(defender.isPlayer()){ - Player player = (Player)defender; - if (attacker.isPlayer()) { - Player pAttacker = (Player)attacker; - if(player.getHealth() < 1){ - vMinecraftChat.gmsg(player, pAttacker.getName() + " has murdered " + player.getName()); - } + try{ + Player player = (Player)defender; + if (attacker.isPlayer()) { + Player pAttacker = (Player)attacker; + if(player.getHealth() < 1){ + vMinecraftChat.gmsg(player, pAttacker.getName() + " has murdered " + player.getName()); + } + } + if (player.getHealth() < 1 && !attacker.isPlayer()) { + if (type == type.CREEPER_EXPLOSION) { + vMinecraftChat.gmsg(player,player.getName() + Colors.Red + " was blown to bits by a creeper"); + } else if(type == type.FALL){ + vMinecraftChat.gmsg(player,player.getName() + Colors.Red + " fell to death!"); + } else if(type == type.FIRE){ + vMinecraftChat.gmsg(player, player.getName() + Colors.Red + " was incinerated"); + } else if (type == type.FIRE_TICK){ + vMinecraftChat.gmsg(player, Colors.Red + " Stop drop and roll, not scream, run, and burn " + player.getName()); + } else if (type == type.LAVA){ + vMinecraftChat.gmsg(player, Colors.Red + player.getName() + " drowned in lava"); + } else if (type == type.WATER){ + vMinecraftChat.gmsg(player, Colors.Blue + player.getName() + " should've attended that swimming class"); + } + //This should trigger the player death message + } else if (player.getHealth() < 1 && attacker.isPlayer()){ + Player pAttacker = (Player)attacker; + vMinecraftChat.gmsg(player, pAttacker.getName() + " has murdered " + player.getName()); + damagetype = 0; + } else + vMinecraftChat.gmsg(player, Colors.Gray + player.getName() + " " + vMinecraftSettings.randomDeathMsg()); + } catch (Exception e) {} + catch (Throwable e) {} + } - if (player.getHealth() < 1 && !attacker.isPlayer()) { - if (type == type.CREEPER_EXPLOSION) { - damagetype = 1; //Creeper - } else if(type == type.FALL){ - damagetype = 2; //Fall - } else if(type == type.FIRE){ - damagetype = 3; //Fire going to make it share with firetick since its similar - } else if (type == type.FIRE_TICK){ - damagetype = 4; //Firetick - } else if (type == type.LAVA){ - damagetype = 5; //Lava - } else if (type == type.WATER){ - damagetype = 6; //Water - } - //This should trigger the player death message - } else if (player.getHealth() < 1 && attacker.isPlayer()){ - damagetype = 7; //Player - } - if(damagetype == 1){ - vMinecraftChat.gmsg(player,player.getName() + Colors.Red + " was blown to bits by a creeper"); - damagetype = 0; - } else if (damagetype == 2) { - vMinecraftChat.gmsg(player,player.getName() + Colors.Red + " fell to death!"); - damagetype = 0; - } else if (damagetype ==3){ - vMinecraftChat.gmsg(player, player.getName() + Colors.Red + " was incinerated"); - damagetype = 0; - } else if (damagetype == 4){ - vMinecraftChat.gmsg(player, Colors.Red + " Stop drop and roll, not scream, run, and burn " + player.getName()); - damagetype = 0; - } else if (damagetype == 5){ - vMinecraftChat.gmsg(player, Colors.Red + player.getName() + " drowned in lava"); - damagetype = 0; - } else if (damagetype == 6){ - vMinecraftChat.gmsg(player, Colors.Blue + player.getName() + " should've attended that swimming class"); - damagetype = 0; - } else if (damagetype == 7){ - Player pAttacker = (Player)attacker; - vMinecraftChat.gmsg(player, pAttacker.getName() + " has murdered " + player.getName()); - damagetype = 0; - } - else { - vMinecraftChat.gmsg(player, Colors.Gray + player.getName() + " " + vMinecraftSettings.randomDeathMsg()); - } - } - return false; + return false; } } \ No newline at end of file diff --git a/vMinecraftUsers.java b/vMinecraftUsers.java index 459a1cab9..75e419e6c 100644 --- a/vMinecraftUsers.java +++ b/vMinecraftUsers.java @@ -282,10 +282,10 @@ class PlayerList //Use: Finds if the specified player is in the ignore list //===================================================================== public boolean isIgnored(Player player){ - log.log(Level.INFO, String.valueOf(ignoreList.contains(player.getName()))); for(String pl : ignoreList) log.log(Level.INFO, pl); - return ignoreList.contains(player.getName());} + return ignoreList.contains(player.getName()); + } //===================================================================== //Function: addIgnore