From 64a54873eebb6ac2cb1d63cb2ab4761c64539b65 Mon Sep 17 00:00:00 2001 From: mjkaufer Date: Mon, 29 Dec 2014 08:19:42 -0500 Subject: [PATCH] Toolless unarmed now configurable Added features outlined here: https://github.com/mcMMO-Dev/mcMMO/pull/2389 New option in config.yml: Items_As_Unarmed When marked as true, users can attack with any non-item (blocks, their hand, etc.) and it will count as unarmed. --- Changelog.txt | 2 ++ src/main/java/com/gmail/nossr50/config/Config.java | 1 + src/main/java/com/gmail/nossr50/util/ItemUtils.java | 6 +++++- src/main/resources/config.yml | 2 ++ 4 files changed, 10 insertions(+), 1 deletion(-) diff --git a/Changelog.txt b/Changelog.txt index 96a57d744..ad736e0da 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -7,6 +7,8 @@ Key: ! Change - Removal + + Added option to config.yml to let non-tools in hand count as unarmed + Version 1.5.02-dev + Added option to config.yml for Chimaera Wings to stop using bed spawn points = Fixed bug where no Mining XP was granted when Flux Mining was successful diff --git a/src/main/java/com/gmail/nossr50/config/Config.java b/src/main/java/com/gmail/nossr50/config/Config.java index d4578166f..2c363b6d8 100644 --- a/src/main/java/com/gmail/nossr50/config/Config.java +++ b/src/main/java/com/gmail/nossr50/config/Config.java @@ -498,6 +498,7 @@ public class Config extends AutoUpdateConfigLoader { /* Unarmed */ public boolean getUnarmedBlockCrackerSmoothbrickToCracked() { return config.getBoolean("Skills.Unarmed.Block_Cracker.SmoothBrick_To_CrackedBrick", true); } public boolean getUnarmedItemPickupDisabled() { return config.getBoolean("Skills.Unarmed.Item_Pickup_Disabled_Full_Inventory", true); } + public boolean getUnarmedItemsAsUnarmed() { return config.getBoolean("Skills.Unarmed.Items_As_Unarmed", false); } /* Taming */ public Material getTamingCOTWMaterial(EntityType type) { return Material.matchMaterial(config.getString("Skills.Taming.Call_Of_The_Wild." + StringUtils.getPrettyEntityTypeString(type) + ".Item_Material")); } diff --git a/src/main/java/com/gmail/nossr50/util/ItemUtils.java b/src/main/java/com/gmail/nossr50/util/ItemUtils.java index e9d9275fe..a4e092157 100644 --- a/src/main/java/com/gmail/nossr50/util/ItemUtils.java +++ b/src/main/java/com/gmail/nossr50/util/ItemUtils.java @@ -13,6 +13,7 @@ import org.bukkit.material.Dye; import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.config.party.ItemWeightConfig; +import com.gmail.nossr50.config.Config; import com.gmail.nossr50.locale.LocaleLoader; public final class ItemUtils { @@ -153,7 +154,10 @@ public final class ItemUtils { * @return true if the item counts as unarmed, false otherwise */ public static boolean isUnarmed(ItemStack item) { - return !isMinecraftTool(item); + if(Config.getInstance().getUnarmedItemsAsUnarmed()) + return !isMinecraftTool(item); + + return item.getType() == Material.AIR; } /** diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml index dc22cf3b3..17f9c0d09 100644 --- a/src/main/resources/config.yml +++ b/src/main/resources/config.yml @@ -395,6 +395,8 @@ Skills: # When using Unarmed, picked up items will automatically get moved to a free slot instead of going in the slot # of your hand. Should item pickup be disabled when your entire inventory - except for your hand - is full? Item_Pickup_Disabled_Full_Inventory: true + # Any attacks made without a tool, i.e. with one's open hand, a block, etc., will count as unarmed. + Items_As_Unarmed: false Woodcutting: Tree_Feller_Sounds: true Level_Cap: 0