Berserk now breaks a soft block if it was used to activate it

This commit is contained in:
nossr50 2020-01-24 01:25:55 -08:00
parent 4fd94bfe29
commit 15d3119627
3 changed files with 20 additions and 4 deletions

View File

@ -1,5 +1,7 @@
Version 2.1.113
Activating Berserk on a soft block (glass, snow, dirts) will break that material right away instead of only breaking subsequent blocks hit by the player
Berserk will now break glass and glass pane blocks
Hitting glass with berserk readied will activate it
Added GLASS settings to sounds.yml for Berserk
Fixed bug where BlockCracker didn't work on infested_stone_bricks
Fixed a bug where beacons could be duplicated

View File

@ -849,7 +849,6 @@ public class McMMOPlayer {
return;
}
//TODO: This is hacky and temporary solution until skills are move to the new system
//Potential problems with this include skills with two super abilities (ie mining)
if(!skill.isSuperAbilityUnlocked(getPlayer()))

View File

@ -512,8 +512,23 @@ public class BlockListener implements Listener {
else if (mcMMOPlayer.getToolPreparationMode(ToolType.SHOVEL) && ItemUtils.isShovel(heldItem) && BlockUtils.affectedByGigaDrillBreaker(blockState) && Permissions.gigaDrillBreaker(player)) {
mcMMOPlayer.checkAbilityActivation(PrimarySkillType.EXCAVATION);
}
else if (mcMMOPlayer.getToolPreparationMode(ToolType.FISTS) && heldItem.getType() == Material.AIR && (BlockUtils.affectedByGigaDrillBreaker(blockState) || blockState.getType() == Material.SNOW || BlockUtils.affectedByBlockCracker(blockState) && Permissions.berserk(player))) {
else if (mcMMOPlayer.getToolPreparationMode(ToolType.FISTS) && heldItem.getType() == Material.AIR && (BlockUtils.affectedByGigaDrillBreaker(blockState)
|| mcMMO.getMaterialMapStore().isGlass(blockState.getType())
|| blockState.getType() == Material.SNOW
|| BlockUtils.affectedByBlockCracker(blockState) && Permissions.berserk(player))) {
mcMMOPlayer.checkAbilityActivation(PrimarySkillType.UNARMED);
if(mcMMOPlayer.getAbilityMode(SuperAbilityType.BERSERK)) {
if (SuperAbilityType.BERSERK.blockCheck(blockState) && EventUtils.simulateBlockBreak(blockState.getBlock(), player, true)) {
event.setInstaBreak(true);
if(blockState.getType().getKey().getKey().contains("glass")) {
SoundManager.worldSendSound(player.getWorld(), blockState.getLocation(), SoundType.GLASS);
} else {
SoundManager.sendSound(player, blockState.getLocation(), SoundType.POP);
}
}
}
}
}
@ -593,10 +608,10 @@ public class BlockListener implements Listener {
blockState.update();
}
}
else if (SuperAbilityType.BERSERK.blockCheck(block.getState()) && EventUtils.simulateBlockBreak(block, player, true)) {
else if (!event.getInstaBreak() && SuperAbilityType.BERSERK.blockCheck(blockState) && EventUtils.simulateBlockBreak(block, player, true)) {
event.setInstaBreak(true);
if(block.getState().getType().getKey().getKey().contains("glass")) {
if(blockState.getType().getKey().getKey().contains("glass")) {
SoundManager.worldSendSound(player.getWorld(), block.getLocation(), SoundType.GLASS);
} else {
SoundManager.sendSound(player, block.getLocation(), SoundType.POP);