Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/3.8-dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
lokka30 committed Oct 23, 2022
2 parents dc43252 + 3b7defb commit c87939b
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 8 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.8.0 b716</version>
<version>3.8.1 b718</version>
<packaging>jar</packaging>
<name>LevelledMobs</name>
<description>The Ultimate RPG Mob Levelling Plugin</description>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,20 @@ public class FineTuningAttributes implements Cloneable {
public Double xpDrop;
public boolean doNotMerge;

public boolean isEmpty(){
try {
for (Field f : this.getClass().getDeclaredFields()){
if (f.get(this) instanceof Double && f.get(this) != null){
return false;
}
}
} catch (IllegalAccessException e) {
e.printStackTrace();
}

return true;
}

void mergeAttributes(final @Nullable FineTuningAttributes attributes) {
if (attributes == null) {
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1328,7 +1328,7 @@ private void parseFineTuning(final @Nullable ConfigurationSection cs) {

parsingInfo.vanillaBonuses = (CachedModalList<VanillaBonusEnum>) buildCachedModalOfType(cs,
parsingInfo.vanillaBonuses, ModalListParsingTypes.VANILLA_BONUSES);
parsingInfo.allMobMultipliers = parseFineTuningValues(cs);
parsingInfo.allMobMultipliers = parseFineTuningValues(cs, parsingInfo.allMobMultipliers);

final ConfigurationSection cs_Custom = objTo_CS(cs, "custom-mob-level");
if (cs_Custom == null) {
Expand All @@ -1354,7 +1354,7 @@ private void parseFineTuning(final @Nullable ConfigurationSection cs) {
}

final FineTuningAttributes attribs = parseFineTuningValues(
objTo_CS(cs_Custom, mobName));
objTo_CS(cs_Custom, mobName), null);
if (attribs == null) {
continue;
}
Expand All @@ -1371,12 +1371,16 @@ private void parseFineTuning(final @Nullable ConfigurationSection cs) {
}
}

private @Nullable FineTuningAttributes parseFineTuningValues(final @Nullable ConfigurationSection cs) {
private @Nullable FineTuningAttributes parseFineTuningValues(final @Nullable ConfigurationSection cs,
final @Nullable FineTuningAttributes defaults) {
if (cs == null) {
return null;
return defaults;
}

final FineTuningAttributes attribs = new FineTuningAttributes();
final boolean doMerge = ymlHelper.getBoolean(cs, "merge", true);

final FineTuningAttributes attribs = parsingInfo.allMobMultipliers != null && doMerge ?
parsingInfo.allMobMultipliers : new FineTuningAttributes();

attribs.maxHealth = ymlHelper.getDouble2(cs, "max-health", attribs.maxHealth);
attribs.movementSpeed = ymlHelper.getDouble2(cs, "movement-speed", attribs.movementSpeed);
Expand All @@ -1402,6 +1406,10 @@ private void parseFineTuning(final @Nullable ConfigurationSection cs) {
attribs.followRange = ymlHelper.getDouble2(cs, "follow-range", attribs.followRange);
attribs.doNotMerge = ymlHelper.getBoolean(cs, "do-not-merge", false);

if (attribs.isEmpty()) {
return defaults;
}

return attribs;
}

Expand Down
3 changes: 1 addition & 2 deletions src/main/resources/rules.yml
Original file line number Diff line number Diff line change
Expand Up @@ -349,8 +349,7 @@ default-rule:
apply-settings:
multipliers:
vanilla-bonus:
allowed-list: 'BABY_SPEED_BOOST'
excluded-list: '*'
excluded-list: ['LEADER_ZOMBIE_BONUS', 'RANDOM_SPAWN_BONUS']

sunlight-intensity: 5
creeper-max-damage-radius: 3
Expand Down

0 comments on commit c87939b

Please sign in to comment.