SPIGOT-7383: Add EntityDamageEvent.DamageCause#KILL and EntityDamageEvent.DamageCause#WORLD_BORDER

By: Doc <nachito94@msn.com>
This commit is contained in:
Bukkit/Spigot 2023-06-12 08:17:04 +10:00
parent 486c2ad801
commit 192986747c

View File

@ -8,6 +8,7 @@ import java.util.EnumMap;
import java.util.Map;
import java.util.Objects;
import org.bukkit.Material;
import org.bukkit.WorldBorder;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
import org.bukkit.event.Cancellable;
@ -260,6 +261,18 @@ public class EntityDamageEvent extends EntityEvent implements Cancellable {
*/
public enum DamageCause {
/**
* Damage caused by /kill command
* <p>
* Damage: {@link Float#MAX_VALUE}
*/
KILL,
/**
* Damage caused by the World Border
* <p>
* Damage: {@link WorldBorder#getDamageAmount()}
*/
WORLD_BORDER,
/**
* Damage caused when an entity contacts a block such as a Cactus,
* Dripstone (Stalagmite) or Berry Bush.
@ -356,7 +369,7 @@ public class EntityDamageEvent extends EntityEvent implements Cancellable {
* Damage caused by committing suicide.
* <p>
* <b>Note:</b> This is currently only used by plugins, default commands
* like /minecraft:kill use {@link #VOID} to damage players.
* like /minecraft:kill use {@link #KILL} to damage players.
* <p>
* Damage: variable
*/