From 37280856d5f509d965b7d344b0f4f2caf6ccad88 Mon Sep 17 00:00:00 2001 From: Jamie Sinn Date: Sun, 7 May 2017 15:22:46 -0400 Subject: [PATCH] Add config toggle for breaking glass with Berserk. --- .../java/com/gmail/nossr50/config/AdvancedConfig.java | 9 +++++---- .../com/gmail/nossr50/datatypes/skills/AbilityType.java | 7 ++++++- src/main/resources/advanced.yml | 3 +++ 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/gmail/nossr50/config/AdvancedConfig.java b/src/main/java/com/gmail/nossr50/config/AdvancedConfig.java index 0469583ef..1097e537c 100644 --- a/src/main/java/com/gmail/nossr50/config/AdvancedConfig.java +++ b/src/main/java/com/gmail/nossr50/config/AdvancedConfig.java @@ -1,9 +1,5 @@ package com.gmail.nossr50.config; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - import com.gmail.nossr50.datatypes.skills.SecondaryAbility; import com.gmail.nossr50.datatypes.skills.SkillType; import com.gmail.nossr50.skills.alchemy.Alchemy; @@ -14,6 +10,10 @@ import com.gmail.nossr50.skills.salvage.Salvage; import com.gmail.nossr50.skills.smelting.Smelting; import com.gmail.nossr50.util.StringUtils; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + public class AdvancedConfig extends AutoUpdateConfigLoader { private static AdvancedConfig instance; @@ -842,6 +842,7 @@ public class AdvancedConfig extends AutoUpdateConfigLoader { public double getIronArmMaxBonus() { return config.getDouble("Skills.Unarmed.IronArm.BonusMax", 8.0D); } public int getIronArmIncreaseLevel() { return config.getInt("Skills.Unarmed.IronArm.IncreaseLevel", 50); } public boolean getDisarmProtected() { return config.getBoolean("Skills.Unarmed.Disarm.AntiTheft", false); } + public boolean getBerserkBreakGlass() { return config.getBoolean("Skills.Unarmed.Berserk.BreakGlass", false); } /* WOODCUTTING */ public int getLeafBlowUnlockLevel() { return config.getInt("Skills.Woodcutting.LeafBlower.UnlockLevel", 100); } diff --git a/src/main/java/com/gmail/nossr50/datatypes/skills/AbilityType.java b/src/main/java/com/gmail/nossr50/datatypes/skills/AbilityType.java index 8dd8454b5..cd6ba93b8 100644 --- a/src/main/java/com/gmail/nossr50/datatypes/skills/AbilityType.java +++ b/src/main/java/com/gmail/nossr50/datatypes/skills/AbilityType.java @@ -1,5 +1,6 @@ package com.gmail.nossr50.datatypes.skills; +import com.gmail.nossr50.config.AdvancedConfig; import org.bukkit.Material; import org.bukkit.block.BlockState; import org.bukkit.entity.Player; @@ -184,7 +185,11 @@ public enum AbilityType { public boolean blockCheck(BlockState blockState) { switch (this) { case BERSERK: - return (BlockUtils.affectedByGigaDrillBreaker(blockState) || blockState.getType() == Material.SNOW); + return (BlockUtils.affectedByGigaDrillBreaker(blockState) || blockState.getType() == Material.SNOW + || (AdvancedConfig.getInstance().getBerserkBreakGlass() && ( blockState.getType() == Material.GLASS + || blockState.getType() == Material.THIN_GLASS + || blockState.getType() == Material.STAINED_GLASS + || blockState.getType() == Material.STAINED_GLASS_PANE))); case GIGA_DRILL_BREAKER: return BlockUtils.affectedByGigaDrillBreaker(blockState); diff --git a/src/main/resources/advanced.yml b/src/main/resources/advanced.yml index ae876fd76..65d7316ec 100644 --- a/src/main/resources/advanced.yml +++ b/src/main/resources/advanced.yml @@ -560,6 +560,9 @@ Skills: BonusMin: 3.0 BonusMax: 8.0 IncreaseLevel: 50 + Berserk: + # BreakGlass: Toggles whether berserk breaks glass in addition to "soft" blocks + BreakGlass: true # # Settings for Woodcutting ###