Skip to content

Damage.CommandSource

Package: com.hypixel.hytale.server.core.modules.entity.damage

public static class Damage.CommandSource implements Damage.Source

A Damage.Source that identifies a command as the origin of the damage. Tracks both the CommandSender who executed the command and the command name.

public CommandSource(@Nonnull CommandSender commandSender, @Nonnull AbstractCommand cmd)

Creates a command source from a sender and a command object. The command name is extracted via cmd.getName().

public CommandSource(@Nonnull CommandSender commandSender, @Nullable String commandName)

Creates a command source from a sender and an explicit command name string.

@Nonnull
@Override
public Message getDeathMessage(@Nonnull Damage info, @Nonnull Ref<EntityStore> targetRef, @Nonnull ComponentAccessor<EntityStore> componentAccessor)

Returns a localized death message using the server.general.killedByCommand translation key, parameterized with the sender’s display name and the command name (or “Unknown” if null).

FieldTypeModifiersDescription
commandSenderCommandSenderprivate finalThe sender who executed the command.
commandNameStringprivate finalName of the command, or null.
Hydex is an independent community resource. Hytale is a trademark of Hypixel Studios. Hydex is not affiliated with or endorsed by Hypixel Studios.