mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-25 14:46:46 +01:00
Unarmed no longer uses a serverwide cooldown for all players for bonus
damage
This commit is contained in:
parent
9092e70544
commit
a66940b2b8
@ -1,5 +1,6 @@
|
||||
Version 2.1.91
|
||||
mcMMO is now more compatible with plugins that spawn arrows in unexpected ways, this fixes some NPE in mcMMO when using certain plugins
|
||||
Fixed a bug where Unarmed was using the same CD timer for every player in the server (thanks slop_me)
|
||||
|
||||
Version 2.1.90
|
||||
Salvaged items now travel much slower towards the player
|
||||
|
2
pom.xml
2
pom.xml
@ -2,7 +2,7 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>com.gmail.nossr50.mcMMO</groupId>
|
||||
<artifactId>mcMMO</artifactId>
|
||||
<version>2.1.91-SNAPSHOT</version>
|
||||
<version>2.1.91</version>
|
||||
<name>mcMMO</name>
|
||||
<url>https://github.com/mcMMO-Dev/mcMMO</url>
|
||||
<scm>
|
||||
|
@ -10,8 +10,6 @@ import org.bukkit.inventory.ItemStack;
|
||||
public class Unarmed {
|
||||
public static boolean blockCrackerSmoothBrick = Config.getInstance().getUnarmedBlockCrackerSmoothbrickToCracked();
|
||||
public static double berserkDamageModifier = 1.5;
|
||||
public static long lastAttacked = 0;
|
||||
public static long attackInterval = 750;
|
||||
|
||||
public static void handleItemPickup(Player player, EntityPickupItemEvent event) {
|
||||
ItemStack[] storageContents = player.getInventory().getStorageContents();
|
||||
|
@ -20,17 +20,29 @@ import com.gmail.nossr50.util.skills.RankUtils;
|
||||
import com.gmail.nossr50.util.skills.SkillActivationType;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.BlockState;
|
||||
import org.bukkit.block.data.BlockData;
|
||||
import org.bukkit.entity.Item;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
public class UnarmedManager extends SkillManager {
|
||||
private long lastAttacked;
|
||||
private long attackInterval;
|
||||
|
||||
public UnarmedManager(McMMOPlayer mcMMOPlayer) {
|
||||
super(mcMMOPlayer, PrimarySkillType.UNARMED);
|
||||
initUnarmedPerPlayerVars();
|
||||
}
|
||||
|
||||
/**
|
||||
* Inits variables used for each player for unarmed
|
||||
*/
|
||||
private void initUnarmedPerPlayerVars() {
|
||||
lastAttacked = 0;
|
||||
attackInterval = 750;
|
||||
}
|
||||
|
||||
|
||||
public boolean canActivateAbility() {
|
||||
return mcMMOPlayer.getToolPreparationMode(ToolType.FISTS) && Permissions.berserk(getPlayer());
|
||||
}
|
||||
@ -74,8 +86,6 @@ public class UnarmedManager extends SkillManager {
|
||||
return false;
|
||||
}
|
||||
|
||||
BlockData data = blockState.getBlockData();
|
||||
|
||||
switch (blockState.getType()) {
|
||||
case STONE_BRICKS:
|
||||
if (!Unarmed.blockCrackerSmoothBrick) {
|
||||
@ -150,7 +160,7 @@ public class UnarmedManager extends SkillManager {
|
||||
}
|
||||
|
||||
public boolean isPunchingCooldownOver() {
|
||||
return (Unarmed.lastAttacked + Unarmed.attackInterval) <= System.currentTimeMillis();
|
||||
return (lastAttacked + attackInterval) <= System.currentTimeMillis();
|
||||
}
|
||||
|
||||
public double getIronArmDamage() {
|
||||
@ -181,4 +191,20 @@ public class UnarmedManager extends SkillManager {
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public long getLastAttacked() {
|
||||
return lastAttacked;
|
||||
}
|
||||
|
||||
public void setLastAttacked(long lastAttacked) {
|
||||
this.lastAttacked = lastAttacked;
|
||||
}
|
||||
|
||||
public long getAttackInterval() {
|
||||
return attackInterval;
|
||||
}
|
||||
|
||||
public void setAttackInterval(long attackInterval) {
|
||||
this.attackInterval = attackInterval;
|
||||
}
|
||||
}
|
||||
|
@ -166,7 +166,7 @@ public final class CombatUtils {
|
||||
|
||||
applyScaledModifiers(initialDamage, finalDamage, event);
|
||||
startGainXp(mcMMOPlayer, target, PrimarySkillType.UNARMED);
|
||||
Unarmed.lastAttacked = System.currentTimeMillis(); //Track how often the player is punching
|
||||
unarmedManager.setLastAttacked(System.currentTimeMillis()); //Track how often the player is punching
|
||||
}
|
||||
|
||||
private static void processTamingCombat(LivingEntity target, Player master, Wolf wolf, EntityDamageByEntityEvent event) {
|
||||
|
Loading…
Reference in New Issue
Block a user