Fixing irregularities with wordwrap. Removed the random nulls that appear.

This commit is contained in:
cerevisiae 2010-12-08 18:30:26 -06:00
parent 861ef59334
commit ccee3b5d5c
3 changed files with 43 additions and 58 deletions

View File

@ -97,7 +97,7 @@ public class vMinecraftChat {
} }
//Merge them and add them to the output array. //Merge them and add them to the output array.
out.add( etc.combineSplit(0, out.add( etc.combineSplit(0,
words.toArray(new String[out.size()]), " ") ); words.toArray(new String[words.size()]), " ") + " " );
} }
//Convert to an array and return //Convert to an array and return
return out.toArray(new String[out.size()]); return out.toArray(new String[out.size()]);
@ -141,8 +141,12 @@ public class vMinecraftChat {
int len = charLength(str.charAt(x)); int len = charLength(str.charAt(x));
if( len > 0) if( len > 0)
length += len; length += len;
else
x++;
x++; x++;
} }
if(x > str.length())
x = str.length();
//Add the substring to the output after cutting it //Add the substring to the output after cutting it
output[0] = str.substring(0, x); output[0] = str.substring(0, x);
//Add the last of the string to the output. //Add the last of the string to the output.
@ -166,7 +170,7 @@ public class vMinecraftChat {
return 4; return 4;
else if("fk{}<>\"*()".indexOf(x) != -1) else if("fk{}<>\"*()".indexOf(x) != -1)
return 5; return 5;
else if("abcdeghjmnopqrsuvwxyzABCDEFGHJKLMNOPQRSTUVWXYZ1234567890\\/#?$%-=_+&".indexOf(x) != -1) else if("abcdeghjmnopqrsuvwxyzABCDEFGHJKLMNOPQRSTUVWXYZ1234567890\\/#?$%-=_+&^".indexOf(x) != -1)
return 6; return 6;
else if("@~".indexOf(x) != -1) else if("@~".indexOf(x) != -1)
return 7; return 7;

View File

@ -104,6 +104,7 @@ public class vMinecraftListener extends PluginListener {
} }
public boolean onDamage(PluginLoader.DamageType type, BaseEntity attacker, BaseEntity defender, int amount) { public boolean onDamage(PluginLoader.DamageType type, BaseEntity attacker, BaseEntity defender, int amount) {
if(defender.isPlayer()){ if(defender.isPlayer()){
try{
Player player = (Player)defender; Player player = (Player)defender;
if (attacker.isPlayer()) { if (attacker.isPlayer()) {
Player pAttacker = (Player)attacker; Player pAttacker = (Player)attacker;
@ -113,48 +114,28 @@ public class vMinecraftListener extends PluginListener {
} }
if (player.getHealth() < 1 && !attacker.isPlayer()) { if (player.getHealth() < 1 && !attacker.isPlayer()) {
if (type == type.CREEPER_EXPLOSION) { if (type == type.CREEPER_EXPLOSION) {
damagetype = 1; //Creeper vMinecraftChat.gmsg(player,player.getName() + Colors.Red + " was blown to bits by a creeper");
} else if(type == type.FALL){ } else if(type == type.FALL){
damagetype = 2; //Fall vMinecraftChat.gmsg(player,player.getName() + Colors.Red + " fell to death!");
} else if(type == type.FIRE){ } else if(type == type.FIRE){
damagetype = 3; //Fire going to make it share with firetick since its similar vMinecraftChat.gmsg(player, player.getName() + Colors.Red + " was incinerated");
} else if (type == type.FIRE_TICK){ } else if (type == type.FIRE_TICK){
damagetype = 4; //Firetick vMinecraftChat.gmsg(player, Colors.Red + " Stop drop and roll, not scream, run, and burn " + player.getName());
} else if (type == type.LAVA){ } else if (type == type.LAVA){
damagetype = 5; //Lava vMinecraftChat.gmsg(player, Colors.Red + player.getName() + " drowned in lava");
} else if (type == type.WATER){ } else if (type == type.WATER){
damagetype = 6; //Water vMinecraftChat.gmsg(player, Colors.Blue + player.getName() + " should've attended that swimming class");
} }
//This should trigger the player death message //This should trigger the player death message
} else if (player.getHealth() < 1 && attacker.isPlayer()){ } 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; Player pAttacker = (Player)attacker;
vMinecraftChat.gmsg(player, pAttacker.getName() + " has murdered " + player.getName()); vMinecraftChat.gmsg(player, pAttacker.getName() + " has murdered " + player.getName());
damagetype = 0; damagetype = 0;
} } else
else {
vMinecraftChat.gmsg(player, Colors.Gray + player.getName() + " " + vMinecraftSettings.randomDeathMsg()); vMinecraftChat.gmsg(player, Colors.Gray + player.getName() + " " + vMinecraftSettings.randomDeathMsg());
} } catch (Exception e) {}
catch (Throwable e) {}
} }
return false; return false;
} }

View File

@ -282,10 +282,10 @@ class PlayerList
//Use: Finds if the specified player is in the ignore list //Use: Finds if the specified player is in the ignore list
//===================================================================== //=====================================================================
public boolean isIgnored(Player player){ public boolean isIgnored(Player player){
log.log(Level.INFO, String.valueOf(ignoreList.contains(player.getName())));
for(String pl : ignoreList) for(String pl : ignoreList)
log.log(Level.INFO, pl); log.log(Level.INFO, pl);
return ignoreList.contains(player.getName());} return ignoreList.contains(player.getName());
}
//===================================================================== //=====================================================================
//Function: addIgnore //Function: addIgnore