mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-22 05:06:45 +01:00
Further revisions, moved death messages to onDamager.
This commit is contained in:
parent
f521bd6fe9
commit
278c24650a
@ -6,7 +6,6 @@ import java.util.logging.Logger;
|
||||
//Author: nossr50, TrapAlice, cerevisiae
|
||||
//=====================================================================
|
||||
public class vMinecraftListener extends PluginListener {
|
||||
public int damagetype;
|
||||
protected static final Logger log = Logger.getLogger("Minecraft");
|
||||
|
||||
//=====================================================================
|
||||
@ -84,8 +83,42 @@ public class vMinecraftListener extends PluginListener {
|
||||
if (vMinecraftSettings.getInstance().isEzModo(player.getName())) {
|
||||
return oldValue > newValue;
|
||||
}
|
||||
//These are place holders until I make random messages for everything and also to see if these work correctly
|
||||
if (vMinecraftSettings.getInstance().globalmessages() && newValue < 1) {
|
||||
return false;
|
||||
}
|
||||
|
||||
public void onLogin(Player player){
|
||||
vMinecraftUsers.addUser(player);
|
||||
}
|
||||
public boolean onDamage(PluginLoader.DamageType type, BaseEntity attacker, BaseEntity defender, int amount) {
|
||||
if(defender.isPlayer()){
|
||||
int damagetype = 0; //Set to 0 to begin with
|
||||
Player player = (Player)defender;
|
||||
if(defender.isPlayer() && 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
|
||||
}
|
||||
}
|
||||
if (defender.isPlayer() && attacker.isPlayer()) {
|
||||
Player pAttacker = (Player)attacker;
|
||||
Player pDefender = (Player)defender;
|
||||
if(pDefender.getHealth() < 1){
|
||||
damagetype =0; //Reset damagetype to 0
|
||||
vMinecraftChat.gmsg(player, pAttacker.getName() + " has murdered " + pDefender.getName());
|
||||
}
|
||||
|
||||
}
|
||||
if (player.getHealth() < 1 && !attacker.isPlayer()) {
|
||||
if (damagetype == 1){
|
||||
vMinecraftChat.gmsg(player,player.getName() + Colors.Red + " was blown to bits by a creeper");
|
||||
} else if (damagetype == 2) {
|
||||
@ -102,53 +135,6 @@ public class vMinecraftListener extends PluginListener {
|
||||
vMinecraftChat.gmsg(player, Colors.Gray + player.getName() + " " + vMinecraftSettings.randomDeathMsg());
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public void onLogin(Player player){
|
||||
vMinecraftUsers.addUser(player);
|
||||
}
|
||||
public boolean onDamage(PluginLoader.DamageType type, BaseEntity attacker, BaseEntity defender, int amount) {
|
||||
if(defender.isPlayer() && !attacker.isPlayer()){
|
||||
Player player = (Player)defender;
|
||||
if(player.getHealth() < 1) {
|
||||
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
|
||||
} else{
|
||||
damagetype = 0;
|
||||
}
|
||||
if (defender.isPlayer() && attacker.isPlayer()) {
|
||||
Player pAttacker = (Player)attacker;
|
||||
Player pDefender = (Player)defender;
|
||||
damagetype = 0;
|
||||
vMinecraftChat.gmsg(player, pAttacker.getName() + " has murdered " + pDefender.getName());
|
||||
}
|
||||
if (damagetype == 1 && !attacker.isPlayer()){
|
||||
vMinecraftChat.gmsg(player,player.getName() + Colors.Red + " was blown to bits by a creeper");
|
||||
} else if (damagetype == 2) {
|
||||
vMinecraftChat.gmsg(player,player.getName() + Colors.Red + " fell to death!");
|
||||
} else if (damagetype ==3){
|
||||
vMinecraftChat.gmsg(player, player.getName() + Colors.Red + " was incinerated");
|
||||
} else if (damagetype == 4){
|
||||
vMinecraftChat.gmsg(player, Colors.Red + " Stop drop and roll, not scream, run, and burn " + player.getName());
|
||||
} else if (damagetype == 5){
|
||||
vMinecraftChat.gmsg(player, Colors.Red + player.getName() + " drowned in lava");
|
||||
} else if (damagetype == 6){
|
||||
vMinecraftChat.gmsg(player, Colors.Blue + player.getName() + " should've attended that swimming class");
|
||||
} else {
|
||||
vMinecraftChat.gmsg(player, Colors.Gray + player.getName() + " " + vMinecraftSettings.randomDeathMsg());
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user