Add config toggle for breaking glass with Berserk.

This commit is contained in:
Jamie Sinn 2017-05-07 15:22:46 -04:00
parent 7d05c9d8e6
commit 37280856d5
3 changed files with 14 additions and 5 deletions

View File

@ -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); }

View File

@ -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);

View File

@ -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
###