mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-22 21:26:46 +01:00
Updated death messages
This commit is contained in:
parent
e24f6570d5
commit
cc541934bf
@ -38,19 +38,20 @@ public class vMinecraftChat {
|
|||||||
|
|
||||||
for (Player receiver : etc.getServer().getPlayerList()) {
|
for (Player receiver : etc.getServer().getPlayerList()) {
|
||||||
|
|
||||||
if (receiver == null) {return;}
|
if (receiver == null) return;
|
||||||
|
|
||||||
|
if(vMinecraftUsers.getProfile(receiver) == null) return;
|
||||||
|
|
||||||
if(vMinecraftUsers.getProfile(receiver) == null)
|
|
||||||
return;
|
|
||||||
//Check if the person has the sender ignored
|
//Check if the person has the sender ignored
|
||||||
if(!vMinecraftUsers.getProfile(receiver).isIgnored(sender))
|
if(sender != null)
|
||||||
{
|
if(vMinecraftUsers.getProfile(receiver).isIgnored(sender))
|
||||||
|
return;
|
||||||
|
|
||||||
String[] message = applyColors(wordWrap(msg));
|
String[] message = applyColors(wordWrap(msg));
|
||||||
for(String out : message)
|
for(String out : message)
|
||||||
receiver.sendMessage(out);
|
receiver.sendMessage(out);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
//=====================================================================
|
//=====================================================================
|
||||||
//Function: gmsg
|
//Function: gmsg
|
||||||
@ -75,15 +76,19 @@ public class vMinecraftChat {
|
|||||||
//Check if the receiver has the sender ignored
|
//Check if the receiver has the sender ignored
|
||||||
if(vMinecraftUsers.getProfile(receiver) == null)
|
if(vMinecraftUsers.getProfile(receiver) == null)
|
||||||
return;
|
return;
|
||||||
if(!vMinecraftUsers.getProfile(receiver).isIgnored(sender))
|
|
||||||
|
if(sender != null)
|
||||||
|
if(vMinecraftUsers.getProfile(receiver).isIgnored(sender))
|
||||||
{
|
{
|
||||||
|
sendMessage(sender, sender, Colors.Rose + receiver.getName()
|
||||||
|
+ " has you on their ignore list.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
String[] message = applyColors(wordWrap(msg));
|
String[] message = applyColors(wordWrap(msg));
|
||||||
for(String out : message)
|
for(String out : message)
|
||||||
receiver.sendMessage(out);
|
receiver.sendMessage(out);
|
||||||
//Tell them if they are
|
//Tell them if they are
|
||||||
} else
|
|
||||||
sendMessage(sender, sender, Colors.Rose + receiver.getName()
|
|
||||||
+ " has you on their ignore list.");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//=====================================================================
|
//=====================================================================
|
||||||
|
@ -6,9 +6,6 @@ import java.util.logging.Logger;
|
|||||||
//Author: nossr50, TrapAlice, cerevisiae
|
//Author: nossr50, TrapAlice, cerevisiae
|
||||||
//=====================================================================
|
//=====================================================================
|
||||||
public class vMinecraftListener extends PluginListener {
|
public class vMinecraftListener extends PluginListener {
|
||||||
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");
|
||||||
|
|
||||||
//=====================================================================
|
//=====================================================================
|
||||||
@ -83,12 +80,8 @@ public class vMinecraftListener extends PluginListener {
|
|||||||
//Use: Checks for exploits and runs the commands
|
//Use: Checks for exploits and runs the commands
|
||||||
//=====================================================================
|
//=====================================================================
|
||||||
public boolean onHealthChange(Player player,int oldValue,int newValue){
|
public boolean onHealthChange(Player player,int oldValue,int newValue){
|
||||||
if (vMinecraftSettings.getInstance().isEzModo(player.getName())) {
|
if (player.getHealth() > 1){
|
||||||
return oldValue > newValue;
|
vMinecraftUsers.getProfile(player).isDead(false);
|
||||||
}
|
|
||||||
if (player.getHealth() < 1){
|
|
||||||
senddeath = true;
|
|
||||||
deadplayer = player.getName();
|
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -113,27 +106,51 @@ 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 (senddeath == true) {
|
|
||||||
if (type == type.CREEPER_EXPLOSION) {
|
Player defend = null;
|
||||||
vMinecraftChat.gmsg(deadplayer + Colors.Rose + " was blown to bits by a creeper");
|
if(defender != null && defender.isPlayer())
|
||||||
} else if(type == type.FALL){
|
{
|
||||||
vMinecraftChat.gmsg(deadplayer + Colors.Rose + " fell to death!");
|
defend = defender.getPlayer();
|
||||||
} else if(type == type.FIRE){
|
if (vMinecraftSettings.getInstance().isEzModo(defend.getName())) {
|
||||||
vMinecraftChat.gmsg(deadplayer + Colors.Rose + " was incinerated");
|
|
||||||
} else if (type == type.FIRE_TICK){
|
|
||||||
vMinecraftChat.gmsg(deadplayer + Colors.Rose + " Stop drop and roll, not scream, run, and burn ");
|
|
||||||
} else if (type == type.LAVA){
|
|
||||||
vMinecraftChat.gmsg(deadplayer + Colors.Rose + " drowned in lava");
|
|
||||||
} else if (type == type.WATER){
|
|
||||||
vMinecraftChat.gmsg(deadplayer + Colors.Rose + " should've attended that swimming class");
|
|
||||||
} else {
|
|
||||||
vMinecraftChat.gmsg(Colors.Gray + deadplayer + " " + vMinecraftSettings.randomDeathMsg());
|
|
||||||
}
|
|
||||||
senddeath = false;
|
|
||||||
}
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (defend.getHealth() > 0)
|
||||||
|
return false;
|
||||||
|
if (vMinecraftUsers.getProfile(defend).isDead())
|
||||||
|
return false;
|
||||||
|
|
||||||
|
vMinecraftUsers.getProfile(defend).isDead(true);
|
||||||
|
|
||||||
|
Player attack = null;
|
||||||
|
if(attacker != null && attacker.isPlayer())
|
||||||
|
attack = attacker.getPlayer();
|
||||||
|
if(attack != null)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
if (type == type.CREEPER_EXPLOSION) {
|
||||||
|
vMinecraftChat.gmsg(defend.getName() + Colors.Rose + " was blown to bits by a creeper");
|
||||||
|
} else if(type == type.FALL){
|
||||||
|
vMinecraftChat.gmsg(defend.getName() + Colors.Rose + " fell to death!");
|
||||||
|
} else if(type == type.FIRE){
|
||||||
|
vMinecraftChat.gmsg(defend.getName() + Colors.Rose + " was incinerated");
|
||||||
|
} else if (type == type.FIRE_TICK){
|
||||||
|
vMinecraftChat.gmsg(defend.getName() + Colors.Rose + " Stop drop and roll, not scream, run, and burn ");
|
||||||
|
} else if (type == type.LAVA){
|
||||||
|
vMinecraftChat.gmsg(defend.getName() + Colors.Rose + " drowned in lava");
|
||||||
|
} else if (type == type.WATER){
|
||||||
|
log.log(Level.INFO, "Water");
|
||||||
|
vMinecraftChat.gmsg(defend.getName() + Colors.Rose + " should've attended that swimming class");
|
||||||
|
} else {
|
||||||
|
vMinecraftChat.gmsg(Colors.Gray + defend.getName() + " " + vMinecraftSettings.randomDeathMsg());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -154,6 +154,8 @@ class PlayerList
|
|||||||
tag,
|
tag,
|
||||||
suffix;
|
suffix;
|
||||||
|
|
||||||
|
private boolean dead;
|
||||||
|
|
||||||
char defaultColor;
|
char defaultColor;
|
||||||
|
|
||||||
String location = "vminecraft.users";
|
String location = "vminecraft.users";
|
||||||
@ -182,6 +184,7 @@ class PlayerList
|
|||||||
defaultColor = 'f';
|
defaultColor = 'f';
|
||||||
ignoreList = new ArrayList<String>();
|
ignoreList = new ArrayList<String>();
|
||||||
aliasList = new commandList();
|
aliasList = new commandList();
|
||||||
|
dead = false;
|
||||||
|
|
||||||
//Try to load the player and if they aren't found, append them
|
//Try to load the player and if they aren't found, append them
|
||||||
if(!load())
|
if(!load())
|
||||||
@ -544,6 +547,22 @@ class PlayerList
|
|||||||
return etc.getServer().matchPlayer(lastMessage);
|
return etc.getServer().matchPlayer(lastMessage);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//=====================================================================
|
||||||
|
//Function: isDead
|
||||||
|
//Input: None
|
||||||
|
//Output: boolean: If the player is dead or not
|
||||||
|
//Use: Gets the player is dead or not.
|
||||||
|
//=====================================================================
|
||||||
|
public boolean isDead() {return dead;}
|
||||||
|
|
||||||
|
//=====================================================================
|
||||||
|
//Function: isDead
|
||||||
|
//Input: boolean isded: if the player is dead or not.
|
||||||
|
//Output: None
|
||||||
|
//Use: Sets if the player is dead or not
|
||||||
|
//=====================================================================
|
||||||
|
public void isDead(boolean isded){dead = isded;}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user