RoseStacker
RoseStacker copied to clipboard
LevelledMobs Compatibility
Hi there!
LevelledMobs doesn't work nicely with mob stacking plugins. To patch this, RoseStacker could have a LevelledMobs hook which ensures mobs are not levelled by LM before they are stacked. This can be achieved solely through the Bukkit API, through this (untested and text-editor-derived) code:
private static NamespacedKey levelledMobsLevelKey = null;
public static boolean isLevelledMob(final @Nonnnull LivingEntity lent) {
if(levelledMobsLevelKey == null) {
final Plugin lmPlugin = Bukkit.getPluginManager().getPlugin("LevelledMobs");
if(plugin == null) return false;
levelledMobsLevelKey = new NamespacedKey(lmPlugin, "level")
}
return lent.getPersistentDataContainer().has(levelledMobsLevelKey, PersistentDataType.INTEGER);
}
Upon the release of LM version 4, there will be a lightweight API which can be used if preferred.
Thanks, Lachlan