mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-18 12:39:05 +00:00
Custom Effect [WIP]
This commit is contained in:
1 parent
65ac349c08
commit
20a46e6007
31 files changed
+1331
-65
No files matched your search
@@ -14,6 +14,7 @@ import noppes.npcs.api.entity.IEntity;
|
||||
import noppes.npcs.api.entity.IEntityLivingBase;
|
||||
import noppes.npcs.api.entity.IPlayer;
|
||||
import noppes.npcs.api.event.IPlayerEvent;
|
||||
import noppes.npcs.api.handler.data.IPlayerEffect;
|
||||
import noppes.npcs.api.item.IItemStack;
|
||||
import noppes.npcs.constants.EnumScriptType;
|
||||
import noppes.npcs.scripted.NpcAPI;
|
||||
@@ -949,4 +950,59 @@ public class PlayerEvent extends CustomNPCsEvent implements IPlayerEvent {
|
||||
return EnumScriptType.RANGED_LAUNCHED.function;
|
||||
}
|
||||
}
|
||||
|
||||
public static class EffectEvent extends PlayerEvent implements IPlayerEvent.EffectEvent {
|
||||
|
||||
public final IPlayerEffect effect;
|
||||
|
||||
public EffectEvent(IPlayer player, IPlayerEffect statusEffect) {
|
||||
super(player);
|
||||
this.effect = statusEffect;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IPlayerEffect getEffect() {
|
||||
return this.effect;
|
||||
}
|
||||
|
||||
public static class Added extends PlayerEvent.EffectEvent implements IPlayerEvent.EffectEvent.Added {
|
||||
|
||||
public Added(IPlayer player, IPlayerEffect statusEffect) {
|
||||
super(player, statusEffect);
|
||||
}
|
||||
|
||||
}
|
||||
public static class Ticked extends PlayerEvent.EffectEvent implements IPlayerEvent.EffectEvent.Ticked {
|
||||
|
||||
public Ticked(IPlayer player, IPlayerEffect statusEffect) {
|
||||
super(player, statusEffect);
|
||||
}
|
||||
|
||||
}
|
||||
public static class Removed extends PlayerEvent.EffectEvent implements IPlayerEvent.EffectEvent.Removed {
|
||||
|
||||
private final ExpirationType type;
|
||||
|
||||
public Removed(IPlayer player, IPlayerEffect statusEffect, ExpirationType type) {
|
||||
super(player, statusEffect);
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasTimerRunOut() {
|
||||
return type == ExpirationType.RUN_OUT;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean causedByDeath() {
|
||||
return type == ExpirationType.DEATH;
|
||||
}
|
||||
}
|
||||
|
||||
public enum ExpirationType {
|
||||
REMOVED,
|
||||
RUN_OUT,
|
||||
DEATH
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user