2021-09-30 01:48:54 -05:00
|
|
|
package noppes.npcs.scripted.event;
|
|
|
|
|
|
2021-09-30 21:44:30 -05:00
|
|
|
import cpw.mods.fml.common.eventhandler.Cancelable;
|
2021-09-30 01:48:54 -05:00
|
|
|
import net.minecraft.entity.Entity;
|
|
|
|
|
import net.minecraft.entity.EntityLivingBase;
|
2021-10-12 02:57:32 -05:00
|
|
|
import net.minecraft.entity.item.EntityXPOrb;
|
|
|
|
|
import net.minecraft.item.ItemStack;
|
2021-09-30 01:48:54 -05:00
|
|
|
import net.minecraft.util.DamageSource;
|
2021-10-18 20:50:54 -05:00
|
|
|
import net.minecraft.world.World;
|
2022-11-15 15:25:53 -05:00
|
|
|
import noppes.npcs.api.IBlock;
|
|
|
|
|
import noppes.npcs.api.IContainer;
|
|
|
|
|
import noppes.npcs.api.IDamageSource;
|
|
|
|
|
import noppes.npcs.api.entity.IEntity;
|
|
|
|
|
import noppes.npcs.api.entity.IEntityLivingBase;
|
|
|
|
|
import noppes.npcs.api.entity.IPlayer;
|
2022-11-24 14:36:09 -06:00
|
|
|
import noppes.npcs.api.event.IPlayerEvent;
|
2022-11-15 15:25:53 -05:00
|
|
|
import noppes.npcs.api.item.IItemStack;
|
2022-11-24 16:46:20 -06:00
|
|
|
import noppes.npcs.constants.EnumScriptType;
|
2022-05-11 22:08:31 -05:00
|
|
|
import noppes.npcs.scripted.NpcAPI;
|
2021-09-30 01:48:54 -05:00
|
|
|
|
2024-05-26 19:26:47 -04:00
|
|
|
public class PlayerEvent extends CustomNPCsEvent implements IPlayerEvent {
|
2021-09-30 01:48:54 -05:00
|
|
|
public final IPlayer player;
|
|
|
|
|
|
|
|
|
|
public PlayerEvent(IPlayer player) {
|
|
|
|
|
this.player = player;
|
|
|
|
|
}
|
|
|
|
|
|
2022-11-24 14:36:09 -06:00
|
|
|
public IPlayer getPlayer() {
|
|
|
|
|
return player;
|
|
|
|
|
}
|
|
|
|
|
|
2021-09-30 01:48:54 -05:00
|
|
|
@Cancelable
|
2022-11-24 14:36:09 -06:00
|
|
|
public static class ChatEvent extends PlayerEvent implements IPlayerEvent.ChatEvent {
|
2021-09-30 01:48:54 -05:00
|
|
|
public String message;
|
|
|
|
|
|
|
|
|
|
public ChatEvent(IPlayer player, String message) {
|
|
|
|
|
super(player);
|
|
|
|
|
this.message = message;
|
|
|
|
|
}
|
2022-11-24 14:36:09 -06:00
|
|
|
|
2022-11-24 16:46:20 -06:00
|
|
|
public String getHookName() {
|
|
|
|
|
return EnumScriptType.CHAT.function;
|
|
|
|
|
}
|
|
|
|
|
|
2022-11-24 14:36:09 -06:00
|
|
|
public void setMessage(String message) {
|
|
|
|
|
this.message = message;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public String getMessage() {
|
|
|
|
|
return message;
|
|
|
|
|
}
|
2021-09-30 01:48:54 -05:00
|
|
|
}
|
|
|
|
|
|
2022-11-24 14:36:09 -06:00
|
|
|
public static class KeyPressedEvent extends PlayerEvent implements IPlayerEvent.KeyPressedEvent {
|
2021-09-30 01:48:54 -05:00
|
|
|
public final int key;
|
|
|
|
|
public final boolean isCtrlPressed;
|
|
|
|
|
public final boolean isAltPressed;
|
|
|
|
|
public final boolean isShiftPressed;
|
|
|
|
|
public final boolean isMetaPressed;
|
2021-11-13 13:32:33 -06:00
|
|
|
public final boolean keyDown;
|
2022-01-31 20:16:00 -06:00
|
|
|
public final int[] keysDown;
|
2021-09-30 01:48:54 -05:00
|
|
|
|
2022-05-03 13:34:56 -05:00
|
|
|
public KeyPressedEvent(IPlayer player, int key, boolean isCtrlPressed, boolean isAltPressed, boolean isShiftPressed, boolean isMetaPressed, boolean keyDown, int[] heldKeys) {
|
2021-09-30 01:48:54 -05:00
|
|
|
super(player);
|
|
|
|
|
this.key = key;
|
|
|
|
|
this.isCtrlPressed = isCtrlPressed;
|
|
|
|
|
this.isAltPressed = isAltPressed;
|
|
|
|
|
this.isShiftPressed = isShiftPressed;
|
|
|
|
|
this.isMetaPressed = isMetaPressed;
|
2021-11-13 13:32:33 -06:00
|
|
|
this.keyDown = keyDown;
|
2022-01-31 20:16:00 -06:00
|
|
|
this.keysDown = heldKeys;
|
2021-09-30 01:48:54 -05:00
|
|
|
}
|
2022-11-24 14:36:09 -06:00
|
|
|
|
2022-11-24 16:46:20 -06:00
|
|
|
public String getHookName() {
|
|
|
|
|
return EnumScriptType.KEY_PRESSED.function;
|
|
|
|
|
}
|
|
|
|
|
|
2022-11-24 14:36:09 -06:00
|
|
|
public int getKey() {
|
|
|
|
|
return key;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public boolean isCtrlPressed() {
|
|
|
|
|
return isCtrlPressed;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public boolean isAltPressed() {
|
|
|
|
|
return isAltPressed;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public boolean isShiftPressed() {
|
|
|
|
|
return isShiftPressed;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public boolean isMetaPressed() {
|
|
|
|
|
return isMetaPressed;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public boolean keyDown() {
|
|
|
|
|
return keyDown;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public int[] getKeysDown() {
|
|
|
|
|
return keysDown;
|
|
|
|
|
}
|
2021-09-30 01:48:54 -05:00
|
|
|
}
|
|
|
|
|
|
2022-11-24 14:36:09 -06:00
|
|
|
public static class MouseClickedEvent extends PlayerEvent implements IPlayerEvent.MouseClickedEvent {
|
2022-07-06 18:41:39 -05:00
|
|
|
public final boolean isCtrlPressed;
|
|
|
|
|
public final boolean isAltPressed;
|
|
|
|
|
public final boolean isShiftPressed;
|
|
|
|
|
public final boolean isMetaPressed;
|
|
|
|
|
public final int[] keysDown;
|
|
|
|
|
|
2021-10-12 02:57:32 -05:00
|
|
|
public final int button;
|
|
|
|
|
public final int mouseWheel;
|
2021-11-13 13:32:33 -06:00
|
|
|
public final boolean buttonDown;
|
2021-10-12 02:57:32 -05:00
|
|
|
|
2022-07-06 18:41:39 -05:00
|
|
|
public MouseClickedEvent(IPlayer player, int button, int mouseWheel, boolean buttonDown, boolean isCtrlPressed, boolean isAltPressed, boolean isShiftPressed, boolean isMetaPressed, int[] heldKeys){
|
2021-10-12 02:57:32 -05:00
|
|
|
super(player);
|
|
|
|
|
this.button = button;
|
|
|
|
|
this.mouseWheel = mouseWheel;
|
2021-11-13 13:32:33 -06:00
|
|
|
this.buttonDown = buttonDown;
|
2022-07-06 18:41:39 -05:00
|
|
|
this.isCtrlPressed = isCtrlPressed;
|
|
|
|
|
this.isAltPressed = isAltPressed;
|
|
|
|
|
this.isShiftPressed = isShiftPressed;
|
|
|
|
|
this.isMetaPressed = isMetaPressed;
|
|
|
|
|
this.keysDown = heldKeys;
|
2021-10-12 02:57:32 -05:00
|
|
|
}
|
2022-11-24 14:36:09 -06:00
|
|
|
|
2022-11-24 16:46:20 -06:00
|
|
|
public String getHookName() {
|
|
|
|
|
return EnumScriptType.MOUSE_CLICKED.function;
|
|
|
|
|
}
|
|
|
|
|
|
2022-11-24 14:36:09 -06:00
|
|
|
public int getButton() {
|
|
|
|
|
return button;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public int getMouseWheel() {
|
|
|
|
|
return mouseWheel;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public boolean buttonDown() {
|
|
|
|
|
return buttonDown;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public boolean isCtrlPressed() {
|
|
|
|
|
return isCtrlPressed;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public boolean isAltPressed() {
|
|
|
|
|
return isAltPressed;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public boolean isShiftPressed() {
|
|
|
|
|
return isShiftPressed;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public boolean isMetaPressed() {
|
|
|
|
|
return isMetaPressed;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public int[] getKeysDown() {
|
|
|
|
|
return keysDown;
|
|
|
|
|
}
|
2021-10-12 02:57:32 -05:00
|
|
|
}
|
|
|
|
|
|
2022-11-24 14:36:09 -06:00
|
|
|
public static class PickupXPEvent extends PlayerEvent implements IPlayerEvent.PickupXPEvent {
|
2021-10-12 02:57:32 -05:00
|
|
|
public final int amount;
|
|
|
|
|
|
|
|
|
|
public PickupXPEvent(IPlayer player, EntityXPOrb orb) {
|
|
|
|
|
super(player);
|
|
|
|
|
this.amount = orb.xpValue;
|
|
|
|
|
}
|
2022-11-24 14:36:09 -06:00
|
|
|
|
2022-11-24 16:46:20 -06:00
|
|
|
public String getHookName() {
|
|
|
|
|
return EnumScriptType.PICKUP_XP.function;
|
|
|
|
|
}
|
|
|
|
|
|
2022-11-24 14:36:09 -06:00
|
|
|
public int getAmount() {
|
|
|
|
|
return amount;
|
|
|
|
|
}
|
2021-10-12 02:57:32 -05:00
|
|
|
}
|
|
|
|
|
|
2022-11-24 14:36:09 -06:00
|
|
|
public static class LevelUpEvent extends PlayerEvent implements IPlayerEvent.LevelUpEvent {
|
2021-09-30 01:48:54 -05:00
|
|
|
public final int change;
|
|
|
|
|
|
|
|
|
|
public LevelUpEvent(IPlayer player, int change) {
|
|
|
|
|
super(player);
|
|
|
|
|
this.change = change;
|
|
|
|
|
}
|
2022-11-24 14:36:09 -06:00
|
|
|
|
2022-11-24 16:46:20 -06:00
|
|
|
public String getHookName() {
|
|
|
|
|
return EnumScriptType.LEVEL_UP.function;
|
|
|
|
|
}
|
|
|
|
|
|
2022-11-24 14:36:09 -06:00
|
|
|
public int getChange() {
|
|
|
|
|
return change;
|
|
|
|
|
}
|
2021-09-30 01:48:54 -05:00
|
|
|
}
|
|
|
|
|
|
2022-11-24 14:36:09 -06:00
|
|
|
public static class LogoutEvent extends PlayerEvent implements IPlayerEvent.LogoutEvent {
|
2021-09-30 01:48:54 -05:00
|
|
|
public LogoutEvent(IPlayer player) {
|
|
|
|
|
super(player);
|
|
|
|
|
}
|
2022-11-24 16:46:20 -06:00
|
|
|
|
|
|
|
|
public String getHookName() {
|
|
|
|
|
return EnumScriptType.LOGOUT.function;
|
|
|
|
|
}
|
2021-09-30 01:48:54 -05:00
|
|
|
}
|
|
|
|
|
|
2022-11-24 14:36:09 -06:00
|
|
|
public static class LoginEvent extends PlayerEvent implements IPlayerEvent.LoginEvent {
|
2021-09-30 01:48:54 -05:00
|
|
|
public LoginEvent(IPlayer player) {
|
|
|
|
|
super(player);
|
|
|
|
|
}
|
2022-11-24 16:46:20 -06:00
|
|
|
|
|
|
|
|
public String getHookName() {
|
|
|
|
|
return EnumScriptType.LOGIN.function;
|
|
|
|
|
}
|
2021-09-30 01:48:54 -05:00
|
|
|
}
|
|
|
|
|
|
2022-11-24 14:36:09 -06:00
|
|
|
public static class RespawnEvent extends PlayerEvent implements IPlayerEvent.RespawnEvent {
|
2021-10-15 09:17:31 -05:00
|
|
|
public RespawnEvent(IPlayer player) {
|
|
|
|
|
super(player);
|
|
|
|
|
}
|
2022-11-24 16:46:20 -06:00
|
|
|
|
|
|
|
|
public String getHookName() {
|
|
|
|
|
return EnumScriptType.RESPAWN.function;
|
|
|
|
|
}
|
2021-10-15 09:17:31 -05:00
|
|
|
}
|
|
|
|
|
|
2022-11-24 14:36:09 -06:00
|
|
|
public static class ChangedDimension extends PlayerEvent implements IPlayerEvent.ChangedDimension {
|
2021-10-15 09:17:31 -05:00
|
|
|
public final int fromDim;
|
|
|
|
|
public final int toDim;
|
|
|
|
|
|
|
|
|
|
public ChangedDimension(IPlayer player, int fromDim, int toDim){
|
|
|
|
|
super(player);
|
|
|
|
|
this.fromDim = fromDim;
|
|
|
|
|
this.toDim = toDim;
|
|
|
|
|
}
|
2022-11-24 14:36:09 -06:00
|
|
|
|
2022-11-24 16:46:20 -06:00
|
|
|
public String getHookName() {
|
|
|
|
|
return EnumScriptType.CHANGED_DIM.function;
|
|
|
|
|
}
|
|
|
|
|
|
2022-11-24 14:36:09 -06:00
|
|
|
public int getFromDim() {
|
|
|
|
|
return fromDim;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public int getToDim() {
|
|
|
|
|
return toDim;
|
|
|
|
|
}
|
2021-10-15 09:17:31 -05:00
|
|
|
}
|
|
|
|
|
|
2022-11-24 14:36:09 -06:00
|
|
|
public static class TimerEvent extends PlayerEvent implements IPlayerEvent.TimerEvent {
|
2021-09-30 01:48:54 -05:00
|
|
|
public final int id;
|
|
|
|
|
|
|
|
|
|
public TimerEvent(IPlayer player, int id) {
|
|
|
|
|
super(player);
|
|
|
|
|
this.id = id;
|
|
|
|
|
}
|
2022-11-24 14:36:09 -06:00
|
|
|
|
2022-11-24 16:46:20 -06:00
|
|
|
public String getHookName() {
|
|
|
|
|
return EnumScriptType.TIMER.function;
|
|
|
|
|
}
|
|
|
|
|
|
2022-11-24 14:36:09 -06:00
|
|
|
public int getId() {
|
|
|
|
|
return id;
|
|
|
|
|
}
|
2021-09-30 01:48:54 -05:00
|
|
|
}
|
|
|
|
|
|
2022-07-07 12:49:30 -05:00
|
|
|
@Cancelable
|
2022-11-24 14:36:09 -06:00
|
|
|
public static class AttackedEvent extends PlayerEvent implements IPlayerEvent.AttackedEvent {
|
2022-07-07 12:49:30 -05:00
|
|
|
public final IDamageSource damageSource;
|
|
|
|
|
public final IEntity source;
|
|
|
|
|
public final float damage;
|
|
|
|
|
|
|
|
|
|
public AttackedEvent(IPlayer player, Entity source, float damage, DamageSource damagesource) {
|
|
|
|
|
super(player);
|
|
|
|
|
this.source = NpcAPI.Instance().getIEntity(source);
|
|
|
|
|
this.damage = damage;
|
|
|
|
|
this.damageSource = NpcAPI.Instance().getIDamageSource(damagesource);
|
|
|
|
|
}
|
2022-11-24 14:36:09 -06:00
|
|
|
|
2022-11-24 16:46:20 -06:00
|
|
|
public String getHookName() {
|
|
|
|
|
return EnumScriptType.ATTACKED.function;
|
|
|
|
|
}
|
|
|
|
|
|
2022-11-24 14:36:09 -06:00
|
|
|
public IDamageSource getDamageSource() {
|
|
|
|
|
return damageSource;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public IEntity getSource() {
|
|
|
|
|
return source;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public float getDamage() {
|
|
|
|
|
return damage;
|
|
|
|
|
}
|
2022-07-07 12:49:30 -05:00
|
|
|
}
|
|
|
|
|
|
2021-09-30 01:48:54 -05:00
|
|
|
@Cancelable
|
2022-11-24 14:36:09 -06:00
|
|
|
public static class DamagedEvent extends PlayerEvent implements IPlayerEvent.DamagedEvent {
|
2021-09-30 01:48:54 -05:00
|
|
|
public final IDamageSource damageSource;
|
|
|
|
|
public final IEntity source;
|
|
|
|
|
public float damage;
|
|
|
|
|
public boolean clearTarget = false;
|
|
|
|
|
|
|
|
|
|
public DamagedEvent(IPlayer player, Entity source, float damage, DamageSource damagesource) {
|
|
|
|
|
super(player);
|
2022-05-11 22:08:31 -05:00
|
|
|
this.source = NpcAPI.Instance().getIEntity(source);
|
2021-09-30 01:48:54 -05:00
|
|
|
this.damage = damage;
|
|
|
|
|
this.damageSource = NpcAPI.Instance().getIDamageSource(damagesource);
|
|
|
|
|
}
|
2022-11-24 14:36:09 -06:00
|
|
|
|
2022-11-24 16:46:20 -06:00
|
|
|
public String getHookName() {
|
|
|
|
|
return EnumScriptType.DAMAGED.function;
|
|
|
|
|
}
|
|
|
|
|
|
2022-11-24 14:36:09 -06:00
|
|
|
public IDamageSource getDamageSource() {
|
|
|
|
|
return damageSource;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public IEntity getSource() {
|
|
|
|
|
return source;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public float getDamage() {
|
|
|
|
|
return damage;
|
|
|
|
|
}
|
2021-09-30 01:48:54 -05:00
|
|
|
}
|
|
|
|
|
|
2021-10-15 09:17:31 -05:00
|
|
|
@Cancelable
|
2022-11-24 14:36:09 -06:00
|
|
|
public static class LightningEvent extends PlayerEvent implements IPlayerEvent.LightningEvent {
|
2021-10-15 09:17:31 -05:00
|
|
|
public LightningEvent(IPlayer player) {
|
|
|
|
|
super(player);
|
|
|
|
|
}
|
2022-11-24 16:46:20 -06:00
|
|
|
|
|
|
|
|
public String getHookName() {
|
|
|
|
|
return EnumScriptType.LIGHTNING.function;
|
|
|
|
|
}
|
2021-10-15 09:17:31 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Cancelable
|
2022-11-24 14:36:09 -06:00
|
|
|
public static class SoundEvent extends PlayerEvent implements IPlayerEvent.SoundEvent {
|
2021-10-15 09:17:31 -05:00
|
|
|
public final String name;
|
|
|
|
|
public final float pitch;
|
|
|
|
|
public final float volume;
|
|
|
|
|
|
2021-10-21 22:14:12 -05:00
|
|
|
public SoundEvent(IPlayer player, String name, float pitch, float volume) {
|
2021-10-15 09:17:31 -05:00
|
|
|
super(player);
|
|
|
|
|
this.name = name;
|
|
|
|
|
this.pitch = pitch;
|
|
|
|
|
this.volume = volume;
|
|
|
|
|
}
|
2022-11-24 14:36:09 -06:00
|
|
|
|
2022-11-24 16:46:20 -06:00
|
|
|
public String getHookName() {
|
|
|
|
|
return EnumScriptType.PLAYSOUND.function;
|
|
|
|
|
}
|
|
|
|
|
|
2022-11-24 14:36:09 -06:00
|
|
|
public String getName() {
|
|
|
|
|
return name;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public float getPitch() {
|
|
|
|
|
return pitch;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public float getVolume() {
|
|
|
|
|
return volume;
|
|
|
|
|
}
|
2021-10-15 09:17:31 -05:00
|
|
|
}
|
|
|
|
|
|
2022-11-24 14:36:09 -06:00
|
|
|
@Cancelable
|
|
|
|
|
public static class FallEvent extends PlayerEvent implements IPlayerEvent.FallEvent {
|
2021-10-12 02:57:32 -05:00
|
|
|
public final float distance;
|
|
|
|
|
|
|
|
|
|
public FallEvent(IPlayer player, float distance){
|
|
|
|
|
super(player);
|
|
|
|
|
this.distance = distance;
|
|
|
|
|
}
|
2022-11-24 14:36:09 -06:00
|
|
|
|
2022-11-24 16:46:20 -06:00
|
|
|
public String getHookName() {
|
|
|
|
|
return EnumScriptType.FALL.function;
|
|
|
|
|
}
|
|
|
|
|
|
2022-11-24 14:36:09 -06:00
|
|
|
public float getDistance() {
|
|
|
|
|
return distance;
|
|
|
|
|
}
|
2021-10-12 02:57:32 -05:00
|
|
|
}
|
|
|
|
|
|
2022-11-24 14:36:09 -06:00
|
|
|
public static class JumpEvent extends PlayerEvent implements IPlayerEvent.JumpEvent {
|
2021-10-18 20:50:54 -05:00
|
|
|
public JumpEvent(IPlayer player){
|
|
|
|
|
super(player);
|
|
|
|
|
}
|
2022-11-24 16:46:20 -06:00
|
|
|
|
|
|
|
|
public String getHookName() {
|
|
|
|
|
return EnumScriptType.JUMP.function;
|
|
|
|
|
}
|
2021-10-18 20:50:54 -05:00
|
|
|
}
|
|
|
|
|
|
2022-11-24 14:36:09 -06:00
|
|
|
public static class KilledEntityEvent extends PlayerEvent implements IPlayerEvent.KilledEntityEvent {
|
2021-09-30 01:48:54 -05:00
|
|
|
public final IEntityLivingBase entity;
|
|
|
|
|
|
|
|
|
|
public KilledEntityEvent(IPlayer player, EntityLivingBase entity) {
|
|
|
|
|
super(player);
|
2022-05-11 22:08:31 -05:00
|
|
|
this.entity = (IEntityLivingBase) NpcAPI.Instance().getIEntity(entity);
|
2021-09-30 01:48:54 -05:00
|
|
|
}
|
2022-11-24 14:36:09 -06:00
|
|
|
|
2022-11-24 16:46:20 -06:00
|
|
|
public String getHookName() {
|
|
|
|
|
return EnumScriptType.KILLS.function;
|
|
|
|
|
}
|
|
|
|
|
|
2022-11-24 14:36:09 -06:00
|
|
|
public IEntityLivingBase getEntity() {
|
|
|
|
|
return entity;
|
|
|
|
|
}
|
2021-09-30 01:48:54 -05:00
|
|
|
}
|
|
|
|
|
|
2022-11-24 14:36:09 -06:00
|
|
|
public static class DiedEvent extends PlayerEvent implements IPlayerEvent.DiedEvent {
|
2021-09-30 01:48:54 -05:00
|
|
|
public final IDamageSource damageSource;
|
|
|
|
|
public final String type;
|
|
|
|
|
public final IEntity source;
|
|
|
|
|
|
|
|
|
|
public DiedEvent(IPlayer player, DamageSource damagesource, Entity entity) {
|
|
|
|
|
super(player);
|
|
|
|
|
this.damageSource = NpcAPI.Instance().getIDamageSource(damagesource);
|
2021-09-30 21:44:30 -05:00
|
|
|
this.type = damagesource.getDamageType();
|
2022-05-11 22:08:31 -05:00
|
|
|
this.source = NpcAPI.Instance().getIEntity(entity);
|
2021-09-30 01:48:54 -05:00
|
|
|
}
|
2022-11-24 14:36:09 -06:00
|
|
|
|
2022-11-24 16:46:20 -06:00
|
|
|
public String getHookName() {
|
|
|
|
|
return EnumScriptType.KILLED.function;
|
|
|
|
|
}
|
|
|
|
|
|
2022-11-24 14:36:09 -06:00
|
|
|
public IDamageSource getDamageSource() {
|
|
|
|
|
return damageSource;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public String getType() {
|
|
|
|
|
return type;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public IEntity getSource() {
|
|
|
|
|
return source;
|
|
|
|
|
}
|
2021-09-30 01:48:54 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Cancelable
|
2022-11-24 14:36:09 -06:00
|
|
|
public static class RangedLaunchedEvent extends PlayerEvent implements IPlayerEvent.RangedLaunchedEvent {
|
2021-10-12 02:57:32 -05:00
|
|
|
public final IItemStack bow;
|
|
|
|
|
public int charge;
|
|
|
|
|
|
|
|
|
|
public RangedLaunchedEvent(IPlayer player, ItemStack bow, int charge) {
|
2021-09-30 01:48:54 -05:00
|
|
|
super(player);
|
2021-10-12 02:57:32 -05:00
|
|
|
this.bow = NpcAPI.Instance().getIItemStack(bow);
|
|
|
|
|
this.charge = charge;
|
2021-09-30 01:48:54 -05:00
|
|
|
}
|
2022-11-24 14:36:09 -06:00
|
|
|
|
2022-11-24 16:46:20 -06:00
|
|
|
public String getHookName() {
|
|
|
|
|
return EnumScriptType.RANGED_LAUNCHED.function;
|
|
|
|
|
}
|
|
|
|
|
|
2022-11-24 14:36:09 -06:00
|
|
|
public IItemStack getBow() {
|
|
|
|
|
return bow;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public int getCharge() {
|
|
|
|
|
return charge;
|
|
|
|
|
}
|
2021-09-30 01:48:54 -05:00
|
|
|
}
|
|
|
|
|
|
2022-07-07 12:49:30 -05:00
|
|
|
@Cancelable
|
2022-11-24 14:36:09 -06:00
|
|
|
public static class AttackEvent extends PlayerEvent implements IPlayerEvent.AttackEvent {
|
2022-07-07 12:49:30 -05:00
|
|
|
public final IDamageSource damageSource;
|
|
|
|
|
public final IEntity target;
|
|
|
|
|
public float damage;
|
|
|
|
|
|
|
|
|
|
public AttackEvent(IPlayer player, Entity target, float damage, DamageSource damagesource) {
|
|
|
|
|
super(player);
|
|
|
|
|
this.target = NpcAPI.Instance().getIEntity(target);
|
|
|
|
|
this.damage = damage;
|
|
|
|
|
this.damageSource = NpcAPI.Instance().getIDamageSource(damagesource);
|
|
|
|
|
}
|
2022-11-24 14:36:09 -06:00
|
|
|
|
2022-11-24 16:46:20 -06:00
|
|
|
public String getHookName() {
|
|
|
|
|
return EnumScriptType.ATTACK.function;
|
|
|
|
|
}
|
|
|
|
|
|
2022-11-24 14:36:09 -06:00
|
|
|
public IDamageSource getDamageSource() {
|
|
|
|
|
return damageSource;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public IEntity getTarget() {
|
|
|
|
|
return target;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public float getDamage() {
|
|
|
|
|
return damage;
|
|
|
|
|
}
|
2022-07-07 12:49:30 -05:00
|
|
|
}
|
|
|
|
|
|
2021-09-30 01:48:54 -05:00
|
|
|
@Cancelable
|
2022-11-24 14:36:09 -06:00
|
|
|
public static class DamagedEntityEvent extends PlayerEvent implements IPlayerEvent.DamagedEntityEvent {
|
2021-09-30 01:48:54 -05:00
|
|
|
public final IDamageSource damageSource;
|
|
|
|
|
public final IEntity target;
|
|
|
|
|
public float damage;
|
|
|
|
|
|
|
|
|
|
public DamagedEntityEvent(IPlayer player, Entity target, float damage, DamageSource damagesource) {
|
|
|
|
|
super(player);
|
2022-05-11 22:08:31 -05:00
|
|
|
this.target = NpcAPI.Instance().getIEntity(target);
|
2021-09-30 01:48:54 -05:00
|
|
|
this.damage = damage;
|
|
|
|
|
this.damageSource = NpcAPI.Instance().getIDamageSource(damagesource);
|
|
|
|
|
}
|
2022-11-24 14:36:09 -06:00
|
|
|
|
2022-11-24 16:46:20 -06:00
|
|
|
public String getHookName() {
|
|
|
|
|
return EnumScriptType.DAMAGED_ENTITY.function;
|
|
|
|
|
}
|
|
|
|
|
|
2022-11-24 14:36:09 -06:00
|
|
|
public IDamageSource getDamageSource() {
|
|
|
|
|
return damageSource;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public IEntity getTarget() {
|
|
|
|
|
return target;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public float getDamage() {
|
|
|
|
|
return damage;
|
|
|
|
|
}
|
2021-09-30 01:48:54 -05:00
|
|
|
}
|
|
|
|
|
|
2022-11-24 14:36:09 -06:00
|
|
|
public static class ContainerClosed extends PlayerEvent implements IPlayerEvent.ContainerClosed {
|
2021-09-30 01:48:54 -05:00
|
|
|
public final IContainer container;
|
|
|
|
|
|
|
|
|
|
public ContainerClosed(IPlayer player, IContainer container) {
|
|
|
|
|
super(player);
|
|
|
|
|
this.container = container;
|
|
|
|
|
}
|
2022-11-24 14:36:09 -06:00
|
|
|
|
2022-11-24 16:46:20 -06:00
|
|
|
public String getHookName() {
|
|
|
|
|
return EnumScriptType.CONTAINER_CLOSED.function;
|
|
|
|
|
}
|
|
|
|
|
|
2022-11-24 14:36:09 -06:00
|
|
|
public IContainer getContainer() {
|
|
|
|
|
return container;
|
|
|
|
|
}
|
2021-09-30 01:48:54 -05:00
|
|
|
}
|
|
|
|
|
|
2022-11-24 14:36:09 -06:00
|
|
|
public static class ContainerOpen extends PlayerEvent implements IPlayerEvent.ContainerOpen {
|
2021-09-30 01:48:54 -05:00
|
|
|
public final IContainer container;
|
|
|
|
|
|
|
|
|
|
public ContainerOpen(IPlayer player, IContainer container) {
|
|
|
|
|
super(player);
|
|
|
|
|
this.container = container;
|
|
|
|
|
}
|
2022-11-24 14:36:09 -06:00
|
|
|
|
2022-11-24 16:46:20 -06:00
|
|
|
public String getHookName() {
|
|
|
|
|
return EnumScriptType.CONTAINER_OPEN.function;
|
|
|
|
|
}
|
|
|
|
|
|
2022-11-24 14:36:09 -06:00
|
|
|
public IContainer getContainer() {
|
|
|
|
|
return container;
|
|
|
|
|
}
|
2021-09-30 01:48:54 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Cancelable
|
2022-11-24 14:36:09 -06:00
|
|
|
public static class PickUpEvent extends PlayerEvent implements IPlayerEvent.PickUpEvent {
|
2021-09-30 01:48:54 -05:00
|
|
|
public final IItemStack item;
|
|
|
|
|
|
|
|
|
|
public PickUpEvent(IPlayer player, IItemStack item) {
|
|
|
|
|
super(player);
|
|
|
|
|
this.item = item;
|
|
|
|
|
}
|
2022-11-24 14:36:09 -06:00
|
|
|
|
2022-11-24 16:46:20 -06:00
|
|
|
public String getHookName() {
|
|
|
|
|
return EnumScriptType.PICKUP.function;
|
|
|
|
|
}
|
|
|
|
|
|
2022-11-24 14:36:09 -06:00
|
|
|
public IItemStack getItem() {
|
|
|
|
|
return item;
|
|
|
|
|
}
|
2021-09-30 01:48:54 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Cancelable
|
2022-11-24 14:36:09 -06:00
|
|
|
public static class DropEvent extends PlayerEvent implements IPlayerEvent.DropEvent {
|
2021-10-12 02:57:32 -05:00
|
|
|
public final IItemStack[] items;
|
2021-09-30 01:48:54 -05:00
|
|
|
|
2021-10-18 22:01:15 -05:00
|
|
|
public DropEvent(IPlayer player, IItemStack[] items) {
|
2021-09-30 01:48:54 -05:00
|
|
|
super(player);
|
2021-10-12 02:57:32 -05:00
|
|
|
this.items = items;
|
2021-09-30 01:48:54 -05:00
|
|
|
}
|
2022-11-24 14:36:09 -06:00
|
|
|
|
2022-11-24 16:46:20 -06:00
|
|
|
public String getHookName() {
|
|
|
|
|
return EnumScriptType.DROP.function;
|
|
|
|
|
}
|
|
|
|
|
|
2022-11-24 14:36:09 -06:00
|
|
|
public IItemStack[] getItems() {
|
|
|
|
|
return items;
|
|
|
|
|
}
|
2021-09-30 01:48:54 -05:00
|
|
|
}
|
|
|
|
|
|
2021-10-18 22:01:15 -05:00
|
|
|
@Cancelable
|
2022-11-24 14:36:09 -06:00
|
|
|
public static class TossEvent extends PlayerEvent implements IPlayerEvent.TossEvent {
|
2021-10-18 22:01:15 -05:00
|
|
|
public final IItemStack item;
|
|
|
|
|
|
|
|
|
|
public TossEvent(IPlayer player, IItemStack item) {
|
|
|
|
|
super(player);
|
|
|
|
|
this.item = item;
|
|
|
|
|
}
|
2022-11-24 14:36:09 -06:00
|
|
|
|
2022-11-24 16:46:20 -06:00
|
|
|
public String getHookName() {
|
|
|
|
|
return EnumScriptType.TOSS.function;
|
|
|
|
|
}
|
|
|
|
|
|
2022-11-24 14:36:09 -06:00
|
|
|
public IItemStack getItem() {
|
|
|
|
|
return item;
|
|
|
|
|
}
|
2021-10-18 22:01:15 -05:00
|
|
|
}
|
|
|
|
|
|
2021-09-30 01:48:54 -05:00
|
|
|
@Cancelable
|
2022-11-24 14:36:09 -06:00
|
|
|
public static class InteractEvent extends PlayerEvent implements IPlayerEvent.InteractEvent {
|
2021-09-30 01:48:54 -05:00
|
|
|
public final int type;
|
2022-11-24 14:36:09 -06:00
|
|
|
public final IEntity target;
|
2021-09-30 01:48:54 -05:00
|
|
|
|
2022-11-24 14:36:09 -06:00
|
|
|
public InteractEvent(IPlayer player, int type, IEntity target) {
|
2021-09-30 01:48:54 -05:00
|
|
|
super(player);
|
|
|
|
|
this.type = type;
|
|
|
|
|
this.target = target;
|
|
|
|
|
}
|
2022-11-24 14:36:09 -06:00
|
|
|
|
2022-11-24 16:46:20 -06:00
|
|
|
public String getHookName() {
|
|
|
|
|
return EnumScriptType.INTERACT.function;
|
|
|
|
|
}
|
|
|
|
|
|
2022-11-24 14:36:09 -06:00
|
|
|
public int getType() {
|
|
|
|
|
return type;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public IEntity getTarget() {
|
|
|
|
|
return target;
|
|
|
|
|
}
|
2021-09-30 01:48:54 -05:00
|
|
|
}
|
|
|
|
|
|
2022-11-24 14:36:09 -06:00
|
|
|
public static class UpdateEvent extends PlayerEvent implements IPlayerEvent.UpdateEvent {
|
2021-09-30 01:48:54 -05:00
|
|
|
public UpdateEvent(IPlayer player) {
|
|
|
|
|
super(player);
|
|
|
|
|
}
|
2022-11-24 16:46:20 -06:00
|
|
|
|
|
|
|
|
public String getHookName() {
|
|
|
|
|
return EnumScriptType.TICK.function;
|
|
|
|
|
}
|
2021-09-30 01:48:54 -05:00
|
|
|
}
|
|
|
|
|
|
2022-11-24 14:36:09 -06:00
|
|
|
public static class InitEvent extends PlayerEvent implements IPlayerEvent.InitEvent {
|
2021-09-30 01:48:54 -05:00
|
|
|
public InitEvent(IPlayer player) {
|
|
|
|
|
super(player);
|
|
|
|
|
}
|
2022-11-24 16:46:20 -06:00
|
|
|
|
|
|
|
|
public String getHookName() {
|
|
|
|
|
return EnumScriptType.INIT.function;
|
|
|
|
|
}
|
2021-09-30 01:48:54 -05:00
|
|
|
}
|
2021-10-12 02:57:32 -05:00
|
|
|
|
2023-01-25 21:54:25 -06:00
|
|
|
@Cancelable
|
2022-11-24 14:36:09 -06:00
|
|
|
public static class StartUsingItem extends PlayerEvent implements IPlayerEvent.StartUsingItem {
|
2021-10-12 02:57:32 -05:00
|
|
|
public final IItemStack item;
|
|
|
|
|
public final int duration;
|
|
|
|
|
|
|
|
|
|
public StartUsingItem(IPlayer player, ItemStack item, int duration){
|
|
|
|
|
super(player);
|
|
|
|
|
|
|
|
|
|
this.item = NpcAPI.Instance().getIItemStack(item);
|
|
|
|
|
this.duration = duration;
|
|
|
|
|
}
|
2022-11-24 14:36:09 -06:00
|
|
|
|
2022-11-24 16:46:20 -06:00
|
|
|
public String getHookName() {
|
|
|
|
|
return EnumScriptType.START_USING_ITEM.function;
|
|
|
|
|
}
|
|
|
|
|
|
2022-11-24 14:36:09 -06:00
|
|
|
public IItemStack getItem() {
|
|
|
|
|
return item;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public int getDuration() {
|
|
|
|
|
return duration;
|
|
|
|
|
}
|
2021-10-12 02:57:32 -05:00
|
|
|
}
|
2023-01-25 21:54:25 -06:00
|
|
|
|
|
|
|
|
@Cancelable
|
2022-11-24 14:36:09 -06:00
|
|
|
public static class UsingItem extends PlayerEvent implements IPlayerEvent.UsingItem {
|
2021-10-12 02:57:32 -05:00
|
|
|
public final IItemStack item;
|
|
|
|
|
public final int duration;
|
|
|
|
|
|
|
|
|
|
public UsingItem(IPlayer player, ItemStack item, int duration){
|
|
|
|
|
super(player);
|
|
|
|
|
|
|
|
|
|
this.item = NpcAPI.Instance().getIItemStack(item);
|
|
|
|
|
this.duration = duration;
|
|
|
|
|
}
|
2022-11-24 14:36:09 -06:00
|
|
|
|
2022-11-24 16:46:20 -06:00
|
|
|
public String getHookName() {
|
|
|
|
|
return EnumScriptType.USING_ITEM.function;
|
|
|
|
|
}
|
|
|
|
|
|
2022-11-24 14:36:09 -06:00
|
|
|
public IItemStack getItem() {
|
|
|
|
|
return item;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public int getDuration() {
|
|
|
|
|
return duration;
|
|
|
|
|
}
|
2021-10-12 02:57:32 -05:00
|
|
|
}
|
2023-01-25 21:54:25 -06:00
|
|
|
|
|
|
|
|
@Cancelable
|
2022-11-24 14:36:09 -06:00
|
|
|
public static class StopUsingItem extends PlayerEvent implements IPlayerEvent.StopUsingItem {
|
2021-10-12 02:57:32 -05:00
|
|
|
public final IItemStack item;
|
|
|
|
|
public final int duration;
|
|
|
|
|
|
|
|
|
|
public StopUsingItem(IPlayer player, ItemStack item, int duration){
|
|
|
|
|
super(player);
|
|
|
|
|
|
|
|
|
|
this.item = NpcAPI.Instance().getIItemStack(item);
|
|
|
|
|
this.duration = duration;
|
|
|
|
|
}
|
2022-11-24 14:36:09 -06:00
|
|
|
|
2022-11-24 16:46:20 -06:00
|
|
|
public String getHookName() {
|
|
|
|
|
return EnumScriptType.STOP_USING_ITEM.function;
|
|
|
|
|
}
|
|
|
|
|
|
2022-11-24 14:36:09 -06:00
|
|
|
public IItemStack getItem() {
|
|
|
|
|
return item;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public int getDuration() {
|
|
|
|
|
return duration;
|
|
|
|
|
}
|
2021-10-12 02:57:32 -05:00
|
|
|
}
|
2023-01-25 21:54:25 -06:00
|
|
|
|
2022-11-24 14:36:09 -06:00
|
|
|
public static class FinishUsingItem extends PlayerEvent implements IPlayerEvent.FinishUsingItem {
|
2021-10-12 02:57:32 -05:00
|
|
|
public final IItemStack item;
|
|
|
|
|
public final int duration;
|
|
|
|
|
|
|
|
|
|
public FinishUsingItem(IPlayer player, ItemStack item, int duration){
|
|
|
|
|
super(player);
|
|
|
|
|
|
|
|
|
|
this.item = NpcAPI.Instance().getIItemStack(item);
|
|
|
|
|
this.duration = duration;
|
|
|
|
|
}
|
2022-11-24 14:36:09 -06:00
|
|
|
|
2022-11-24 16:46:20 -06:00
|
|
|
public String getHookName() {
|
|
|
|
|
return EnumScriptType.FINISH_USING_ITEM.function;
|
|
|
|
|
}
|
|
|
|
|
|
2022-11-24 14:36:09 -06:00
|
|
|
public IItemStack getItem() {
|
|
|
|
|
return item;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public int getDuration() {
|
|
|
|
|
return duration;
|
|
|
|
|
}
|
2021-10-12 02:57:32 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Cancelable
|
2022-11-24 14:36:09 -06:00
|
|
|
public static class BreakEvent extends PlayerEvent implements IPlayerEvent.BreakEvent {
|
2021-10-12 02:57:32 -05:00
|
|
|
public final IBlock block;
|
|
|
|
|
public int exp;
|
|
|
|
|
|
|
|
|
|
public BreakEvent(IPlayer player, IBlock block, int exp) {
|
|
|
|
|
super(player);
|
|
|
|
|
this.block = block;
|
|
|
|
|
this.exp = exp;
|
|
|
|
|
}
|
2022-11-24 14:36:09 -06:00
|
|
|
|
2022-11-24 16:46:20 -06:00
|
|
|
public String getHookName() {
|
|
|
|
|
return EnumScriptType.BREAK_BLOCK.function;
|
|
|
|
|
}
|
|
|
|
|
|
2022-11-24 14:36:09 -06:00
|
|
|
public IBlock getBlock() {
|
|
|
|
|
return block;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public int getExp() {
|
|
|
|
|
return exp;
|
|
|
|
|
}
|
2021-10-12 02:57:32 -05:00
|
|
|
}
|
2021-10-18 20:50:54 -05:00
|
|
|
|
2022-11-24 14:36:09 -06:00
|
|
|
public static class UseHoe extends PlayerEvent implements UseHoeEvent {
|
2021-10-18 20:50:54 -05:00
|
|
|
public final IItemStack hoe;
|
|
|
|
|
public final int x;
|
|
|
|
|
public final int y;
|
|
|
|
|
public final int z;
|
|
|
|
|
|
|
|
|
|
public UseHoe(IPlayer player, ItemStack item, int x, int y, int z) {
|
|
|
|
|
super(player);
|
2022-05-11 22:08:31 -05:00
|
|
|
this.hoe = NpcAPI.Instance().getIItemStack(item);
|
2021-10-18 20:50:54 -05:00
|
|
|
this.x = x;
|
|
|
|
|
this.y = y;
|
|
|
|
|
this.z = z;
|
|
|
|
|
}
|
2022-11-24 14:36:09 -06:00
|
|
|
|
2022-11-24 16:46:20 -06:00
|
|
|
public String getHookName() {
|
|
|
|
|
return EnumScriptType.USE_HOE.function;
|
|
|
|
|
}
|
|
|
|
|
|
2022-11-24 14:36:09 -06:00
|
|
|
public IItemStack getHoe() {
|
|
|
|
|
return hoe;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public int getX() {
|
|
|
|
|
return x;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public int getY() {
|
|
|
|
|
return y;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public int getZ() {
|
|
|
|
|
return z;
|
|
|
|
|
}
|
2021-10-18 20:50:54 -05:00
|
|
|
}
|
|
|
|
|
|
2022-11-24 14:36:09 -06:00
|
|
|
public static class WakeUp extends PlayerEvent implements WakeUpEvent {
|
2021-10-18 20:50:54 -05:00
|
|
|
public final boolean setSpawn;
|
|
|
|
|
|
|
|
|
|
public WakeUp(IPlayer player, boolean setSpawn) {
|
|
|
|
|
super(player);
|
|
|
|
|
this.setSpawn = setSpawn;
|
|
|
|
|
}
|
2022-11-24 14:36:09 -06:00
|
|
|
|
2022-11-24 16:46:20 -06:00
|
|
|
public String getHookName() {
|
|
|
|
|
return EnumScriptType.WAKE_UP.function;
|
|
|
|
|
}
|
|
|
|
|
|
2022-11-24 14:36:09 -06:00
|
|
|
public boolean setSpawn() {
|
|
|
|
|
return setSpawn;
|
|
|
|
|
}
|
2021-10-18 20:50:54 -05:00
|
|
|
}
|
|
|
|
|
|
2022-11-24 14:36:09 -06:00
|
|
|
public static class Sleep extends PlayerEvent implements SleepEvent {
|
2021-10-18 20:50:54 -05:00
|
|
|
public final int x;
|
|
|
|
|
public final int y;
|
|
|
|
|
public final int z;
|
|
|
|
|
|
2021-10-21 22:14:12 -05:00
|
|
|
public Sleep(IPlayer player, int x, int y, int z) {
|
2021-10-18 20:50:54 -05:00
|
|
|
super(player);
|
|
|
|
|
this.x = x;
|
|
|
|
|
this.y = y;
|
|
|
|
|
this.z = z;
|
|
|
|
|
}
|
2022-11-24 14:36:09 -06:00
|
|
|
|
2022-11-24 16:46:20 -06:00
|
|
|
public String getHookName() {
|
|
|
|
|
return EnumScriptType.SLEEP.function;
|
|
|
|
|
}
|
|
|
|
|
|
2022-11-24 14:36:09 -06:00
|
|
|
public int getX() {
|
|
|
|
|
return x;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public int getY() {
|
|
|
|
|
return y;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public int getZ() {
|
|
|
|
|
return z;
|
|
|
|
|
}
|
2021-10-18 20:50:54 -05:00
|
|
|
}
|
|
|
|
|
|
2022-11-24 14:36:09 -06:00
|
|
|
public static class Achievement extends PlayerEvent implements AchievementEvent {
|
2021-10-18 20:50:54 -05:00
|
|
|
public final String description;
|
|
|
|
|
|
|
|
|
|
public Achievement(IPlayer player, String description) {
|
|
|
|
|
super(player);
|
|
|
|
|
this.description = description;
|
|
|
|
|
}
|
2022-11-24 14:36:09 -06:00
|
|
|
|
2022-11-24 16:46:20 -06:00
|
|
|
public String getHookName() {
|
|
|
|
|
return EnumScriptType.ACHIEVEMENT.function;
|
|
|
|
|
}
|
|
|
|
|
|
2022-11-24 14:36:09 -06:00
|
|
|
public String getDescription() {
|
|
|
|
|
return description;
|
|
|
|
|
}
|
2021-10-18 20:50:54 -05:00
|
|
|
}
|
|
|
|
|
|
2022-11-24 14:36:09 -06:00
|
|
|
public static class FillBucket extends PlayerEvent implements FillBucketEvent {
|
2021-10-18 20:50:54 -05:00
|
|
|
public final IItemStack current;
|
|
|
|
|
public final IItemStack result;
|
|
|
|
|
|
|
|
|
|
public FillBucket(IPlayer player, ItemStack current, ItemStack result) {
|
|
|
|
|
super(player);
|
2022-05-11 22:08:31 -05:00
|
|
|
this.current = NpcAPI.Instance().getIItemStack(current);
|
|
|
|
|
this.result = NpcAPI.Instance().getIItemStack(result);
|
2021-10-18 20:50:54 -05:00
|
|
|
}
|
2022-11-24 14:36:09 -06:00
|
|
|
|
2022-11-24 16:46:20 -06:00
|
|
|
public String getHookName() {
|
|
|
|
|
return EnumScriptType.FILL_BUCKET.function;
|
|
|
|
|
}
|
|
|
|
|
|
2022-11-24 14:36:09 -06:00
|
|
|
public IItemStack getCurrent() {
|
|
|
|
|
return current;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public IItemStack getFilled() {
|
|
|
|
|
return result;
|
|
|
|
|
}
|
2021-10-18 20:50:54 -05:00
|
|
|
}
|
|
|
|
|
|
2022-11-24 14:36:09 -06:00
|
|
|
public static class Bonemeal extends PlayerEvent implements BonemealEvent {
|
2021-10-18 20:50:54 -05:00
|
|
|
public final IBlock block;
|
|
|
|
|
public final int x;
|
|
|
|
|
public final int y;
|
|
|
|
|
public final int z;
|
|
|
|
|
|
|
|
|
|
public Bonemeal(IPlayer player, int x, int y, int z, World world) {
|
|
|
|
|
super(player);
|
2022-11-06 01:25:28 -06:00
|
|
|
this.block = API.getIBlock(NpcAPI.Instance().getIWorld(world), x, y, z);
|
2021-10-18 20:50:54 -05:00
|
|
|
this.x = x;
|
|
|
|
|
this.y = y;
|
|
|
|
|
this.z = z;
|
|
|
|
|
}
|
2022-11-24 14:36:09 -06:00
|
|
|
|
2022-11-24 16:46:20 -06:00
|
|
|
public String getHookName() {
|
|
|
|
|
return EnumScriptType.BONEMEAL.function;
|
|
|
|
|
}
|
|
|
|
|
|
2022-11-24 14:36:09 -06:00
|
|
|
public IBlock getBlock() {
|
|
|
|
|
return block;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public int getX() {
|
|
|
|
|
return x;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public int getY() {
|
|
|
|
|
return y;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public int getZ() {
|
|
|
|
|
return z;
|
|
|
|
|
}
|
2021-10-18 20:50:54 -05:00
|
|
|
}
|
|
|
|
|
|
2023-01-25 21:54:25 -06:00
|
|
|
@Cancelable
|
2022-11-24 14:36:09 -06:00
|
|
|
public static class RangedChargeEvent extends PlayerEvent implements IPlayerEvent.RangedChargeEvent {
|
2021-10-21 22:14:12 -05:00
|
|
|
public RangedChargeEvent(IPlayer player) {
|
2021-10-18 20:50:54 -05:00
|
|
|
super(player);
|
|
|
|
|
}
|
2022-11-24 16:46:20 -06:00
|
|
|
|
|
|
|
|
public String getHookName() {
|
|
|
|
|
return EnumScriptType.RANGED_LAUNCHED.function;
|
|
|
|
|
}
|
2021-10-18 20:50:54 -05:00
|
|
|
}
|
2021-09-30 01:48:54 -05:00
|
|
|
}
|