Skip to content

Commit

Permalink
requested changes
Browse files Browse the repository at this point in the history
  • Loading branch information
EquipableMC committed Dec 28, 2024
1 parent 35e0c4e commit 83d02db
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/main/java/ch/njol/skript/effects/EffKill.java
Original file line number Diff line number Diff line change
Expand Up @@ -53,20 +53,20 @@ public boolean init(Expression<?>[] exprs, int matchedPattern, Kleenean isDelaye
protected void execute(Event event) {
for (Entity entity : entities.getArray(event)) {

if (entity instanceof EnderDragonPart) {
entity = ((EnderDragonPart) entity).getParent();
if (entity instanceof EnderDragonPart part) {
entity = part.getParent();
}

if (ignoreTotem) {
HealthUtils.setHealth((Damageable) entity, 0);
return;
}

if (entity instanceof Damageable) {
if (entity instanceof Damageable damageable) {
boolean creative = entity instanceof Player player && player.getGameMode() == GameMode.CREATIVE;
if (creative) // Set player to survival before applying damage
((Player) entity).setGameMode(GameMode.SURVIVAL);
HealthUtils.damage((Damageable) entity, HealthUtils.getMaxHealth((Damageable) entity) * 100); // just to make sure that it really dies >:)
HealthUtils.damage(damageable, HealthUtils.getMaxHealth(damageable) * 100); // just to make sure that it really dies >:)

if (creative) // Set creative player back to creative
((Player) entity).setGameMode(GameMode.CREATIVE);
Expand All @@ -82,7 +82,7 @@ protected void execute(Event event) {

@Override
public String toString(@Nullable Event event, boolean debug) {
return "kill" + entities.toString(event, debug);
return "kill " + entities.toString(event, debug);
}

}

0 comments on commit 83d02db

Please sign in to comment.