Package me.deecaad.core.mechanics
Class PlayerEffectMechanicList
java.lang.Object
me.deecaad.core.mechanics.defaultmechanics.Mechanic
me.deecaad.core.mechanics.PlayerEffectMechanicList
- All Implemented Interfaces:
InlineSerializer<Mechanic>,Serializer<Mechanic>,net.kyori.adventure.key.Keyed,org.bukkit.Keyed
This class wraps a list of
PlayerEffectMechanic. The purpose of this is to cache a list
of targeted players so we don't waste resources instead targeting every entity in the world,
every mechanic we cast. This is especially crucial for the
SoundMechanic, which may exist 10+ times in 1
MechanicManager, causing major performance issues on big servers.-
Nested Class Summary
Nested classes/interfaces inherited from interface me.deecaad.core.file.InlineSerializer
InlineSerializer.FormatException -
Field Summary
Fields inherited from class me.deecaad.core.mechanics.defaultmechanics.Mechanic
conditions, targeterFields inherited from interface me.deecaad.core.file.InlineSerializer
NAME_FINDER, UNIQUE_IDENTIFIER -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddMechanic(PlayerEffectMechanic mechanic) @NotNull org.bukkit.NamespacedKeygetKey()booleanisEmpty()@NotNull Mechanicserialize(@NotNull me.deecaad.core.file.SerializeData data) Instantiates a new Object to be added into the finalized configuration.voidThis method will trigger this Mechanic.protected voidThis method should be overridden to define the behavior of the Mechanic.Methods inherited from class me.deecaad.core.mechanics.defaultmechanics.Mechanic
applyParentArgs, getChance, getConditions, getDelayBeforePlay, getRepeatAmount, getRepeatInterval, getTargeter, handleTargetersAndConditionsMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface me.deecaad.core.file.InlineSerializer
getInlineKeyword, getKeyword, shouldSerializeMethods inherited from interface org.bukkit.Keyed
keyMethods inherited from interface me.deecaad.core.file.Serializer
canUsePathTo, getName, getParentKeywords, getWikiLink, letPassThrough, tryPathTo, useLater
-
Constructor Details
-
PlayerEffectMechanicList
public PlayerEffectMechanicList()
-
-
Method Details
-
getKey
@NotNull public @NotNull org.bukkit.NamespacedKey getKey() -
addMechanic
-
isEmpty
public boolean isEmpty() -
use
Description copied from class:MechanicThis method will trigger this Mechanic.This method probably shouldn't be overridden. It handles the global repeat, delay, targeter, and condition code. The behavior of the specific Mechanic is handled by the protected
Mechanic.use0(CastData)method. -
use0
Description copied from class:MechanicThis method should be overridden to define the behavior of the Mechanic. For example, a Potion mechanic may use theCastData.getTarget()method to apply a potion effect. -
serialize
@NotNull public @NotNull Mechanic serialize(@NotNull @NotNull me.deecaad.core.file.SerializeData data) throws me.deecaad.core.file.SerializerException Description copied from interface:SerializerInstantiates a new Object to be added into the finalized configuration. The object should be built off ofSerializeData.getConfig(). If there is any misconfiguration (or any other issue preventing the construction of an object), then this method should throw aSerializerException. This method may not return null.- Parameters:
data- The non-null data containing config- Returns:
- The non-null serialized data.
- Throws:
me.deecaad.core.file.SerializerException- If there is an error in config.
-