mirror of
https://github.com/EssentialsX/Essentials.git
synced 2025-01-28 19:11:53 +01:00
Properly apply damage causes
This commit is contained in:
parent
8485bd44f9
commit
7d6714f713
@ -34,6 +34,7 @@ public class Commandkill extends EssentialsLoopCommand {
|
|||||||
if (ede.isCancelled() && sender.isPlayer() && !ess.getUser(sender.getPlayer()).isAuthorized("essentials.kill.force")) {
|
if (ede.isCancelled() && sender.isPlayer() && !ess.getUser(sender.getPlayer()).isAuthorized("essentials.kill.force")) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
ede.getEntity().setLastDamageCause(ede);
|
||||||
matchPlayer.damage(Short.MAX_VALUE);
|
matchPlayer.damage(Short.MAX_VALUE);
|
||||||
|
|
||||||
if (matchPlayer.getHealth() > 0) {
|
if (matchPlayer.getHealth() > 0) {
|
||||||
|
@ -16,6 +16,7 @@ public class Commandsuicide extends EssentialsCommand {
|
|||||||
public void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception {
|
public void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception {
|
||||||
EntityDamageEvent ede = new EntityDamageEvent(user.getBase(), EntityDamageEvent.DamageCause.SUICIDE, Short.MAX_VALUE);
|
EntityDamageEvent ede = new EntityDamageEvent(user.getBase(), EntityDamageEvent.DamageCause.SUICIDE, Short.MAX_VALUE);
|
||||||
server.getPluginManager().callEvent(ede);
|
server.getPluginManager().callEvent(ede);
|
||||||
|
ede.getEntity().setLastDamageCause(ede);
|
||||||
user.getBase().damage(Short.MAX_VALUE);
|
user.getBase().damage(Short.MAX_VALUE);
|
||||||
if (user.getBase().getHealth() > 0) {
|
if (user.getBase().getHealth() > 0) {
|
||||||
user.getBase().setHealth(0);
|
user.getBase().setHealth(0);
|
||||||
|
Loading…
Reference in New Issue
Block a user