Spring-cleaning round 1: remove deprecated Player.updateInventory

This commit is contained in:
nossr50
2025-11-09 09:57:28 -08:00
parent 2a8be52be5
commit 3533c50489
12 changed files with 42 additions and 156 deletions

View File

@@ -6,7 +6,6 @@ import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
import com.gmail.nossr50.datatypes.skills.SubSkillType; import com.gmail.nossr50.datatypes.skills.SubSkillType;
import com.gmail.nossr50.events.fake.FakeBrewEvent; import com.gmail.nossr50.events.fake.FakeBrewEvent;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.runnables.player.PlayerUpdateInventoryTask;
import com.gmail.nossr50.skills.alchemy.Alchemy; import com.gmail.nossr50.skills.alchemy.Alchemy;
import com.gmail.nossr50.skills.alchemy.AlchemyPotionBrewer; import com.gmail.nossr50.skills.alchemy.AlchemyPotionBrewer;
import com.gmail.nossr50.util.ContainerMetadataUtils; import com.gmail.nossr50.util.ContainerMetadataUtils;
@@ -270,7 +269,6 @@ public class InventoryListener implements Listener {
} }
event.setCancelled(true); event.setCancelled(true);
AlchemyPotionBrewer.scheduleUpdate(inventory);
AlchemyPotionBrewer.scheduleCheck(stand); AlchemyPotionBrewer.scheduleCheck(stand);
return; return;
default: default:
@@ -294,7 +292,6 @@ public class InventoryListener implements Listener {
event.setCurrentItem(cursor.clone()); event.setCurrentItem(cursor.clone());
event.setCursor(null); event.setCursor(null);
AlchemyPotionBrewer.scheduleUpdate(inventory);
AlchemyPotionBrewer.scheduleCheck(stand); AlchemyPotionBrewer.scheduleCheck(stand);
} else if (click == ClickType.RIGHT) { } else if (click == ClickType.RIGHT) {
event.setCancelled(true); event.setCancelled(true);
@@ -308,7 +305,6 @@ public class InventoryListener implements Listener {
event.setCurrentItem(one); event.setCurrentItem(one);
event.setCursor(rest); event.setCursor(rest);
AlchemyPotionBrewer.scheduleUpdate(inventory);
AlchemyPotionBrewer.scheduleCheck(stand); AlchemyPotionBrewer.scheduleCheck(stand);
} }
} }
@@ -371,7 +367,6 @@ public class InventoryListener implements Listener {
} }
event.setCancelled(true); event.setCancelled(true);
AlchemyPotionBrewer.scheduleUpdate(inventory);
} }
} }
@@ -511,9 +506,6 @@ public class InventoryListener implements Listener {
return; return;
} }
} }
mcMMO.p.getFoliaLib().getScheduler()
.runAtEntity(whoClicked, new PlayerUpdateInventoryTask((Player) whoClicked));
} }
} }

View File

@@ -737,7 +737,6 @@ public class PlayerListener implements Listener {
// Make sure the player knows what he's doing when trying to repair an enchanted item // Make sure the player knows what he's doing when trying to repair an enchanted item
if (repairManager.checkConfirmation(true)) { if (repairManager.checkConfirmation(true)) {
repairManager.handleRepair(heldItem); repairManager.handleRepair(heldItem);
player.updateInventory();
} }
} }
/* SALVAGE CHECKS */ /* SALVAGE CHECKS */
@@ -756,7 +755,6 @@ public class PlayerListener implements Listener {
if (salvageManager.checkConfirmation(true)) { if (salvageManager.checkConfirmation(true)) {
SkillUtils.removeAbilityBoostsFromInventory(player); SkillUtils.removeAbilityBoostsFromInventory(player);
salvageManager.handleSalvage(clickedBlock.getLocation(), heldItem); salvageManager.handleSalvage(clickedBlock.getLocation(), heldItem);
player.updateInventory();
} }
} }
@@ -926,7 +924,6 @@ public class PlayerListener implements Listener {
// Bukkit.getPluginManager().callEvent(fakeSwing); // Bukkit.getPluginManager().callEvent(fakeSwing);
player.getInventory().getItemInMainHand() player.getInventory().getItemInMainHand()
.setAmount(heldItem.getAmount() - 1); .setAmount(heldItem.getAmount() - 1);
player.updateInventory();
if (herbalismManager.processGreenThumbBlocks(blockState) if (herbalismManager.processGreenThumbBlocks(blockState)
&& EventUtils.simulateBlockBreak(block, player)) { && EventUtils.simulateBlockBreak(block, player)) {
blockState.update(true); blockState.update(true);

View File

@@ -172,10 +172,8 @@ public final class ShareHandler {
} }
private static void awardDrop(Player winningPlayer, ItemStack drop) { private static void awardDrop(Player winningPlayer, ItemStack drop) {
if (winningPlayer.getInventory().addItem(drop).size() != 0) { if (!winningPlayer.getInventory().addItem(drop).isEmpty()) {
winningPlayer.getWorld().dropItem(winningPlayer.getLocation(), drop); winningPlayer.getWorld().dropItem(winningPlayer.getLocation(), drop);
} }
winningPlayer.updateInventory();
} }
} }

