2021-09-30 00:56:49 -05:00
|
|
|
//
|
|
|
|
|
// Source code recreated from a .class file by IntelliJ IDEA
|
|
|
|
|
// (powered by Fernflower decompiler)
|
|
|
|
|
//
|
|
|
|
|
|
|
|
|
|
package noppes.npcs;
|
|
|
|
|
|
2021-10-11 06:49:30 -05:00
|
|
|
import cpw.mods.fml.common.eventhandler.Event;
|
2021-09-30 00:56:49 -05:00
|
|
|
import net.minecraft.entity.Entity;
|
|
|
|
|
import net.minecraft.entity.EntityLivingBase;
|
|
|
|
|
import net.minecraft.entity.item.EntityItem;
|
2021-10-12 02:57:32 -05:00
|
|
|
import net.minecraft.entity.item.EntityXPOrb;
|
2022-01-12 20:12:16 -06:00
|
|
|
import net.minecraft.entity.player.EntityPlayer;
|
2021-09-30 00:56:49 -05:00
|
|
|
import net.minecraft.entity.player.EntityPlayerMP;
|
|
|
|
|
import net.minecraft.inventory.Container;
|
2021-10-12 02:57:32 -05:00
|
|
|
import net.minecraft.item.ItemStack;
|
2021-09-30 00:56:49 -05:00
|
|
|
import net.minecraft.util.DamageSource;
|
2021-10-18 20:50:54 -05:00
|
|
|
import net.minecraft.world.World;
|
2021-10-11 06:49:30 -05:00
|
|
|
import net.minecraft.world.WorldServer;
|
|
|
|
|
import net.minecraftforge.event.entity.EntityEvent;
|
|
|
|
|
import net.minecraftforge.event.world.WorldEvent;
|
2022-11-15 15:25:53 -05:00
|
|
|
import noppes.npcs.api.IWorld;
|
|
|
|
|
import noppes.npcs.api.entity.IEntity;
|
|
|
|
|
import noppes.npcs.api.entity.IPlayer;
|
2023-03-16 02:51:40 -05:00
|
|
|
import noppes.npcs.api.entity.IProjectile;
|
2024-03-06 05:05:16 -05:00
|
|
|
import noppes.npcs.api.event.IPartyEvent;
|
2022-11-15 15:25:53 -05:00
|
|
|
import noppes.npcs.api.gui.ICustomGui;
|
2023-03-18 15:52:50 -05:00
|
|
|
import noppes.npcs.api.gui.IItemSlot;
|
2022-11-15 15:25:53 -05:00
|
|
|
import noppes.npcs.api.item.IItemCustom;
|
|
|
|
|
import noppes.npcs.api.item.IItemStack;
|
2021-09-30 00:56:49 -05:00
|
|
|
import noppes.npcs.constants.EnumScriptType;
|
2023-01-12 21:33:06 -05:00
|
|
|
import noppes.npcs.controllers.CustomGuiController;
|
2023-03-16 02:51:40 -05:00
|
|
|
import noppes.npcs.controllers.ScriptContainer;
|
2023-01-12 21:33:06 -05:00
|
|
|
import noppes.npcs.controllers.ScriptController;
|
|
|
|
|
import noppes.npcs.controllers.data.*;
|
|
|
|
|
import noppes.npcs.entity.EntityNPCInterface;
|
2023-03-16 02:51:40 -05:00
|
|
|
import noppes.npcs.entity.EntityProjectile;
|
2023-01-12 21:33:06 -05:00
|
|
|
import noppes.npcs.scripted.NpcAPI;
|
|
|
|
|
import noppes.npcs.scripted.event.*;
|
|
|
|
|
import noppes.npcs.scripted.event.PlayerEvent.*;
|
2022-11-23 23:59:01 -06:00
|
|
|
import noppes.npcs.scripted.item.ScriptCustomItem;
|
2021-10-11 06:49:30 -05:00
|
|
|
import org.apache.commons.lang3.StringUtils;
|
2021-09-30 00:56:49 -05:00
|
|
|
|
2021-10-12 02:57:32 -05:00
|
|
|
import java.util.ArrayList;
|
|
|
|
|
|
2021-09-30 00:56:49 -05:00
|
|
|
public class EventHooks {
|
|
|
|
|
public EventHooks() {
|
|
|
|
|
}
|
|
|
|
|
|
2022-05-11 22:08:31 -05:00
|
|
|
public static void onScriptItemInit(IItemCustom handler) {
|
2022-11-23 23:59:01 -06:00
|
|
|
if (!((ScriptCustomItem) handler).isClient()) {
|
2022-05-11 13:30:13 -05:00
|
|
|
ItemEvent.InitEvent event = new ItemEvent.InitEvent(handler);
|
2022-11-23 23:59:01 -06:00
|
|
|
((ScriptCustomItem) handler).callScript(EnumScriptType.INIT, event);
|
2022-05-11 17:12:48 -05:00
|
|
|
NpcAPI.EVENT_BUS.post(event);
|
2022-05-11 01:10:31 -05:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2022-05-11 22:08:31 -05:00
|
|
|
public static void onScriptItemUpdate(IItemCustom handler, EntityLivingBase player) {
|
2022-11-23 23:59:01 -06:00
|
|
|
if (!((ScriptCustomItem) handler).isClient()) {
|
2022-05-11 22:08:31 -05:00
|
|
|
ItemEvent.UpdateEvent event = new ItemEvent.UpdateEvent(handler, NpcAPI.Instance().getIEntity(player));
|
2022-11-23 23:59:01 -06:00
|
|
|
((ScriptCustomItem) handler).callScript(EnumScriptType.TICK, event);
|
2022-05-11 17:12:48 -05:00
|
|
|
NpcAPI.EVENT_BUS.post(event);
|
2022-05-11 01:10:31 -05:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2022-05-11 22:08:31 -05:00
|
|
|
public static boolean onScriptItemTossed(IItemCustom handler, EntityPlayer player, EntityItem entity) {
|
|
|
|
|
ItemEvent.TossedEvent event = new ItemEvent.TossedEvent(handler, (IPlayer)NpcAPI.Instance().getIEntity(player), NpcAPI.Instance().getIEntity(entity));
|
2022-11-23 23:59:01 -06:00
|
|
|
((ScriptCustomItem) handler).callScript(EnumScriptType.TOSSED, event);
|
2022-05-11 17:12:48 -05:00
|
|
|
return NpcAPI.EVENT_BUS.post(event);
|
2022-05-11 01:10:31 -05:00
|
|
|
}
|
|
|
|
|
|
2022-05-11 22:08:31 -05:00
|
|
|
public static boolean onScriptItemPickedUp(IItemCustom handler, EntityPlayer player) {
|
|
|
|
|
ItemEvent.PickedUpEvent event = new ItemEvent.PickedUpEvent(handler, (IPlayer)NpcAPI.Instance().getIEntity(player));
|
2022-11-23 23:59:01 -06:00
|
|
|
((ScriptCustomItem) handler).callScript(EnumScriptType.PICKEDUP, event);
|
2022-05-11 17:12:48 -05:00
|
|
|
return NpcAPI.EVENT_BUS.post(event);
|
2022-05-11 01:10:31 -05:00
|
|
|
}
|
|
|
|
|
|
2022-05-11 22:08:31 -05:00
|
|
|
public static boolean onScriptItemSpawn(IItemCustom handler, EntityItem entity) {
|
|
|
|
|
ItemEvent.SpawnEvent event = new ItemEvent.SpawnEvent(handler, NpcAPI.Instance().getIEntity(entity));
|
2022-11-23 23:59:01 -06:00
|
|
|
((ScriptCustomItem) handler).callScript(EnumScriptType.SPAWN, event);
|
2022-05-11 17:12:48 -05:00
|
|
|
return NpcAPI.EVENT_BUS.post(event);
|
2022-05-11 01:10:31 -05:00
|
|
|
}
|
|
|
|
|
|
2022-05-11 22:08:31 -05:00
|
|
|
public static boolean onScriptItemInteract(IItemCustom handler, noppes.npcs.scripted.event.ItemEvent.InteractEvent event) {
|
2022-11-23 23:59:01 -06:00
|
|
|
((ScriptCustomItem) handler).callScript(EnumScriptType.INTERACT, event);
|
2022-05-11 17:12:48 -05:00
|
|
|
return NpcAPI.EVENT_BUS.post(event);
|
2022-05-11 01:10:31 -05:00
|
|
|
}
|
|
|
|
|
|
2024-02-21 00:31:17 -05:00
|
|
|
public static boolean onScriptItemRightClick(IItemCustom handler, noppes.npcs.scripted.event.ItemEvent.RightClickEvent event) {
|
|
|
|
|
((ScriptCustomItem) handler).callScript(EnumScriptType.RIGHT_CLICK, event);
|
|
|
|
|
return NpcAPI.EVENT_BUS.post(event);
|
|
|
|
|
}
|
|
|
|
|
|
2022-05-11 22:08:31 -05:00
|
|
|
public static boolean onScriptItemAttack(IItemCustom handler, noppes.npcs.scripted.event.ItemEvent.AttackEvent event) {
|
2022-11-23 23:59:01 -06:00
|
|
|
((ScriptCustomItem) handler).callScript(EnumScriptType.ATTACK, event);
|
2022-05-11 17:12:48 -05:00
|
|
|
return NpcAPI.EVENT_BUS.post(event);
|
2022-05-11 14:24:12 -05:00
|
|
|
}
|
|
|
|
|
|
2022-05-11 22:08:31 -05:00
|
|
|
public static boolean onStartUsingCustomItem(IItemCustom handler, IPlayer player, int duration) {
|
2022-05-11 14:24:12 -05:00
|
|
|
ItemEvent.StartUsingItem event = new ItemEvent.StartUsingItem(handler, player, duration);
|
2022-11-23 23:59:01 -06:00
|
|
|
((ScriptCustomItem) handler).callScript(EnumScriptType.START_USING_ITEM, event);
|
2022-05-11 17:12:48 -05:00
|
|
|
return NpcAPI.EVENT_BUS.post(event);
|
2022-05-11 14:24:12 -05:00
|
|
|
}
|
|
|
|
|
|
2022-05-11 22:08:31 -05:00
|
|
|
public static boolean onUsingCustomItem(IItemCustom handler, IPlayer player, int duration) {
|
2022-05-11 14:24:12 -05:00
|
|
|
ItemEvent.UsingItem event = new ItemEvent.UsingItem(handler, player, duration);
|
2022-11-23 23:59:01 -06:00
|
|
|
((ScriptCustomItem) handler).callScript(EnumScriptType.USING_ITEM, event);
|
2022-05-11 17:12:48 -05:00
|
|
|
return NpcAPI.EVENT_BUS.post(event);
|
2022-05-11 14:24:12 -05:00
|
|
|
}
|
|
|
|
|
|
2022-05-11 22:08:31 -05:00
|
|
|
public static boolean onStopUsingCustomItem(IItemCustom handler, IPlayer player, int duration) {
|
2022-05-11 14:24:12 -05:00
|
|
|
ItemEvent.StopUsingItem event = new ItemEvent.StopUsingItem(handler, player, duration);
|
2022-11-23 23:59:01 -06:00
|
|
|
((ScriptCustomItem) handler).callScript(EnumScriptType.STOP_USING_ITEM, event);
|
2022-05-11 17:12:48 -05:00
|
|
|
return NpcAPI.EVENT_BUS.post(event);
|
2022-05-11 14:24:12 -05:00
|
|
|
}
|
|
|
|
|
|
2022-05-11 22:08:31 -05:00
|
|
|
public static boolean onFinishUsingCustomItem(IItemCustom handler, IPlayer player, int duration) {
|
2022-05-11 14:24:12 -05:00
|
|
|
ItemEvent.FinishUsingItem event = new ItemEvent.FinishUsingItem(handler, player, duration);
|
2022-11-23 23:59:01 -06:00
|
|
|
((ScriptCustomItem) handler).callScript(EnumScriptType.FINISH_USING_ITEM, event);
|
2022-05-11 17:12:48 -05:00
|
|
|
return NpcAPI.EVENT_BUS.post(event);
|
2022-05-11 01:10:31 -05:00
|
|
|
}
|
|
|
|
|
|
2022-03-23 03:54:06 -05:00
|
|
|
public static void onNPCInit(EntityNPCInterface npc) {
|
2022-03-23 04:02:01 -05:00
|
|
|
if(npc == null || npc.wrappedNPC == null)
|
|
|
|
|
return;
|
|
|
|
|
|
2022-03-23 03:54:06 -05:00
|
|
|
noppes.npcs.scripted.event.NpcEvent.InitEvent event = new noppes.npcs.scripted.event.NpcEvent.InitEvent(npc.wrappedNPC);
|
2023-03-16 04:27:19 -05:00
|
|
|
ScriptController.Instance.globalNpcScripts.callScript(EnumScriptType.INIT, event);
|
2022-06-10 18:32:42 -05:00
|
|
|
npc.script.callScript(EnumScriptType.INIT, event);
|
2022-05-11 17:12:48 -05:00
|
|
|
NpcAPI.EVENT_BUS.post(event);
|
2022-06-08 00:32:58 -05:00
|
|
|
npc.advanced.soulStoneInit = false;
|
2022-03-23 03:54:06 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static void onNPCUpdate(EntityNPCInterface npc) {
|
2022-03-23 04:02:01 -05:00
|
|
|
if(npc == null || npc.wrappedNPC == null)
|
|
|
|
|
return;
|
|
|
|
|
|
2022-03-23 03:54:06 -05:00
|
|
|
noppes.npcs.scripted.event.NpcEvent.UpdateEvent event = new noppes.npcs.scripted.event.NpcEvent.UpdateEvent(npc.wrappedNPC);
|
2023-03-16 04:27:19 -05:00
|
|
|
ScriptController.Instance.globalNpcScripts.callScript(EnumScriptType.TICK, event);
|
2022-06-10 18:32:42 -05:00
|
|
|
npc.script.callScript(EnumScriptType.TICK, event);
|
2022-05-11 17:12:48 -05:00
|
|
|
NpcAPI.EVENT_BUS.post(event);
|
2022-03-23 03:54:06 -05:00
|
|
|
}
|
|
|
|
|
|
2022-11-05 04:19:03 -05:00
|
|
|
public static boolean onNPCDialog(EntityNPCInterface npc, EntityPlayer player, int dialogId, int optionId, Dialog dialog) {
|
2022-03-23 04:02:01 -05:00
|
|
|
if(npc == null || npc.wrappedNPC == null)
|
2022-11-05 04:19:03 -05:00
|
|
|
return false;
|
2022-03-23 04:02:01 -05:00
|
|
|
|
2022-04-09 00:17:16 -05:00
|
|
|
NpcEvent.DialogEvent event = new NpcEvent.DialogEvent(npc.wrappedNPC, player, dialogId, optionId, dialog);
|
2023-03-16 04:27:19 -05:00
|
|
|
ScriptController.Instance.globalNpcScripts.callScript(EnumScriptType.DIALOG, event);
|
2022-06-10 18:32:42 -05:00
|
|
|
npc.script.callScript(EnumScriptType.DIALOG, event, "player", event.getPlayer(), "dialog", event.getDialogId(), "option", event.getOptionId(), "dialogObj", event.getDialog());
|
2022-04-13 04:25:44 -05:00
|
|
|
|
2022-11-05 04:19:03 -05:00
|
|
|
return NpcAPI.EVENT_BUS.post(event);
|
2022-03-23 03:54:06 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static void onNPCDialogClosed(EntityNPCInterface npc, EntityPlayer player, int dialogId, int optionId, Dialog dialog) {
|
2022-03-23 04:02:01 -05:00
|
|
|
if(npc == null || npc.wrappedNPC == null)
|
|
|
|
|
return;
|
|
|
|
|
|
2022-03-23 03:54:06 -05:00
|
|
|
NpcEvent.DialogClosedEvent event = new NpcEvent.DialogClosedEvent(npc.wrappedNPC, player, dialogId, optionId, dialog);
|
2023-03-16 04:27:19 -05:00
|
|
|
ScriptController.Instance.globalNpcScripts.callScript(EnumScriptType.DIALOG_CLOSE, event);
|
2022-06-10 18:32:42 -05:00
|
|
|
npc.script.callScript(EnumScriptType.DIALOG_CLOSE, event, "player", event.getPlayer(), "dialog", event.getDialogId(), "option", event.getOptionId(), "dialogObj", event.getDialog());
|
2022-04-13 04:25:44 -05:00
|
|
|
|
2022-05-11 17:12:48 -05:00
|
|
|
NpcAPI.EVENT_BUS.post(event);
|
2022-03-23 03:54:06 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static boolean onNPCInteract(EntityNPCInterface npc, EntityPlayer player) {
|
2022-03-23 04:02:01 -05:00
|
|
|
if(npc == null || npc.wrappedNPC == null)
|
|
|
|
|
return false;
|
|
|
|
|
|
2022-03-23 03:54:06 -05:00
|
|
|
NpcEvent.InteractEvent event = new NpcEvent.InteractEvent(npc.wrappedNPC,player);
|
2023-03-16 04:27:19 -05:00
|
|
|
ScriptController.Instance.globalNpcScripts.callScript(EnumScriptType.INTERACT, event);
|
2022-06-10 18:32:42 -05:00
|
|
|
boolean result = npc.script.callScript(EnumScriptType.INTERACT, event, "player", player);
|
2022-05-11 17:12:48 -05:00
|
|
|
NpcAPI.EVENT_BUS.post(event);
|
2022-03-23 03:54:06 -05:00
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
2022-06-10 18:32:42 -05:00
|
|
|
public static boolean onNPCMeleeAttack(EntityNPCInterface npc, NpcEvent.MeleeAttackEvent event){
|
2022-03-23 04:02:01 -05:00
|
|
|
if(npc == null || npc.wrappedNPC == null)
|
|
|
|
|
return false;
|
|
|
|
|
|
2023-03-16 04:27:19 -05:00
|
|
|
ScriptController.Instance.globalNpcScripts.callScript(EnumScriptType.ATTACK_MELEE, event);
|
2022-06-10 18:32:42 -05:00
|
|
|
npc.script.callScript(EnumScriptType.ATTACK, event, "target", event.target);
|
|
|
|
|
return NpcAPI.EVENT_BUS.post(event);
|
2022-03-23 03:54:06 -05:00
|
|
|
}
|
|
|
|
|
|
2024-02-12 02:56:11 -05:00
|
|
|
public static boolean onNPCMeleeSwing(EntityNPCInterface npc, NpcEvent.SwingEvent event){
|
|
|
|
|
if(npc == null || npc.wrappedNPC == null)
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
ScriptController.Instance.globalNpcScripts.callScript(EnumScriptType.ATTACK_SWING, event);
|
|
|
|
|
npc.script.callScript(EnumScriptType.ATTACK_SWING, event);
|
|
|
|
|
return NpcAPI.EVENT_BUS.post(event);
|
|
|
|
|
}
|
|
|
|
|
|
2022-06-10 18:32:42 -05:00
|
|
|
public static boolean onNPCRangedAttack(EntityNPCInterface npc, NpcEvent.RangedLaunchedEvent event){
|
2022-03-23 04:02:01 -05:00
|
|
|
if(npc == null || npc.wrappedNPC == null)
|
|
|
|
|
return false;
|
|
|
|
|
|
2023-03-16 04:27:19 -05:00
|
|
|
ScriptController.Instance.globalNpcScripts.callScript(EnumScriptType.RANGED_LAUNCHED, event);
|
2022-06-10 18:32:42 -05:00
|
|
|
npc.script.callScript(EnumScriptType.ATTACK, event, "target", event.target);
|
|
|
|
|
return NpcAPI.EVENT_BUS.post(event);
|
2022-03-23 03:54:06 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static void onNPCKilledEntity(EntityNPCInterface npc, EntityLivingBase entity){
|
2022-03-23 04:02:01 -05:00
|
|
|
if(npc == null || npc.wrappedNPC == null)
|
|
|
|
|
return;
|
|
|
|
|
|
2022-03-23 03:54:06 -05:00
|
|
|
NpcEvent.KilledEntityEvent event = new NpcEvent.KilledEntityEvent(npc.wrappedNPC,entity);
|
2023-03-16 04:27:19 -05:00
|
|
|
ScriptController.Instance.globalNpcScripts.callScript(EnumScriptType.KILLS, event);
|
2022-06-10 18:32:42 -05:00
|
|
|
npc.script.callScript(EnumScriptType.KILLS, event, "target", entity);
|
2022-05-11 17:12:48 -05:00
|
|
|
NpcAPI.EVENT_BUS.post(event);
|
2022-03-23 03:54:06 -05:00
|
|
|
}
|
|
|
|
|
|
2022-06-10 18:32:42 -05:00
|
|
|
public static boolean onNPCTarget(EntityNPCInterface npc, NpcEvent.TargetEvent event){
|
2022-03-23 04:02:01 -05:00
|
|
|
if(npc == null || npc.wrappedNPC == null)
|
|
|
|
|
return false;
|
|
|
|
|
|
2023-03-16 04:27:19 -05:00
|
|
|
ScriptController.Instance.globalNpcScripts.callScript(EnumScriptType.TARGET, event);
|
2022-06-10 18:32:42 -05:00
|
|
|
npc.script.callScript(EnumScriptType.TARGET, event);
|
|
|
|
|
return NpcAPI.EVENT_BUS.post(event);
|
2022-03-23 03:54:06 -05:00
|
|
|
}
|
|
|
|
|
|
2023-03-16 04:56:33 -05:00
|
|
|
public static boolean onNPCTargetLost(EntityNPCInterface npc, EntityLivingBase prevtarget, EntityLivingBase newTarget) {
|
|
|
|
|
if(npc.script.isClient())
|
|
|
|
|
return false;
|
|
|
|
|
NpcEvent.TargetLostEvent event = new NpcEvent.TargetLostEvent(npc.wrappedNPC, prevtarget, newTarget);
|
|
|
|
|
|
|
|
|
|
ScriptController.Instance.globalNpcScripts.callScript(EnumScriptType.TARGET_LOST, event);
|
|
|
|
|
npc.script.callScript(EnumScriptType.TARGET_LOST, event);
|
|
|
|
|
return NpcAPI.EVENT_BUS.post(event);
|
|
|
|
|
}
|
|
|
|
|
|
2022-03-23 03:54:06 -05:00
|
|
|
public static void onNPCCollide(EntityNPCInterface npc, Entity entity){
|
2022-03-23 04:02:01 -05:00
|
|
|
if(npc == null || npc.wrappedNPC == null)
|
|
|
|
|
return;
|
|
|
|
|
|
2022-03-23 03:54:06 -05:00
|
|
|
NpcEvent.CollideEvent event = new NpcEvent.CollideEvent(npc.wrappedNPC,entity);
|
2023-03-16 04:27:19 -05:00
|
|
|
ScriptController.Instance.globalNpcScripts.callScript(EnumScriptType.COLLIDE, event);
|
2022-06-10 18:32:42 -05:00
|
|
|
npc.script.callScript(EnumScriptType.COLLIDE, event, "entity", entity);
|
2022-05-11 17:12:48 -05:00
|
|
|
NpcAPI.EVENT_BUS.post(event);
|
2022-03-23 03:54:06 -05:00
|
|
|
}
|
|
|
|
|
|
2022-06-10 18:32:42 -05:00
|
|
|
public static boolean onNPCDamaged(EntityNPCInterface npc, NpcEvent.DamagedEvent event){
|
2022-03-23 04:02:01 -05:00
|
|
|
if(npc == null || npc.wrappedNPC == null)
|
|
|
|
|
return false;
|
|
|
|
|
|
2023-03-16 04:27:19 -05:00
|
|
|
ScriptController.Instance.globalNpcScripts.callScript(EnumScriptType.DAMAGED, event);
|
2022-06-10 18:32:42 -05:00
|
|
|
npc.script.callScript(EnumScriptType.DAMAGED, event);
|
|
|
|
|
return NpcAPI.EVENT_BUS.post(event);
|
2022-03-23 03:54:06 -05:00
|
|
|
}
|
|
|
|
|
|
2022-06-10 18:32:42 -05:00
|
|
|
public static boolean onNPCKilled(EntityNPCInterface npc, NpcEvent.DiedEvent event){
|
2022-03-23 04:02:01 -05:00
|
|
|
if(npc == null || npc.wrappedNPC == null)
|
|
|
|
|
return false;
|
|
|
|
|
|
2023-03-16 04:27:19 -05:00
|
|
|
ScriptController.Instance.globalNpcScripts.callScript(EnumScriptType.KILLED, event);
|
2022-06-10 18:32:42 -05:00
|
|
|
npc.script.callScript(EnumScriptType.KILLED, event);
|
|
|
|
|
return NpcAPI.EVENT_BUS.post(event);
|
2022-03-23 03:54:06 -05:00
|
|
|
}
|
2022-01-12 04:44:08 -06:00
|
|
|
|
2021-10-20 23:04:52 -05:00
|
|
|
public static void onNPCTimer(EntityNPCInterface npc, int id) {
|
2022-03-23 04:02:01 -05:00
|
|
|
if(npc == null || npc.wrappedNPC == null)
|
|
|
|
|
return;
|
|
|
|
|
|
2021-10-20 23:04:52 -05:00
|
|
|
NpcEvent.TimerEvent event = new NpcEvent.TimerEvent(npc.wrappedNPC, id);
|
2023-03-16 04:27:19 -05:00
|
|
|
ScriptController.Instance.globalNpcScripts.callScript(EnumScriptType.TIMER, event);
|
2023-03-16 16:43:05 -05:00
|
|
|
npc.script.callScript(EnumScriptType.TIMER, event);
|
2022-05-11 17:12:48 -05:00
|
|
|
NpcAPI.EVENT_BUS.post(event);
|
2021-10-20 23:04:52 -05:00
|
|
|
}
|
|
|
|
|
|
2023-03-16 02:51:40 -05:00
|
|
|
public static void onProjectileTick(EntityProjectile projectile) {
|
|
|
|
|
ProjectileEvent.UpdateEvent event = new ProjectileEvent.UpdateEvent((IProjectile) NpcAPI.Instance().getIEntity(projectile));
|
2023-03-16 16:43:05 -05:00
|
|
|
ScriptController.Instance.globalNpcScripts.callScript(EnumScriptType.PROJECTILE_TICK, event);
|
2023-03-16 02:51:40 -05:00
|
|
|
for(ScriptContainer script : projectile.scripts) {
|
|
|
|
|
if(script.isValid()) {
|
|
|
|
|
script.run(EnumScriptType.PROJECTILE_TICK, event);
|
|
|
|
|
}
|
|
|
|
|
}
|
2023-12-31 16:10:38 -05:00
|
|
|
|
|
|
|
|
EntityLivingBase thrower = projectile.getThrower();
|
|
|
|
|
if(thrower != null){
|
|
|
|
|
if(thrower instanceof EntityNPCInterface){
|
|
|
|
|
((EntityNPCInterface) thrower).script.callScript(EnumScriptType.PROJECTILE_TICK, event);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2023-03-16 02:51:40 -05:00
|
|
|
NpcAPI.EVENT_BUS.post(event);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static void onProjectileImpact(EntityProjectile projectile, ProjectileEvent.ImpactEvent event) {
|
2023-03-16 16:43:05 -05:00
|
|
|
ScriptController.Instance.globalNpcScripts.callScript(EnumScriptType.PROJECTILE_IMPACT, event);
|
2023-03-16 02:51:40 -05:00
|
|
|
for(ScriptContainer script : projectile.scripts) {
|
|
|
|
|
if(script.isValid()) {
|
|
|
|
|
script.run(EnumScriptType.PROJECTILE_IMPACT, event);
|
|
|
|
|
}
|
|
|
|
|
}
|
2023-12-31 16:10:38 -05:00
|
|
|
|
|
|
|
|
EntityLivingBase thrower = projectile.getThrower();
|
|
|
|
|
if(thrower != null){
|
|
|
|
|
if(thrower instanceof EntityNPCInterface){
|
|
|
|
|
((EntityNPCInterface) thrower).script.callScript(EnumScriptType.PROJECTILE_IMPACT, event);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2023-03-16 02:51:40 -05:00
|
|
|
NpcAPI.EVENT_BUS.post(event);
|
|
|
|
|
}
|
|
|
|
|
|
2022-05-11 22:08:31 -05:00
|
|
|
public static void onPlayerInit(PlayerDataScript handler, IPlayer player) {
|
2021-12-18 08:34:30 -06:00
|
|
|
noppes.npcs.scripted.event.PlayerEvent.InitEvent event = new noppes.npcs.scripted.event.PlayerEvent.InitEvent(player);
|
2021-12-16 21:54:05 -06:00
|
|
|
handler.callScript(EnumScriptType.INIT, event);
|
2022-05-11 17:12:48 -05:00
|
|
|
NpcAPI.EVENT_BUS.post(event);
|
2021-09-30 00:56:49 -05:00
|
|
|
}
|
|
|
|
|
|
2022-05-11 22:08:31 -05:00
|
|
|
public static void onPlayerTick(PlayerDataScript handler, IPlayer player) {
|
2021-12-18 08:34:30 -06:00
|
|
|
noppes.npcs.scripted.event.PlayerEvent.UpdateEvent event = new noppes.npcs.scripted.event.PlayerEvent.UpdateEvent(player);
|
2021-12-16 21:54:05 -06:00
|
|
|
handler.callScript(EnumScriptType.TICK, event);
|
2022-05-11 17:12:48 -05:00
|
|
|
NpcAPI.EVENT_BUS.post(event);
|
2021-09-30 00:56:49 -05:00
|
|
|
}
|
|
|
|
|
|
2021-10-11 06:49:30 -05:00
|
|
|
public static boolean onPlayerInteract(PlayerDataScript handler, noppes.npcs.scripted.event.PlayerEvent.InteractEvent event) {
|
2021-12-16 21:54:05 -06:00
|
|
|
handler.callScript(EnumScriptType.INTERACT, event);
|
2022-05-11 17:12:48 -05:00
|
|
|
return NpcAPI.EVENT_BUS.post(event);
|
2021-10-12 02:57:32 -05:00
|
|
|
}
|
|
|
|
|
|
2022-05-11 22:08:31 -05:00
|
|
|
public static boolean onStartUsingItem(PlayerDataScript handler, IPlayer player, int duration, ItemStack item){
|
2021-12-18 08:34:30 -06:00
|
|
|
PlayerEvent.StartUsingItem event = new PlayerEvent.StartUsingItem(player, item, duration);
|
2021-12-16 21:54:05 -06:00
|
|
|
handler.callScript(EnumScriptType.START_USING_ITEM, event);
|
2022-05-11 17:12:48 -05:00
|
|
|
return NpcAPI.EVENT_BUS.post(event);
|
2021-10-12 02:57:32 -05:00
|
|
|
}
|
|
|
|
|
|
2022-05-11 22:08:31 -05:00
|
|
|
public static boolean onUsingItem(PlayerDataScript handler, IPlayer player, int duration, ItemStack item){
|
2021-12-18 08:34:30 -06:00
|
|
|
PlayerEvent.UsingItem event = new PlayerEvent.UsingItem(player, item, duration);
|
2021-12-16 21:54:05 -06:00
|
|
|
handler.callScript(EnumScriptType.USING_ITEM, event);
|
2022-05-11 17:12:48 -05:00
|
|
|
return NpcAPI.EVENT_BUS.post(event);
|
2021-09-30 00:56:49 -05:00
|
|
|
}
|
|
|
|
|
|
2022-05-11 22:08:31 -05:00
|
|
|
public static boolean onStopUsingItem(PlayerDataScript handler, IPlayer player, int duration, ItemStack item){
|
2021-12-18 08:34:30 -06:00
|
|
|
PlayerEvent.StopUsingItem event = new PlayerEvent.StopUsingItem(player, item, duration);
|
2021-12-16 21:54:05 -06:00
|
|
|
handler.callScript(EnumScriptType.STOP_USING_ITEM, event);
|
2022-05-11 17:12:48 -05:00
|
|
|
return NpcAPI.EVENT_BUS.post(event);
|
2021-09-30 00:56:49 -05:00
|
|
|
}
|
|
|
|
|
|
2022-05-11 22:08:31 -05:00
|
|
|
public static void onFinishUsingItem(PlayerDataScript handler, IPlayer player, int duration, ItemStack item){
|
2021-12-18 08:34:30 -06:00
|
|
|
PlayerEvent.FinishUsingItem event = new PlayerEvent.FinishUsingItem(player, item, duration);
|
2021-12-16 21:54:05 -06:00
|
|
|
handler.callScript(EnumScriptType.FINISH_USING_ITEM, event);
|
2022-05-11 17:12:48 -05:00
|
|
|
NpcAPI.EVENT_BUS.post(event);
|
2021-10-12 02:57:32 -05:00
|
|
|
}
|
|
|
|
|
|
2022-05-11 22:08:31 -05:00
|
|
|
public static boolean onPlayerDropItems(PlayerDataScript handler, IPlayer player, ArrayList<EntityItem> entityItems) {
|
2021-10-12 02:57:32 -05:00
|
|
|
IItemStack[] items = new IItemStack[entityItems.size()];
|
|
|
|
|
for(int i = 0; i < entityItems.size(); i++){ items[i] = NpcAPI.Instance().getIItemStack(entityItems.get(i).getEntityItem()); }
|
|
|
|
|
|
2021-12-18 08:34:30 -06:00
|
|
|
DropEvent event = new DropEvent(player, items);
|
2021-12-16 21:54:05 -06:00
|
|
|
handler.callScript(EnumScriptType.DROP, event);
|
2022-05-11 17:12:48 -05:00
|
|
|
return NpcAPI.EVENT_BUS.post(event);
|
2021-09-30 00:56:49 -05:00
|
|
|
}
|
|
|
|
|
|
2022-05-11 22:08:31 -05:00
|
|
|
public static void onPlayerPickupXP(PlayerDataScript handler, IPlayer player, EntityXPOrb orb) {
|
2021-12-18 08:34:30 -06:00
|
|
|
PlayerEvent.PickupXPEvent event = new PlayerEvent.PickupXPEvent(player, orb);
|
2021-12-16 21:54:05 -06:00
|
|
|
handler.callScript(EnumScriptType.PICKUP_XP, event);
|
2022-05-11 17:12:48 -05:00
|
|
|
NpcAPI.EVENT_BUS.post(event);
|
2021-09-30 00:56:49 -05:00
|
|
|
}
|
|
|
|
|
|
2022-05-11 22:08:31 -05:00
|
|
|
public static boolean onPlayerToss(PlayerDataScript handler, IPlayer player, EntityItem entityItem) {
|
2021-12-18 08:34:30 -06:00
|
|
|
PlayerEvent.TossEvent event = new PlayerEvent.TossEvent(player, NpcAPI.Instance().getIItemStack(entityItem.getEntityItem()));
|
2021-12-16 21:54:05 -06:00
|
|
|
handler.callScript(EnumScriptType.TOSS, event);
|
2022-05-11 17:12:48 -05:00
|
|
|
return NpcAPI.EVENT_BUS.post(event);
|
2021-10-18 22:01:15 -05:00
|
|
|
}
|
|
|
|
|
|
2022-05-11 22:08:31 -05:00
|
|
|
public static boolean onPlayerPickUp(PlayerDataScript handler, IPlayer player, EntityItem entityItem) {
|
|
|
|
|
PickUpEvent event = new PickUpEvent(player, NpcAPI.Instance().getIItemStack(entityItem.getEntityItem()));//NpcAPI.Instance().getIItemStack(entityItem.getEntityItem()));
|
2021-12-16 21:54:05 -06:00
|
|
|
handler.callScript(EnumScriptType.PICKUP, event);
|
2022-05-11 17:12:48 -05:00
|
|
|
return NpcAPI.EVENT_BUS.post(event);
|
2021-09-30 00:56:49 -05:00
|
|
|
}
|
|
|
|
|
|
2022-05-11 22:08:31 -05:00
|
|
|
public static void onPlayerContainerOpen(PlayerDataScript handler, IPlayer player, Container container) {
|
2021-12-18 08:34:30 -06:00
|
|
|
ContainerOpen event = new ContainerOpen(player, NpcAPI.Instance().getIContainer(container));
|
2021-12-16 21:54:05 -06:00
|
|
|
handler.callScript(EnumScriptType.CONTAINER_OPEN, event);
|
2022-05-11 17:12:48 -05:00
|
|
|
NpcAPI.EVENT_BUS.post(event);
|
2021-09-30 00:56:49 -05:00
|
|
|
}
|
|
|
|
|
|
2022-05-11 22:08:31 -05:00
|
|
|
public static void onPlayerUseHoe(PlayerDataScript handler, IPlayer player, ItemStack hoe, int x, int y, int z) {
|
2021-12-18 08:34:30 -06:00
|
|
|
noppes.npcs.scripted.event.PlayerEvent.UseHoe event = new noppes.npcs.scripted.event.PlayerEvent.UseHoe(player, hoe, x, y, z);
|
2021-12-16 21:54:05 -06:00
|
|
|
handler.callScript(EnumScriptType.USE_HOE, event);
|
2022-05-11 17:12:48 -05:00
|
|
|
NpcAPI.EVENT_BUS.post(event);
|
2021-10-18 20:50:54 -05:00
|
|
|
}
|
|
|
|
|
|
2022-05-11 22:08:31 -05:00
|
|
|
public static void onPlayerSleep(PlayerDataScript handler, IPlayer player, int x, int y, int z) {
|
2021-12-18 08:34:30 -06:00
|
|
|
noppes.npcs.scripted.event.PlayerEvent.Sleep event = new noppes.npcs.scripted.event.PlayerEvent.Sleep(player, x, y, z);
|
2021-12-16 21:54:05 -06:00
|
|
|
handler.callScript(EnumScriptType.SLEEP, event);
|
2022-05-11 17:12:48 -05:00
|
|
|
NpcAPI.EVENT_BUS.post(event);
|
2021-10-18 20:50:54 -05:00
|
|
|
}
|
|
|
|
|
|
2022-05-11 22:08:31 -05:00
|
|
|
public static void onPlayerWakeUp(PlayerDataScript handler, IPlayer player, boolean setSpawn) {
|
2021-12-18 08:34:30 -06:00
|
|
|
noppes.npcs.scripted.event.PlayerEvent.WakeUp event = new noppes.npcs.scripted.event.PlayerEvent.WakeUp(player, setSpawn);
|
2021-12-16 21:54:05 -06:00
|
|
|
handler.callScript(EnumScriptType.WAKE_UP, event);
|
2022-05-11 17:12:48 -05:00
|
|
|
NpcAPI.EVENT_BUS.post(event);
|
2021-10-18 20:50:54 -05:00
|
|
|
}
|
|
|
|
|
|
2022-05-11 22:08:31 -05:00
|
|
|
public static void onPlayerDeath(PlayerDataScript handler, IPlayer player, DamageSource source, Entity entity) {
|
2021-12-18 08:34:30 -06:00
|
|
|
noppes.npcs.scripted.event.PlayerEvent.DiedEvent event = new noppes.npcs.scripted.event.PlayerEvent.DiedEvent(player, source, entity);
|
2021-12-16 21:54:05 -06:00
|
|
|
handler.callScript(EnumScriptType.KILLED, event);
|
2022-05-11 17:12:48 -05:00
|
|
|
NpcAPI.EVENT_BUS.post(event);
|
2021-09-30 00:56:49 -05:00
|
|
|
}
|
|
|
|
|
|
2022-05-11 22:08:31 -05:00
|
|
|
public static void onPlayerKills(PlayerDataScript handler, IPlayer player, EntityLivingBase entityLiving) {
|
2021-12-18 08:34:30 -06:00
|
|
|
noppes.npcs.scripted.event.PlayerEvent.KilledEntityEvent event = new noppes.npcs.scripted.event.PlayerEvent.KilledEntityEvent(player, entityLiving);
|
2021-12-16 21:54:05 -06:00
|
|
|
handler.callScript(EnumScriptType.KILLS, event);
|
2022-05-11 17:12:48 -05:00
|
|
|
NpcAPI.EVENT_BUS.post(event);
|
2021-09-30 00:56:49 -05:00
|
|
|
}
|
|
|
|
|
|
2022-07-07 12:49:30 -05:00
|
|
|
public static boolean onPlayerAttacked(PlayerDataScript handler, noppes.npcs.scripted.event.PlayerEvent.AttackedEvent event) {
|
|
|
|
|
handler.callScript(EnumScriptType.ATTACKED, event);
|
|
|
|
|
return NpcAPI.EVENT_BUS.post(event);
|
|
|
|
|
}
|
|
|
|
|
|
2021-10-11 06:49:30 -05:00
|
|
|
public static boolean onPlayerDamaged(PlayerDataScript handler, noppes.npcs.scripted.event.PlayerEvent.DamagedEvent event) {
|
2021-12-16 21:54:05 -06:00
|
|
|
handler.callScript(EnumScriptType.DAMAGED, event);
|
2022-05-11 17:12:48 -05:00
|
|
|
return NpcAPI.EVENT_BUS.post(event);
|
2021-09-30 00:56:49 -05:00
|
|
|
}
|
|
|
|
|
|
2022-05-11 22:08:31 -05:00
|
|
|
public static boolean onPlayerLightning(PlayerDataScript handler, IPlayer player) {
|
2021-12-18 08:34:30 -06:00
|
|
|
PlayerEvent.LightningEvent event = new PlayerEvent.LightningEvent(player);
|
2021-12-16 21:54:05 -06:00
|
|
|
handler.callScript(EnumScriptType.LIGHTNING, event);
|
2022-05-11 17:12:48 -05:00
|
|
|
return NpcAPI.EVENT_BUS.post(event);
|
2021-10-15 09:17:31 -05:00
|
|
|
}
|
|
|
|
|
|
2022-05-11 22:08:31 -05:00
|
|
|
public static boolean onPlayerSound(PlayerDataScript handler, IPlayer player, String name, float pitch, float volume) {
|
2021-12-18 08:34:30 -06:00
|
|
|
PlayerEvent.SoundEvent event = new PlayerEvent.SoundEvent(player, name, pitch, volume);
|
2021-12-16 21:54:05 -06:00
|
|
|
handler.callScript(EnumScriptType.PLAYSOUND, event);
|
2022-05-11 17:12:48 -05:00
|
|
|
return NpcAPI.EVENT_BUS.post(event);
|
2021-10-15 09:17:31 -05:00
|
|
|
}
|
|
|
|
|
|
2022-11-24 14:36:09 -06:00
|
|
|
public static boolean onPlayerFall(PlayerDataScript handler, IPlayer player, float distance) {
|
2021-12-18 08:34:30 -06:00
|
|
|
PlayerEvent.FallEvent event = new PlayerEvent.FallEvent(player,distance);
|
2021-12-16 21:54:05 -06:00
|
|
|
handler.callScript(EnumScriptType.FALL, event);
|
2022-11-24 14:36:09 -06:00
|
|
|
return NpcAPI.EVENT_BUS.post(event);
|
2021-10-12 02:57:32 -05:00
|
|
|
}
|
|
|
|
|
|
2022-05-11 22:08:31 -05:00
|
|
|
public static void onPlayerJump(PlayerDataScript handler, IPlayer player) {
|
2021-12-18 08:34:30 -06:00
|
|
|
PlayerEvent.JumpEvent event = new PlayerEvent.JumpEvent(player);
|
2021-12-16 21:54:05 -06:00
|
|
|
handler.callScript(EnumScriptType.JUMP, event);
|
2022-05-11 17:12:48 -05:00
|
|
|
NpcAPI.EVENT_BUS.post(event);
|
2021-10-18 20:50:54 -05:00
|
|
|
}
|
|
|
|
|
|
2022-05-11 22:08:31 -05:00
|
|
|
public static void onPlayerLogin(PlayerDataScript handler, IPlayer player) {
|
2021-12-18 08:34:30 -06:00
|
|
|
LoginEvent event = new LoginEvent(player);
|
2021-12-16 21:54:05 -06:00
|
|
|
handler.callScript(EnumScriptType.LOGIN, event);
|
2022-05-11 17:12:48 -05:00
|
|
|
NpcAPI.EVENT_BUS.post(event);
|
2021-09-30 00:56:49 -05:00
|
|
|
}
|
|
|
|
|
|
2022-05-11 22:08:31 -05:00
|
|
|
public static void onPlayerAchievement(PlayerDataScript handler, IPlayer player, String description) {
|
2021-12-18 08:34:30 -06:00
|
|
|
PlayerEvent.Achievement event = new PlayerEvent.Achievement(player, description);
|
2021-12-16 21:54:05 -06:00
|
|
|
handler.callScript(EnumScriptType.ACHIEVEMENT, event);
|
2022-05-11 17:12:48 -05:00
|
|
|
NpcAPI.EVENT_BUS.post(event);
|
2021-10-18 20:50:54 -05:00
|
|
|
}
|
|
|
|
|
|
2022-05-11 22:08:31 -05:00
|
|
|
public static void onPlayerFillBucket(PlayerDataScript handler, IPlayer player, ItemStack current, ItemStack result) {
|
2021-12-18 08:34:30 -06:00
|
|
|
PlayerEvent.FillBucket event = new PlayerEvent.FillBucket(player, current, result);
|
2021-12-16 21:54:05 -06:00
|
|
|
handler.callScript(EnumScriptType.FILL_BUCKET, event);
|
2022-05-11 17:12:48 -05:00
|
|
|
NpcAPI.EVENT_BUS.post(event);
|
2021-10-18 20:50:54 -05:00
|
|
|
}
|
|
|
|
|
|
2022-05-11 22:08:31 -05:00
|
|
|
public static void onPlayerBonemeal(PlayerDataScript handler, IPlayer player, int x, int y, int z, World world) {
|
2021-12-18 08:34:30 -06:00
|
|
|
PlayerEvent.Bonemeal event = new PlayerEvent.Bonemeal(player, x, y, z, world);
|
2021-12-16 21:54:05 -06:00
|
|
|
handler.callScript(EnumScriptType.BONEMEAL, event);
|
2022-05-11 17:12:48 -05:00
|
|
|
NpcAPI.EVENT_BUS.post(event);
|
2021-10-18 20:50:54 -05:00
|
|
|
}
|
2021-10-15 09:17:31 -05:00
|
|
|
|
2022-05-11 22:08:31 -05:00
|
|
|
public static void onPlayerRespawn(PlayerDataScript handler, IPlayer player) {
|
2021-12-18 08:34:30 -06:00
|
|
|
PlayerEvent.RespawnEvent event = new PlayerEvent.RespawnEvent(player);
|
2021-12-16 21:54:05 -06:00
|
|
|
handler.callScript(EnumScriptType.RESPAWN, event);
|
2022-05-11 17:12:48 -05:00
|
|
|
NpcAPI.EVENT_BUS.post(event);
|
2021-10-15 09:17:31 -05:00
|
|
|
}
|
|
|
|
|
|
2022-05-11 22:08:31 -05:00
|
|
|
public static void onPlayerLogout(PlayerDataScript handler, IPlayer player) {
|
2021-12-18 08:34:30 -06:00
|
|
|
LogoutEvent event = new LogoutEvent(player);
|
2021-12-16 21:54:05 -06:00
|
|
|
handler.callScript(EnumScriptType.LOGOUT, event);
|
2022-05-11 17:12:48 -05:00
|
|
|
NpcAPI.EVENT_BUS.post(event);
|
2021-09-30 00:56:49 -05:00
|
|
|
}
|
|
|
|
|
|
2021-10-11 06:49:30 -05:00
|
|
|
public static void onPlayerChat(PlayerDataScript handler, ChatEvent event) {
|
2021-12-16 21:54:05 -06:00
|
|
|
handler.callScript(EnumScriptType.CHAT, event);
|
2022-05-11 17:12:48 -05:00
|
|
|
NpcAPI.EVENT_BUS.post(event);
|
2021-09-30 00:56:49 -05:00
|
|
|
}
|
|
|
|
|
|
2021-10-18 20:50:54 -05:00
|
|
|
public static boolean onPlayerBowCharge(PlayerDataScript handler, noppes.npcs.scripted.event.PlayerEvent.RangedChargeEvent event) {
|
2021-12-16 21:54:05 -06:00
|
|
|
handler.callScript(EnumScriptType.RANGED_CHARGE, event);
|
2022-05-11 17:12:48 -05:00
|
|
|
return NpcAPI.EVENT_BUS.post(event);
|
2021-10-18 20:50:54 -05:00
|
|
|
}
|
|
|
|
|
|
2021-10-11 06:49:30 -05:00
|
|
|
public static boolean onPlayerRanged(PlayerDataScript handler, noppes.npcs.scripted.event.PlayerEvent.RangedLaunchedEvent event) {
|
2021-12-16 21:54:05 -06:00
|
|
|
handler.callScript(EnumScriptType.RANGED_LAUNCHED, event);
|
2022-05-11 17:12:48 -05:00
|
|
|
return NpcAPI.EVENT_BUS.post(event);
|
2021-09-30 00:56:49 -05:00
|
|
|
}
|
|
|
|
|
|
2022-07-07 12:49:30 -05:00
|
|
|
public static boolean onPlayerAttack(PlayerDataScript handler, PlayerEvent.AttackEvent event) {
|
|
|
|
|
handler.callScript(EnumScriptType.ATTACK, event);
|
|
|
|
|
return NpcAPI.EVENT_BUS.post(event);
|
|
|
|
|
}
|
|
|
|
|
|
2021-10-11 06:49:30 -05:00
|
|
|
public static boolean onPlayerDamagedEntity(PlayerDataScript handler, DamagedEntityEvent event) {
|
2021-12-16 21:54:05 -06:00
|
|
|
handler.callScript(EnumScriptType.DAMAGED_ENTITY, event);
|
2022-05-11 17:12:48 -05:00
|
|
|
return NpcAPI.EVENT_BUS.post(event);
|
2021-09-30 00:56:49 -05:00
|
|
|
}
|
|
|
|
|
|
2022-05-11 22:08:31 -05:00
|
|
|
public static void onPlayerChangeDim(PlayerDataScript handler, IPlayer player, int fromDim, int toDim) {
|
2021-12-18 08:34:30 -06:00
|
|
|
PlayerEvent.ChangedDimension event = new PlayerEvent.ChangedDimension(player, fromDim, toDim);
|
2021-12-16 21:54:05 -06:00
|
|
|
handler.callScript(EnumScriptType.CHANGED_DIM, event);
|
2022-05-11 17:12:48 -05:00
|
|
|
NpcAPI.EVENT_BUS.post(event);
|
2021-10-15 09:17:31 -05:00
|
|
|
}
|
|
|
|
|
|
2022-07-06 18:41:39 -05:00
|
|
|
public static void onPlayerMouseClicked(EntityPlayerMP player, int button, int mouseWheel, boolean buttonDown, boolean isCtrlPressed, boolean isShiftPressed, boolean isAltPressed, boolean isMetaPressed, int[] heldKeys) {
|
2021-12-18 08:34:30 -06:00
|
|
|
PlayerDataScript handler = ScriptController.Instance.playerScripts;
|
2022-07-06 18:41:39 -05:00
|
|
|
PlayerEvent.MouseClickedEvent event = new PlayerEvent.MouseClickedEvent((IPlayer)NpcAPI.Instance().getIEntity(player), button, mouseWheel, buttonDown, isCtrlPressed, isAltPressed, isShiftPressed, isMetaPressed, heldKeys);
|
2021-12-16 21:54:05 -06:00
|
|
|
handler.callScript(EnumScriptType.MOUSE_CLICKED, event);
|
2022-05-11 17:12:48 -05:00
|
|
|
NpcAPI.EVENT_BUS.post(event);
|
2021-10-12 02:57:32 -05:00
|
|
|
}
|
|
|
|
|
|
2022-05-03 13:34:56 -05:00
|
|
|
public static void onPlayerKeyPressed(EntityPlayerMP player, int button, boolean isCtrlPressed, boolean isShiftPressed, boolean isAltPressed, boolean isMetaPressed, boolean buttonDown, int[] heldKeys) {
|
2021-12-18 08:34:30 -06:00
|
|
|
PlayerDataScript handler = ScriptController.Instance.playerScripts;
|
2022-05-11 22:08:31 -05:00
|
|
|
KeyPressedEvent event = new KeyPressedEvent((IPlayer)NpcAPI.Instance().getIEntity(player), button, isCtrlPressed, isAltPressed, isShiftPressed, isMetaPressed, buttonDown, heldKeys);
|
2021-12-16 21:54:05 -06:00
|
|
|
handler.callScript(EnumScriptType.KEY_PRESSED, event);
|
2022-05-11 17:12:48 -05:00
|
|
|
NpcAPI.EVENT_BUS.post(event);
|
2021-09-30 00:56:49 -05:00
|
|
|
}
|
2021-10-11 06:49:30 -05:00
|
|
|
|
|
|
|
|
public static void onPlayerTimer(PlayerData data, int id) {
|
2021-12-18 08:34:30 -06:00
|
|
|
PlayerDataScript handler = ScriptController.Instance.playerScripts;
|
2022-05-11 22:08:31 -05:00
|
|
|
noppes.npcs.scripted.event.PlayerEvent.TimerEvent event = new noppes.npcs.scripted.event.PlayerEvent.TimerEvent((IPlayer)NpcAPI.Instance().getIEntity(data.player), id);
|
2021-12-16 21:54:05 -06:00
|
|
|
handler.callScript(EnumScriptType.TIMER, event);
|
2022-05-11 17:12:48 -05:00
|
|
|
NpcAPI.EVENT_BUS.post(event);
|
2021-10-11 06:49:30 -05:00
|
|
|
}
|
|
|
|
|
|
2021-10-12 02:57:32 -05:00
|
|
|
public static boolean onPlayerBreak(PlayerDataScript handler, PlayerEvent.BreakEvent event) {
|
2021-12-16 21:54:05 -06:00
|
|
|
handler.callScript(EnumScriptType.BREAK_BLOCK, event);
|
2022-05-11 17:12:48 -05:00
|
|
|
return NpcAPI.EVENT_BUS.post(event);
|
2021-10-12 02:57:32 -05:00
|
|
|
}
|
|
|
|
|
|
2021-10-11 06:49:30 -05:00
|
|
|
public static void onForgeEntityEvent(EntityEvent event) {
|
2022-05-11 22:08:31 -05:00
|
|
|
IEntity e = NpcAPI.Instance().getIEntity(event.entity);
|
2021-10-11 06:49:30 -05:00
|
|
|
onForgeEvent(new noppes.npcs.scripted.event.ForgeEvent.EntityEvent(event, e), event);
|
|
|
|
|
}
|
|
|
|
|
|
2021-10-18 06:33:39 -05:00
|
|
|
public static void onForgeWorldEvent(WorldEvent event) {
|
|
|
|
|
if(ScriptController.Instance.forgeScripts.isEnabled()) {
|
|
|
|
|
IWorld e = NpcAPI.Instance().getIWorld((WorldServer)event.world);
|
|
|
|
|
onForgeEvent(new noppes.npcs.scripted.event.ForgeEvent.WorldEvent(event, e), event);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static void onForgeInit(ForgeDataScript handler) {
|
|
|
|
|
noppes.npcs.scripted.event.ForgeEvent.InitEvent event = new noppes.npcs.scripted.event.ForgeEvent.InitEvent();
|
|
|
|
|
handler.callScript("init", event);
|
2022-05-11 17:12:48 -05:00
|
|
|
NpcAPI.EVENT_BUS.post(event);
|
2021-10-18 06:33:39 -05:00
|
|
|
}
|
|
|
|
|
|
2021-10-11 06:49:30 -05:00
|
|
|
public static void onForgeEvent(ForgeEvent ev, Event event) {
|
2021-10-18 06:33:39 -05:00
|
|
|
ForgeDataScript handler = ScriptController.Instance.forgeScripts;
|
|
|
|
|
if(handler.isEnabled()) {
|
2021-10-11 06:49:30 -05:00
|
|
|
String eventName = event.getClass().getName();
|
|
|
|
|
int i = eventName.lastIndexOf(".");
|
|
|
|
|
eventName = StringUtils.uncapitalize(eventName.substring(i + 1).replace("$", ""));
|
|
|
|
|
if(event.isCancelable()) {
|
|
|
|
|
ev.setCanceled(event.isCanceled());
|
|
|
|
|
}
|
|
|
|
|
|
2021-10-18 06:33:39 -05:00
|
|
|
handler.callScript(eventName, event);
|
2022-05-11 17:12:48 -05:00
|
|
|
NpcAPI.EVENT_BUS.post(ev);
|
2021-10-11 06:49:30 -05:00
|
|
|
if(event.isCancelable()) {
|
|
|
|
|
event.setCanceled(ev.isCanceled());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
2022-01-12 04:44:08 -06:00
|
|
|
|
2022-11-24 14:36:09 -06:00
|
|
|
public static boolean onCNPCNaturalSpawn(CustomNPCsEvent.CNPCNaturalSpawnEvent event) {
|
2022-06-29 03:36:52 -05:00
|
|
|
ForgeDataScript handler = ScriptController.Instance.forgeScripts;
|
|
|
|
|
if (handler.isEnabled()) {
|
2022-11-24 16:46:20 -06:00
|
|
|
handler.callScript(EnumScriptType.CNPC_NATURAL_SPAWN, event);
|
2022-06-29 03:36:52 -05:00
|
|
|
return NpcAPI.EVENT_BUS.post(event);
|
|
|
|
|
}
|
2023-05-09 23:28:16 -05:00
|
|
|
return false;
|
2022-06-29 03:36:52 -05:00
|
|
|
}
|
|
|
|
|
|
2024-01-20 12:17:15 +03:00
|
|
|
public static void onScriptedCommand(CustomNPCsEvent.ScriptedCommandEvent event) {
|
|
|
|
|
ForgeDataScript handler = ScriptController.Instance.forgeScripts;
|
|
|
|
|
if (handler.isEnabled()) {
|
|
|
|
|
handler.callScript(EnumScriptType.SCRIPT_COMMAND, event);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2022-05-11 22:08:31 -05:00
|
|
|
public static void onCustomGuiButton(IPlayer player, ICustomGui gui, int buttonId) {
|
2022-01-12 04:44:08 -06:00
|
|
|
CustomGuiEvent.ButtonEvent event = new CustomGuiEvent.ButtonEvent(player, gui, buttonId);
|
|
|
|
|
CustomGuiController.onButton(event);
|
|
|
|
|
}
|
|
|
|
|
|
2023-03-18 15:52:50 -05:00
|
|
|
public static void onCustomGuiSlot(IPlayer player, ICustomGui gui, int slotId, ItemStack stack, IItemSlot slot) {
|
|
|
|
|
CustomGuiEvent.SlotEvent event = new CustomGuiEvent.SlotEvent(player, gui, slotId, stack, slot);
|
2022-01-12 04:44:08 -06:00
|
|
|
CustomGuiController.onSlotChange(event);
|
|
|
|
|
}
|
|
|
|
|
|
2023-03-18 15:52:50 -05:00
|
|
|
public static boolean onCustomGuiSlotClicked(IPlayer player, ICustomGui gui, int slotId, IItemSlot slot, int dragType, int clickType) {
|
|
|
|
|
CustomGuiEvent.SlotClickEvent event = new CustomGuiEvent.SlotClickEvent(player, gui, slotId, slot, player.getOpenContainer().getSlot(slotId), dragType, clickType);
|
2022-06-18 12:52:23 -05:00
|
|
|
return CustomGuiController.onSlotClick(event);
|
|
|
|
|
}
|
|
|
|
|
|
2022-05-11 22:08:31 -05:00
|
|
|
public static void onCustomGuiUnfocused(IPlayer player, ICustomGui gui, int textfieldId) {
|
2022-01-14 16:09:27 -06:00
|
|
|
CustomGuiEvent.UnfocusedEvent event = new CustomGuiEvent.UnfocusedEvent(player, gui, textfieldId);
|
|
|
|
|
CustomGuiController.onCustomGuiUnfocused(event);
|
|
|
|
|
}
|
|
|
|
|
|
2022-05-11 22:08:31 -05:00
|
|
|
public static void onCustomGuiScrollClick(IPlayer player, ICustomGui gui, int scrollId, int scrollIndex, String[] selection, boolean doubleClick) {
|
2022-01-12 04:44:08 -06:00
|
|
|
CustomGuiEvent.ScrollEvent event = new CustomGuiEvent.ScrollEvent(player, gui, scrollId, scrollIndex, selection, doubleClick);
|
|
|
|
|
CustomGuiController.onScrollClick(event);
|
|
|
|
|
}
|
|
|
|
|
|
2022-05-11 22:08:31 -05:00
|
|
|
public static void onCustomGuiClose(IPlayer player, ICustomGui gui) {
|
2022-01-12 04:44:08 -06:00
|
|
|
noppes.npcs.scripted.event.CustomGuiEvent.CloseEvent event = new noppes.npcs.scripted.event.CustomGuiEvent.CloseEvent(player, gui);
|
|
|
|
|
CustomGuiController.onClose(event);
|
|
|
|
|
}
|
2022-01-12 20:12:16 -06:00
|
|
|
|
|
|
|
|
public static void onQuestFinished(EntityPlayer player, Quest quest){
|
|
|
|
|
PlayerDataScript handler = ScriptController.Instance.playerScripts;
|
2022-05-11 22:08:31 -05:00
|
|
|
QuestEvent.QuestCompletedEvent event = new QuestEvent.QuestCompletedEvent((IPlayer) NpcAPI.Instance().getIEntity((EntityPlayerMP) player), quest);
|
2022-01-12 20:12:16 -06:00
|
|
|
handler.callScript(EnumScriptType.QUEST_COMPLETED, event);
|
2022-05-11 17:12:48 -05:00
|
|
|
NpcAPI.EVENT_BUS.post(event);
|
2022-01-12 20:12:16 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static boolean onQuestStarted(EntityPlayer player, Quest quest){
|
|
|
|
|
PlayerDataScript handler = ScriptController.Instance.playerScripts;
|
2022-05-11 22:08:31 -05:00
|
|
|
QuestEvent.QuestStartEvent event = new QuestEvent.QuestStartEvent((IPlayer) NpcAPI.Instance().getIEntity((EntityPlayerMP) player), quest);
|
2022-01-12 20:12:16 -06:00
|
|
|
handler.callScript(EnumScriptType.QUEST_START, event);
|
2022-05-11 17:12:48 -05:00
|
|
|
return NpcAPI.EVENT_BUS.post(event);
|
2022-01-12 20:12:16 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static void onQuestTurnedIn(QuestEvent.QuestTurnedInEvent event){
|
|
|
|
|
PlayerDataScript handler = ScriptController.Instance.playerScripts;
|
|
|
|
|
handler.callScript(EnumScriptType.QUEST_TURNIN, event);
|
2022-05-11 17:12:48 -05:00
|
|
|
NpcAPI.EVENT_BUS.post(event);
|
2022-01-12 20:12:16 -06:00
|
|
|
}
|
|
|
|
|
|
2022-11-24 14:36:09 -06:00
|
|
|
public static boolean onFactionPoints(FactionEvent.FactionPoints event){
|
2022-01-12 20:12:16 -06:00
|
|
|
PlayerDataScript handler = ScriptController.Instance.playerScripts;
|
|
|
|
|
handler.callScript(EnumScriptType.FACTION_POINTS, event);
|
2022-11-24 14:36:09 -06:00
|
|
|
return NpcAPI.EVENT_BUS.post(event);
|
2022-01-12 20:12:16 -06:00
|
|
|
}
|
2022-01-12 22:59:03 -06:00
|
|
|
|
2022-11-24 14:36:09 -06:00
|
|
|
public static boolean onDialogOpen(DialogEvent.DialogOpen event){
|
2022-01-12 22:59:03 -06:00
|
|
|
PlayerDataScript handler = ScriptController.Instance.playerScripts;
|
|
|
|
|
handler.callScript(EnumScriptType.DIALOG_OPEN, event);
|
2022-11-24 14:36:09 -06:00
|
|
|
return NpcAPI.EVENT_BUS.post(event);
|
2022-01-12 22:59:03 -06:00
|
|
|
}
|
|
|
|
|
|
2022-11-24 14:36:09 -06:00
|
|
|
public static boolean onDialogOption(DialogEvent.DialogOption event){
|
2022-01-12 22:59:03 -06:00
|
|
|
PlayerDataScript handler = ScriptController.Instance.playerScripts;
|
|
|
|
|
handler.callScript(EnumScriptType.DIALOG_OPTION, event);
|
2022-11-24 14:36:09 -06:00
|
|
|
return NpcAPI.EVENT_BUS.post(event);
|
2022-01-12 22:59:03 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static void onDialogClosed(DialogEvent.DialogClosed event){
|
|
|
|
|
PlayerDataScript handler = ScriptController.Instance.playerScripts;
|
|
|
|
|
handler.callScript(EnumScriptType.DIALOG_CLOSE, event);
|
2022-05-11 17:12:48 -05:00
|
|
|
NpcAPI.EVENT_BUS.post(event);
|
2022-01-12 22:59:03 -06:00
|
|
|
}
|
2024-01-21 10:59:01 +03:00
|
|
|
|
|
|
|
|
public static boolean onScriptBlockInteract(IScriptBlockHandler handler, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
|
|
|
|
|
if(handler.isClient())
|
|
|
|
|
return false;
|
|
|
|
|
BlockEvent.InteractEvent event = new BlockEvent.InteractEvent(handler.getBlock(), player, side, hitX, hitY, hitZ);
|
|
|
|
|
handler.callScript(EnumScriptType.INTERACT, event);
|
|
|
|
|
return NpcAPI.EVENT_BUS.post(event);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static void onScriptBlockCollide(IScriptBlockHandler handler, Entity entityIn) {
|
|
|
|
|
if(handler.isClient())
|
|
|
|
|
return;
|
|
|
|
|
BlockEvent.CollidedEvent event = new BlockEvent.CollidedEvent(handler.getBlock(), entityIn);
|
|
|
|
|
handler.callScript(EnumScriptType.COLLIDE, event);
|
|
|
|
|
NpcAPI.EVENT_BUS.post(event);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static void onScriptBlockRainFill(IScriptBlockHandler handler) {
|
|
|
|
|
if(handler.isClient())
|
|
|
|
|
return;
|
|
|
|
|
BlockEvent.RainFillEvent event = new BlockEvent.RainFillEvent(handler.getBlock());
|
|
|
|
|
handler.callScript(EnumScriptType.RAIN_FILLED, event);
|
|
|
|
|
NpcAPI.EVENT_BUS.post(event);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static float onScriptBlockFallenUpon(IScriptBlockHandler handler, Entity entity, float distance) {
|
|
|
|
|
if(handler.isClient())
|
|
|
|
|
return distance;
|
|
|
|
|
BlockEvent.EntityFallenUponEvent event = new BlockEvent.EntityFallenUponEvent(handler.getBlock(), entity, distance);
|
|
|
|
|
handler.callScript(EnumScriptType.FALLEN_UPON, event);
|
|
|
|
|
if(NpcAPI.EVENT_BUS.post(event))
|
|
|
|
|
return 0;
|
|
|
|
|
return event.distanceFallen;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static void onScriptBlockClicked(IScriptBlockHandler handler, EntityPlayer player) {
|
|
|
|
|
if(handler.isClient())
|
|
|
|
|
return;
|
|
|
|
|
BlockEvent.ClickedEvent event = new BlockEvent.ClickedEvent(handler.getBlock(), player);
|
|
|
|
|
handler.callScript(EnumScriptType.CLICKED, event);
|
|
|
|
|
NpcAPI.EVENT_BUS.post(event);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static void onScriptBlockBreak(IScriptBlockHandler handler) {
|
|
|
|
|
if(handler.isClient())
|
|
|
|
|
return;
|
|
|
|
|
BlockEvent.BreakEvent event = new BlockEvent.BreakEvent(handler.getBlock());
|
|
|
|
|
handler.callScript(EnumScriptType.BROKEN, event);
|
|
|
|
|
NpcAPI.EVENT_BUS.post(event);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static boolean onScriptBlockHarvest(IScriptBlockHandler handler, EntityPlayer player) {
|
|
|
|
|
if(handler.isClient())
|
|
|
|
|
return false;
|
|
|
|
|
BlockEvent.HarvestedEvent event = new BlockEvent.HarvestedEvent(handler.getBlock(), player);
|
|
|
|
|
handler.callScript(EnumScriptType.HARVESTED, event);
|
|
|
|
|
return NpcAPI.EVENT_BUS.post(event);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static boolean onScriptBlockExploded(IScriptBlockHandler handler) {
|
|
|
|
|
if(handler.isClient())
|
|
|
|
|
return false;
|
|
|
|
|
BlockEvent.ExplodedEvent event = new BlockEvent.ExplodedEvent(handler.getBlock());
|
|
|
|
|
handler.callScript(EnumScriptType.EXPLODED, event);
|
|
|
|
|
return NpcAPI.EVENT_BUS.post(event);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static void onScriptBlockNeighborChanged(IScriptBlockHandler handler, int x, int y, int z) {
|
|
|
|
|
if(handler.isClient())
|
|
|
|
|
return;
|
|
|
|
|
BlockEvent.NeighborChangedEvent event = new BlockEvent.NeighborChangedEvent(handler.getBlock(), NpcAPI.Instance().getIPos(x,y,z));
|
|
|
|
|
handler.callScript(EnumScriptType.NEIGHBOR_CHANGED, event);
|
|
|
|
|
NpcAPI.EVENT_BUS.post(event);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static void onScriptBlockRedstonePower(IScriptBlockHandler handler, int prevPower, int power) {
|
|
|
|
|
if(handler.isClient())
|
|
|
|
|
return;
|
|
|
|
|
BlockEvent.RedstoneEvent event = new BlockEvent.RedstoneEvent(handler.getBlock(), prevPower, power);
|
|
|
|
|
handler.callScript(EnumScriptType.REDSTONE, event);
|
|
|
|
|
NpcAPI.EVENT_BUS.post(event);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static void onScriptBlockInit(IScriptBlockHandler handler) {
|
|
|
|
|
if(handler.isClient())
|
|
|
|
|
return;
|
|
|
|
|
BlockEvent.InitEvent event = new BlockEvent.InitEvent(handler.getBlock());
|
|
|
|
|
handler.callScript(EnumScriptType.INIT, event);
|
|
|
|
|
NpcAPI.EVENT_BUS.post(event);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static void onScriptBlockUpdate(IScriptBlockHandler handler) {
|
|
|
|
|
if(handler.isClient())
|
|
|
|
|
return;
|
|
|
|
|
BlockEvent.UpdateEvent event = new BlockEvent.UpdateEvent(handler.getBlock());
|
|
|
|
|
handler.callScript(EnumScriptType.TICK, event);
|
|
|
|
|
NpcAPI.EVENT_BUS.post(event);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static void onScriptBlockTimer(IScriptBlockHandler handler, int id) {
|
|
|
|
|
BlockEvent.TimerEvent event = new BlockEvent.TimerEvent(handler.getBlock(), id);
|
|
|
|
|
handler.callScript(EnumScriptType.TIMER, event);
|
|
|
|
|
NpcAPI.EVENT_BUS.post(event);
|
|
|
|
|
}
|
2024-03-06 05:05:16 -05:00
|
|
|
|
|
|
|
|
public static void onPartyFinished(Party party, Quest quest){
|
|
|
|
|
PlayerDataScript handler = ScriptController.Instance.playerScripts;
|
|
|
|
|
PartyEvent.PartyQuestCompletedEvent event = new PartyEvent.PartyQuestCompletedEvent(party, quest);
|
|
|
|
|
handler.callScript(EnumScriptType.PARTY_QUEST_COMPLETED, event);
|
|
|
|
|
NpcAPI.EVENT_BUS.post(event);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static void onPartyQuestSet(PartyEvent.PartyQuestSetEvent event){
|
|
|
|
|
PlayerDataScript handler = ScriptController.Instance.playerScripts;
|
|
|
|
|
handler.callScript(EnumScriptType.PARTY_QUEST_SET, event);
|
|
|
|
|
NpcAPI.EVENT_BUS.post(event);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static void onPartyTurnIn(PartyEvent.PartyQuestTurnedInEvent event){
|
|
|
|
|
PlayerDataScript handler = ScriptController.Instance.playerScripts;
|
|
|
|
|
handler.callScript(EnumScriptType.PARTY_QUEST_TURNED_IN, event);
|
|
|
|
|
NpcAPI.EVENT_BUS.post(event);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static void onPartyInvite(PartyEvent.PartyInviteEvent event){
|
|
|
|
|
PlayerDataScript handler = ScriptController.Instance.playerScripts;
|
|
|
|
|
handler.callScript(EnumScriptType.PARTY_INVITE, event);
|
|
|
|
|
NpcAPI.EVENT_BUS.post(event);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static void onPartyKick(PartyEvent.PartyKickEvent event){
|
|
|
|
|
PlayerDataScript handler = ScriptController.Instance.playerScripts;
|
|
|
|
|
handler.callScript(EnumScriptType.PARTY_KICK, event);
|
|
|
|
|
NpcAPI.EVENT_BUS.post(event);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static void onPartyLeave(PartyEvent.PartyLeaveEvent event){
|
|
|
|
|
PlayerDataScript handler = ScriptController.Instance.playerScripts;
|
|
|
|
|
handler.callScript(EnumScriptType.PARTY_LEAVE, event);
|
|
|
|
|
NpcAPI.EVENT_BUS.post(event);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static void onPartyDisband(PartyEvent.PartyDisbandEvent event){
|
|
|
|
|
PlayerDataScript handler = ScriptController.Instance.playerScripts;
|
|
|
|
|
handler.callScript(EnumScriptType.PARTY_DISBAND, event);
|
|
|
|
|
NpcAPI.EVENT_BUS.post(event);
|
|
|
|
|
}
|
2024-02-15 17:54:28 -05:00
|
|
|
}
|