mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-22 21:26:46 +01:00
Theoretically working death messages, emphasis on theoretically since I can't test them yet!
This commit is contained in:
parent
8a0d0bf60f
commit
31906f2766
@ -7,6 +7,8 @@ import java.util.logging.Logger;
|
|||||||
//=====================================================================
|
//=====================================================================
|
||||||
public class vMinecraftListener extends PluginListener {
|
public class vMinecraftListener extends PluginListener {
|
||||||
public int damagetype;
|
public int damagetype;
|
||||||
|
public String deadplayer;
|
||||||
|
public boolean senddeath;
|
||||||
protected static final Logger log = Logger.getLogger("Minecraft");
|
protected static final Logger log = Logger.getLogger("Minecraft");
|
||||||
|
|
||||||
//=====================================================================
|
//=====================================================================
|
||||||
@ -84,6 +86,10 @@ public class vMinecraftListener extends PluginListener {
|
|||||||
if (vMinecraftSettings.getInstance().isEzModo(player.getName())) {
|
if (vMinecraftSettings.getInstance().isEzModo(player.getName())) {
|
||||||
return oldValue > newValue;
|
return oldValue > newValue;
|
||||||
}
|
}
|
||||||
|
if (player.getHealth() < 1){
|
||||||
|
senddeath = true;
|
||||||
|
deadplayer = player.getName();
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -108,41 +114,26 @@ public class vMinecraftListener extends PluginListener {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
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()){
|
|
||||||
try{
|
if (senddeath == true) {
|
||||||
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) {
|
if (type == type.CREEPER_EXPLOSION) {
|
||||||
vMinecraftChat.gmsg(player,player.getName() + Colors.Red + " was blown to bits by a creeper");
|
vMinecraftChat.gmsg(player, deadplayer + Colors.Red + " was blown to bits by a creeper");
|
||||||
} else if(type == type.FALL){
|
} else if(type == type.FALL){
|
||||||
vMinecraftChat.gmsg(player,player.getName() + Colors.Red + " fell to death!");
|
vMinecraftChat.gmsg(player, deadplayer + Colors.Red + " fell to death!");
|
||||||
} else if(type == type.FIRE){
|
} else if(type == type.FIRE){
|
||||||
vMinecraftChat.gmsg(player, player.getName() + Colors.Red + " was incinerated");
|
vMinecraftChat.gmsg(player, deadplayer + Colors.Red + " was incinerated");
|
||||||
} else if (type == type.FIRE_TICK){
|
} else if (type == type.FIRE_TICK){
|
||||||
vMinecraftChat.gmsg(player, Colors.Red + " Stop drop and roll, not scream, run, and burn " + player.getName());
|
vMinecraftChat.gmsg(player, deadplayer + Colors.Red + " Stop drop and roll, not scream, run, and burn " + player.getName());
|
||||||
} else if (type == type.LAVA){
|
} else if (type == type.LAVA){
|
||||||
vMinecraftChat.gmsg(player, Colors.Red + player.getName() + " drowned in lava");
|
vMinecraftChat.gmsg(player, deadplayer + Colors.Red + " drowned in lava");
|
||||||
} else if (type == type.WATER){
|
} else if (type == type.WATER){
|
||||||
vMinecraftChat.gmsg(player, Colors.Blue + player.getName() + " should've attended that swimming class");
|
vMinecraftChat.gmsg(player, deadplayer + Colors.Blue + " should've attended that swimming class");
|
||||||
|
} else {
|
||||||
|
vMinecraftChat.gmsg(player, Colors.Gray + deadplayer + " " + vMinecraftSettings.randomDeathMsg());
|
||||||
}
|
}
|
||||||
//This should trigger the player death message
|
senddeath = false;
|
||||||
} 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) {}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
return false;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user