mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-22 05:06:45 +01:00
Revert "Players who used unarmed combat are still considered using unarmed while not holding weapons for a brief time period"
This reverts commit 993b418fbc
.
This commit is contained in:
parent
df0362bcba
commit
45f96793a5
@ -4,7 +4,6 @@ Version 2.1.216
|
|||||||
NOTES:
|
NOTES:
|
||||||
The Sculk blocks don't quite fit perfectly as mining-related, especially since hoes are the fastest tool to use for them. Let me know what you think.
|
The Sculk blocks don't quite fit perfectly as mining-related, especially since hoes are the fastest tool to use for them. Let me know what you think.
|
||||||
Version 2.1.215
|
Version 2.1.215
|
||||||
Unarmed bonuses apply to players who hurt an entity with empty fists in the last 60 seconds, these bonuses do not get applied if you are using another mcMMO tool/weapon/trident/etc (see notes)
|
|
||||||
Fixed Coal Blocks and potentially other fuel sources not showing burning animation to players (see notes)
|
Fixed Coal Blocks and potentially other fuel sources not showing burning animation to players (see notes)
|
||||||
Level up broadcasts from level milestones will now be visible to the player who achieved them
|
Level up broadcasts from level milestones will now be visible to the player who achieved them
|
||||||
Fixed a bug where hovering over skill descriptions did not display anything (thanks Greymagic27)
|
Fixed a bug where hovering over skill descriptions did not display anything (thanks Greymagic27)
|
||||||
@ -13,8 +12,6 @@ Version 2.1.215
|
|||||||
Item in main hand is now used for Tree Feller drops (thanks destro174)
|
Item in main hand is now used for Tree Feller drops (thanks destro174)
|
||||||
|
|
||||||
NOTES:
|
NOTES:
|
||||||
The unarmed change is to lower the penalty for picking up items during a fight, as an alternative solution, you can turn on Skills.Unarmed.Items_As_Unarmed in config.yml to have players be considered to be using unarmed while holding items regardless of last unarmed combat (holding tools/weapons/tridents will disqualify you from this)
|
|
||||||
Players who damage another entity with empty hands are considered "recently unarmed" for the next 60 seconds, during this period if they attack with items in their hands (other weapons/tools/tridents excluded) they will be processed as if they are using unarmed combat, this also works with stuff like block breaker
|
|
||||||
The burning animation bug is actually in Spigot, it takes an int for setBurnTime when it really should only take a short as the game is expecting a short value, I implemented a hacky workaround via Math.min
|
The burning animation bug is actually in Spigot, it takes an int for setBurnTime when it really should only take a short as the game is expecting a short value, I implemented a hacky workaround via Math.min
|
||||||
There is a bug where you may lose your config comments, this will be complex to solve, for now you can check our GitHub for the configs with comments.
|
There is a bug where you may lose your config comments, this will be complex to solve, for now you can check our GitHub for the configs with comments.
|
||||||
|
|
||||||
|
@ -22,7 +22,6 @@ import com.gmail.nossr50.skills.salvage.Salvage;
|
|||||||
import com.gmail.nossr50.skills.woodcutting.WoodcuttingManager;
|
import com.gmail.nossr50.skills.woodcutting.WoodcuttingManager;
|
||||||
import com.gmail.nossr50.util.*;
|
import com.gmail.nossr50.util.*;
|
||||||
import com.gmail.nossr50.util.player.UserManager;
|
import com.gmail.nossr50.util.player.UserManager;
|
||||||
import com.gmail.nossr50.util.skills.CombatUtils;
|
|
||||||
import com.gmail.nossr50.util.skills.SkillUtils;
|
import com.gmail.nossr50.util.skills.SkillUtils;
|
||||||
import com.gmail.nossr50.util.sounds.SoundManager;
|
import com.gmail.nossr50.util.sounds.SoundManager;
|
||||||
import com.gmail.nossr50.util.sounds.SoundType;
|
import com.gmail.nossr50.util.sounds.SoundType;
|
||||||
@ -626,7 +625,7 @@ public class BlockListener implements Listener {
|
|||||||
blockState.update(true);
|
blockState.update(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (mcMMOPlayer.getAbilityMode(SuperAbilityType.BERSERK) && ItemUtils.isUnarmed(mcMMOPlayer.getPlayer().getInventory().getItemInMainHand()) || CombatUtils.isUsingUnarmedCombat(mcMMOPlayer)) {
|
else if (mcMMOPlayer.getAbilityMode(SuperAbilityType.BERSERK) && (heldItem.getType() == Material.AIR || mcMMO.p.getGeneralConfig().getUnarmedItemsAsUnarmed())) {
|
||||||
if (mcMMOPlayer.getUnarmedManager().canUseBlockCracker() && BlockUtils.affectedByBlockCracker(blockState)) {
|
if (mcMMOPlayer.getUnarmedManager().canUseBlockCracker() && BlockUtils.affectedByBlockCracker(blockState)) {
|
||||||
if (EventUtils.simulateBlockBreak(block, player, true) && mcMMOPlayer.getUnarmedManager().blockCrackerCheck(blockState)) {
|
if (EventUtils.simulateBlockBreak(block, player, true) && mcMMOPlayer.getUnarmedManager().blockCrackerCheck(blockState)) {
|
||||||
blockState.update();
|
blockState.update();
|
||||||
|
@ -13,7 +13,6 @@ import com.gmail.nossr50.util.*;
|
|||||||
import com.gmail.nossr50.util.player.NotificationManager;
|
import com.gmail.nossr50.util.player.NotificationManager;
|
||||||
import com.gmail.nossr50.util.player.UserManager;
|
import com.gmail.nossr50.util.player.UserManager;
|
||||||
import com.gmail.nossr50.util.random.RandomChanceUtil;
|
import com.gmail.nossr50.util.random.RandomChanceUtil;
|
||||||
import com.gmail.nossr50.util.skills.CombatUtils;
|
|
||||||
import com.gmail.nossr50.util.skills.RankUtils;
|
import com.gmail.nossr50.util.skills.RankUtils;
|
||||||
import com.gmail.nossr50.util.skills.SkillActivationType;
|
import com.gmail.nossr50.util.skills.SkillActivationType;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
@ -25,14 +24,6 @@ import org.bukkit.inventory.ItemStack;
|
|||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
public class UnarmedManager extends SkillManager {
|
public class UnarmedManager extends SkillManager {
|
||||||
private long lastUsedUnarmed = 0L;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Players are considered using Unarmed if they have damaged another entity with empty fists in the last 60 seconds
|
|
||||||
*/
|
|
||||||
public boolean usedUnarmedCombatRecently() {
|
|
||||||
return lastUsedUnarmed + 60000 > System.currentTimeMillis();
|
|
||||||
}
|
|
||||||
|
|
||||||
public UnarmedManager(McMMOPlayer mcMMOPlayer) {
|
public UnarmedManager(McMMOPlayer mcMMOPlayer) {
|
||||||
super(mcMMOPlayer, PrimarySkillType.UNARMED);
|
super(mcMMOPlayer, PrimarySkillType.UNARMED);
|
||||||
@ -66,11 +57,7 @@ public class UnarmedManager extends SkillManager {
|
|||||||
|
|
||||||
Player player = getPlayer();
|
Player player = getPlayer();
|
||||||
|
|
||||||
McMMOPlayer mmoPlayer = UserManager.getPlayer(player);
|
return ItemUtils.isUnarmed(player.getInventory().getItemInMainHand()) && Permissions.isSubSkillEnabled(getPlayer(), SubSkillType.UNARMED_ARROW_DEFLECT);
|
||||||
if(mmoPlayer == null)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
return CombatUtils.isUsingUnarmedCombat(mmoPlayer) && Permissions.isSubSkillEnabled(getPlayer(), SubSkillType.UNARMED_ARROW_DEFLECT);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean canUseBlockCracker() {
|
public boolean canUseBlockCracker() {
|
||||||
@ -201,8 +188,4 @@ public class UnarmedManager extends SkillManager {
|
|||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateLastUsedUnarmed() {
|
|
||||||
this.lastUsedUnarmed = System.currentTimeMillis();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,6 @@ package com.gmail.nossr50.util;
|
|||||||
|
|
||||||
import com.gmail.nossr50.config.experience.ExperienceConfig;
|
import com.gmail.nossr50.config.experience.ExperienceConfig;
|
||||||
import com.gmail.nossr50.config.party.ItemWeightConfig;
|
import com.gmail.nossr50.config.party.ItemWeightConfig;
|
||||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
|
||||||
import com.gmail.nossr50.datatypes.treasure.EnchantmentWrapper;
|
import com.gmail.nossr50.datatypes.treasure.EnchantmentWrapper;
|
||||||
import com.gmail.nossr50.datatypes.treasure.FishingTreasureBook;
|
import com.gmail.nossr50.datatypes.treasure.FishingTreasureBook;
|
||||||
import com.gmail.nossr50.locale.LocaleLoader;
|
import com.gmail.nossr50.locale.LocaleLoader;
|
||||||
@ -179,12 +178,18 @@ public final class ItemUtils {
|
|||||||
return mcMMO.getMaterialMapStore().isPickAxe(item.getType().getKey().getKey());
|
return mcMMO.getMaterialMapStore().isPickAxe(item.getType().getKey().getKey());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isUnarmed(@NotNull ItemStack itemInMainHand) {
|
/**
|
||||||
|
* 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 (mcMMO.p.getGeneralConfig().getUnarmedItemsAsUnarmed()) {
|
if (mcMMO.p.getGeneralConfig().getUnarmedItemsAsUnarmed()) {
|
||||||
return !isMinecraftTool(itemInMainHand);
|
return !isMinecraftTool(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
return itemInMainHand.getType() == Material.AIR;
|
return item.getType() == Material.AIR;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -40,8 +40,6 @@ import org.jetbrains.annotations.Nullable;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import static com.gmail.nossr50.util.ItemUtils.isMinecraftTool;
|
|
||||||
|
|
||||||
public final class CombatUtils {
|
public final class CombatUtils {
|
||||||
|
|
||||||
private CombatUtils() {}
|
private CombatUtils() {}
|
||||||
@ -168,45 +166,47 @@ public final class CombatUtils {
|
|||||||
printFinalDamageDebug(player, event, mcMMOPlayer);
|
printFinalDamageDebug(player, event, mcMMOPlayer);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void processUnarmedCombat(@NotNull LivingEntity target, @NotNull McMMOPlayer mmoPlayer, @NotNull EntityDamageByEntityEvent event) {
|
private static void processUnarmedCombat(@NotNull LivingEntity target, @NotNull Player player, @NotNull EntityDamageByEntityEvent event) {
|
||||||
if (event.getCause() == DamageCause.THORNS) {
|
if (event.getCause() == DamageCause.THORNS) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
double boostedDamage = event.getDamage();
|
double boostedDamage = event.getDamage();
|
||||||
|
|
||||||
UnarmedManager unarmedManager = mmoPlayer.getUnarmedManager();
|
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
||||||
|
|
||||||
if(isUsingUnarmedCombat(mmoPlayer)) {
|
//Make sure the profiles been loaded
|
||||||
if (unarmedManager.canActivateAbility()) {
|
if(mcMMOPlayer == null) {
|
||||||
mmoPlayer.checkAbilityActivation(PrimarySkillType.UNARMED);
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (unarmedManager.canUseSteelArm()) {
|
UnarmedManager unarmedManager = mcMMOPlayer.getUnarmedManager();
|
||||||
boostedDamage+=(unarmedManager.calculateSteelArmStyleDamage() * mmoPlayer.getAttackStrength());
|
|
||||||
}
|
|
||||||
|
|
||||||
if (unarmedManager.canUseBerserk()) {
|
if (unarmedManager.canActivateAbility()) {
|
||||||
boostedDamage+=(unarmedManager.berserkDamage(boostedDamage) * mmoPlayer.getAttackStrength());
|
mcMMOPlayer.checkAbilityActivation(PrimarySkillType.UNARMED);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (unarmedManager.canDisarm(target)) {
|
if (unarmedManager.canUseSteelArm()) {
|
||||||
unarmedManager.disarmCheck((Player) target);
|
boostedDamage+=(unarmedManager.calculateSteelArmStyleDamage() * mcMMOPlayer.getAttackStrength());
|
||||||
}
|
}
|
||||||
|
|
||||||
if(canUseLimitBreak(mmoPlayer.getPlayer(), target, SubSkillType.UNARMED_UNARMED_LIMIT_BREAK))
|
if (unarmedManager.canUseBerserk()) {
|
||||||
{
|
boostedDamage+=(unarmedManager.berserkDamage(boostedDamage) * mcMMOPlayer.getAttackStrength());
|
||||||
boostedDamage+=(getLimitBreakDamage(mmoPlayer.getPlayer(), target, SubSkillType.UNARMED_UNARMED_LIMIT_BREAK) * mmoPlayer.getAttackStrength());
|
}
|
||||||
}
|
|
||||||
|
if (unarmedManager.canDisarm(target)) {
|
||||||
|
unarmedManager.disarmCheck((Player) target);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(canUseLimitBreak(player, target, SubSkillType.UNARMED_UNARMED_LIMIT_BREAK))
|
||||||
|
{
|
||||||
|
boostedDamage+=(getLimitBreakDamage(player, target, SubSkillType.UNARMED_UNARMED_LIMIT_BREAK) * mcMMOPlayer.getAttackStrength());
|
||||||
}
|
}
|
||||||
|
|
||||||
event.setDamage(boostedDamage);
|
event.setDamage(boostedDamage);
|
||||||
processCombatXP(mmoPlayer, target, PrimarySkillType.UNARMED);
|
processCombatXP(mcMMOPlayer, target, PrimarySkillType.UNARMED);
|
||||||
printFinalDamageDebug(mmoPlayer.getPlayer(), event, mmoPlayer);
|
|
||||||
|
|
||||||
if (ItemUtils.isUnarmed(mmoPlayer.getPlayer().getInventory().getItemInMainHand())) {
|
printFinalDamageDebug(player, event, mcMMOPlayer);
|
||||||
mmoPlayer.getUnarmedManager().updateLastUsedUnarmed();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void processTamingCombat(@NotNull LivingEntity target, @Nullable Player master, @NotNull Wolf wolf, @NotNull EntityDamageByEntityEvent event) {
|
private static void processTamingCombat(@NotNull LivingEntity target, @Nullable Player master, @NotNull Wolf wolf, @NotNull EntityDamageByEntityEvent event) {
|
||||||
@ -335,7 +335,6 @@ public final class CombatUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (painSourceRoot instanceof Player player && entityType == EntityType.PLAYER) {
|
if (painSourceRoot instanceof Player player && entityType == EntityType.PLAYER) {
|
||||||
McMMOPlayer mmoPlayer = UserManager.getPlayer(player);
|
|
||||||
|
|
||||||
if (!UserManager.hasPlayerDataKey(player)) {
|
if (!UserManager.hasPlayerDataKey(player)) {
|
||||||
return;
|
return;
|
||||||
@ -378,13 +377,13 @@ public final class CombatUtils {
|
|||||||
processAxeCombat(target, player, event);
|
processAxeCombat(target, player, event);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (mmoPlayer != null && (mmoPlayer.getUnarmedManager().usedUnarmedCombatRecently() || ItemUtils.isUnarmed(heldItem))) {
|
else if (ItemUtils.isUnarmed(heldItem)) {
|
||||||
if (!mcMMO.p.getSkillTools().canCombatSkillsTrigger(PrimarySkillType.UNARMED, target)) {
|
if (!mcMMO.p.getSkillTools().canCombatSkillsTrigger(PrimarySkillType.UNARMED, target)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mcMMO.p.getSkillTools().doesPlayerHaveSkillPermission(player, PrimarySkillType.UNARMED)) {
|
if (mcMMO.p.getSkillTools().doesPlayerHaveSkillPermission(player, PrimarySkillType.UNARMED)) {
|
||||||
processUnarmedCombat(target, mmoPlayer, event);
|
processUnarmedCombat(target, player, event);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -978,21 +977,4 @@ public final class CombatUtils {
|
|||||||
public static void delayArrowMetaCleanup(@NotNull Projectile entity) {
|
public static void delayArrowMetaCleanup(@NotNull Projectile entity) {
|
||||||
Bukkit.getServer().getScheduler().runTaskLater(mcMMO.p, () -> cleanupArrowMetadata(entity), 20*60);
|
Bukkit.getServer().getScheduler().runTaskLater(mcMMO.p, () -> cleanupArrowMetadata(entity), 20*60);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Check if a player is considered "unarmed"
|
|
||||||
*
|
|
||||||
* @param mmoPlayer target player
|
|
||||||
* @return true if the item counts as unarmed, false otherwise
|
|
||||||
*/
|
|
||||||
public static boolean isUsingUnarmedCombat(@NotNull McMMOPlayer mmoPlayer) {
|
|
||||||
ItemStack itemInMainHand = mmoPlayer.getPlayer().getInventory().getItemInMainHand();
|
|
||||||
|
|
||||||
// player has to have been unarmed recently or config allows items as unarmed
|
|
||||||
if (mmoPlayer.getUnarmedManager().usedUnarmedCombatRecently() || mcMMO.p.getGeneralConfig().getUnarmedItemsAsUnarmed()) {
|
|
||||||
return !isMinecraftTool(itemInMainHand);
|
|
||||||
}
|
|
||||||
|
|
||||||
return itemInMainHand.getType() == Material.AIR;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user