mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-25 06:36:45 +01:00
Move BlockCracker into the UnarmedManager
This commit is contained in:
parent
09169bd019
commit
a9438ed52b
@ -34,7 +34,7 @@ import com.gmail.nossr50.skills.herbalism.HerbalismManager;
|
|||||||
import com.gmail.nossr50.skills.mining.MiningManager;
|
import com.gmail.nossr50.skills.mining.MiningManager;
|
||||||
import com.gmail.nossr50.skills.repair.Repair;
|
import com.gmail.nossr50.skills.repair.Repair;
|
||||||
import com.gmail.nossr50.skills.smelting.SmeltingManager;
|
import com.gmail.nossr50.skills.smelting.SmeltingManager;
|
||||||
import com.gmail.nossr50.skills.unarmed.Unarmed;
|
import com.gmail.nossr50.skills.unarmed.UnarmedManager;
|
||||||
import com.gmail.nossr50.skills.woodcutting.WoodcuttingManager;
|
import com.gmail.nossr50.skills.woodcutting.WoodcuttingManager;
|
||||||
import com.gmail.nossr50.util.BlockUtils;
|
import com.gmail.nossr50.util.BlockUtils;
|
||||||
import com.gmail.nossr50.util.ItemUtils;
|
import com.gmail.nossr50.util.ItemUtils;
|
||||||
@ -354,8 +354,10 @@ public class BlockListener implements Listener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Another perm check for the cracked blocks activation
|
// Another perm check for the cracked blocks activation
|
||||||
else if (BlockUtils.affectedByBlockCracker(blockState) && Permissions.blockCracker(player)) {
|
else if (BlockUtils.affectedByBlockCracker(blockState)) {
|
||||||
if (Unarmed.blockCracker(player, blockState)) {
|
UnarmedManager unarmedManager = mcMMOPlayer.getUnarmedManager();
|
||||||
|
|
||||||
|
if (unarmedManager.canUseBlockCracker() && SkillUtils.blockBreakSimulate(block, player, false) && unarmedManager.blockCrackerCheck(blockState)) {
|
||||||
blockState.update();
|
blockState.update();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,12 +1,7 @@
|
|||||||
package com.gmail.nossr50.skills.unarmed;
|
package com.gmail.nossr50.skills.unarmed;
|
||||||
|
|
||||||
import org.bukkit.Material;
|
|
||||||
import org.bukkit.block.BlockState;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
|
|
||||||
import com.gmail.nossr50.config.AdvancedConfig;
|
import com.gmail.nossr50.config.AdvancedConfig;
|
||||||
import com.gmail.nossr50.config.Config;
|
import com.gmail.nossr50.config.Config;
|
||||||
import com.gmail.nossr50.util.skills.SkillUtils;
|
|
||||||
|
|
||||||
public class Unarmed {
|
public class Unarmed {
|
||||||
public static int ironArmMaxBonusDamage = AdvancedConfig.getInstance().getIronArmMaxBonus();
|
public static int ironArmMaxBonusDamage = AdvancedConfig.getInstance().getIronArmMaxBonus();
|
||||||
@ -24,23 +19,4 @@ public class Unarmed {
|
|||||||
public static boolean blockCrackerSmoothBrick = Config.getInstance().getUnarmedBlockCrackerSmoothbrickToCracked();
|
public static boolean blockCrackerSmoothBrick = Config.getInstance().getUnarmedBlockCrackerSmoothbrickToCracked();
|
||||||
|
|
||||||
public static double berserkDamageModifier = 1.5;
|
public static double berserkDamageModifier = 1.5;
|
||||||
|
|
||||||
public static boolean blockCracker(Player player, BlockState blockState) {
|
|
||||||
if (SkillUtils.blockBreakSimulate(blockState.getBlock(), player, false)) {
|
|
||||||
Material type = blockState.getType();
|
|
||||||
|
|
||||||
switch (type) {
|
|
||||||
case SMOOTH_BRICK:
|
|
||||||
if (blockCrackerSmoothBrick && blockState.getRawData() == (byte) 0x0) {
|
|
||||||
blockState.setRawData((byte) 0x2);
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
|
|
||||||
default:
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package com.gmail.nossr50.skills.unarmed;
|
package com.gmail.nossr50.skills.unarmed;
|
||||||
|
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.block.BlockState;
|
||||||
import org.bukkit.entity.LivingEntity;
|
import org.bukkit.entity.LivingEntity;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
@ -44,6 +45,25 @@ public class UnarmedManager extends SkillManager {
|
|||||||
return player.getItemInHand().getType() == Material.AIR && Permissions.arrowDeflect(player);
|
return player.getItemInHand().getType() == Material.AIR && Permissions.arrowDeflect(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean canUseBlockCracker() {
|
||||||
|
return Permissions.blockCracker(getPlayer());
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean blockCrackerCheck(BlockState blockState) {
|
||||||
|
Material type = blockState.getType();
|
||||||
|
|
||||||
|
switch (type) {
|
||||||
|
case SMOOTH_BRICK:
|
||||||
|
if (Unarmed.blockCrackerSmoothBrick && blockState.getRawData() == (byte) 0x0) {
|
||||||
|
blockState.setRawData((byte) 0x2);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
|
||||||
|
default:
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check for disarm.
|
* Check for disarm.
|
||||||
*
|
*
|
||||||
|
Loading…
Reference in New Issue
Block a user