mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-22 21:26:46 +01:00
Added isUnarmed Method
Checks if the player is not holding a tool, as opposed to checking if the player is holding air. This means that attacking with something such as a dirt block would count as unarmed.
This commit is contained in:
parent
af7ff3df58
commit
9426f44cdd
@ -9,6 +9,7 @@ Key:
|
|||||||
|
|
||||||
Version 1.5.02-dev
|
Version 1.5.02-dev
|
||||||
+ Added option to config.yml for Chimaera Wings to stop using bed spawn points
|
+ Added option to config.yml for Chimaera Wings to stop using bed spawn points
|
||||||
|
+ Added option to config.yml to let non-tools in hand count as unarmed
|
||||||
= Fixed bug where no Mining XP was granted when Flux Mining was successful
|
= Fixed bug where no Mining XP was granted when Flux Mining was successful
|
||||||
= Fixed bug where MobHealthbarTypes were not saved between server restarts
|
= Fixed bug where MobHealthbarTypes were not saved between server restarts
|
||||||
! Changed Flux Mining mechanics. In order to use the ability, you need to infuse a pickaxe with furnace powers first.
|
! Changed Flux Mining mechanics. In order to use the ability, you need to infuse a pickaxe with furnace powers first.
|
||||||
|
@ -498,6 +498,7 @@ public class Config extends AutoUpdateConfigLoader {
|
|||||||
/* Unarmed */
|
/* Unarmed */
|
||||||
public boolean getUnarmedBlockCrackerSmoothbrickToCracked() { return config.getBoolean("Skills.Unarmed.Block_Cracker.SmoothBrick_To_CrackedBrick", true); }
|
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 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 */
|
/* Taming */
|
||||||
public Material getTamingCOTWMaterial(EntityType type) { return Material.matchMaterial(config.getString("Skills.Taming.Call_Of_The_Wild." + StringUtils.getPrettyEntityTypeString(type) + ".Item_Material")); }
|
public Material getTamingCOTWMaterial(EntityType type) { return Material.matchMaterial(config.getString("Skills.Taming.Call_Of_The_Wild." + StringUtils.getPrettyEntityTypeString(type) + ".Item_Material")); }
|
||||||
|
@ -19,6 +19,7 @@ import com.gmail.nossr50.datatypes.skills.ToolType;
|
|||||||
import com.gmail.nossr50.locale.LocaleLoader;
|
import com.gmail.nossr50.locale.LocaleLoader;
|
||||||
import com.gmail.nossr50.skills.SkillManager;
|
import com.gmail.nossr50.skills.SkillManager;
|
||||||
import com.gmail.nossr50.util.EventUtils;
|
import com.gmail.nossr50.util.EventUtils;
|
||||||
|
import com.gmail.nossr50.util.ItemUtils;
|
||||||
import com.gmail.nossr50.util.Misc;
|
import com.gmail.nossr50.util.Misc;
|
||||||
import com.gmail.nossr50.util.Permissions;
|
import com.gmail.nossr50.util.Permissions;
|
||||||
import com.gmail.nossr50.util.player.UserManager;
|
import com.gmail.nossr50.util.player.UserManager;
|
||||||
@ -48,7 +49,7 @@ public class UnarmedManager extends SkillManager {
|
|||||||
public boolean canDeflect() {
|
public boolean canDeflect() {
|
||||||
Player player = getPlayer();
|
Player player = getPlayer();
|
||||||
|
|
||||||
return player.getItemInHand().getType() == Material.AIR && Permissions.secondaryAbilityEnabled(getPlayer(), SecondaryAbility.DEFLECT);
|
return ItemUtils.isUnarmed(player.getItemInHand()) && Permissions.secondaryAbilityEnabled(getPlayer(), SecondaryAbility.DEFLECT);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean canUseBlockCracker() {
|
public boolean canUseBlockCracker() {
|
||||||
|
@ -13,6 +13,7 @@ import org.bukkit.material.Dye;
|
|||||||
|
|
||||||
import com.gmail.nossr50.mcMMO;
|
import com.gmail.nossr50.mcMMO;
|
||||||
import com.gmail.nossr50.config.party.ItemWeightConfig;
|
import com.gmail.nossr50.config.party.ItemWeightConfig;
|
||||||
|
import com.gmail.nossr50.config.Config;
|
||||||
import com.gmail.nossr50.locale.LocaleLoader;
|
import com.gmail.nossr50.locale.LocaleLoader;
|
||||||
|
|
||||||
public final class ItemUtils {
|
public final class ItemUtils {
|
||||||
@ -146,6 +147,20 @@ public final class ItemUtils {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if the item counts as unarmed.
|
||||||
|
*
|
||||||
|
* @param item Item to check
|
||||||
|
* @return true if the item counts as unarmed, false otherwise
|
||||||
|
*/
|
||||||
|
public static boolean isUnarmed(ItemStack item) {
|
||||||
|
if (Config.getInstance().getUnarmedItemsAsUnarmed()) {
|
||||||
|
return !isMinecraftTool(item);
|
||||||
|
}
|
||||||
|
|
||||||
|
return item.getType() == Material.AIR;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if the item is a helmet.
|
* Checks if the item is a helmet.
|
||||||
*
|
*
|
||||||
|
@ -41,6 +41,7 @@ import com.gmail.nossr50.skills.axes.AxesManager;
|
|||||||
import com.gmail.nossr50.skills.swords.Swords;
|
import com.gmail.nossr50.skills.swords.Swords;
|
||||||
import com.gmail.nossr50.skills.swords.SwordsManager;
|
import com.gmail.nossr50.skills.swords.SwordsManager;
|
||||||
import com.gmail.nossr50.skills.taming.TamingManager;
|
import com.gmail.nossr50.skills.taming.TamingManager;
|
||||||
|
import com.gmail.nossr50.skills.unarmed.Unarmed;
|
||||||
import com.gmail.nossr50.skills.unarmed.UnarmedManager;
|
import com.gmail.nossr50.skills.unarmed.UnarmedManager;
|
||||||
import com.gmail.nossr50.util.EventUtils;
|
import com.gmail.nossr50.util.EventUtils;
|
||||||
import com.gmail.nossr50.util.ItemUtils;
|
import com.gmail.nossr50.util.ItemUtils;
|
||||||
@ -251,7 +252,7 @@ public final class CombatUtils {
|
|||||||
processAxeCombat(target, player, event);
|
processAxeCombat(target, player, event);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (heldItem.getType() == Material.AIR) {
|
else if (ItemUtils.isUnarmed(heldItem)) {
|
||||||
if (!SkillType.UNARMED.shouldProcess(target)) {
|
if (!SkillType.UNARMED.shouldProcess(target)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -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
|
# 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?
|
# of your hand. Should item pickup be disabled when your entire inventory - except for your hand - is full?
|
||||||
Item_Pickup_Disabled_Full_Inventory: true
|
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:
|
Woodcutting:
|
||||||
Tree_Feller_Sounds: true
|
Tree_Feller_Sounds: true
|
||||||
Level_Cap: 0
|
Level_Cap: 0
|
||||||
|
Loading…
Reference in New Issue
Block a user