Wire up unarmed config

This commit is contained in:
nossr50 2019-06-14 11:36:21 -07:00
parent ab56464bc4
commit e7e28ec3cb
5 changed files with 17 additions and 14 deletions

View File

@ -321,12 +321,6 @@ public class MainConfig extends ConfigValidated {
return getBooleanValue(SKILLS, ALCHEMY, PREVENT_HOPPER_TRANSFER_BOTTLES);
}
/* Unarmed */
public boolean getUnarmedBlockCrackerSmoothbrickToCracked() {
return getBooleanValue(SKILLS, UNARMED, BLOCK_CRACKER, SMOOTH_BRICK_TO_CRACKED_BRICK);
}
public boolean getUnarmedItemsAsUnarmed() {
return getBooleanValue(SKILLS, UNARMED, ITEMS + AS + UNARMED);
}

View File

@ -7,9 +7,16 @@ import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable;
@ConfigSerializable
public class ConfigUnarmed {
private static final boolean ITEMS_COUNT_AS_UNARMED_DEFAULT = true;
@Setting(value = ConfigConstants.SUB_SKILL_NODE)
private ConfigUnarmedSubskills subskills = new ConfigUnarmedSubskills();
@Setting(value = "Items-Count-As-Unarmed", comment = "Unarmed skills will work even if you are holding an item." +
"\nMost tools are not considered an item, for example pickaxes, tridents, swords, etc won't count as unarmed with this setting enabled." +
"\nDefault value: "+ITEMS_COUNT_AS_UNARMED_DEFAULT)
private boolean doItemsCountAsUnarmed = ITEMS_COUNT_AS_UNARMED_DEFAULT;
public ConfigUnarmedSubskills getSubskills() {
return subskills;
}
@ -18,7 +25,11 @@ public class ConfigUnarmed {
return subskills.getDisarm();
}
public boolean isPreventItemTheft() {
public boolean doesDisarmPreventTheft() {
return subskills.isPreventItemTheft();
}
public boolean doItemsCountAsUnarmed() {
return doItemsCountAsUnarmed;
}
}

View File

@ -8,7 +8,7 @@ import org.bukkit.event.entity.EntityPickupItemEvent;
import org.bukkit.inventory.ItemStack;
public class Unarmed {
public static boolean blockCrackerSmoothBrick = MainConfig.getInstance().getUnarmedBlockCrackerSmoothbrickToCracked();
// public static boolean blockCrackerSmoothBrick = MainConfig.getInstance().getUnarmedBlockCrackerSmoothbrickToCracked();
public static double berserkDamageModifier = 1.5;
public static long lastAttacked = 0;
public static long attackInterval = 750;

View File

@ -1,6 +1,5 @@
package com.gmail.nossr50.skills.unarmed;
import com.gmail.nossr50.config.AdvancedConfig;
import com.gmail.nossr50.core.MetadataConstants;
import com.gmail.nossr50.datatypes.interactions.NotificationType;
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
@ -78,9 +77,9 @@ public class UnarmedManager extends SkillManager {
switch (blockState.getType()) {
case STONE_BRICKS:
if (!Unarmed.blockCrackerSmoothBrick) {
/*if (!Unarmed.blockCrackerSmoothBrick) {
return false;
}
}*/
blockState.setType(Material.CRACKED_STONE_BRICKS);
return true;
@ -106,7 +105,7 @@ public class UnarmedManager extends SkillManager {
Item item = Misc.dropItem(defender.getLocation(), defender.getInventory().getItemInMainHand());
if (item != null && AdvancedConfig.getInstance().getDisarmProtected()) {
if (item != null && mcMMO.getConfigManager().getConfigUnarmed().doesDisarmPreventTheft()) {
item.setMetadata(MetadataConstants.DISARMED_ITEM_METAKEY, UserManager.getPlayer(defender).getPlayerMetadata());
}

View File

@ -1,6 +1,5 @@
package com.gmail.nossr50.util;
import com.gmail.nossr50.config.MainConfig;
import com.gmail.nossr50.datatypes.skills.ItemMaterialCategory;
import com.gmail.nossr50.datatypes.skills.ItemType;
import com.gmail.nossr50.locale.LocaleLoader;
@ -235,7 +234,7 @@ public final class ItemUtils {
* @return true if the item counts as unarmed, false otherwise
*/
public static boolean isUnarmed(ItemStack item) {
if (MainConfig.getInstance().getUnarmedItemsAsUnarmed()) {
if (mcMMO.getConfigManager().getConfigUnarmed().doItemsCountAsUnarmed()) {
return !isMinecraftTool(item);
}