Package noppes.npcs.api.handler
Interface ICustomEffectHandler
-
public interface ICustomEffectHandler
Handler interface for managing custom effects. Provides methods to create, retrieve, apply, remove, and save custom effects.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
applyEffect(IPlayer player, int id, int duration, byte level)
Applies the effect with the specified ID to the player.void
applyEffect(IPlayer player, int id, int duration, byte level, int index)
Applies the effect with the specified ID and index to the player.void
applyEffect(IPlayer player, ICustomEffect effect, int duration, byte level)
Applies the specified custom effect to the player.void
applyEffect(IPlayer player, ICustomEffect effect, int duration, byte level, int index)
Applies the specified custom effect (with the given index) to the player.void
clearEffects(IPlayer player)
Clears all custom effects from the specified player.void
clearEffects(IPlayer player, int index)
Clears all custom effects with the specified index from the player.ICustomEffect
createEffect(java.lang.String name)
Creates a new custom effect with the specified name.void
deleteEffect(java.lang.String name)
Deletes the custom effect with the specified name.ICustomEffect
getEffect(int id, int index)
Retrieves the custom effect with the specified ID and index.ICustomEffect
getEffect(java.lang.String name)
Retrieves the custom effect with the specified name.ICustomEffect
getEffect(java.lang.String name, int index)
Retrieves the custom effect with the specified name and index.int
getEffectDuration(IPlayer player, int id)
Retrieves the remaining duration of the effect with the specified ID for the given player.int
getEffectDuration(IPlayer player, int id, int index)
Retrieves the remaining duration of the effect with the specified ID and index for the given player.int
getEffectDuration(IPlayer player, ICustomEffect effect)
Retrieves the remaining duration of the given custom effect for the specified player.int
getEffectDuration(IPlayer player, ICustomEffect effect, int index)
Retrieves the remaining duration of the specified custom effect (with the given index) for the player.boolean
hasEffect(IPlayer player, int id)
Checks if the specified player currently has an effect with the given ID.boolean
hasEffect(IPlayer player, ICustomEffect effect)
Checks if the specified player currently has the given custom effect.void
removeEffect(IPlayer player, int id)
Removes the effect with the specified ID from the player.void
removeEffect(IPlayer player, int id, int index)
Removes the effect with the specified ID and index from the player.void
removeEffect(IPlayer player, ICustomEffect effect)
Removes the specified custom effect from the player.void
removeEffect(IPlayer player, ICustomEffect effect, int index)
Removes the specified custom effect (with the given index) from the player.ICustomEffect
saveEffect(ICustomEffect customEffect)
Persists the given custom effect.
-
-
-
Method Detail
-
createEffect
ICustomEffect createEffect(java.lang.String name)
Creates a new custom effect with the specified name. If an effect with the given name already exists, the existing effect is returned.- Parameters:
name
- the name of the custom effect to create- Returns:
- the newly created or existing custom effect
-
getEffect
ICustomEffect getEffect(java.lang.String name)
Retrieves the custom effect with the specified name.- Parameters:
name
- the name of the custom effect to retrieve- Returns:
- the custom effect with the given name, or null if not found
-
deleteEffect
void deleteEffect(java.lang.String name)
Deletes the custom effect with the specified name.- Parameters:
name
- the name of the custom effect to delete
-
hasEffect
boolean hasEffect(IPlayer player, int id)
Checks if the specified player currently has an effect with the given ID.- Parameters:
player
- the player to checkid
- the ID of the status effect- Returns:
- true if the player has the effect, false otherwise
-
hasEffect
boolean hasEffect(IPlayer player, ICustomEffect effect)
Checks if the specified player currently has the given custom effect.- Parameters:
player
- the player to checkeffect
- the custom effect to check for- Returns:
- true if the player has the effect, false otherwise
-
getEffectDuration
int getEffectDuration(IPlayer player, int id)
Retrieves the remaining duration of the effect with the specified ID for the given player.Return values:
- -1 if the player does not have the effect
- -100 if the effect has an infinite duration
- Parameters:
player
- the player whose effect duration is queriedid
- the ID of the status effect- Returns:
- the remaining effect time in seconds
-
getEffectDuration
int getEffectDuration(IPlayer player, ICustomEffect effect)
Retrieves the remaining duration of the given custom effect for the specified player.Return values:
- -1 if the player does not have the effect
- -100 if the effect has an infinite duration
- Parameters:
player
- the player whose effect duration is queriedeffect
- the custom effect to check- Returns:
- the remaining effect time in seconds
-
applyEffect
void applyEffect(IPlayer player, int id, int duration, byte level)
Applies the effect with the specified ID to the player.- Parameters:
player
- the player to apply the effect toid
- the ID of the status effectduration
- the duration of the effect in seconds (-100 for infinite duration)level
- the level of the effect (some effects may ignore this value)
-
applyEffect
void applyEffect(IPlayer player, ICustomEffect effect, int duration, byte level)
Applies the specified custom effect to the player.- Parameters:
player
- the player to apply the effect toeffect
- the custom effect to applyduration
- the duration of the effect in seconds (-100 for infinite duration)level
- the level of the effect (some effects may ignore this value)
-
removeEffect
void removeEffect(IPlayer player, int id)
Removes the effect with the specified ID from the player.- Parameters:
player
- the player to remove the effect fromid
- the ID of the status effect to remove
-
removeEffect
void removeEffect(IPlayer player, ICustomEffect effect)
Removes the specified custom effect from the player.- Parameters:
player
- the player to remove the effect fromeffect
- the custom effect to remove
-
clearEffects
void clearEffects(IPlayer player)
Clears all custom effects from the specified player.- Parameters:
player
- the player whose effects should be cleared
-
applyEffect
void applyEffect(IPlayer player, int id, int duration, byte level, int index)
Applies the effect with the specified ID and index to the player. The index parameter allows for multiple variants of the same effect.Note: INDEX: 0: CNPC+, 1: DBC Addon
- Parameters:
player
- the player to apply the effect toid
- the ID of the status effectduration
- the duration of the effect in seconds (-100 for infinite duration)level
- the level of the effectindex
- the index to differentiate between variants of the effect (INDEX: 0: CNPC+, 1: DBC Addon)
-
applyEffect
void applyEffect(IPlayer player, ICustomEffect effect, int duration, byte level, int index)
Applies the specified custom effect (with the given index) to the player.Note: INDEX: 0: CNPC+, 1: DBC Addon
- Parameters:
player
- the player to apply the effect toeffect
- the custom effect to applyduration
- the duration of the effect in seconds (-100 for infinite duration)level
- the level of the effectindex
- the index to differentiate between variants of the effect (INDEX: 0: CNPC+, 1: DBC Addon)
-
removeEffect
void removeEffect(IPlayer player, int id, int index)
Removes the effect with the specified ID and index from the player.Note: INDEX: 0: CNPC+, 1: DBC Addon
- Parameters:
player
- the player to remove the effect fromid
- the ID of the status effect to removeindex
- the index of the effect variant to remove (INDEX: 0: CNPC+, 1: DBC Addon)
-
removeEffect
void removeEffect(IPlayer player, ICustomEffect effect, int index)
Removes the specified custom effect (with the given index) from the player.Note: INDEX: 0: CNPC+, 1: DBC Addon
- Parameters:
player
- the player to remove the effect fromeffect
- the custom effect to removeindex
- the index of the effect variant to remove (INDEX: 0: CNPC+, 1: DBC Addon)
-
clearEffects
void clearEffects(IPlayer player, int index)
Clears all custom effects with the specified index from the player.Note: INDEX: 0: CNPC+, 1: DBC Addon
- Parameters:
player
- the player whose effects should be clearedindex
- the index of the effect variants to clear (INDEX: 0: CNPC+, 1: DBC Addon)
-
getEffectDuration
int getEffectDuration(IPlayer player, int id, int index)
Retrieves the remaining duration of the effect with the specified ID and index for the given player.Return values:
- -1 if the player does not have the effect
- -100 if the effect has an infinite duration
Note: INDEX: 0: CNPC+, 1: DBC Addon
- Parameters:
player
- the player whose effect duration is queriedid
- the ID of the status effectindex
- the index of the effect variant (INDEX: 0: CNPC+, 1: DBC Addon)- Returns:
- the remaining effect time in seconds
-
getEffectDuration
int getEffectDuration(IPlayer player, ICustomEffect effect, int index)
Retrieves the remaining duration of the specified custom effect (with the given index) for the player.Return values:
- -1 if the player does not have the effect
- -100 if the effect has an infinite duration
Note: INDEX: 0: CNPC+, 1: DBC Addon
- Parameters:
player
- the player whose effect duration is queriedeffect
- the custom effect to checkindex
- the index of the effect variant (INDEX: 0: CNPC+, 1: DBC Addon)- Returns:
- the remaining effect time in seconds
-
getEffect
ICustomEffect getEffect(java.lang.String name, int index)
Retrieves the custom effect with the specified name and index.Note: INDEX: 0: CNPC+, 1: DBC Addon
- Parameters:
name
- the name of the custom effectindex
- the index of the effect variant (INDEX: 0: CNPC+, 1: DBC Addon)- Returns:
- the custom effect matching the name and index, or null if not found
-
getEffect
ICustomEffect getEffect(int id, int index)
Retrieves the custom effect with the specified ID and index.Note: INDEX: 0: CNPC+, 1: DBC Addon
- Parameters:
id
- the ID of the custom effectindex
- the index of the effect variant (INDEX: 0: CNPC+, 1: DBC Addon)- Returns:
- the custom effect matching the ID and index, or null if not found
-
saveEffect
ICustomEffect saveEffect(ICustomEffect customEffect)
Persists the given custom effect. This method saves the effect and returns the saved instance, potentially with an updated ID or name.- Parameters:
customEffect
- the custom effect to save- Returns:
- the saved custom effect instance
-
-