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
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidapplyLevelToMob(@NotNull LivingEntityWrapper lmEntity, int level, boolean isSummoned, boolean bypassLimits, @NotNull HashSet<AdditionalLevelInformation> additionalLevelInformation) This method applies a level to the target mob.voidintgenerateLevel(@NotNull LivingEntityWrapper lmEntity) This method generates a level for the mob.intgenerateLevel(@NotNull LivingEntityWrapper lmEntity, int minLevel_Pre, int maxLevel_Pre) This method generates a level for the mob.@NotNull LevellableStategetLevellableState(@NotNull LivingEntityInterface lmInterface) Check if an existing mob is allowed to be levelled, according to the user's configuration.intgetLevelledExpDrops(@NotNull LivingEntityWrapper lmEntity, double xp) intgetLevelOfMob(@NotNull org.bukkit.entity.LivingEntity livingEntity) Retrieve the level of a levelled mob.getMinAndMaxLevels(@NotNull LivingEntityInterface lmInterface) @NotNull NametagResultgetNametag(@NotNull LivingEntityWrapper lmEntity, boolean isDeathNametag) @NotNull NametagResultgetNametag(@NotNull LivingEntityWrapper lmEntity, boolean isDeathNametag, boolean preserveMobName) @NotNull PlayerLevelSourceResultgetPlayerLevelSourceNumber(@Nullable org.bukkit.entity.Player player, @NotNull LivingEntityWrapper lmEntity, @NotNull String variableToUse) booleanisLevelled(@NotNull org.bukkit.entity.LivingEntity livingEntity) Check if a LivingEntity is a levelled mob or not.voidmultiplyDrop(LivingEntityWrapper lmEntity, @NotNull org.bukkit.inventory.ItemStack currentDrop, double addition, boolean isCustomDrop) voidremoveLevel(@NotNull LivingEntityWrapper lmEntity) Un-level a mob.voidremoveVanillaDrops(@NotNull LivingEntityWrapper lmEntity, List<org.bukkit.inventory.ItemStack> drops) @NotNull StringreplaceStringPlaceholders(@NotNull String text, @NotNull LivingEntityWrapper lmEntity, boolean usePAPI, @Nullable org.bukkit.entity.Player player, boolean preserveMobName) voidsetLevelledItemDrops(LivingEntityWrapper lmEntity, @NotNull List<org.bukkit.inventory.ItemStack> currentDrops, boolean disableItemBoost) voidvoidvoid@NotNull NametagResultupdateNametag(@NotNull LivingEntityWrapper lmEntity, @NotNull StringReplacer nametag, boolean preserveMobName, String customDeathMessage) voidupdateNametag(@NotNull LivingEntityWrapper lmEntity, NametagResult nametag, List<org.bukkit.entity.Player> players) voidupdateNametag(LivingEntityWrapper lmEntity) voidupdateNametagWithDelay(@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:
generateLevelin 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:
generateLevelin 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:LevelInterfaceCheck if an existing mob is allowed to be levelled, according to the user's configuration.Thread-safety intended, but not tested.
- Specified by:
getLevellableStatein 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:
applyLevelToMobin 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:
isLevelledin 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:
getLevelOfMobin interfaceLevelInterface- Parameters:
livingEntity- the levelled mob to get the level of- Returns:
- the mob's level
-
removeLevel
Un-level a mob.- Specified by:
removeLevelin interfaceLevelInterface- Parameters:
lmEntity- levelled mob to un-level
-