View File

@@ -1,18 +0,0 @@
package com.gmail.nossr50.runnables.player;
import com.gmail.nossr50.util.CancellableRunnable;
import org.bukkit.entity.Player;
@SuppressWarnings("deprecation")
public class PlayerUpdateInventoryTask extends CancellableRunnable {
private final Player player;
public PlayerUpdateInventoryTask(Player player) {
this.player = player;
}
@Override
public void run() {
player.updateInventory();
}
}

View File

@@ -159,13 +159,13 @@ public class AlchemyBrewTask extends CancellableRunnable {
private void finish() { private void finish() {
if (mmoPlayer == null) { if (mmoPlayer == null) {
// Still need to finish brewing if the player is null // Still need to finish brewing if the player is null
AlchemyPotionBrewer.finishBrewing(brewingStand, null, false); AlchemyPotionBrewer.finishBrewing(brewingStand, null);
} else { } else {
final McMMOPlayerBrewEvent event = new McMMOPlayerBrewEvent(mmoPlayer, brewingStand); final McMMOPlayerBrewEvent event = new McMMOPlayerBrewEvent(mmoPlayer, brewingStand);
mcMMO.p.getServer().getPluginManager().callEvent(event); mcMMO.p.getServer().getPluginManager().callEvent(event);
if (!event.isCancelled()) { if (!event.isCancelled()) {
AlchemyPotionBrewer.finishBrewing(brewingStand, mmoPlayer, false); AlchemyPotionBrewer.finishBrewing(brewingStand, mmoPlayer);
} }
} }
@@ -175,7 +175,7 @@ public class AlchemyBrewTask extends CancellableRunnable {
public void finishImmediately() { public void finishImmediately() {
this.cancel(); this.cancel();
AlchemyPotionBrewer.finishBrewing(brewingStand, mmoPlayer, true); AlchemyPotionBrewer.finishBrewing(brewingStand, mmoPlayer);
Alchemy.brewingStandMap.remove(brewingStand.getLocation()); Alchemy.brewingStandMap.remove(brewingStand.getLocation());
} }

View File

@@ -6,7 +6,6 @@ import com.gmail.nossr50.datatypes.skills.alchemy.AlchemyPotion;
import com.gmail.nossr50.datatypes.skills.alchemy.PotionStage; import com.gmail.nossr50.datatypes.skills.alchemy.PotionStage;
import com.gmail.nossr50.events.fake.FakeBrewEvent; import com.gmail.nossr50.events.fake.FakeBrewEvent;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.runnables.player.PlayerUpdateInventoryTask;
import com.gmail.nossr50.runnables.skills.AlchemyBrewCheckTask; import com.gmail.nossr50.runnables.skills.AlchemyBrewCheckTask;
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;
@@ -18,11 +17,9 @@ import java.util.List;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.block.BlockState; import org.bukkit.block.BlockState;
import org.bukkit.block.BrewingStand; import org.bukkit.block.BrewingStand;
import org.bukkit.entity.HumanEntity;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType; import org.bukkit.event.inventory.ClickType;
import org.bukkit.inventory.BrewerInventory; import org.bukkit.inventory.BrewerInventory;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.InventoryView; import org.bukkit.inventory.InventoryView;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
@@ -164,8 +161,7 @@ public final class AlchemyPotionBrewer {
? 1 : mmoPlayer.getAlchemyManager().getTier()); ? 1 : mmoPlayer.getAlchemyManager().getTier());
} }
public static void finishBrewing(BlockState brewingStand, @Nullable McMMOPlayer mmoPlayer, public static void finishBrewing(BlockState brewingStand, @Nullable McMMOPlayer mmoPlayer) {
boolean forced) {
// Check if the brewing stand block state is an actual brewing stand // Check if the brewing stand block state is an actual brewing stand
if (!(brewingStand instanceof BrewingStand)) { if (!(brewingStand instanceof BrewingStand)) {
return; return;
@@ -257,11 +253,6 @@ public final class AlchemyPotionBrewer {
} }
} }
} }
// If the brewing was not forced by external conditions, schedule a new update
if (!forced) {
scheduleUpdate(inventory);
}
} }
public static boolean transferItems(InventoryView view, int fromSlot, ClickType click) { public static boolean transferItems(InventoryView view, int fromSlot, ClickType click) {
@@ -356,13 +347,4 @@ public final class AlchemyPotionBrewer {
mcMMO.p.getFoliaLib().getScheduler().runAtLocation( mcMMO.p.getFoliaLib().getScheduler().runAtLocation(
brewingStand.getLocation(), new AlchemyBrewCheckTask(brewingStand)); brewingStand.getLocation(), new AlchemyBrewCheckTask(brewingStand));
} }
public static void scheduleUpdate(Inventory inventory) {
for (HumanEntity humanEntity : inventory.getViewers()) {
if (humanEntity instanceof Player) {
mcMMO.p.getFoliaLib().getScheduler().runAtEntity(humanEntity,
new PlayerUpdateInventoryTask((Player) humanEntity));
}
}
}
} }

