diff --git a/pom.xml b/pom.xml index 044724fa3..e396c0d6c 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ me.lokka30 LevelledMobs - 3.7.2 b695 + 3.7.3 b701 jar LevelledMobs The Ultimate RPG Mob Levelling Plugin diff --git a/src/main/java/me/lokka30/levelledmobs/Companion.java b/src/main/java/me/lokka30/levelledmobs/Companion.java index 2b0e29e00..7551c165a 100644 --- a/src/main/java/me/lokka30/levelledmobs/Companion.java +++ b/src/main/java/me/lokka30/levelledmobs/Companion.java @@ -44,7 +44,6 @@ import me.lokka30.levelledmobs.listeners.PlayerInteractEventListener; import me.lokka30.levelledmobs.listeners.PlayerJoinListener; import me.lokka30.levelledmobs.listeners.PlayerPortalEventListener; -import me.lokka30.levelledmobs.listeners.ServerStartListener; import me.lokka30.levelledmobs.managers.ExternalCompatibilityManager; import me.lokka30.levelledmobs.managers.LevelManager; import me.lokka30.levelledmobs.managers.PlaceholderApiIntegration; @@ -292,7 +291,6 @@ void registerListeners() { pluginManager.registerEvents(new CombustListener(main), main); pluginManager.registerEvents(main.blockPlaceListener, main); pluginManager.registerEvents(new PlayerPortalEventListener(main), main); - pluginManager.registerEvents(new ServerStartListener(main), main); main.chunkLoadListener = new ChunkLoadListener(main); main.playerInteractEventListener = new PlayerInteractEventListener(main); pluginManager.registerEvents(main.playerInteractEventListener, main); diff --git a/src/main/java/me/lokka30/levelledmobs/LevelledMobs.java b/src/main/java/me/lokka30/levelledmobs/LevelledMobs.java index 494de67ef..d9fbb680b 100644 --- a/src/main/java/me/lokka30/levelledmobs/LevelledMobs.java +++ b/src/main/java/me/lokka30/levelledmobs/LevelledMobs.java @@ -26,6 +26,7 @@ import me.lokka30.levelledmobs.managers.MobsQueueManager; import me.lokka30.levelledmobs.managers.NametagQueueManager; import me.lokka30.levelledmobs.managers.PlaceholderApiIntegration; +import me.lokka30.levelledmobs.misc.FileLoader; import me.lokka30.levelledmobs.misc.LivingEntityWrapper; import me.lokka30.levelledmobs.misc.NamespacedKeys; import me.lokka30.levelledmobs.misc.NametagTimerChecker; @@ -127,6 +128,8 @@ public void onEnable() { levelManager.startNametagAutoUpdateTask(); levelManager.startNametagTimer(); } + + prepareToLoadCustomDrops(); companion.startCleanupTask(); companion.setupMetrics(); companion.checkUpdates(); @@ -135,6 +138,20 @@ public void onEnable() { Utils.logger.info("Start-up complete (took " + loadTime + "ms)"); } + private void prepareToLoadCustomDrops(){ + if (Bukkit.getPluginManager().getPlugin("LM_Items") != null){ + final LevelledMobs mainInstance = this; + Bukkit.getScheduler().scheduleSyncDelayedTask(this, () -> customDropsHandler.customDropsParser.loadDrops( + FileLoader.loadFile(mainInstance, "customdrops", FileLoader.CUSTOMDROPS_FILE_VERSION) + ), 10L); + } + else{ + customDropsHandler.customDropsParser.loadDrops( + FileLoader.loadFile(this, "customdrops", FileLoader.CUSTOMDROPS_FILE_VERSION) + ); + } + } + public void reloadLM(final @NotNull CommandSender sender) { migratedFromPre30 = false; List reloadStartedMsg = messagesCfg.getStringList( diff --git a/src/main/java/me/lokka30/levelledmobs/commands/subcommands/DebugSubcommand.java b/src/main/java/me/lokka30/levelledmobs/commands/subcommands/DebugSubcommand.java index 206dd1d41..16d5a13ae 100644 --- a/src/main/java/me/lokka30/levelledmobs/commands/subcommands/DebugSubcommand.java +++ b/src/main/java/me/lokka30/levelledmobs/commands/subcommands/DebugSubcommand.java @@ -85,7 +85,7 @@ private void doNbtDump(final @NotNull CommandSender sender, final String @NotNul } final LivingEntityWrapper lmEntity = main.levelledMobsCommand.rulesSubcommand.getMobBeingLookedAt( - player, true); + player, true, sender); if (lmEntity == null) { sender.sendMessage("Could not locate any mobs near player: " + player.getName()); return; @@ -110,11 +110,9 @@ private void doNbtDump(final @NotNull CommandSender sender, final String @NotNul lmEntity.getNameIfBaby(), lmEntity.getWorldName(), locationStr, - MiscUtils.getNBTDump(main.nametagQueueManager.nmsHandler.nmsVersionString, lmEntity.getLivingEntity()) + MiscUtils.getNBTDump(lmEntity.getLivingEntity(), main) ); - final String nmsVersion = main.nametagQueueManager.nmsHandler.nmsVersionString; - lmEntity.free(); Utils.logger.info(message); } diff --git a/src/main/java/me/lokka30/levelledmobs/commands/subcommands/RulesSubcommand.java b/src/main/java/me/lokka30/levelledmobs/commands/subcommands/RulesSubcommand.java index a8e1ed179..7b2e36bb0 100644 --- a/src/main/java/me/lokka30/levelledmobs/commands/subcommands/RulesSubcommand.java +++ b/src/main/java/me/lokka30/levelledmobs/commands/subcommands/RulesSubcommand.java @@ -346,7 +346,7 @@ private void showRule(final CommandSender sender, @NotNull final String @NotNull private void showEffectiveRules(@NotNull final Player player, final boolean showOnConsole, final boolean findNearbyEntities) { - final LivingEntityWrapper lmEntity = getMobBeingLookedAt(player, findNearbyEntities); + final LivingEntityWrapper lmEntity = getMobBeingLookedAt(player, findNearbyEntities, this.commandSender); if (lmEntity == null) { return; } @@ -389,7 +389,8 @@ public void run() { } @Nullable public LivingEntityWrapper getMobBeingLookedAt(@NotNull final Player player, - final boolean findNearbyEntities) { + final boolean findNearbyEntities, final @NotNull CommandSender sender) { + this.commandSender = sender; LivingEntity livingEntity = null; LivingEntityWrapper lmEntity = null; final Location eye = player.getEyeLocation(); diff --git a/src/main/java/me/lokka30/levelledmobs/listeners/EntityDamageListener.java b/src/main/java/me/lokka30/levelledmobs/listeners/EntityDamageListener.java index 5a08fa913..ed117c1e3 100644 --- a/src/main/java/me/lokka30/levelledmobs/listeners/EntityDamageListener.java +++ b/src/main/java/me/lokka30/levelledmobs/listeners/EntityDamageListener.java @@ -4,6 +4,7 @@ package me.lokka30.levelledmobs.listeners; +import java.time.Instant; import java.util.HashSet; import java.util.List; import me.lokka30.levelledmobs.LevelledMobs; @@ -27,6 +28,7 @@ import org.bukkit.event.Listener; import org.bukkit.event.entity.EntityDamageByEntityEvent; import org.bukkit.event.entity.EntityDamageEvent; +import org.bukkit.persistence.PersistentDataType; import org.jetbrains.annotations.NotNull; /** @@ -119,6 +121,8 @@ public void onEntityDamageEvent(@NotNull final EntityDamageEvent event) { } } + lmEntity.getPDC().set(main.namespacedKeys.lastDamageTime, PersistentDataType.LONG, Instant.now().toEpochMilli()); + // Update their nametag with a 1 tick delay so that their health after the damage is shown main.levelManager.updateNametagWithDelay(lmEntity); lmEntity.free(); diff --git a/src/main/java/me/lokka30/levelledmobs/listeners/ServerStartListener.java b/src/main/java/me/lokka30/levelledmobs/listeners/ServerStartListener.java deleted file mode 100644 index 9d3017304..000000000 --- a/src/main/java/me/lokka30/levelledmobs/listeners/ServerStartListener.java +++ /dev/null @@ -1,24 +0,0 @@ -package me.lokka30.levelledmobs.listeners; - -import me.lokka30.levelledmobs.LevelledMobs; -import me.lokka30.levelledmobs.misc.FileLoader; -import org.bukkit.event.EventHandler; -import org.bukkit.event.EventPriority; -import org.bukkit.event.Listener; -import org.bukkit.event.server.ServerLoadEvent; - -public class ServerStartListener implements Listener { - - public ServerStartListener(final LevelledMobs main) { - this.main = main; - } - - private final LevelledMobs main; - - @EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR) - private void onServerLoadEvent(final ServerLoadEvent event) { - main.customDropsHandler.customDropsParser.loadDrops( - FileLoader.loadFile(main, "customdrops", FileLoader.CUSTOMDROPS_FILE_VERSION) - ); - } -} diff --git a/src/main/java/me/lokka30/levelledmobs/managers/ExternalCompatibilityManager.java b/src/main/java/me/lokka30/levelledmobs/managers/ExternalCompatibilityManager.java index c7bc3c724..b8a6e2d8d 100644 --- a/src/main/java/me/lokka30/levelledmobs/managers/ExternalCompatibilityManager.java +++ b/src/main/java/me/lokka30/levelledmobs/managers/ExternalCompatibilityManager.java @@ -193,25 +193,10 @@ public static boolean isMythicMob(@NotNull final LivingEntityWrapper lmEntity) { return false; } - if (!p.getDescription().getVersion().startsWith("4.12") && !p.getDescription().getVersion() - .startsWith("5.")) { - final NamespacedKey mmKey = new NamespacedKey(p, "type"); - synchronized (lmEntity.getLivingEntity().getPersistentDataContainer()) { - return lmEntity.getPDC().has(mmKey, PersistentDataType.STRING); - } - } - - if (lmEntity.getLivingEntity().hasMetadata("mythicmob")) { - final List metadatas = lmEntity.getLivingEntity() - .getMetadata("mythicmob"); - for (final MetadataValue md : metadatas) { - if (md.asBoolean()) { - return true; - } - } + final NamespacedKey mmKey = new NamespacedKey(p, "type"); + synchronized (lmEntity.getLivingEntity().getPersistentDataContainer()) { + return lmEntity.getPDC().has(mmKey, PersistentDataType.STRING); } - - return false; } @NotNull public static String getMythicMobInternalName(@NotNull final LivingEntityWrapper lmEntity) { @@ -224,33 +209,11 @@ public static boolean isMythicMob(@NotNull final LivingEntityWrapper lmEntity) { return ""; } - final boolean useNamespaceKey = - p.getDescription().getVersion().startsWith("5.") && - !p.getDescription().getVersion().startsWith("5.01") && - !p.getDescription().getVersion().startsWith("5.00"); - - if (useNamespaceKey) { - final NamespacedKey mmKey = new NamespacedKey(p, "type"); - synchronized (lmEntity.getLivingEntity().getPersistentDataContainer()) { - if (lmEntity.getPDC().has(mmKey, PersistentDataType.STRING)) { - final String type = lmEntity.getPDC().get(mmKey, PersistentDataType.STRING); - return type == null ? "" : type; - } else { - return ""; - } - } - } - - // MM version 4, 5.00 and 5.01 detection below: - - if (!lmEntity.getLivingEntity().hasMetadata("mobname")) { - return ""; - } - - final List metadatas = lmEntity.getLivingEntity().getMetadata("mobname"); - for (final MetadataValue md : metadatas) { - if ("true".equalsIgnoreCase(md.asString())) { - return md.asString(); + final NamespacedKey mmKey = new NamespacedKey(p, "type"); + synchronized (lmEntity.getLivingEntity().getPersistentDataContainer()) { + if (lmEntity.getPDC().has(mmKey, PersistentDataType.STRING)) { + final String type = lmEntity.getPDC().get(mmKey, PersistentDataType.STRING); + return type == null ? "" : type; } } diff --git a/src/main/java/me/lokka30/levelledmobs/managers/LevelManager.java b/src/main/java/me/lokka30/levelledmobs/managers/LevelManager.java index 3d37d5dd1..a9354d642 100644 --- a/src/main/java/me/lokka30/levelledmobs/managers/LevelManager.java +++ b/src/main/java/me/lokka30/levelledmobs/managers/LevelManager.java @@ -250,7 +250,7 @@ private int generateRandomLevel(RandomLevellingStrategy randomLevelling, final i int levelSource; final String variableToUse = - Utils.isNullOrEmpty(options.variable) ? "%level%" : options.variable; + Utils.isNullOrEmpty(options.variable) ? "%level%" : options.variable; final double scale = options.playerLevelScale != null ? options.playerLevelScale : 1.0; final boolean usePlayerMax = options.usePlayerMaxLevel != null && options.usePlayerMaxLevel; final boolean matchPlayerLvl = options.matchPlayerLevel != null && options.matchPlayerLevel; @@ -348,13 +348,19 @@ private int generateRandomLevel(RandomLevellingStrategy randomLevelling, final i } } + if (options.recheckPlayers != null && options.recheckPlayers) { + final String numberOrString = playerLevelSourceResult.isNumericResult ? + playerLevelSourceResult.numericResult + "" : playerLevelSourceResult.stringResult; + if (numberOrString != null) + lmEntity.getPDC().set(main.namespacedKeys.playerLevellingSourceNumber, PersistentDataType.STRING, numberOrString); + } lmEntity.playerLevellingAllowDecrease = options.decreaseLevel; return results; } - public PlayerLevelSourceResult getPlayerLevelSourceNumber(final Player player, - final String variableToUse) { + public @NotNull PlayerLevelSourceResult getPlayerLevelSourceNumber(final @Nullable Player player, + final @NotNull String variableToUse) { if (player == null) { return new PlayerLevelSourceResult(1); } @@ -973,10 +979,13 @@ private void runNametagCheck_aSync(final @NotNull Map> enti lmEntity.playerForPermissionsCheck = player; if (lmEntity.isLevelled()) { - final boolean skipLevelling = ( + boolean skipLevelling = ( lmEntity.getSpawnReason() == LevelledMobSpawnReason.LM_SPAWNER || lmEntity.getSpawnReason() == LevelledMobSpawnReason.LM_SUMMON ); + if (main.configUtils.playerLevellingEnabled && !checkIfReadyForRelevelling(lmEntity)){ + skipLevelling = true; + } if (main.configUtils.playerLevellingEnabled && !skipLevelling) { final boolean hasKey = entityToPlayer.containsKey(lmEntity); final List players = hasKey ? @@ -1046,6 +1055,25 @@ private void runNametagCheck_aSync(final @NotNull Map> enti } } + private boolean checkIfReadyForRelevelling(final @NotNull LivingEntityWrapper lmEntity){ + final PlayerLevellingOptions opts = main.rulesManager.getRulePlayerLevellingOptions(lmEntity); + if (opts == null || opts.preserveEntityTime == null) { + return true; + } + + if (!lmEntity.getPDC().has(main.namespacedKeys.lastDamageTime)){ + return true; + } + + final Long lastLevelledTime = lmEntity.getPDC().get(main.namespacedKeys.lastDamageTime, PersistentDataType.LONG); + if (lastLevelledTime == null) { + return true; + } + + final Instant levelledTime = Instant.ofEpochMilli(lastLevelledTime); + return Utils.getMillisecondsFromInstant(levelledTime) > opts.preserveEntityTime; + } + private void checkEntityForPlayerLevelling(final @NotNull LivingEntityWrapper lmEntity, final @NotNull List players) { final LivingEntity mob = lmEntity.getLivingEntity(); @@ -1079,7 +1107,7 @@ private void checkEntityForPlayerLevelling(final @NotNull LivingEntityWrapper lm main.companion.removeRecentlyJoinedPlayer(closestPlayer); } - if (doesMobNeedRelevelling(mob, closestPlayer)) { + if (doesMobNeedRelevelling(lmEntity, closestPlayer)) { lmEntity.pendingPlayerIdToSet = closestPlayer.getUniqueId().toString(); lmEntity.setPlayerForLevelling(closestPlayer); lmEntity.reEvaluateLevel = true; @@ -1119,8 +1147,10 @@ private void checkLevelledEntity(@NotNull final LivingEntityWrapper lmEntity, } } - private boolean doesMobNeedRelevelling(final @NotNull LivingEntity mob, + private boolean doesMobNeedRelevelling(final @NotNull LivingEntityWrapper lmEntity, final @NotNull Player player) { + final LivingEntity mob = lmEntity.getLivingEntity(); + if (main.playerLevellingMinRelevelTime > 0L && main.playerLevellingEntities.containsKey( mob)) { final Instant lastCheck = main.playerLevellingEntities.get(mob); @@ -1152,6 +1182,21 @@ private boolean doesMobNeedRelevelling(final @NotNull LivingEntity mob, return true; } + final PlayerLevellingOptions opts = main.rulesManager.getRulePlayerLevellingOptions(lmEntity); + if (player.getUniqueId().toString().equals(playerId) && opts != null && opts.recheckPlayers != null && opts.recheckPlayers){ + final String previousResult = lmEntity.getPDC().get(main.namespacedKeys.playerLevellingSourceNumber, PersistentDataType.STRING); + if (previousResult == null) { + return true; + } + final String variableToUse = + Utils.isNullOrEmpty(opts.variable) ? "%level%" : opts.variable; + PlayerLevelSourceResult result = getPlayerLevelSourceNumber(player, variableToUse); + final String sourceNumberStr = result.isNumericResult ? + result.numericResult + "" : result.stringResult; + + return !previousResult.equals(sourceNumberStr); + } + return !player.getUniqueId().toString().equals(playerId); } diff --git a/src/main/java/me/lokka30/levelledmobs/misc/NamespacedKeys.java b/src/main/java/me/lokka30/levelledmobs/misc/NamespacedKeys.java index d0fece0e0..efa05d77f 100644 --- a/src/main/java/me/lokka30/levelledmobs/misc/NamespacedKeys.java +++ b/src/main/java/me/lokka30/levelledmobs/misc/NamespacedKeys.java @@ -33,6 +33,8 @@ public NamespacedKeys(final LevelledMobs main) { lockedNameOverride = new NamespacedKey(main, "lockedNameOverride"); lockedDropRules = new NamespacedKey(main, "lockedDropRules"); lockedDropRulesOverride = new NamespacedKey(main, "lockedDropRulesOverride"); + playerLevellingSourceNumber = new NamespacedKey(main, "playerLevellingSourceNumber"); + lastDamageTime = new NamespacedKey(main, "lastDamageTime"); spawnerEgg = new NamespacedKey(main, "spawnerEgg"); spawnerEggName = new NamespacedKey(main, "spawnerEggName"); @@ -70,6 +72,8 @@ public NamespacedKeys(final LevelledMobs main) { public final NamespacedKey playerNetherCoords; public final NamespacedKey playerNetherCoordsIntoWorld; public final NamespacedKey skyLightLevel; + public final NamespacedKey playerLevellingSourceNumber; + public final NamespacedKey lastDamageTime; public final NamespacedKey lockSettings; public final NamespacedKey lockedNametag; diff --git a/src/main/java/me/lokka30/levelledmobs/nms/MiscUtils.java b/src/main/java/me/lokka30/levelledmobs/nms/MiscUtils.java index 2c4206a28..09c28684c 100644 --- a/src/main/java/me/lokka30/levelledmobs/nms/MiscUtils.java +++ b/src/main/java/me/lokka30/levelledmobs/nms/MiscUtils.java @@ -1,6 +1,6 @@ package me.lokka30.levelledmobs.nms; -import me.lokka30.levelledmobs.util.Utils; +import me.lokka30.levelledmobs.LevelledMobs; import net.minecraft.nbt.CompoundTag; import org.bukkit.entity.LivingEntity; import org.jetbrains.annotations.NotNull; @@ -8,21 +8,67 @@ import java.lang.reflect.Method; public class MiscUtils { - public static @NotNull String getNBTDump(final String nmsVersion, final LivingEntity livingEntity){ - final CompoundTag compoundTag = new CompoundTag(); - final Class clazz_CraftLivingEntity; + public static @NotNull String getNBTDump(final @NotNull LivingEntity livingEntity, final @NotNull LevelledMobs main){ + final String nmsVersion = main.nametagQueueManager.nmsHandler.nmsVersionString; + if (main.nametagQueueManager.nmsHandler.minecraftVersion <= 1.16){ + return getNBTDump_1_16(livingEntity, nmsVersion); + } + try { + final Class clazz_CraftLivingEntity; + clazz_CraftLivingEntity = Class.forName( "org.bukkit.craftbukkit." + nmsVersion + ".entity.CraftLivingEntity"); - final Method method_getHandle = clazz_CraftLivingEntity.getDeclaredMethod("getHandle"); - final net.minecraft.world.entity.LivingEntity internalLivingEntity = (net.minecraft.world.entity.LivingEntity) method_getHandle.invoke( - livingEntity); - internalLivingEntity.saveWithoutId(compoundTag); + final Method method_getHandle = clazz_CraftLivingEntity.getDeclaredMethod("getHandle"); + final net.minecraft.world.entity.LivingEntity internalLivingEntity = (net.minecraft.world.entity.LivingEntity) method_getHandle.invoke( + livingEntity); + + final Class compoundTagClazz = Class.forName("net.minecraft.nbt.NBTTagCompound"); + final Object compoundTag = compoundTagClazz.getConstructor().newInstance(); + + if (main.nametagQueueManager.nmsHandler.minecraftVersion >= 1.18){ + internalLivingEntity.saveWithoutId((CompoundTag) compoundTag); + } + else { + final Class entityClazz = Class.forName("net.minecraft.world.entity.Entity"); + final Method saveWithoutId = entityClazz.getDeclaredMethod("save", compoundTagClazz); + saveWithoutId.invoke(internalLivingEntity, compoundTag); + } + return compoundTag.toString(); + } catch (Exception e) { + e.printStackTrace(); + } + + return ""; + } + + private static @NotNull String getNBTDump_1_16(final @NotNull LivingEntity livingEntity, final String nmsVersion){ + final String compoundTagName = "net.minecraft.server.v1_16_R3.NBTTagCompound"; + final String methodName = "save"; + + try { + final Class clazz_CraftLivingEntity; + + clazz_CraftLivingEntity = Class.forName( + "org.bukkit.craftbukkit." + nmsVersion + ".entity.CraftLivingEntity"); + final Method method_getHandle = clazz_CraftLivingEntity.getDeclaredMethod("getHandle"); + + // net.minecraft.server.v1_16_R3.EntityLiving + final Object internalLivingEntity = method_getHandle.invoke(livingEntity); + + final Class compoundTagClazz = Class.forName(compoundTagName); + final Object compoundTag = compoundTagClazz.getConstructor().newInstance(); + + final Class clazz_Entity = Class.forName("net.minecraft.server." + nmsVersion + ".Entity"); + final Method saveWithoutId = clazz_Entity.getDeclaredMethod(methodName, compoundTagClazz); + saveWithoutId.invoke(internalLivingEntity, compoundTag); + + return compoundTag.toString(); } catch (Exception e) { - Utils.logger.warning("Error getting nbt_dump: " + e.getMessage()); + e.printStackTrace(); } - return compoundTag.toString(); + return ""; } } diff --git a/src/main/java/me/lokka30/levelledmobs/rules/PlayerLevellingOptions.java b/src/main/java/me/lokka30/levelledmobs/rules/PlayerLevellingOptions.java index f17097ff3..9f492308c 100644 --- a/src/main/java/me/lokka30/levelledmobs/rules/PlayerLevellingOptions.java +++ b/src/main/java/me/lokka30/levelledmobs/rules/PlayerLevellingOptions.java @@ -26,7 +26,9 @@ public class PlayerLevellingOptions implements Cloneable { public Boolean matchPlayerLevel; public Boolean enabled; public Boolean usePlayerMaxLevel; + public Boolean recheckPlayers; public Integer levelCap; + public Long preserveEntityTime; public Double playerLevelScale; public String variable; public boolean decreaseLevel; @@ -55,6 +57,9 @@ public void mergeRule(final PlayerLevellingOptions options) { if (options.enabled != null) { this.enabled = options.enabled; } + if (options.recheckPlayers != null) { + this.recheckPlayers = options.recheckPlayers; + } } public PlayerLevellingOptions cloneItem() { @@ -127,6 +132,13 @@ public String toString() { sb.append("decrease-lvl"); } + if (recheckPlayers != null && recheckPlayers){ + if (sb.length() > 0) { + sb.append(", "); + } + sb.append("rechk-plr"); + } + if (sb.length() == 0) { return super.toString(); } else { diff --git a/src/main/java/me/lokka30/levelledmobs/rules/RulesParsingManager.java b/src/main/java/me/lokka30/levelledmobs/rules/RulesParsingManager.java index 8c91cdde2..1a049e8f4 100644 --- a/src/main/java/me/lokka30/levelledmobs/rules/RulesParsingManager.java +++ b/src/main/java/me/lokka30/levelledmobs/rules/RulesParsingManager.java @@ -1254,6 +1254,8 @@ private void parsePlayerLevellingOptions(final ConfigurationSection cs) { options.enabled = ymlHelper.getBoolean2(cs, "enabled", options.enabled); options.variable = ymlHelper.getString(cs, "variable", options.variable); options.decreaseLevel = ymlHelper.getBoolean(cs, "decrease-level", true); + options.recheckPlayers = ymlHelper.getBoolean2(cs, "recheck-players", options.recheckPlayers); + options.preserveEntityTime = ymlHelper.getIntTimeUnitMS(cs, "preserve-entity", options.preserveEntityTime); parsingInfo.playerLevellingOptions = options; final ConfigurationSection csTiers = objTo_CS(cs, "tiers"); diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index c6e3ae84d..aff580fba 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -18,6 +18,7 @@ softdepend: - SimplePets - Essentials - LM_Items + - SCore commands: levelledmobs: diff --git a/src/main/resources/rules.yml b/src/main/resources/rules.yml index c24218981..9e1ce7236 100644 --- a/src/main/resources/rules.yml +++ b/src/main/resources/rules.yml @@ -115,6 +115,8 @@ presets: match-level: true use-player-max-level: false decrease-level: true + recheck-players: false + preserve-entity: 10s player-level-scale: 1.0 level-cap: 30 tiers: