Package me.lokka30.levelledmobs.managers
Class LevelManager
java.lang.Object
me.lokka30.levelledmobs.managers.LevelManager
- All Implemented Interfaces:
LevelInterface
Generates levels and manages other functions related to levelling mobs
- Since:
- 2.4.0
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
applyLevelToMob
(@NotNull LivingEntityWrapper lmEntity, int level, boolean isSummoned, boolean bypassLimits, @NotNull HashSet<AdditionalLevelInformation> additionalLevelInformation) This method applies a level to the target mob.void
int
generateLevel
(@NotNull LivingEntityWrapper lmEntity) This method generates a level for the mob.int
generateLevel
(@NotNull LivingEntityWrapper lmEntity, int minLevel_Pre, int maxLevel_Pre) This method generates a level for the mob.@NotNull LevellableState
getLevellableState
(@NotNull LivingEntityInterface lmInterface) Check if an existing mob is allowed to be levelled, according to the user's configuration.int
getLevelledExpDrops
(@NotNull LivingEntityWrapper lmEntity, double xp) int
getLevelOfMob
(@NotNull org.bukkit.entity.LivingEntity livingEntity) Retrieve the level of a levelled mob.getMinAndMaxLevels
(@NotNull LivingEntityInterface lmInterface) @NotNull NametagResult
getNametag
(@NotNull LivingEntityWrapper lmEntity, boolean isDeathNametag) @NotNull NametagResult
getNametag
(@NotNull LivingEntityWrapper lmEntity, boolean isDeathNametag, boolean preserveMobName) @NotNull PlayerLevelSourceResult
getPlayerLevelSourceNumber
(@Nullable org.bukkit.entity.Player player, @NotNull LivingEntityWrapper lmEntity, @NotNull String variableToUse) boolean
isLevelled
(@NotNull org.bukkit.entity.LivingEntity livingEntity) Check if a LivingEntity is a levelled mob or not.void
multiplyDrop
(LivingEntityWrapper lmEntity, @NotNull org.bukkit.inventory.ItemStack currentDrop, double addition, boolean isCustomDrop) void
removeLevel
(@NotNull LivingEntityWrapper lmEntity) Un-level a mob.void
removeVanillaDrops
(@NotNull LivingEntityWrapper lmEntity, List<org.bukkit.inventory.ItemStack> drops) @NotNull String
replaceStringPlaceholders
(@NotNull String text, @NotNull LivingEntityWrapper lmEntity, boolean usePAPI, @Nullable org.bukkit.entity.Player player, boolean preserveMobName) void
setLevelledItemDrops
(LivingEntityWrapper lmEntity, @NotNull List<org.bukkit.inventory.ItemStack> currentDrops, boolean disableItemBoost) void
void
void
@NotNull NametagResult
updateNametag
(@NotNull LivingEntityWrapper lmEntity, @NotNull StringReplacer nametag, boolean preserveMobName, String customDeathMessage) void
updateNametag
(@NotNull LivingEntityWrapper lmEntity, NametagResult nametag, List<org.bukkit.entity.Player> players) void
updateNametag
(LivingEntityWrapper lmEntity) void
updateNametagWithDelay
(@NotNull LivingEntityWrapper lmEntity)
-
Field Details
-
summonedOrSpawnEggs
-
summonedOrSpawnEggs_Lock
-
doCheckMobHash
public boolean doCheckMobHash -
entitySpawnListener
-
FORCED_BLOCKED_ENTITY_TYPES
The following entity types *MUST NOT* be levellable. -
nametagAutoUpdateTask
-
-
Constructor Details
-
LevelManager
-
-
Method Details
-
clearRandomLevellingCache
public void clearRandomLevellingCache() -
generateLevel
This method generates a level for the mob. It utilises the levelling mode specified by the administrator through the settings.yml configuration.Thread-safety intended, but not tested.
- Specified by:
generateLevel
in interfaceLevelInterface
- Parameters:
lmEntity
- the entity to generate a level for- Returns:
- a level for the entity
-
generateLevel
public int generateLevel(@NotNull @NotNull LivingEntityWrapper lmEntity, int minLevel_Pre, int maxLevel_Pre) This method generates a level for the mob. It utilises the levelling mode specified by the administrator through the settings.yml configuration.Thread-safety intended, but not tested.
- Specified by:
generateLevel
in interfaceLevelInterface
- Parameters:
lmEntity
- the entity to generate a level forminLevel_Pre
- the minimum level to be used for the mobmaxLevel_Pre
- the maximum level to be used for the mob- Returns:
- a level for the entity
-
getPlayerLevelSourceNumber
@NotNull public @NotNull PlayerLevelSourceResult getPlayerLevelSourceNumber(@Nullable @Nullable org.bukkit.entity.Player player, @NotNull @NotNull LivingEntityWrapper lmEntity, @NotNull @NotNull String variableToUse) -
getMinAndMaxLevels
-
setLevelledItemDrops
public void setLevelledItemDrops(LivingEntityWrapper lmEntity, @NotNull @NotNull List<org.bukkit.inventory.ItemStack> currentDrops, boolean disableItemBoost) -
multiplyDrop
public void multiplyDrop(LivingEntityWrapper lmEntity, @NotNull @NotNull org.bukkit.inventory.ItemStack currentDrop, double addition, boolean isCustomDrop) -
removeVanillaDrops
public void removeVanillaDrops(@NotNull @NotNull LivingEntityWrapper lmEntity, List<org.bukkit.inventory.ItemStack> drops) -
getLevelledExpDrops
-
getNametag
@NotNull public @NotNull NametagResult getNametag(@NotNull @NotNull LivingEntityWrapper lmEntity, boolean isDeathNametag) -
getNametag
@NotNull public @NotNull NametagResult getNametag(@NotNull @NotNull LivingEntityWrapper lmEntity, boolean isDeathNametag, boolean preserveMobName) -
updateNametag
@NotNull public @NotNull NametagResult updateNametag(@NotNull @NotNull LivingEntityWrapper lmEntity, @NotNull @NotNull StringReplacer nametag, boolean preserveMobName, String customDeathMessage) -
replaceStringPlaceholders
@NotNull public @NotNull String replaceStringPlaceholders(@NotNull @NotNull String text, @NotNull @NotNull LivingEntityWrapper lmEntity, boolean usePAPI, @Nullable @Nullable org.bukkit.entity.Player player, boolean preserveMobName) -
updateNametagWithDelay
-
updateNametag
-
updateNametag
public void updateNametag(@NotNull @NotNull LivingEntityWrapper lmEntity, NametagResult nametag, List<org.bukkit.entity.Player> players) -
startNametagAutoUpdateTask
public void startNametagAutoUpdateTask() -
startNametagTimer
public void startNametagTimer() -
stopNametagAutoUpdateTask
public void stopNametagAutoUpdateTask() -
getLevellableState
@NotNull public @NotNull LevellableState getLevellableState(@NotNull @NotNull LivingEntityInterface lmInterface) Description copied from interface:LevelInterface
Check if an existing mob is allowed to be levelled, according to the user's configuration.Thread-safety intended, but not tested.
- Specified by:
getLevellableState
in interfaceLevelInterface
- Parameters:
lmInterface
- target mob- Returns:
- if the mob is allowed to be levelled (yes/no), with reason
-
applyLevelToMob
public void applyLevelToMob(@NotNull @NotNull LivingEntityWrapper lmEntity, int level, boolean isSummoned, boolean bypassLimits, @NotNull @NotNull HashSet<AdditionalLevelInformation> additionalLevelInformation) This method applies a level to the target mob.You can run this method on a mob regardless if they are already levelled or not.
This method DOES NOT check if it is LEVELLABLE. It is assumed that plugins make sure this is the case (unless they intend otherwise).
It is highly recommended to leave bypassLimits = false, unless the desired behaviour is to override the user-configured limits.
Thread-safety intended, but not tested.
- Specified by:
applyLevelToMob
in interfaceLevelInterface
- Parameters:
lmEntity
- target moblevel
- the level the mob should haveisSummoned
- if the mob was spawned by LevelledMobs, not by the serverbypassLimits
- whether LM should disregard max level, etc.additionalLevelInformation
- used to determine the source event
-
isLevelled
public boolean isLevelled(@NotNull @NotNull org.bukkit.entity.LivingEntity livingEntity) Check if a LivingEntity is a levelled mob or not. This is determined *after* MobPreLevelEvent.Thread-safety intended, but not tested.
- Specified by:
isLevelled
in interfaceLevelInterface
- Parameters:
livingEntity
- living entity to check- Returns:
- if the mob is levelled or not
-
getLevelOfMob
public int getLevelOfMob(@NotNull @NotNull org.bukkit.entity.LivingEntity livingEntity) Retrieve the level of a levelled mob.Thread-safety intended, but not tested.
- Specified by:
getLevelOfMob
in interfaceLevelInterface
- Parameters:
livingEntity
- the levelled mob to get the level of- Returns:
- the mob's level
-
removeLevel
Un-level a mob.- Specified by:
removeLevel
in interfaceLevelInterface
- Parameters:
lmEntity
- levelled mob to un-level
-