View File

@@ -596,8 +596,6 @@ public class FishingManager extends SkillManager {
drop.getAmount() - 1) : null); drop.getAmount() - 1) : null);
drop.setAmount(1); drop.setAmount(1);
} }
targetPlayer.updateInventory();
} }
break; break;

View File

@@ -4,6 +4,8 @@ import static com.gmail.nossr50.util.ItemUtils.hasItemIncludingOffHand;
import static com.gmail.nossr50.util.ItemUtils.removeItemIncludingOffHand; import static com.gmail.nossr50.util.ItemUtils.removeItemIncludingOffHand;
import static com.gmail.nossr50.util.Misc.TICK_CONVERSION_FACTOR; import static com.gmail.nossr50.util.Misc.TICK_CONVERSION_FACTOR;
import static com.gmail.nossr50.util.Misc.getBlockCenter; import static com.gmail.nossr50.util.Misc.getBlockCenter;
import static com.gmail.nossr50.util.Permissions.isSubSkillEnabled;
import static com.gmail.nossr50.util.skills.RankUtils.hasUnlockedSubskill;
import static com.gmail.nossr50.util.text.ConfigStringUtils.getMaterialConfigString; import static com.gmail.nossr50.util.text.ConfigStringUtils.getMaterialConfigString;
import static java.util.Objects.requireNonNull; import static java.util.Objects.requireNonNull;
@@ -30,7 +32,6 @@ import com.gmail.nossr50.util.CancellableRunnable;
import com.gmail.nossr50.util.EventUtils; import com.gmail.nossr50.util.EventUtils;
import com.gmail.nossr50.util.ItemUtils; import com.gmail.nossr50.util.ItemUtils;
import com.gmail.nossr50.util.MetadataConstants; import com.gmail.nossr50.util.MetadataConstants;
import com.gmail.nossr50.util.Misc;
import com.gmail.nossr50.util.Permissions; import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.player.NotificationManager; import com.gmail.nossr50.util.player.NotificationManager;
import com.gmail.nossr50.util.random.ProbabilityUtil; import com.gmail.nossr50.util.random.ProbabilityUtil;
@@ -62,17 +63,23 @@ import org.jetbrains.annotations.NotNull;
public class HerbalismManager extends SkillManager { public class HerbalismManager extends SkillManager {
private final static HashMap<String, Integer> plantBreakLimits; private final static HashMap<String, Integer> plantBreakLimits;
private static final String CACTUS_STR = "cactus"; private static final String CACTUS_ID = "cactus";
private static final String CACTUS_FLOWER_STR = "cactus_flower"; private static final String CACTUS_FLOWER_STR = "cactus_flower";
private static final String BAMBOO_ID = "bamboo";
private static final String SUGAR_CANE_ID = "sugar_cane";
private static final String KELP_ID = "kelp";
private static final String KELP_PLANT_ID = "kelp_plant";
private static final String CHORUS_PLANT_ID = "chorus_plant";
private static final String SWEET_BERRY_BUSH_ID = "sweet_berry_bush";
static { static {
plantBreakLimits = new HashMap<>(); plantBreakLimits = new HashMap<>();
plantBreakLimits.put(CACTUS_STR, 3); plantBreakLimits.put(CACTUS_ID, 3);
plantBreakLimits.put("bamboo", 20); plantBreakLimits.put(BAMBOO_ID, 20);
plantBreakLimits.put("sugar_cane", 3); plantBreakLimits.put(SUGAR_CANE_ID, 3);
plantBreakLimits.put("kelp", 26); plantBreakLimits.put(KELP_ID, 26);
plantBreakLimits.put("kelp_plant", 26); plantBreakLimits.put(KELP_PLANT_ID, 26);
plantBreakLimits.put("chorus_plant", 22); plantBreakLimits.put(CHORUS_PLANT_ID, 22);
} }
public HerbalismManager(McMMOPlayer mmoPlayer) { public HerbalismManager(McMMOPlayer mmoPlayer) {
@@ -80,7 +87,7 @@ public class HerbalismManager extends SkillManager {
} }
public boolean canGreenThumbBlock(BlockState blockState) { public boolean canGreenThumbBlock(BlockState blockState) {
if (!RankUtils.hasUnlockedSubskill(getPlayer(), SubSkillType.HERBALISM_GREEN_THUMB)) { if (!hasUnlockedSubskill(getPlayer(), SubSkillType.HERBALISM_GREEN_THUMB)) {
return false; return false;
} }
@@ -98,7 +105,7 @@ public class HerbalismManager extends SkillManager {
return false; return false;
} }
if (!RankUtils.hasUnlockedSubskill(getPlayer(), SubSkillType.HERBALISM_SHROOM_THUMB)) { if (!hasUnlockedSubskill(getPlayer(), SubSkillType.HERBALISM_SHROOM_THUMB)) {
return false; return false;
} }
@@ -110,12 +117,12 @@ public class HerbalismManager extends SkillManager {
|| itemType == Material.RED_MUSHROOM) || itemType == Material.RED_MUSHROOM)
&& inventory.contains(Material.BROWN_MUSHROOM, 1) && inventory.contains(Material.BROWN_MUSHROOM, 1)
&& inventory.contains(Material.RED_MUSHROOM, 1) && inventory.contains(Material.RED_MUSHROOM, 1)
&& Permissions.isSubSkillEnabled(player, SubSkillType.HERBALISM_SHROOM_THUMB); && isSubSkillEnabled(player, SubSkillType.HERBALISM_SHROOM_THUMB);
} }
public void processBerryBushHarvesting(@NotNull BlockState blockState) { public void processBerryBushHarvesting(@NotNull BlockState blockState) {
/* Check if the player is harvesting a berry bush */ /* Check if the player is harvesting a berry bush */
if (blockState.getType().toString().equalsIgnoreCase("sweet_berry_bush")) { if (blockState.getType().toString().equalsIgnoreCase(SWEET_BERRY_BUSH_ID)) {
if (mmoPlayer.isDebugMode()) { if (mmoPlayer.isDebugMode()) {
mmoPlayer.getPlayer().sendMessage("Processing sweet berry bush rewards"); mmoPlayer.getPlayer().sendMessage("Processing sweet berry bush rewards");
} }
@@ -167,7 +174,7 @@ public class HerbalismManager extends SkillManager {
public void run() { public void run() {
BlockState blockState = block.getState(); BlockState blockState = block.getState();
if (blockState.getType().toString().equalsIgnoreCase("sweet_berry_bush")) { if (blockState.getType().toString().equalsIgnoreCase(SWEET_BERRY_BUSH_ID)) {
if (blockState.getBlockData() instanceof Ageable ageable) { if (blockState.getBlockData() instanceof Ageable ageable) {
if (ageable.getAge() <= 1) { if (ageable.getAge() <= 1) {
@@ -180,16 +187,16 @@ public class HerbalismManager extends SkillManager {
public boolean canUseHylianLuck() { public boolean canUseHylianLuck() {
if (!RankUtils.hasUnlockedSubskill(getPlayer(), SubSkillType.HERBALISM_HYLIAN_LUCK)) { if (!hasUnlockedSubskill(getPlayer(), SubSkillType.HERBALISM_HYLIAN_LUCK)) {
return false; return false;
} }
return Permissions.isSubSkillEnabled(getPlayer(), SubSkillType.HERBALISM_HYLIAN_LUCK); return isSubSkillEnabled(getPlayer(), SubSkillType.HERBALISM_HYLIAN_LUCK);
} }
public boolean canActivateAbility() { public boolean canActivateAbility() {
return mmoPlayer.getToolPreparationMode(ToolType.HOE) && Permissions.greenTerra( return mmoPlayer.getToolPreparationMode(ToolType.HOE)
getPlayer()); && Permissions.greenTerra(getPlayer());
} }
public boolean isGreenTerraActive() { public boolean isGreenTerraActive() {
@@ -379,8 +386,8 @@ public class HerbalismManager extends SkillManager {
public void checkDoubleDropsOnBrokenPlants(Player player, Collection<Block> brokenPlants) { public void checkDoubleDropsOnBrokenPlants(Player player, Collection<Block> brokenPlants) {
//Only proceed if skill unlocked and permission enabled //Only proceed if skill unlocked and permission enabled
if (!RankUtils.hasUnlockedSubskill(player, SubSkillType.HERBALISM_DOUBLE_DROPS) if (!hasUnlockedSubskill(player, SubSkillType.HERBALISM_DOUBLE_DROPS)
|| !Permissions.isSubSkillEnabled(player, SubSkillType.HERBALISM_DOUBLE_DROPS)) { || !isSubSkillEnabled(player, SubSkillType.HERBALISM_DOUBLE_DROPS)) {
return; return;
} }
@@ -470,7 +477,7 @@ public class HerbalismManager extends SkillManager {
/* /*
* Unnatural Blocks * Unnatural Blocks
*/ */
//If its a Crop we need to reward XP when its fully grown //If it's a Crop we need to reward XP when its fully grown
if (isAgeableAndFullyMature(plantData) && !isBizarreAgeable(plantData)) { if (isAgeableAndFullyMature(plantData) && !isBizarreAgeable(plantData)) {
xpToReward += ExperienceConfig.getInstance() xpToReward += ExperienceConfig.getInstance()
.getXp(PrimarySkillType.HERBALISM, brokenBlockNewState.getType()); .getXp(PrimarySkillType.HERBALISM, brokenBlockNewState.getType());
@@ -660,7 +667,7 @@ public class HerbalismManager extends SkillManager {
} }
private boolean isCactus(Material material) { private boolean isCactus(Material material) {
return material.getKey().getKey().equalsIgnoreCase(CACTUS_STR) return material.getKey().getKey().equalsIgnoreCase(CACTUS_ID)
|| material.getKey().getKey().equalsIgnoreCase(CACTUS_FLOWER_STR); || material.getKey().getKey().equalsIgnoreCase(CACTUS_FLOWER_STR);
} }
@@ -799,7 +806,6 @@ public class HerbalismManager extends SkillManager {
playerInventory.removeItem(new ItemStack(Material.BROWN_MUSHROOM)); playerInventory.removeItem(new ItemStack(Material.BROWN_MUSHROOM));
playerInventory.removeItem(new ItemStack(Material.RED_MUSHROOM)); playerInventory.removeItem(new ItemStack(Material.RED_MUSHROOM));
getPlayer().updateInventory();
if (!ProbabilityUtil.isSkillRNGSuccessful(SubSkillType.HERBALISM_SHROOM_THUMB, mmoPlayer)) { if (!ProbabilityUtil.isSkillRNGSuccessful(SubSkillType.HERBALISM_SHROOM_THUMB, mmoPlayer)) {
NotificationManager.sendPlayerInformation(getPlayer(), NotificationManager.sendPlayerInformation(getPlayer(),

View File

@@ -425,7 +425,6 @@ public class TamingManager extends SkillManager {
int itemAmountAfterPayingCost = int itemAmountAfterPayingCost =
itemInMainHand.getAmount() - tamingSummon.getItemAmountRequired(); itemInMainHand.getAmount() - tamingSummon.getItemAmountRequired();
itemInMainHand.setAmount(itemAmountAfterPayingCost); itemInMainHand.setAmount(itemAmountAfterPayingCost);
player.updateInventory();
} }
} else { } else {

View File

@@ -1,75 +0,0 @@
package com.gmail.nossr50.skills.unarmed;
import com.gmail.nossr50.util.sounds.SoundManager;
import com.gmail.nossr50.util.sounds.SoundType;
import org.bukkit.entity.Player;
import org.bukkit.event.entity.EntityPickupItemEvent;
import org.bukkit.inventory.ItemStack;
public class Unarmed {
public static double berserkDamageModifier = 1.5;
public static void handleItemPickup(Player player, EntityPickupItemEvent event) {
ItemStack[] storageContents = player.getInventory().getStorageContents();
ItemStack itemDrop = event.getItem().getItemStack();
int heldItemSlotID = player.getInventory().getHeldItemSlot();
int amount = itemDrop.getAmount();
boolean grabbedItem = false;
for (int i = 0; i <= storageContents.length - 1; i++) {
if (amount <= 0) {
break;
}
if (i == heldItemSlotID) {
continue;
}
//EMPTY SLOT!
if (storageContents[i] == null) {
player.getInventory().setItem(i, itemDrop);
amount = 0;
grabbedItem = true;
break;
} else if (itemDrop.isSimilar(storageContents[i])
&& storageContents[i].getAmount() < storageContents[i].getMaxStackSize()) {
//If we can fit this whole itemstack into this item
if (amount + storageContents[i].getAmount()
<= storageContents[i].getMaxStackSize()) {
ItemStack modifiedAmount = storageContents[i];
modifiedAmount.setAmount(amount + storageContents[i].getAmount());
player.getInventory().setItem(i, modifiedAmount);
grabbedItem = true;
amount = 0;
} else {
//Add what we can from this stack
ItemStack modifiedAmount = storageContents[i];
int amountThatCanFit =
storageContents[i].getMaxStackSize() - storageContents[i].getAmount();
modifiedAmount.setAmount(amountThatCanFit);
player.getInventory().setItem(i, modifiedAmount);
//Remove the amount we've added
grabbedItem = true;
amount -= amountThatCanFit;
}
}
}
if (amount <= 0) {
event.getItem().remove(); //Cleanup Item
} else {
event.getItem().getItemStack().setAmount(amount);
}
event.setCancelled(true);
if (grabbedItem) {
SoundManager.sendSound(player, player.getLocation(), SoundType.POP);
player.updateInventory();
}
}
}

View File

@@ -29,6 +29,7 @@ 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 {
public static final double BERSERK_DMG_MODIFIER = 1.5;
public UnarmedManager(McMMOPlayer mmoPlayer) { public UnarmedManager(McMMOPlayer mmoPlayer) {
super(mmoPlayer, PrimarySkillType.UNARMED); super(mmoPlayer, PrimarySkillType.UNARMED);
@@ -163,7 +164,7 @@ public class UnarmedManager extends SkillManager {
*/ */
public double berserkDamage(double damage) { public double berserkDamage(double damage) {
damage = damage =
((damage * Unarmed.berserkDamageModifier) * mmoPlayer.getAttackStrength()) - damage; ((damage * BERSERK_DMG_MODIFIER) * mmoPlayer.getAttackStrength()) - damage;
return damage; return damage;
} }

View File

@@ -1,6 +1,12 @@
package com.gmail.nossr50.events.items; package com.gmail.nossr50.events.items;
import static org.junit.jupiter.api.Assertions.*; import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertNotEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertSame;
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.mockito.Mockito.RETURNS_DEEP_STUBS; import static org.mockito.Mockito.RETURNS_DEEP_STUBS;
import static org.mockito.Mockito.atLeastOnce; import static org.mockito.Mockito.atLeastOnce;
import static org.mockito.Mockito.mock; import static org.mockito.Mockito.mock;