Skip to content

Commit

Permalink
Merge branch '3.9-dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
lokka30 committed Mar 19, 2023
2 parents 5cb5da3 + cb1a0f9 commit d48206b
Show file tree
Hide file tree
Showing 6 changed files with 86 additions and 73 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>me.lokka30</groupId>
<artifactId>LevelledMobs</artifactId>
<version>3.9.4 b740</version>
<version>3.9.5 b743</version>

<name>LevelledMobs</name>
<description>The Ultimate RPG Mob Levelling Solution</description>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ else if (ver.getMinecraftVersion() <= 1.17) {

// net.minecraft.world.level.entity.EntityAccess ->
// int getId() ->
if (this.isOneNinteenThreeOrNewer){
if (ver.getMinecraftVersion() >= 1.18){
if (ver.getRevision() >= 4){
methodName = "af";
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

import me.lokka30.levelledmobs.LevelledMobs;
import me.lokka30.levelledmobs.result.NametagResult;
import me.lokka30.levelledmobs.util.Utils;
import me.lokka30.microlib.messaging.MessageUtils;
import org.bukkit.Bukkit;
import org.bukkit.entity.LivingEntity;
Expand Down Expand Up @@ -220,7 +221,7 @@ private Optional<Object> buildNametagComponent(
final int displayNameIndex = mobName.indexOf(displayName);

if (displayNameIndex < 0) {
final Object comp = ComponentUtils.getTextComponent(nametag.getNametagNonNull());
final Object comp = ComponentUtils.getTextComponent(MessageUtils.colorizeAll(nametag.getNametagNonNull()));
return comp == null ?
Optional.empty() : Optional.of(comp);
}
Expand Down
134 changes: 67 additions & 67 deletions src/main/java/me/lokka30/levelledmobs/rules/RuleInfo.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,80 +39,80 @@ public RuleInfo(final String id) {
}

private String ruleName;
@DoNotMerge boolean ruleIsEnabled;
public @DoNotMerge boolean ruleIsEnabled;
@DoNotMerge boolean isTempDisabled;
Boolean disableVanillaDropsOnChunkMax;
boolean useNoSpawnerParticles;
Boolean babyMobsInheritAdultSetting;
Boolean mobLevelInheritance;
public Boolean disableVanillaDropsOnChunkMax;
public boolean useNoSpawnerParticles;
public Boolean babyMobsInheritAdultSetting;
public Boolean mobLevelInheritance;
public Boolean customDrops_UseForMobs;
Boolean customDrops_UseOverride;
Boolean stopProcessingRules;
Boolean useRandomLevelling;
Boolean mergeEntityNameOverrides;
Boolean passengerMatchLevel;
public Boolean customDrops_UseOverride;
public Boolean stopProcessingRules;
public Boolean useRandomLevelling;
public Boolean mergeEntityNameOverrides;
public Boolean passengerMatchLevel;
Boolean lockEntity;
@DoNotMerge int rulePriority;
Integer spawnerParticlesCount;
Integer maxRandomVariance;
Integer creeperMaxDamageRadius;
Integer conditions_MinLevel;
Integer conditions_MaxLevel;
Integer restrictions_MinLevel;
Integer restrictions_MaxLevel;
Integer conditions_ApplyAboveY;
Integer conditions_ApplyBelowY;
Integer conditions_MinDistanceFromSpawn;
Integer conditions_MaxDistanceFromSpawn;
Long nametagVisibleTime;
Integer maximumDeathInChunkThreshold;
Integer chunkMaxCoolDownTime;
Integer maxAdjacentChunks;
Long conditions_CooldownTime;
Integer conditions_TimesToCooldownActivation;
Float conditions_Chance;
Double sunlightBurnAmount;
public Integer spawnerParticlesCount;
public Integer maxRandomVariance;
public Integer creeperMaxDamageRadius;
public Integer conditions_MinLevel;
public Integer conditions_MaxLevel;
public Integer restrictions_MinLevel;
public Integer restrictions_MaxLevel;
public Integer conditions_ApplyAboveY;
public Integer conditions_ApplyBelowY;
public Integer conditions_MinDistanceFromSpawn;
public Integer conditions_MaxDistanceFromSpawn;
public Long nametagVisibleTime;
public Integer maximumDeathInChunkThreshold;
public Integer chunkMaxCoolDownTime;
public Integer maxAdjacentChunks;
public Long conditions_CooldownTime;
public Integer conditions_TimesToCooldownActivation;
public Float conditions_Chance;
public Double sunlightBurnAmount;
public String nametag;
String nametag_CreatureDeath;
String nametag_Placeholder_Levelled;
String nametag_Placeholder_Unlevelled;
@DoNotMerge String presetName;
final @NotNull List<String> customDrop_DropTableIds;
HealthIndicator healthIndicator;
MobCustomNameStatus conditions_MobCustomnameStatus;
MobTamedStatus conditions_MobTamedStatus;
LevellingStrategy levellingStrategy;
PlayerLevellingOptions playerLevellingOptions;
Map<String, List<LevelTierMatching>> entityNameOverrides_Level;
Map<String, LevelTierMatching> entityNameOverrides;
DeathMessages deathMessages;
public String nametag_CreatureDeath;
public String nametag_Placeholder_Levelled;
public String nametag_Placeholder_Unlevelled;
public @DoNotMerge String presetName;
public final @NotNull List<String> customDrop_DropTableIds;
public HealthIndicator healthIndicator;
public MobCustomNameStatus conditions_MobCustomnameStatus;
public MobTamedStatus conditions_MobTamedStatus;
public LevellingStrategy levellingStrategy;
public PlayerLevellingOptions playerLevellingOptions;
public Map<String, List<LevelTierMatching>> entityNameOverrides_Level;
public Map<String, LevelTierMatching> entityNameOverrides;
public DeathMessages deathMessages;
public List<NametagVisibilityEnum> nametagVisibilityEnum;
@NotNull @DoNotMerge public final Map<String, String> ruleSourceNames;
public @NotNull @DoNotMerge final Map<String, String> ruleSourceNames;
public Particle spawnerParticle;
List<TieredColoringInfo> tieredColoringInfos;
Map<ExternalCompatibilityManager.ExternalCompatibility, Boolean> enabledExtCompats;
MergeableStringList mobNBT_Data;
CachedModalList<String> allowedEntities;
MinAndMax conditions_SkyLightLevel;
CachedModalList<String> conditions_Worlds;
CachedModalList<String> conditions_Entities;
CachedModalList<Biome> conditions_Biomes;
CachedModalList<String> conditions_ApplyPlugins;
CachedModalList<String> conditions_CustomNames;
CachedModalList<String> conditions_NoDropEntities;
CachedModalList<String> conditions_WGRegions;
CachedModalList<String> conditions_WGRegionOwners;
CachedModalList<String> conditions_MM_Names;
CachedModalList<String> conditions_SpawnerNames;
CachedModalList<String> conditions_SpawnegEggNames;
CachedModalList<String> conditions_ScoreboardTags;
CachedModalList<MinAndMax> conditions_WorldTickTime;
CachedModalList<VanillaBonusEnum> vanillaBonuses;
CachedModalList<LevelledMobSpawnReason> conditions_SpawnReasons;
CachedModalList<String> conditions_Permission;
WithinCoordinates conditions_WithinCoords;
@Nullable FineTuningAttributes allMobMultipliers;
Map<String, FineTuningAttributes> specificMobMultipliers;
public List<TieredColoringInfo> tieredColoringInfos;
public Map<ExternalCompatibilityManager.ExternalCompatibility, Boolean> enabledExtCompats;
public MergeableStringList mobNBT_Data;
public CachedModalList<String> allowedEntities;
public MinAndMax conditions_SkyLightLevel;
public CachedModalList<String> conditions_Worlds;
public CachedModalList<String> conditions_Entities;
public CachedModalList<Biome> conditions_Biomes;
public CachedModalList<String> conditions_ApplyPlugins;
public CachedModalList<String> conditions_CustomNames;
public CachedModalList<String> conditions_NoDropEntities;
public CachedModalList<String> conditions_WGRegions;
public CachedModalList<String> conditions_WGRegionOwners;
public CachedModalList<String> conditions_MM_Names;
public CachedModalList<String> conditions_SpawnerNames;
public CachedModalList<String> conditions_SpawnegEggNames;
public CachedModalList<String> conditions_ScoreboardTags;
public CachedModalList<MinAndMax> conditions_WorldTickTime;
public CachedModalList<VanillaBonusEnum> vanillaBonuses;
public CachedModalList<LevelledMobSpawnReason> conditions_SpawnReasons;
public CachedModalList<String> conditions_Permission;
public WithinCoordinates conditions_WithinCoords;
public @Nullable FineTuningAttributes allMobMultipliers;
public Map<String, FineTuningAttributes> specificMobMultipliers;

public String getRuleName() {
return this.ruleName;
Expand Down
7 changes: 7 additions & 0 deletions src/main/java/me/lokka30/levelledmobs/rules/RulesManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,13 @@ public boolean getRuleIsWorldAllowedInAnyRule(final @Nullable World world) {
return result;
}

public void addCustomRule(final @Nullable RuleInfo ri){
if (ri == null) return;

main.rulesParsingManager.customRules.add(ri);
main.rulesParsingManager.checkCustomRules();
}

@NotNull public List<String> getRuleNbtData(final @NotNull LivingEntityWrapper lmEntity) {
final List<String> nbtData = new LinkedList<>();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,16 @@ public void parseRulesMain(final @Nullable YamlConfiguration config) {
|| this.defaultRule.conditions_WGRegionOwners != null;

this.main.rulesManager.buildBiomeGroupMappings(customBiomeGroups);
final Map<String, RuleInfo> ruleMappings = new TreeMap<>(String.CASE_INSENSITIVE_ORDER);
this.customRules = parseCustomRules(
config.get(ymlHelper.getKeyNameFromConfig(config, "custom-rules")));

checkCustomRules();
autoGenerateWeightedRandom();
}

public void checkCustomRules(){
final Map<String, RuleInfo> ruleMappings = new TreeMap<>(String.CASE_INSENSITIVE_ORDER);

for (final RuleInfo ruleInfo : customRules) {
if (!this.main.rulesManager.rulesInEffect.containsKey(ruleInfo.rulePriority)) {
this.main.rulesManager.rulesInEffect.put(ruleInfo.rulePriority, new LinkedList<>());
Expand All @@ -116,8 +123,6 @@ public void parseRulesMain(final @Nullable YamlConfiguration config) {
this.main.rulesManager.ruleNameMappings.putAll(ruleMappings);
this.main.rulesManager.rulesCooldown.clear();
}

autoGenerateWeightedRandom();
}

public @NotNull List<RuleInfo> getAllRules() {
Expand Down

0 comments on commit d48206b

Please sign in to comment.