mirror of
https://github.com/KAMKEEL/CustomNPC-Plus-API.git
synced 2026-11-15 18:24:44 +00:00
Custom Effects and Player Events API
This commit is contained in:
1 parent
f91f9b43ba
commit
5a8246f728
4 files changed
+168
No files matched your search
@@ -7,6 +7,7 @@ import noppes.npcs.api.IDamageSource;
|
||||
import noppes.npcs.api.entity.IEntity;
|
||||
import noppes.npcs.api.entity.IEntityLivingBase;
|
||||
import noppes.npcs.api.entity.IPlayer;
|
||||
import noppes.npcs.api.handler.data.IPlayerEffect;
|
||||
import noppes.npcs.api.item.IItemStack;
|
||||
|
||||
public interface IPlayerEvent extends ICustomNPCsEvent {
|
||||
@@ -268,4 +269,29 @@ public interface IPlayerEvent extends ICustomNPCsEvent {
|
||||
|
||||
interface RangedChargeEvent extends IPlayerEvent {
|
||||
}
|
||||
|
||||
interface EffectEvent extends IPlayerEvent {
|
||||
|
||||
IPlayerEffect getEffect();
|
||||
|
||||
interface Added extends EffectEvent {
|
||||
|
||||
}
|
||||
interface Ticked extends EffectEvent {
|
||||
|
||||
}
|
||||
interface Removed extends EffectEvent {
|
||||
|
||||
/**
|
||||
* @return If the effect timer has ticked down to 0.
|
||||
*/
|
||||
boolean hasTimerRunOut();
|
||||
|
||||
/**
|
||||
* @return If the effect was removed on death.
|
||||
*/
|
||||
boolean causedByDeath();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
package noppes.npcs.api.handler;
|
||||
|
||||
import noppes.npcs.api.entity.IPlayer;
|
||||
import noppes.npcs.api.handler.data.ICustomEffect;
|
||||
|
||||
public interface IStatusEffectHandler {
|
||||
|
||||
ICustomEffect createEffect(String name);
|
||||
|
||||
ICustomEffect getEffect(String name);
|
||||
|
||||
void deleteEffect(String name);
|
||||
|
||||
/**
|
||||
*
|
||||
* @param player Player
|
||||
* @param id ID of Status Effect -- Only DBC Addon
|
||||
* @return True if Player has Effect
|
||||
*/
|
||||
boolean hasEffect(IPlayer player, int id);
|
||||
|
||||
boolean hasEffect(IPlayer player, ICustomEffect effect);
|
||||
|
||||
/**
|
||||
*
|
||||
* -1 : Does not have effect
|
||||
* -100 : Has infinite effect
|
||||
*
|
||||
* @param player Player
|
||||
* @param id ID of Status Effect -- Only DBC Addon
|
||||
* @return Effect Time
|
||||
*/
|
||||
int getEffectDuration(IPlayer player, int id);
|
||||
|
||||
int getEffectDuration(IPlayer player, ICustomEffect effect);
|
||||
|
||||
/**
|
||||
* @param player Player
|
||||
* @param id ID of Status Effect
|
||||
* @param duration Duration of Effect in Seconds | -100 : Has infinite effect
|
||||
* @param level Level of Effect [Some effects not affected by level]
|
||||
*/
|
||||
void applyEffect(IPlayer player, int id, int duration, byte level);
|
||||
|
||||
void applyEffect(IPlayer player, ICustomEffect effect, int duration, byte level);
|
||||
|
||||
/**
|
||||
* @param player Player
|
||||
* @param id ID of Status Effect
|
||||
*/
|
||||
void removeEffect(IPlayer player, int id);
|
||||
|
||||
void removeEffect(IPlayer player, ICustomEffect effect);
|
||||
|
||||
void clearEffects(IPlayer player);
|
||||
|
||||
ICustomEffect saveEffect(ICustomEffect customEffect);
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
package noppes.npcs.api.handler.data;
|
||||
|
||||
public interface ICustomEffect {
|
||||
|
||||
int getID();
|
||||
|
||||
String getName();
|
||||
|
||||
boolean isCustom();
|
||||
|
||||
void setMenuName(String name);
|
||||
|
||||
String getMenuName();
|
||||
|
||||
void setName(String name);
|
||||
|
||||
String getIcon();
|
||||
|
||||
void setIcon(String icon);
|
||||
|
||||
int getEveryXTick();
|
||||
|
||||
void setEveryXTick(int everyXTick);
|
||||
|
||||
int getIconX();
|
||||
|
||||
void setIconX(int iconX);
|
||||
|
||||
int getIconY();
|
||||
|
||||
void setIconY(int iconY);
|
||||
|
||||
int getWidth();
|
||||
|
||||
void setWidth(int width);
|
||||
|
||||
int getHeight();
|
||||
|
||||
void setHeight(int height);
|
||||
|
||||
boolean isLossOnDeath();
|
||||
|
||||
void setLossOnDeath(boolean lossOnDeath);
|
||||
|
||||
ICustomEffect save();
|
||||
|
||||
void setID(int id);
|
||||
|
||||
/**
|
||||
* Utilized by DBC Addon or other Addons to tell
|
||||
* which map of Effects to Match to.
|
||||
* Index: 0 - CNPC+
|
||||
* Index: 1 - DBC Addon
|
||||
*/
|
||||
int getIndex();
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
package noppes.npcs.api.handler.data;
|
||||
|
||||
import noppes.npcs.api.entity.IPlayer;
|
||||
|
||||
public interface IPlayerEffect {
|
||||
|
||||
void kill();
|
||||
|
||||
int getId();
|
||||
|
||||
int getDuration();
|
||||
|
||||
void setDuration(int duration);
|
||||
|
||||
byte getLevel();
|
||||
|
||||
void setLevel(byte level);
|
||||
|
||||
String getName();
|
||||
|
||||
void performEffect(IPlayer player);
|
||||
|
||||
int getIndex();
|
||||
|
||||
void setIndex();
|
||||
}
|
||||
Reference in new issue
Block a user