mirror of
https://github.com/KAMKEEL/CustomNPC-Plus-API.git
synced 2026-11-25 05:14:34 +00:00
A lot of GOOD API DOCUMENTATION
This commit is contained in:
1 parent
a6c55ca331
commit
319e774518
131 files changed
+3363
-175
No files matched your search
@@ -15,26 +15,31 @@ public interface IAbilityEvent extends INpcEvent {
|
||||
|
||||
/**
|
||||
* Get the entity executing the ability (NPC or Player).
|
||||
* @return the entity executing the ability
|
||||
*/
|
||||
IEntityLivingBase getEntity();
|
||||
|
||||
/**
|
||||
* Get the player executing the ability, or null if the caster is an NPC.
|
||||
* @return the player executing the ability, or null if NPC
|
||||
*/
|
||||
IPlayer getPlayer();
|
||||
|
||||
/**
|
||||
* Whether the entity executing the ability is an NPC.
|
||||
* @return true if the executor is an NPC
|
||||
*/
|
||||
boolean isNPC();
|
||||
|
||||
/**
|
||||
* Get the ability involved in this event.
|
||||
* @return the ability being executed
|
||||
*/
|
||||
IAbility getAbility();
|
||||
|
||||
/**
|
||||
* Get the target of the ability, or null if no target.
|
||||
* @return the current target entity
|
||||
*/
|
||||
IEntityLivingBase getTarget();
|
||||
|
||||
@@ -60,11 +65,13 @@ public interface IAbilityEvent extends INpcEvent {
|
||||
interface InterruptEvent extends IAbilityEvent {
|
||||
/**
|
||||
* Get the damage source that caused the interruption.
|
||||
* @return the damage source
|
||||
*/
|
||||
IDamageSource getDamageSource();
|
||||
|
||||
/**
|
||||
* Get the amount of damage that caused the interruption.
|
||||
* @return the final damage dealt
|
||||
*/
|
||||
float getDamage();
|
||||
}
|
||||
@@ -105,36 +112,43 @@ public interface IAbilityEvent extends INpcEvent {
|
||||
interface HitEvent extends IAbilityEvent {
|
||||
/**
|
||||
* Get the entity that was hit by the ability.
|
||||
* @return the entity that was hit
|
||||
*/
|
||||
IEntityLivingBase getHitEntity();
|
||||
|
||||
/**
|
||||
* Get the damage amount.
|
||||
* @return the damage amount
|
||||
*/
|
||||
float getDamage();
|
||||
|
||||
/**
|
||||
* Set the damage amount. Allows scripts to modify damage.
|
||||
* @param damage the new damage amount
|
||||
*/
|
||||
void setDamage(float damage);
|
||||
|
||||
/**
|
||||
* Get the horizontal knockback amount.
|
||||
* @return the knockback strength
|
||||
*/
|
||||
float getKnockback();
|
||||
|
||||
/**
|
||||
* Set the horizontal knockback amount.
|
||||
* @param knockback the new knockback strength
|
||||
*/
|
||||
void setKnockback(float knockback);
|
||||
|
||||
/**
|
||||
* Get the vertical knockback (upward force) amount.
|
||||
* @return the upward knockback component
|
||||
*/
|
||||
float getKnockbackUp();
|
||||
|
||||
/**
|
||||
* Set the vertical knockback (upward force) amount.
|
||||
* @param knockbackUp the new upward knockback component
|
||||
*/
|
||||
void setKnockbackUp(float knockbackUp);
|
||||
}
|
||||
@@ -147,11 +161,13 @@ public interface IAbilityEvent extends INpcEvent {
|
||||
/**
|
||||
* Get the current phase of the ability.
|
||||
* 0 = IDLE, 1 = WINDUP, 2 = ACTIVE, 3 = DAZED, 4 = BURST_DELAY
|
||||
* @return the current ability phase (0=IDLE, 1=WINDUP, 2=ACTIVE, 3=DAZED, 4=BURST_DELAY)
|
||||
*/
|
||||
int getAbilityPhase();
|
||||
|
||||
/**
|
||||
* Get the current tick count within the phase.
|
||||
* @return the current tick within the phase
|
||||
*/
|
||||
int getTick();
|
||||
}
|
||||
|
||||
@@ -6,15 +6,22 @@ import noppes.npcs.api.handler.data.IAnimation;
|
||||
import noppes.npcs.api.handler.data.IAnimationData;
|
||||
import noppes.npcs.api.handler.data.IFrame;
|
||||
|
||||
/**
|
||||
* Events fired during entity animation playback.
|
||||
*/
|
||||
public interface IAnimationEvent extends ICustomNPCsEvent {
|
||||
|
||||
/** @return the animation being played. */
|
||||
IAnimation getAnimation();
|
||||
|
||||
/** @return the animation data managing the playback. */
|
||||
IAnimationData getAnimationData();
|
||||
|
||||
/** @return the animatable entity playing the animation. */
|
||||
IAnimatable getEntity();
|
||||
|
||||
/**
|
||||
* Fired when an animation starts playing. Cancelable.
|
||||
* @hookName animationStart
|
||||
*/
|
||||
@Cancelable
|
||||
@@ -23,16 +30,20 @@ public interface IAnimationEvent extends ICustomNPCsEvent {
|
||||
}
|
||||
|
||||
/**
|
||||
* Fired when an animation finishes playing.
|
||||
* @hookName animationEnd
|
||||
*/
|
||||
interface Ended extends IAnimationEvent {
|
||||
|
||||
}
|
||||
|
||||
/** Events fired when animation frames are entered or exited. */
|
||||
interface IFrameEvent extends IAnimationEvent {
|
||||
|
||||
/** @return the frame index. */
|
||||
int getIndex();
|
||||
|
||||
/** @return the frame data. */
|
||||
IFrame getFrame();
|
||||
|
||||
/**
|
||||
|
||||
@@ -6,7 +6,11 @@ import noppes.npcs.api.IPos;
|
||||
import noppes.npcs.api.entity.IEntity;
|
||||
import noppes.npcs.api.entity.IPlayer;
|
||||
|
||||
/**
|
||||
* Events fired for scripted blocks, including interactions, redstone, and entity collisions.
|
||||
*/
|
||||
public interface IBlockEvent extends ICustomNPCsEvent {
|
||||
/** @return the scripted block associated with this event. */
|
||||
IBlock getBlock();
|
||||
|
||||
/**
|
||||
|
||||
@@ -15,36 +15,43 @@ public interface IChainEvent extends ICustomNPCsEvent {
|
||||
|
||||
/**
|
||||
* Get the entity executing the chain (NPC or Player).
|
||||
* @return the entity executing the chain
|
||||
*/
|
||||
IEntityLivingBase getEntity();
|
||||
|
||||
/**
|
||||
* Get the player executing the chain, or null if the caster is an NPC.
|
||||
* @return the player executing the chain, or null if NPC
|
||||
*/
|
||||
IPlayer getPlayer();
|
||||
|
||||
/**
|
||||
* Get the NPC executing the chain, or null if the caster is a player.
|
||||
* @return the NPC executing the chain, or null if player
|
||||
*/
|
||||
ICustomNpc<?> getNpc();
|
||||
|
||||
/**
|
||||
* Whether the entity executing the chain is an NPC.
|
||||
* @return true if the executor is an NPC
|
||||
*/
|
||||
boolean isNPC();
|
||||
|
||||
/**
|
||||
* Get the chained ability being executed.
|
||||
* @return the chained ability being executed
|
||||
*/
|
||||
IChainedAbility getChain();
|
||||
|
||||
/**
|
||||
* Get the target of the chain, or null if no target.
|
||||
* @return the current target entity
|
||||
*/
|
||||
IEntityLivingBase getTarget();
|
||||
|
||||
/**
|
||||
* Get the current entry index within the chain (0-based).
|
||||
* @return the current entry index in the chain
|
||||
*/
|
||||
int getEntryIndex();
|
||||
|
||||
@@ -69,11 +76,13 @@ public interface IChainEvent extends ICustomNPCsEvent {
|
||||
interface InterruptEvent extends IChainEvent {
|
||||
/**
|
||||
* Get the damage source that caused the interruption.
|
||||
* @return the damage source used for this hit
|
||||
*/
|
||||
IDamageSource getDamageSource();
|
||||
|
||||
/**
|
||||
* Get the amount of damage that caused the interruption.
|
||||
* @return the damage amount
|
||||
*/
|
||||
float getDamage();
|
||||
}
|
||||
|
||||
@@ -4,10 +4,15 @@ import cpw.mods.fml.common.eventhandler.Cancelable;
|
||||
import noppes.npcs.api.gui.ICustomGui;
|
||||
import noppes.npcs.api.item.IItemStack;
|
||||
|
||||
/**
|
||||
* Events fired when a player interacts with a custom GUI.
|
||||
*/
|
||||
public interface ICustomGuiEvent extends IPlayerEvent {
|
||||
|
||||
/** @return the custom GUI associated with this event. */
|
||||
ICustomGui getGui();
|
||||
|
||||
/** @return the component ID that triggered this event. */
|
||||
int getId();
|
||||
|
||||
/**
|
||||
|
||||
@@ -5,8 +5,12 @@ import noppes.npcs.api.IPos;
|
||||
import noppes.npcs.api.IWorld;
|
||||
import noppes.npcs.api.handler.data.INaturalSpawn;
|
||||
|
||||
/**
|
||||
* Base interface for all CustomNPC+ script events.
|
||||
*/
|
||||
public interface ICustomNPCsEvent {
|
||||
|
||||
/** @return the script hook name that triggered this event. */
|
||||
String getHookName();
|
||||
|
||||
/**
|
||||
|
||||
@@ -3,23 +3,38 @@ package noppes.npcs.api.event;
|
||||
import cpw.mods.fml.common.eventhandler.Cancelable;
|
||||
import noppes.npcs.api.handler.data.IDialog;
|
||||
|
||||
/**
|
||||
* Events fired during dialog interactions between a player and an NPC.
|
||||
*/
|
||||
public interface IDialogEvent extends IPlayerEvent {
|
||||
|
||||
/** @return the dialog associated with this event. */
|
||||
IDialog getDialog();
|
||||
|
||||
/** @return the dialog's unique ID. */
|
||||
int getDialogId();
|
||||
|
||||
/** @return the selected dialog option ID. */
|
||||
int getOptionId();
|
||||
|
||||
/**
|
||||
* Fired when a dialog is opened. Cancelable.
|
||||
* @hookName dialogOpen
|
||||
*/
|
||||
@Cancelable
|
||||
interface DialogOpen extends IDialogEvent {
|
||||
}
|
||||
|
||||
/**
|
||||
* Fired when a dialog option is selected. Cancelable.
|
||||
* @hookName dialogOption
|
||||
*/
|
||||
@Cancelable
|
||||
interface DialogOption extends IDialogEvent {
|
||||
}
|
||||
|
||||
/**
|
||||
* Fired when a dialog is closed.
|
||||
* @hookName dialogClose
|
||||
*/
|
||||
interface DialogClosed extends IDialogEvent {
|
||||
|
||||
@@ -4,36 +4,48 @@ import noppes.npcs.api.entity.IEnergyBarrier;
|
||||
import noppes.npcs.api.entity.IEnergyProjectile;
|
||||
import noppes.npcs.api.entity.IEntity;
|
||||
|
||||
/**
|
||||
* Events fired during energy barrier lifecycle and interactions.
|
||||
*/
|
||||
public interface IEnergyBarrierEvent extends ICustomNPCsEvent {
|
||||
|
||||
/** @return the energy barrier entity. */
|
||||
IEnergyBarrier getBarrier();
|
||||
|
||||
/** @return the entity that owns this barrier. */
|
||||
IEntity getOwner();
|
||||
|
||||
/**
|
||||
* Fired when an energy barrier is spawned.
|
||||
* @hookName energyBarrierSpawned
|
||||
*/
|
||||
interface SpawnedEvent extends IEnergyBarrierEvent {
|
||||
}
|
||||
|
||||
/**
|
||||
* Fired each tick while the barrier exists.
|
||||
* @hookName energyBarrierTick
|
||||
*/
|
||||
interface UpdateEvent extends IEnergyBarrierEvent {
|
||||
}
|
||||
|
||||
/**
|
||||
* Fired when the barrier is hit by an energy projectile.
|
||||
* @hookName energyBarrierHit
|
||||
*/
|
||||
interface HitEvent extends IEnergyBarrierEvent {
|
||||
/** @return the projectile that hit the barrier. */
|
||||
IEnergyProjectile getProjectile();
|
||||
|
||||
/** @return the damage dealt. */
|
||||
float getDamage();
|
||||
|
||||
/** @param damage the new damage value. */
|
||||
void setDamage(float damage);
|
||||
}
|
||||
|
||||
/**
|
||||
* Fired when the barrier is destroyed.
|
||||
* @hookName energyBarrierDestroyed
|
||||
*/
|
||||
interface DestroyedEvent extends IEnergyBarrierEvent {
|
||||
|
||||
@@ -4,43 +4,57 @@ import noppes.npcs.api.IBlock;
|
||||
import noppes.npcs.api.entity.IEnergyProjectile;
|
||||
import noppes.npcs.api.entity.IEntity;
|
||||
|
||||
/**
|
||||
* Events fired during energy projectile lifecycle and impacts.
|
||||
*/
|
||||
public interface IEnergyProjectileEvent extends ICustomNPCsEvent {
|
||||
|
||||
/** @return the energy projectile entity. */
|
||||
IEnergyProjectile getProjectile();
|
||||
|
||||
/** @return the entity that fired this projectile. */
|
||||
IEntity getOwner();
|
||||
|
||||
/**
|
||||
* Fired when an energy projectile is launched.
|
||||
* @hookName energyProjectileFired
|
||||
*/
|
||||
interface FiredEvent extends IEnergyProjectileEvent {
|
||||
}
|
||||
|
||||
/**
|
||||
* Fired each tick while the projectile exists.
|
||||
* @hookName energyProjectileTick
|
||||
*/
|
||||
interface UpdateEvent extends IEnergyProjectileEvent {
|
||||
}
|
||||
|
||||
/**
|
||||
* Fired when the projectile hits an entity.
|
||||
* @hookName energyProjectileEntityImpact
|
||||
*/
|
||||
interface EntityImpactEvent extends IEnergyProjectileEvent {
|
||||
/** @return the entity that was hit. */
|
||||
IEntity getTarget();
|
||||
|
||||
/** @return the damage dealt. */
|
||||
float getDamage();
|
||||
|
||||
/** @param damage the new damage value. */
|
||||
void setDamage(float damage);
|
||||
}
|
||||
|
||||
/**
|
||||
* Fired when the projectile hits a block.
|
||||
* @hookName energyProjectileBlockImpact
|
||||
*/
|
||||
interface BlockImpactEvent extends IEnergyProjectileEvent {
|
||||
/** @return the block that was hit. */
|
||||
IBlock getBlock();
|
||||
}
|
||||
|
||||
/**
|
||||
* Fired when the projectile expires without hitting anything.
|
||||
* @hookName energyProjectileExpired
|
||||
*/
|
||||
interface ExpiredEvent extends IEnergyProjectileEvent {
|
||||
|
||||
@@ -3,14 +3,24 @@ package noppes.npcs.api.event;
|
||||
import cpw.mods.fml.common.eventhandler.Cancelable;
|
||||
import noppes.npcs.api.handler.data.IFaction;
|
||||
|
||||
/**
|
||||
* Events fired when a player's faction standing changes.
|
||||
*/
|
||||
public interface IFactionEvent extends IPlayerEvent {
|
||||
|
||||
/** @return the faction involved in this event. */
|
||||
IFaction getFaction();
|
||||
|
||||
/**
|
||||
* Fired when a player's faction points change. Cancelable.
|
||||
* @hookName factionPoints
|
||||
*/
|
||||
@Cancelable
|
||||
interface FactionPoints extends IFactionEvent {
|
||||
/** @return true if the points decreased, false if increased. */
|
||||
boolean decreased();
|
||||
|
||||
/** @return the amount of points changed. */
|
||||
int getPoints();
|
||||
}
|
||||
}
|
||||
@@ -4,25 +4,34 @@ import cpw.mods.fml.common.eventhandler.Event;
|
||||
import noppes.npcs.api.IWorld;
|
||||
import noppes.npcs.api.entity.IEntity;
|
||||
|
||||
/**
|
||||
* Wrapper events for Forge events, allowing scripts to listen for native Forge events.
|
||||
*/
|
||||
public interface IForgeEvent extends ICustomNPCsEvent {
|
||||
|
||||
/** @return the underlying Forge event. */
|
||||
Event getEvent();
|
||||
|
||||
/**
|
||||
* Fired for Forge world events.
|
||||
* @hookName forgeWorld
|
||||
*/
|
||||
interface WorldEvent extends IForgeEvent {
|
||||
/** @return the world associated with this event. */
|
||||
IWorld getWorld();
|
||||
}
|
||||
|
||||
/**
|
||||
* Fired for Forge entity events.
|
||||
* @hookName forgeEntity
|
||||
*/
|
||||
interface EntityEvent extends IForgeEvent {
|
||||
/** @return the entity associated with this event. */
|
||||
IEntity getEntity();
|
||||
}
|
||||
|
||||
/**
|
||||
* Fired during Forge initialization.
|
||||
* @hookName forgeInit
|
||||
*/
|
||||
interface InitEvent extends IForgeEvent {
|
||||
|
||||
@@ -6,113 +6,185 @@ import noppes.npcs.api.entity.IPlayer;
|
||||
import noppes.npcs.api.item.IItemCustomizable;
|
||||
import noppes.npcs.api.item.IItemStack;
|
||||
|
||||
/**
|
||||
* Events fired for scripted/customizable items during their lifecycle and interactions.
|
||||
*/
|
||||
public interface IItemEvent extends ICustomNPCsEvent {
|
||||
|
||||
/** @return the customizable item associated with this event. */
|
||||
IItemCustomizable getItem();
|
||||
|
||||
/**
|
||||
* Fired when the item is initialized.
|
||||
* @hookName init
|
||||
*/
|
||||
interface InitEvent extends IItemEvent {
|
||||
}
|
||||
|
||||
/**
|
||||
* Fired each tick while the item exists in an entity's inventory.
|
||||
* @hookName tick
|
||||
*/
|
||||
interface UpdateEvent extends IItemEvent {
|
||||
/** @return the entity holding the item. */
|
||||
IEntity getEntity();
|
||||
}
|
||||
|
||||
/**
|
||||
* Fired when the item is tossed/dropped. Cancelable.
|
||||
* @hookName tossed
|
||||
*/
|
||||
@Cancelable
|
||||
interface TossedEvent extends IItemEvent {
|
||||
/** @return the dropped item entity. */
|
||||
IEntity getEntity();
|
||||
|
||||
/** @return the player who dropped the item. */
|
||||
IPlayer getPlayer();
|
||||
}
|
||||
|
||||
/**
|
||||
* Fired when the item is picked up.
|
||||
* @hookName pickedUp
|
||||
*/
|
||||
interface PickedUpEvent extends IItemEvent {
|
||||
/** @return the player who picked up the item. */
|
||||
IPlayer getPlayer();
|
||||
}
|
||||
|
||||
/**
|
||||
* Fired when the item entity spawns in the world. Cancelable.
|
||||
* @hookName spawn
|
||||
*/
|
||||
@Cancelable
|
||||
interface SpawnEvent extends IItemEvent {
|
||||
/** @return the spawned item entity. */
|
||||
IEntity getEntity();
|
||||
}
|
||||
|
||||
/**
|
||||
* Fired when the item is used to interact with an entity. Cancelable.
|
||||
* @hookName interact
|
||||
*/
|
||||
@Cancelable
|
||||
interface InteractEvent extends IItemEvent {
|
||||
/** @return the interaction type. */
|
||||
int getType();
|
||||
|
||||
/** @return the target entity. */
|
||||
IEntity getTarget();
|
||||
|
||||
/** @return the player performing the interaction. */
|
||||
IPlayer getPlayer();
|
||||
}
|
||||
|
||||
/**
|
||||
* Fired when the item is right-clicked. Cancelable.
|
||||
* @hookName rightClick
|
||||
*/
|
||||
@Cancelable
|
||||
interface RightClickEvent extends IItemEvent {
|
||||
/** @return the click type. */
|
||||
int getType();
|
||||
|
||||
/** @return the target (entity or block). */
|
||||
Object getTarget();
|
||||
|
||||
/** @return the player who right-clicked. */
|
||||
IPlayer getPlayer();
|
||||
}
|
||||
|
||||
/**
|
||||
* Fired when the item is used to attack an entity. Cancelable.
|
||||
* @hookName attack
|
||||
*/
|
||||
@Cancelable
|
||||
interface AttackEvent extends IItemEvent {
|
||||
/** @return the attack type. */
|
||||
int getType();
|
||||
|
||||
/** @return the entity being attacked. */
|
||||
IEntity getTarget();
|
||||
|
||||
/** @return the entity swinging the item. */
|
||||
IEntity getSwingingEntity();
|
||||
}
|
||||
|
||||
/**
|
||||
* Fired when the player starts using the item (e.g., drawing a bow).
|
||||
* @hookName startItem
|
||||
*/
|
||||
interface StartUsingItem extends IItemEvent {
|
||||
/** @return the player using the item. */
|
||||
IPlayer getPlayer();
|
||||
|
||||
int getDuration();
|
||||
}
|
||||
|
||||
interface UsingItem extends IItemEvent {
|
||||
IPlayer getPlayer();
|
||||
|
||||
/** @return the use duration in ticks. */
|
||||
int getDuration();
|
||||
}
|
||||
|
||||
/**
|
||||
* Fired each tick while the player is using the item.
|
||||
* @hookName usingItem
|
||||
*/
|
||||
interface UsingItem extends IItemEvent {
|
||||
/** @return the player using the item. */
|
||||
IPlayer getPlayer();
|
||||
|
||||
/** @return the remaining use duration in ticks. */
|
||||
int getDuration();
|
||||
}
|
||||
|
||||
/**
|
||||
* Fired when the player stops using the item before completion.
|
||||
* @hookName stopItem
|
||||
*/
|
||||
interface StopUsingItem extends IItemEvent {
|
||||
/** @return the player who stopped using the item. */
|
||||
IPlayer getPlayer();
|
||||
|
||||
/** @return the remaining use duration in ticks. */
|
||||
int getDuration();
|
||||
}
|
||||
|
||||
/**
|
||||
* Fired when the player finishes using the item (full duration).
|
||||
* @hookName finishItem
|
||||
*/
|
||||
interface FinishUsingItem extends IItemEvent {
|
||||
/** @return the player who finished using the item. */
|
||||
IPlayer getPlayer();
|
||||
|
||||
/** @return the total use duration in ticks. */
|
||||
int getDuration();
|
||||
}
|
||||
|
||||
// onBreakEvent if Durability Expires or Consumed
|
||||
/**
|
||||
* Fired when the item breaks due to durability loss or consumption.
|
||||
* @hookName breakItem
|
||||
*/
|
||||
interface BreakItem extends IItemEvent {
|
||||
|
||||
/** @return the item stack that broke. */
|
||||
IItemStack getBrokenStack();
|
||||
|
||||
/** @return the player whose item broke. */
|
||||
IPlayer getPlayer();
|
||||
}
|
||||
|
||||
// onRepairEvent
|
||||
/**
|
||||
* Fired when the item is repaired on an anvil.
|
||||
* @hookName repairItem
|
||||
*/
|
||||
interface RepairItem extends IItemEvent {
|
||||
|
||||
/** @return the left input item. */
|
||||
IItemStack getLeft();
|
||||
|
||||
/** @return the right input item (repair material). */
|
||||
IItemStack getRight();
|
||||
|
||||
/** @return the resulting output item. */
|
||||
IItemStack getOutput();
|
||||
|
||||
/** @return the chance the anvil breaks after this repair. */
|
||||
float getAnvilBreakChance();
|
||||
}
|
||||
}
|
||||
@@ -1,18 +1,24 @@
|
||||
package noppes.npcs.api.event;
|
||||
|
||||
/**
|
||||
* Events fired for linked items when their version changes or when they are being built.
|
||||
*/
|
||||
public interface ILinkedItemEvent extends IItemEvent {
|
||||
|
||||
/**
|
||||
* Fired when the linked item's version changes.
|
||||
* @hookName versionChanged
|
||||
*/
|
||||
interface VersionChangeEvent extends IItemEvent {
|
||||
|
||||
/** @return the new version number. */
|
||||
int getVersion();
|
||||
|
||||
/** @return the previous version number. */
|
||||
int getPreviousVersion();
|
||||
}
|
||||
|
||||
/**
|
||||
* Fired when the linked item is being built/constructed.
|
||||
* @hookName buildingItem
|
||||
*/
|
||||
interface BuildEvent extends IItemEvent {
|
||||
|
||||
@@ -9,55 +9,94 @@ import noppes.npcs.api.entity.IPlayer;
|
||||
import noppes.npcs.api.handler.data.IDialog;
|
||||
import noppes.npcs.api.item.IItemStack;
|
||||
|
||||
/**
|
||||
* Events fired for CustomNPC entities during their lifecycle and interactions.
|
||||
*/
|
||||
public interface INpcEvent extends ICustomNPCsEvent {
|
||||
|
||||
/** @return the NPC associated with this event. */
|
||||
ICustomNpc getNpc();
|
||||
|
||||
/**
|
||||
* Fired when an NPC timer triggers.
|
||||
* @hookName timer
|
||||
*/
|
||||
interface TimerEvent extends INpcEvent {
|
||||
/** @return the timer ID. */
|
||||
int getId();
|
||||
}
|
||||
|
||||
/**
|
||||
* Fired when an entity collides with the NPC.
|
||||
* @hookName collide
|
||||
*/
|
||||
interface CollideEvent extends INpcEvent {
|
||||
/** @return the colliding entity. */
|
||||
IEntity getEntity();
|
||||
}
|
||||
|
||||
/**
|
||||
* Fired when the NPC takes damage. Cancelable.
|
||||
* @hookName damaged
|
||||
*/
|
||||
@Cancelable
|
||||
interface DamagedEvent extends INpcEvent {
|
||||
|
||||
/** @return the entity that caused the damage, or null. */
|
||||
IEntity getSource();
|
||||
|
||||
/** @return the damage source details. */
|
||||
IDamageSource getDamageSource();
|
||||
|
||||
/** @return the damage amount. */
|
||||
float getDamage();
|
||||
|
||||
/** @param damage the new damage amount. */
|
||||
void setDamage(float damage);
|
||||
|
||||
/** @param bo whether to clear the NPC's current target after damage. */
|
||||
void setClearTarget(boolean bo);
|
||||
|
||||
/** @return whether the NPC's target will be cleared after damage. */
|
||||
boolean getClearTarget();
|
||||
|
||||
/** @return the damage type string. */
|
||||
String getType();
|
||||
}
|
||||
|
||||
/**
|
||||
* Fired when the NPC launches a ranged attack. Cancelable.
|
||||
* @hookName rangedLaunched
|
||||
*/
|
||||
@Cancelable
|
||||
interface RangedLaunchedEvent extends INpcEvent {
|
||||
/** @return the target entity. */
|
||||
IEntityLivingBase getTarget();
|
||||
|
||||
/** @param damage the new ranged damage. */
|
||||
void setDamage(float damage);
|
||||
|
||||
float getDamage();
|
||||
}
|
||||
|
||||
@Cancelable
|
||||
interface MeleeAttackEvent extends INpcEvent {
|
||||
IEntityLivingBase getTarget();
|
||||
|
||||
void setDamage(float damage);
|
||||
|
||||
/** @return the ranged damage. */
|
||||
float getDamage();
|
||||
}
|
||||
|
||||
/**
|
||||
* Fired when the NPC performs a melee attack. Cancelable.
|
||||
* @hookName meleeAttack
|
||||
*/
|
||||
@Cancelable
|
||||
interface MeleeAttackEvent extends INpcEvent {
|
||||
/** @return the target entity. */
|
||||
IEntityLivingBase getTarget();
|
||||
|
||||
/** @param damage the new melee damage. */
|
||||
void setDamage(float damage);
|
||||
|
||||
/** @return the melee damage. */
|
||||
float getDamage();
|
||||
}
|
||||
|
||||
/**
|
||||
* Fired when the NPC swings its weapon.
|
||||
* @hookName meleeSwing
|
||||
*/
|
||||
interface SwingEvent extends INpcEvent {
|
||||
@@ -71,78 +110,126 @@ public interface INpcEvent extends ICustomNPCsEvent {
|
||||
}
|
||||
|
||||
/**
|
||||
* Fired when the NPC kills an entity.
|
||||
* @hookName kills
|
||||
*/
|
||||
interface KilledEntityEvent {
|
||||
/** @return the entity that was killed. */
|
||||
IEntityLivingBase getEntity();
|
||||
}
|
||||
|
||||
/**
|
||||
* Fired when the NPC dies. Cancelable.
|
||||
* @hookName killed
|
||||
*/
|
||||
@Cancelable
|
||||
interface DiedEvent extends INpcEvent {
|
||||
/** @return the entity that killed this NPC, or null. */
|
||||
IEntity getSource();
|
||||
|
||||
/** @return the damage source details. */
|
||||
IDamageSource getDamageSource();
|
||||
|
||||
/** @return the damage type string. */
|
||||
String getType();
|
||||
|
||||
/** @param droppedItems the items to drop on death. */
|
||||
void setDroppedItems(IItemStack[] droppedItems);
|
||||
|
||||
/** @return the items dropped on death. */
|
||||
IItemStack[] getDroppedItems();
|
||||
|
||||
/** @param expDropped the experience to drop on death. */
|
||||
void setExpDropped(int expDropped);
|
||||
|
||||
/** @return the experience dropped on death. */
|
||||
int getExpDropped();
|
||||
}
|
||||
|
||||
/**
|
||||
* Fired when a player interacts with the NPC. Cancelable.
|
||||
* @hookName interact
|
||||
*/
|
||||
@Cancelable
|
||||
interface InteractEvent extends INpcEvent {
|
||||
/** @return the interacting player. */
|
||||
IPlayer getPlayer();
|
||||
}
|
||||
|
||||
/**
|
||||
* Fired when a dialog opens with the NPC. Cancelable.
|
||||
* @hookName dialog
|
||||
*/
|
||||
@Cancelable
|
||||
interface DialogEvent extends INpcEvent {
|
||||
/** @return the interacting player. */
|
||||
IPlayer getPlayer();
|
||||
|
||||
/** @return the dialog. */
|
||||
IDialog getDialog();
|
||||
|
||||
/** @return the dialog ID. */
|
||||
int getDialogId();
|
||||
|
||||
/** @return the selected option ID. */
|
||||
int getOptionId();
|
||||
}
|
||||
|
||||
/**
|
||||
* Fired when a dialog with the NPC is closed.
|
||||
* @hookName dialogClosed
|
||||
*/
|
||||
interface DialogClosedEvent extends INpcEvent {
|
||||
/** @return the player who closed the dialog. */
|
||||
IPlayer getPlayer();
|
||||
|
||||
/** @return the dialog. */
|
||||
IDialog getDialog();
|
||||
|
||||
/** @return the dialog ID. */
|
||||
int getDialogId();
|
||||
|
||||
/** @return the selected option ID. */
|
||||
int getOptionId();
|
||||
}
|
||||
|
||||
/**
|
||||
* Fired when the NPC loses its current target. Cancelable.
|
||||
* @hookName targetLost
|
||||
*/
|
||||
@Cancelable
|
||||
interface TargetLostEvent extends INpcEvent {
|
||||
/** @return the target being lost. */
|
||||
IEntityLivingBase getTarget();
|
||||
|
||||
/** @return the new target, or null. */
|
||||
IEntityLivingBase getNewTarget();
|
||||
}
|
||||
|
||||
/**
|
||||
* Fired when the NPC acquires a new target. Cancelable.
|
||||
* @hookName target
|
||||
*/
|
||||
@Cancelable
|
||||
interface TargetEvent extends INpcEvent {
|
||||
/** @param entity the new target to set. */
|
||||
void setTarget(IEntityLivingBase entity);
|
||||
|
||||
/** @return the current target. */
|
||||
IEntityLivingBase getTarget();
|
||||
}
|
||||
|
||||
/**
|
||||
* Fired each tick for the NPC.
|
||||
* @hookName tick
|
||||
*/
|
||||
interface UpdateEvent extends INpcEvent {
|
||||
}
|
||||
|
||||
/**
|
||||
* Fired when the NPC is initialized.
|
||||
* @hookName init
|
||||
*/
|
||||
interface InitEvent extends INpcEvent {
|
||||
}
|
||||
}
|
||||
@@ -5,45 +5,82 @@ import noppes.npcs.api.entity.IPlayer;
|
||||
import noppes.npcs.api.handler.data.IParty;
|
||||
import noppes.npcs.api.handler.data.IQuest;
|
||||
|
||||
/**
|
||||
* Events fired during party operations such as quest progress, invitations, kicks, and disbanding.
|
||||
*/
|
||||
public interface IPartyEvent {
|
||||
|
||||
/** @return the party involved in this event. */
|
||||
IParty getParty();
|
||||
|
||||
/** @return the quest associated with this party event. */
|
||||
IQuest getQuest();
|
||||
|
||||
/**
|
||||
* Fired when a party quest is completed.
|
||||
* @hookName partyQuestCompleted
|
||||
*/
|
||||
interface PartyQuestCompletedEvent extends IPartyEvent {
|
||||
}
|
||||
|
||||
/**
|
||||
* Fired when a quest is assigned to the party. Cancelable.
|
||||
* @hookName partyQuestSet
|
||||
*/
|
||||
@Cancelable
|
||||
interface PartyQuestSetEvent extends IPartyEvent {
|
||||
}
|
||||
|
||||
/**
|
||||
* Fired when a party quest is turned in. Cancelable.
|
||||
* @hookName partyQuestTurnedIn
|
||||
*/
|
||||
@Cancelable
|
||||
interface PartyQuestTurnedInEvent extends IPartyEvent {
|
||||
}
|
||||
|
||||
/**
|
||||
* Fired when a player is invited to the party. Cancelable.
|
||||
* @hookName partyInvite
|
||||
*/
|
||||
@Cancelable
|
||||
interface PartyInviteEvent extends IPartyEvent {
|
||||
|
||||
/** @return the invited player. */
|
||||
IPlayer getPlayer();
|
||||
|
||||
/** @return the invited player's name. */
|
||||
String getPlayerName();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Fired when a player is kicked from the party. Cancelable.
|
||||
* @hookName partyKick
|
||||
*/
|
||||
@Cancelable
|
||||
interface PartyKickEvent extends IPartyEvent {
|
||||
/** @return the kicked player. */
|
||||
IPlayer getPlayer();
|
||||
|
||||
/** @return the kicked player's name. */
|
||||
String getPlayerName();
|
||||
}
|
||||
|
||||
/**
|
||||
* Fired when a player voluntarily leaves the party.
|
||||
* @hookName partyLeave
|
||||
*/
|
||||
interface PartyLeaveEvent extends IPartyEvent {
|
||||
/** @return the leaving player. */
|
||||
IPlayer getPlayer();
|
||||
|
||||
/** @return the leaving player's name. */
|
||||
String getPlayerName();
|
||||
}
|
||||
|
||||
/**
|
||||
* Fired when the party is disbanded.
|
||||
* @hookName partyDisband
|
||||
*/
|
||||
interface PartyDisbandEvent extends IPartyEvent {
|
||||
}
|
||||
}
|
||||
@@ -11,307 +11,537 @@ import noppes.npcs.api.handler.data.IPlayerEffect;
|
||||
import noppes.npcs.api.handler.data.IProfile;
|
||||
import noppes.npcs.api.item.IItemStack;
|
||||
|
||||
/**
|
||||
* Events fired for player actions including combat, items, movement, and interactions.
|
||||
*/
|
||||
public interface IPlayerEvent extends ICustomNPCsEvent {
|
||||
|
||||
/** @return the player associated with this event. */
|
||||
IPlayer getPlayer();
|
||||
|
||||
/**
|
||||
* Fired when the player sends a chat message. Cancelable.
|
||||
* @hookName chat
|
||||
*/
|
||||
@Cancelable
|
||||
interface ChatEvent extends IPlayerEvent {
|
||||
/** @param message the new chat message. */
|
||||
void setMessage(String message);
|
||||
|
||||
/** @return the chat message. */
|
||||
String getMessage();
|
||||
}
|
||||
|
||||
/**
|
||||
* Fired when the player presses or releases a key.
|
||||
* @hookName keyPressed
|
||||
*/
|
||||
interface KeyPressedEvent extends IPlayerEvent {
|
||||
/** @return the key code. */
|
||||
int getKey();
|
||||
|
||||
/** @return true if Ctrl is held. */
|
||||
boolean isCtrlPressed();
|
||||
|
||||
/** @return true if Alt is held. */
|
||||
boolean isAltPressed();
|
||||
|
||||
/** @return true if Shift is held. */
|
||||
boolean isShiftPressed();
|
||||
|
||||
/** @return true if Meta is held. */
|
||||
boolean isMetaPressed();
|
||||
|
||||
/** @return true if the key is being pressed down, false if released. */
|
||||
boolean keyDown();
|
||||
|
||||
/** @return array of currently held key codes. */
|
||||
int[] getKeysDown();
|
||||
}
|
||||
|
||||
/**
|
||||
* Fired when the player clicks a mouse button.
|
||||
* @hookName mouseClicked
|
||||
*/
|
||||
interface MouseClickedEvent extends IPlayerEvent {
|
||||
/** @return the mouse button index. */
|
||||
int getButton();
|
||||
|
||||
/** @return the mouse wheel scroll delta. */
|
||||
int getMouseWheel();
|
||||
|
||||
/** @return true if the button is being pressed down. */
|
||||
boolean buttonDown();
|
||||
|
||||
/** @return true if Ctrl is held. */
|
||||
boolean isCtrlPressed();
|
||||
|
||||
/** @return true if Alt is held. */
|
||||
boolean isAltPressed();
|
||||
|
||||
/** @return true if Shift is held. */
|
||||
boolean isShiftPressed();
|
||||
|
||||
/** @return true if Meta is held. */
|
||||
boolean isMetaPressed();
|
||||
|
||||
/** @return array of currently held key codes. */
|
||||
int[] getKeysDown();
|
||||
}
|
||||
|
||||
/**
|
||||
* Fired when the player picks up experience orbs.
|
||||
* @hookName pickupXP
|
||||
*/
|
||||
interface PickupXPEvent extends IPlayerEvent {
|
||||
/** @return the amount of XP picked up. */
|
||||
int getAmount();
|
||||
}
|
||||
|
||||
/**
|
||||
* Fired when the player levels up.
|
||||
* @hookName levelUp
|
||||
*/
|
||||
interface LevelUpEvent extends IPlayerEvent {
|
||||
/** @return the number of levels gained. */
|
||||
int getChange();
|
||||
}
|
||||
|
||||
/**
|
||||
* Fired when the player logs out.
|
||||
* @hookName logout
|
||||
*/
|
||||
interface LogoutEvent extends IPlayerEvent {
|
||||
}
|
||||
|
||||
/**
|
||||
* Fired when the player logs in.
|
||||
* @hookName login
|
||||
*/
|
||||
interface LoginEvent extends IPlayerEvent {
|
||||
}
|
||||
|
||||
/**
|
||||
* Fired when the player respawns after death.
|
||||
* @hookName respawn
|
||||
*/
|
||||
interface RespawnEvent extends IPlayerEvent {
|
||||
}
|
||||
|
||||
/**
|
||||
* Fired when the player changes dimensions.
|
||||
* @hookName changedDim
|
||||
*/
|
||||
interface ChangedDimension extends IPlayerEvent {
|
||||
/** @return the dimension ID the player came from. */
|
||||
int getFromDim();
|
||||
|
||||
/** @return the dimension ID the player traveled to. */
|
||||
int getToDim();
|
||||
}
|
||||
|
||||
/**
|
||||
* Fired when a player timer triggers.
|
||||
* @hookName timer
|
||||
*/
|
||||
interface TimerEvent extends IPlayerEvent {
|
||||
/** @return the timer ID. */
|
||||
int getId();
|
||||
}
|
||||
|
||||
/**
|
||||
* Fired when the player is attacked (before armor reduction). Cancelable.
|
||||
* @hookName attacked
|
||||
*/
|
||||
@Cancelable
|
||||
interface AttackedEvent extends IPlayerEvent {
|
||||
/** @return the damage source details. */
|
||||
IDamageSource getDamageSource();
|
||||
|
||||
/** @return the attacking entity, or null. */
|
||||
IEntity getSource();
|
||||
|
||||
/** @return the raw damage amount. */
|
||||
float getDamage();
|
||||
}
|
||||
|
||||
/**
|
||||
* Fired when the player takes damage (after armor reduction). Cancelable.
|
||||
* @hookName damaged
|
||||
*/
|
||||
@Cancelable
|
||||
interface DamagedEvent extends IPlayerEvent {
|
||||
/** @return the damage source details. */
|
||||
IDamageSource getDamageSource();
|
||||
|
||||
/** @return the damaging entity, or null. */
|
||||
IEntity getSource();
|
||||
|
||||
/** @return the damage amount after reduction. */
|
||||
float getDamage();
|
||||
}
|
||||
|
||||
/**
|
||||
* Fired when the player is about to be struck by lightning. Cancelable.
|
||||
* @hookName lightning
|
||||
*/
|
||||
@Cancelable
|
||||
interface LightningEvent extends IPlayerEvent {
|
||||
}
|
||||
|
||||
/**
|
||||
* Fired when a sound is played for the player. Cancelable.
|
||||
* @hookName playSound
|
||||
*/
|
||||
@Cancelable
|
||||
interface SoundEvent extends IPlayerEvent {
|
||||
/** @return the sound resource name. */
|
||||
String getName();
|
||||
|
||||
/** @return the sound pitch. */
|
||||
float getPitch();
|
||||
|
||||
/** @return the sound volume. */
|
||||
float getVolume();
|
||||
}
|
||||
|
||||
/**
|
||||
* Fired when the player falls. Cancelable.
|
||||
* @hookName fall
|
||||
*/
|
||||
@Cancelable
|
||||
interface FallEvent extends IPlayerEvent {
|
||||
/** @return the fall distance in blocks. */
|
||||
float getDistance();
|
||||
}
|
||||
|
||||
/**
|
||||
* Fired when the player jumps.
|
||||
* @hookName jump
|
||||
*/
|
||||
interface JumpEvent extends IPlayerEvent {
|
||||
}
|
||||
|
||||
/**
|
||||
* Fired when the player kills an entity.
|
||||
* @hookName kills
|
||||
*/
|
||||
interface KilledEntityEvent extends IPlayerEvent {
|
||||
/** @return the killed entity. */
|
||||
IEntityLivingBase getEntity();
|
||||
}
|
||||
|
||||
/**
|
||||
* Fired when the player dies.
|
||||
* @hookName killed
|
||||
*/
|
||||
interface DiedEvent extends IPlayerEvent {
|
||||
/** @return the damage source that killed the player. */
|
||||
IDamageSource getDamageSource();
|
||||
|
||||
/** @return the damage type string. */
|
||||
String getType();
|
||||
|
||||
/** @return the entity that killed the player, or null. */
|
||||
IEntity getSource();
|
||||
}
|
||||
|
||||
/**
|
||||
* Fired when the player launches a ranged weapon (e.g., bow). Cancelable.
|
||||
* @hookName rangedLaunched
|
||||
*/
|
||||
@Cancelable
|
||||
interface RangedLaunchedEvent extends IPlayerEvent {
|
||||
/** @return the bow item. */
|
||||
IItemStack getBow();
|
||||
|
||||
/** @return the charge level of the bow. */
|
||||
int getCharge();
|
||||
}
|
||||
|
||||
/**
|
||||
* Fired when the player attacks an entity. Cancelable.
|
||||
* @hookName attack
|
||||
*/
|
||||
@Cancelable
|
||||
interface AttackEvent extends IPlayerEvent {
|
||||
/** @return the damage source details. */
|
||||
IDamageSource getDamageSource();
|
||||
|
||||
/** @return the target entity. */
|
||||
IEntity getTarget();
|
||||
|
||||
/** @return the attack damage. */
|
||||
float getDamage();
|
||||
}
|
||||
|
||||
/**
|
||||
* Fired when the player deals damage to an entity (after hit). Cancelable.
|
||||
* @hookName damagedEntity
|
||||
*/
|
||||
@Cancelable
|
||||
interface DamagedEntityEvent extends IPlayerEvent {
|
||||
/** @return the damage source details. */
|
||||
IDamageSource getDamageSource();
|
||||
|
||||
/** @return the damaged entity. */
|
||||
IEntity getTarget();
|
||||
|
||||
/** @return the damage dealt. */
|
||||
float getDamage();
|
||||
}
|
||||
|
||||
/**
|
||||
* Fired when the player closes a container.
|
||||
* @hookName containerClosed
|
||||
*/
|
||||
interface ContainerClosed extends IPlayerEvent {
|
||||
/** @return the closed container. */
|
||||
IContainer getContainer();
|
||||
}
|
||||
|
||||
/**
|
||||
* Fired when the player opens a container.
|
||||
* @hookName containerOpen
|
||||
*/
|
||||
interface ContainerOpen extends IPlayerEvent {
|
||||
/** @return the opened container. */
|
||||
IContainer getContainer();
|
||||
}
|
||||
|
||||
/**
|
||||
* Fired when the player picks up an item. Cancelable.
|
||||
* @hookName pickUp
|
||||
*/
|
||||
@Cancelable
|
||||
interface PickUpEvent extends IPlayerEvent {
|
||||
/** @return the picked up item. */
|
||||
IItemStack getItem();
|
||||
}
|
||||
|
||||
/**
|
||||
* Fired when items are dropped from the player's inventory (e.g., on death). Cancelable.
|
||||
* @hookName drop
|
||||
*/
|
||||
@Cancelable
|
||||
interface DropEvent extends IPlayerEvent {
|
||||
/** @return the dropped items. */
|
||||
IItemStack[] getItems();
|
||||
}
|
||||
|
||||
/**
|
||||
* Fired when the player tosses a single item. Cancelable.
|
||||
* @hookName toss
|
||||
*/
|
||||
@Cancelable
|
||||
interface TossEvent extends IPlayerEvent {
|
||||
/** @return the tossed item. */
|
||||
IItemStack getItem();
|
||||
}
|
||||
|
||||
/**
|
||||
* Fired when the player interacts with an entity. Cancelable.
|
||||
* @hookName interact
|
||||
*/
|
||||
@Cancelable
|
||||
interface InteractEvent extends IPlayerEvent {
|
||||
/** @return the interaction type. */
|
||||
int getType();
|
||||
|
||||
/** @return the target entity. */
|
||||
IEntity getTarget();
|
||||
}
|
||||
|
||||
/**
|
||||
* Fired when the player right-clicks. Cancelable.
|
||||
* @hookName rightClick
|
||||
*/
|
||||
@Cancelable
|
||||
interface RightClickEvent extends IPlayerEvent {
|
||||
/** @return the click type. */
|
||||
int getType();
|
||||
|
||||
/** @return the target (entity, block, or null). */
|
||||
Object getTarget();
|
||||
|
||||
/** @return the player. */
|
||||
IPlayer getPlayer();
|
||||
}
|
||||
|
||||
/**
|
||||
* Fired each tick for the player.
|
||||
* @hookName tick
|
||||
*/
|
||||
interface UpdateEvent extends IPlayerEvent {
|
||||
}
|
||||
|
||||
/**
|
||||
* Fired when the player script is initialized.
|
||||
* @hookName init
|
||||
*/
|
||||
interface InitEvent extends IPlayerEvent {
|
||||
}
|
||||
|
||||
/**
|
||||
* Fired when the player starts using an item (e.g., drawing a bow).
|
||||
* @hookName startItem
|
||||
*/
|
||||
interface StartUsingItem extends IPlayerEvent {
|
||||
/** @return the item being used. */
|
||||
IItemStack getItem();
|
||||
|
||||
int getDuration();
|
||||
}
|
||||
|
||||
interface UsingItem extends IPlayerEvent {
|
||||
IItemStack getItem();
|
||||
|
||||
/** @return the use duration in ticks. */
|
||||
int getDuration();
|
||||
}
|
||||
|
||||
/**
|
||||
* Fired each tick while the player is using an item.
|
||||
* @hookName usingItem
|
||||
*/
|
||||
interface UsingItem extends IPlayerEvent {
|
||||
/** @return the item being used. */
|
||||
IItemStack getItem();
|
||||
|
||||
/** @return the remaining use duration in ticks. */
|
||||
int getDuration();
|
||||
}
|
||||
|
||||
/**
|
||||
* Fired when the player stops using an item before completion.
|
||||
* @hookName stopItem
|
||||
*/
|
||||
interface StopUsingItem extends IPlayerEvent {
|
||||
/** @return the item that was being used. */
|
||||
IItemStack getItem();
|
||||
|
||||
/** @return the remaining use duration in ticks. */
|
||||
int getDuration();
|
||||
}
|
||||
|
||||
/**
|
||||
* Fired when the player finishes using an item (full duration).
|
||||
* @hookName finishItem
|
||||
*/
|
||||
interface FinishUsingItem extends IPlayerEvent {
|
||||
/** @return the item that was used. */
|
||||
IItemStack getItem();
|
||||
|
||||
/** @return the total use duration in ticks. */
|
||||
int getDuration();
|
||||
}
|
||||
|
||||
/**
|
||||
* Fired when the player breaks a block. Cancelable.
|
||||
* @hookName breakBlock
|
||||
*/
|
||||
@Cancelable
|
||||
interface BreakEvent extends IPlayerEvent {
|
||||
/** @return the block being broken. */
|
||||
IBlock getBlock();
|
||||
|
||||
/** @return the experience dropped from breaking the block. */
|
||||
int getExp();
|
||||
}
|
||||
|
||||
/**
|
||||
* Fired when the player uses a hoe on a block.
|
||||
* @hookName useHoe
|
||||
*/
|
||||
interface UseHoeEvent extends IPlayerEvent {
|
||||
/** @return the hoe item. */
|
||||
IItemStack getHoe();
|
||||
|
||||
/** @return the X coordinate of the hoed block. */
|
||||
int getX();
|
||||
|
||||
/** @return the Y coordinate of the hoed block. */
|
||||
int getY();
|
||||
|
||||
/** @return the Z coordinate of the hoed block. */
|
||||
int getZ();
|
||||
}
|
||||
|
||||
/**
|
||||
* Fired when the player wakes up from a bed.
|
||||
* @hookName wakeUp
|
||||
*/
|
||||
interface WakeUpEvent extends IPlayerEvent {
|
||||
/** @return true if the bed position was set as spawn. */
|
||||
boolean setSpawn();
|
||||
}
|
||||
|
||||
/**
|
||||
* Fired when the player sleeps in a bed.
|
||||
* @hookName sleep
|
||||
*/
|
||||
interface SleepEvent extends IPlayerEvent {
|
||||
/** @return the X coordinate of the bed. */
|
||||
int getX();
|
||||
|
||||
/** @return the Y coordinate of the bed. */
|
||||
int getY();
|
||||
|
||||
/** @return the Z coordinate of the bed. */
|
||||
int getZ();
|
||||
}
|
||||
|
||||
/**
|
||||
* Fired when the player earns an achievement.
|
||||
* @hookName achievement
|
||||
*/
|
||||
interface AchievementEvent extends IPlayerEvent {
|
||||
/** @return the achievement description. */
|
||||
String getDescription();
|
||||
}
|
||||
|
||||
/**
|
||||
* Fired when the player fills a bucket.
|
||||
* @hookName fillBucket
|
||||
*/
|
||||
interface FillBucketEvent extends IPlayerEvent {
|
||||
/** @return the empty bucket item. */
|
||||
IItemStack getCurrent();
|
||||
|
||||
/** @return the filled bucket item. */
|
||||
IItemStack getFilled();
|
||||
}
|
||||
|
||||
/**
|
||||
* Fired when the player uses bonemeal on a block.
|
||||
* @hookName bonemeal
|
||||
*/
|
||||
interface BonemealEvent extends IPlayerEvent {
|
||||
/** @return the block that was bonemealed. */
|
||||
IBlock getBlock();
|
||||
|
||||
/** @return the X coordinate. */
|
||||
int getX();
|
||||
|
||||
/** @return the Y coordinate. */
|
||||
int getY();
|
||||
|
||||
/** @return the Z coordinate. */
|
||||
int getZ();
|
||||
}
|
||||
|
||||
/**
|
||||
* Fired when the player begins charging a ranged weapon.
|
||||
* @hookName rangedCharge
|
||||
*/
|
||||
interface RangedChargeEvent extends IPlayerEvent {
|
||||
}
|
||||
|
||||
/**
|
||||
* Events fired for player custom effects (add, tick, remove).
|
||||
* @hookName onEffect
|
||||
*/
|
||||
interface EffectEvent extends IPlayerEvent {
|
||||
|
||||
/** @return the player effect. */
|
||||
IPlayerEffect getEffect();
|
||||
|
||||
/**
|
||||
* Fired when an effect is added to the player.
|
||||
* @hookName onEffectAdd
|
||||
*/
|
||||
interface Added extends EffectEvent {
|
||||
@@ -319,6 +549,7 @@ public interface IPlayerEvent extends ICustomNPCsEvent {
|
||||
}
|
||||
|
||||
/**
|
||||
* Fired each tick while the effect is active.
|
||||
* @hookName onEffectTick
|
||||
*/
|
||||
interface Ticked extends EffectEvent {
|
||||
@@ -326,6 +557,7 @@ public interface IPlayerEvent extends ICustomNPCsEvent {
|
||||
}
|
||||
|
||||
/**
|
||||
* Fired when an effect is removed from the player.
|
||||
* @hookName onEffectRemove
|
||||
*/
|
||||
interface Removed extends EffectEvent {
|
||||
@@ -343,6 +575,10 @@ public interface IPlayerEvent extends ICustomNPCsEvent {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Events fired for profile operations (create, change, remove). Cancelable.
|
||||
* @hookName profile
|
||||
*/
|
||||
@Cancelable
|
||||
interface ProfileEvent extends IPlayerEvent {
|
||||
|
||||
@@ -362,6 +598,7 @@ public interface IPlayerEvent extends ICustomNPCsEvent {
|
||||
boolean isPost();
|
||||
|
||||
/**
|
||||
* Fired when the player switches profile slots. Cancelable.
|
||||
* @hookName profileChange
|
||||
*/
|
||||
@Cancelable
|
||||
@@ -373,6 +610,7 @@ public interface IPlayerEvent extends ICustomNPCsEvent {
|
||||
}
|
||||
|
||||
/**
|
||||
* Fired when a new profile is created. Cancelable.
|
||||
* @hookName profileCreate
|
||||
*/
|
||||
@Cancelable
|
||||
@@ -380,6 +618,7 @@ public interface IPlayerEvent extends ICustomNPCsEvent {
|
||||
}
|
||||
|
||||
/**
|
||||
* Fired when a profile is removed. Cancelable.
|
||||
* @hookName profileRemove
|
||||
*/
|
||||
@Cancelable
|
||||
|
||||
@@ -4,26 +4,36 @@ import noppes.npcs.api.IBlock;
|
||||
import noppes.npcs.api.entity.IEntity;
|
||||
import noppes.npcs.api.entity.IProjectile;
|
||||
|
||||
/**
|
||||
* Events fired during NPC projectile lifecycle and impacts.
|
||||
*/
|
||||
public interface IProjectileEvent extends ICustomNPCsEvent {
|
||||
|
||||
/** @return the projectile entity. */
|
||||
public IProjectile getProjectile();
|
||||
|
||||
/** @return the entity that launched this projectile. */
|
||||
public IEntity getSource();
|
||||
|
||||
/**
|
||||
* Fired each tick while the projectile exists.
|
||||
* @hookName projectileTick
|
||||
*/
|
||||
interface UpdateEvent extends IProjectileEvent {
|
||||
}
|
||||
|
||||
/**
|
||||
* Fired when the projectile hits something.
|
||||
* @hookName projectileImpact
|
||||
*/
|
||||
interface ImpactEvent extends IProjectileEvent {
|
||||
/** @return the impact type. */
|
||||
public int getType();
|
||||
|
||||
/** @return the entity hit, or null if a block was hit. */
|
||||
public IEntity getEntity();
|
||||
|
||||
/** @return the block hit, or null if an entity was hit. */
|
||||
public IBlock getBlock();
|
||||
}
|
||||
|
||||
|
||||
@@ -4,28 +4,45 @@ import cpw.mods.fml.common.eventhandler.Cancelable;
|
||||
import noppes.npcs.api.handler.data.IQuest;
|
||||
import noppes.npcs.api.item.IItemStack;
|
||||
|
||||
/**
|
||||
* Events fired during quest lifecycle: starting, completing, and turning in.
|
||||
*/
|
||||
public interface IQuestEvent extends IPlayerEvent {
|
||||
|
||||
/** @return the quest associated with this event. */
|
||||
IQuest getQuest();
|
||||
|
||||
/**
|
||||
* Fired when a quest's objectives are all completed.
|
||||
* @hookName questCompleted
|
||||
*/
|
||||
interface QuestCompletedEvent extends IQuestEvent {
|
||||
}
|
||||
|
||||
/**
|
||||
* Fired when a quest is started/accepted. Cancelable.
|
||||
* @hookName questStart
|
||||
*/
|
||||
@Cancelable
|
||||
interface QuestStartEvent extends IQuestEvent {
|
||||
}
|
||||
|
||||
/**
|
||||
* Fired when a completed quest is turned in. Cancelable.
|
||||
* @hookName questTurnIn
|
||||
*/
|
||||
@Cancelable
|
||||
interface QuestTurnedInEvent extends IQuestEvent {
|
||||
/** @param expReward the experience reward to give. */
|
||||
void setExpReward(int expReward);
|
||||
|
||||
/** @param itemRewards the item rewards to give. */
|
||||
void setItemRewards(IItemStack[] itemRewards);
|
||||
|
||||
/** @return the experience reward. */
|
||||
int getExpReward();
|
||||
|
||||
/** @return the item rewards. */
|
||||
IItemStack[] getItemRewards();
|
||||
}
|
||||
}
|
||||
@@ -3,6 +3,9 @@ package noppes.npcs.api.event;
|
||||
import cpw.mods.fml.common.eventhandler.Cancelable;
|
||||
import noppes.npcs.api.item.IItemStack;
|
||||
|
||||
/**
|
||||
* Events fired before and after recipe crafting, for both crafting table and anvil recipes.
|
||||
*/
|
||||
public interface IRecipeEvent extends IPlayerEvent {
|
||||
|
||||
/**
|
||||
@@ -13,14 +16,22 @@ public interface IRecipeEvent extends IPlayerEvent {
|
||||
*/
|
||||
Object getRecipe();
|
||||
|
||||
/** @return the input item stacks used in the recipe. */
|
||||
IItemStack[] getItems();
|
||||
|
||||
/** @return true if this is an anvil recipe, false for crafting table. */
|
||||
boolean isAnvil();
|
||||
|
||||
/**
|
||||
* Fired before a recipe is crafted. Cancelable.
|
||||
* @hookName recipeCraftPre
|
||||
*/
|
||||
@Cancelable
|
||||
interface Pre extends IRecipeEvent {
|
||||
/** @param message the denial message shown when canceled. */
|
||||
void setMessage(String message);
|
||||
|
||||
/** @return the denial message. */
|
||||
String getMessage();
|
||||
|
||||
/**
|
||||
@@ -52,9 +63,15 @@ public interface IRecipeEvent extends IPlayerEvent {
|
||||
void setMaterialUsage(int materialUsage);
|
||||
}
|
||||
|
||||
/**
|
||||
* Fired after a recipe is crafted.
|
||||
* @hookName recipeCraftPost
|
||||
*/
|
||||
interface Post extends IRecipeEvent {
|
||||
/** @return the crafted item. */
|
||||
IItemStack getCraft();
|
||||
|
||||
/** @param stack the item to set as the crafting result. */
|
||||
void setResult(IItemStack stack);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user