mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-17 07:35:11 +00:00
Implemented custom item rotation rate, and start using, using, stop using, finished using events for custom items.
This commit is contained in:
1 parent
11cc46b48f
commit
aab550cdca
7 files changed
+212
-36
No files matched your search
@@ -36,10 +36,7 @@ import noppes.npcs.scripted.event.PlayerEvent.LoginEvent;
|
||||
import noppes.npcs.scripted.event.PlayerEvent.LogoutEvent;
|
||||
import noppes.npcs.scripted.event.PlayerEvent.PickUpEvent;
|
||||
import noppes.npcs.scripted.event.PlayerEvent.DropEvent;
|
||||
import noppes.npcs.scripted.interfaces.ICustomGui;
|
||||
import noppes.npcs.scripted.interfaces.IEntity;
|
||||
import noppes.npcs.scripted.interfaces.IItemStack;
|
||||
import noppes.npcs.scripted.interfaces.IWorld;
|
||||
import noppes.npcs.scripted.interfaces.*;
|
||||
import noppes.npcs.scripted.item.ScriptCustomItem;
|
||||
import noppes.npcs.scripted.item.ScriptItemStack;
|
||||
import noppes.npcs.scripted.wrapper.WrapperNpcAPI;
|
||||
@@ -96,6 +93,30 @@ public class EventHooks {
|
||||
return WrapperNpcAPI.EVENT_BUS.post(event);
|
||||
}
|
||||
|
||||
public static boolean onStartUsingCustomItem(ScriptCustomItem handler, IPlayer player, int duration) {
|
||||
ItemEvent.StartUsingItem event = new ItemEvent.StartUsingItem(handler, player, duration);
|
||||
handler.callScript(EnumScriptType.START_USING_ITEM, event);
|
||||
return WrapperNpcAPI.EVENT_BUS.post(event);
|
||||
}
|
||||
|
||||
public static boolean onUsingCustomItem(ScriptCustomItem handler, IPlayer player, int duration) {
|
||||
ItemEvent.UsingItem event = new ItemEvent.UsingItem(handler, player, duration);
|
||||
handler.callScript(EnumScriptType.USING_ITEM, event);
|
||||
return WrapperNpcAPI.EVENT_BUS.post(event);
|
||||
}
|
||||
|
||||
public static boolean onStopUsingCustomItem(ScriptCustomItem handler, IPlayer player, int duration) {
|
||||
ItemEvent.StopUsingItem event = new ItemEvent.StopUsingItem(handler, player, duration);
|
||||
handler.callScript(EnumScriptType.STOP_USING_ITEM, event);
|
||||
return WrapperNpcAPI.EVENT_BUS.post(event);
|
||||
}
|
||||
|
||||
public static boolean onFinishUsingCustomItem(ScriptCustomItem handler, IPlayer player, int duration) {
|
||||
ItemEvent.FinishUsingItem event = new ItemEvent.FinishUsingItem(handler, player, duration);
|
||||
handler.callScript(EnumScriptType.FINISH_USING_ITEM, event);
|
||||
return WrapperNpcAPI.EVENT_BUS.post(event);
|
||||
}
|
||||
|
||||
public static void onNPCInit(EntityNPCInterface npc) {
|
||||
if(npc == null || npc.wrappedNPC == null)
|
||||
return;
|
||||
|
||||
Reference in new issue
Block a user