mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-25 14:46:46 +01:00
Berserk now breaks glass and makes noise when doing so
This commit is contained in:
parent
7b8c90d362
commit
ac731258c7
@ -1,4 +1,6 @@
|
||||
Version 2.1.113
|
||||
Berserk will now break glass and glass pane blocks
|
||||
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
|
||||
Check player's PTP world permissions before executing a party teleport
|
||||
|
@ -1,7 +1,9 @@
|
||||
package com.gmail.nossr50.datatypes.skills;
|
||||
|
||||
import com.gmail.nossr50.config.Config;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.util.BlockUtils;
|
||||
import com.gmail.nossr50.util.MaterialMapStore;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.StringUtils;
|
||||
import org.bukkit.Material;
|
||||
@ -198,7 +200,7 @@ public enum SuperAbilityType {
|
||||
public boolean blockCheck(BlockState blockState) {
|
||||
switch (this) {
|
||||
case BERSERK:
|
||||
return (BlockUtils.affectedByGigaDrillBreaker(blockState) || blockState.getType() == Material.SNOW);
|
||||
return (BlockUtils.affectedByGigaDrillBreaker(blockState) || blockState.getType() == Material.SNOW || mcMMO.getMaterialMapStore().isGlass(blockState.getType()));
|
||||
|
||||
case GIGA_DRILL_BREAKER:
|
||||
return BlockUtils.affectedByGigaDrillBreaker(blockState);
|
||||
|
@ -595,7 +595,12 @@ public class BlockListener implements Listener {
|
||||
}
|
||||
else if (SuperAbilityType.BERSERK.blockCheck(block.getState()) && EventUtils.simulateBlockBreak(block, player, true)) {
|
||||
event.setInstaBreak(true);
|
||||
SoundManager.sendSound(player, block.getLocation(), SoundType.POP);
|
||||
|
||||
if(block.getState().getType().getKey().getKey().contains("glass")) {
|
||||
SoundManager.worldSendSound(player.getWorld(), block.getLocation(), SoundType.GLASS);
|
||||
} else {
|
||||
SoundManager.sendSound(player, block.getLocation(), SoundType.POP);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (mcMMOPlayer.getWoodcuttingManager().canUseLeafBlower(heldItem) && BlockUtils.isLeaves(blockState) && EventUtils.simulateBlockBreak(block, player, true)) {
|
||||
|
@ -22,6 +22,7 @@ public class MaterialMapStore {
|
||||
private HashSet<String> canMakeShroomyWhiteList;
|
||||
private HashSet<String> multiBlockPlant;
|
||||
private HashSet<String> foodItemWhiteList;
|
||||
private HashSet<String> glassBlocks;
|
||||
|
||||
public MaterialMapStore()
|
||||
{
|
||||
@ -34,6 +35,7 @@ public class MaterialMapStore {
|
||||
canMakeShroomyWhiteList = new HashSet<>();
|
||||
multiBlockPlant = new HashSet<>();
|
||||
foodItemWhiteList = new HashSet<>();
|
||||
glassBlocks = new HashSet<>();
|
||||
|
||||
fillHardcodedHashSets();
|
||||
}
|
||||
@ -89,6 +91,44 @@ public class MaterialMapStore {
|
||||
fillShroomyWhiteList();
|
||||
fillMultiBlockPlantSet();
|
||||
fillFoodWhiteList();
|
||||
fillGlassBlockWhiteList();
|
||||
}
|
||||
|
||||
private void fillGlassBlockWhiteList() {
|
||||
glassBlocks.add("glass");
|
||||
glassBlocks.add("glass_pane");
|
||||
glassBlocks.add("black_stained_glass");
|
||||
glassBlocks.add("black_stained_glass_pane");
|
||||
glassBlocks.add("blue_stained_glass");
|
||||
glassBlocks.add("blue_stained_glass_pane");
|
||||
glassBlocks.add("brown_stained_glass");
|
||||
glassBlocks.add("brown_stained_glass_pane");
|
||||
glassBlocks.add("cyan_stained_glass");
|
||||
glassBlocks.add("cyan_stained_glass_pane");
|
||||
glassBlocks.add("gray_stained_glass");
|
||||
glassBlocks.add("gray_stained_glass_pane");
|
||||
glassBlocks.add("green_stained_glass");
|
||||
glassBlocks.add("green_stained_glass_pane");
|
||||
glassBlocks.add("light_blue_stained_glass");
|
||||
glassBlocks.add("light_blue_stained_glass_pane");
|
||||
glassBlocks.add("light_gray_stained_glass");
|
||||
glassBlocks.add("light_gray_stained_glass_pane");
|
||||
glassBlocks.add("lime_stained_glass");
|
||||
glassBlocks.add("lime_stained_glass_pane");
|
||||
glassBlocks.add("magenta_stained_glass");
|
||||
glassBlocks.add("magenta_stained_glass_pane");
|
||||
glassBlocks.add("orange_stained_glass");
|
||||
glassBlocks.add("orange_stained_glass_pane");
|
||||
glassBlocks.add("pink_stained_glass");
|
||||
glassBlocks.add("pink_stained_glass_pane");
|
||||
glassBlocks.add("purple_stained_glass");
|
||||
glassBlocks.add("purple_stained_glass_pane");
|
||||
glassBlocks.add("red_stained_glass");
|
||||
glassBlocks.add("red_stained_glass_pane");
|
||||
glassBlocks.add("white_stained_glass");
|
||||
glassBlocks.add("white_stained_glass_pane");
|
||||
glassBlocks.add("yellow_stained_glass");
|
||||
glassBlocks.add("yellow_stained_glass_pane");
|
||||
}
|
||||
|
||||
private void fillFoodWhiteList() {
|
||||
@ -130,6 +170,10 @@ public class MaterialMapStore {
|
||||
foodItemWhiteList.add("tropical_fish");
|
||||
}
|
||||
|
||||
public boolean isGlass(Material material) {
|
||||
return glassBlocks.contains(material.getKey().getKey());
|
||||
}
|
||||
|
||||
public boolean isFood(Material material) {
|
||||
return foodItemWhiteList.contains(material.getKey().getKey());
|
||||
}
|
||||
|
@ -91,6 +91,8 @@ public class SoundManager {
|
||||
return Sound.BLOCK_CONDUIT_AMBIENT;
|
||||
case BLEED:
|
||||
return Sound.ENTITY_ENDER_EYE_DEATH;
|
||||
case GLASS:
|
||||
return Sound.BLOCK_GLASS_BREAK;
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
|
@ -14,6 +14,7 @@ public enum SoundType {
|
||||
ABILITY_ACTIVATED_GENERIC,
|
||||
ABILITY_ACTIVATED_BERSERK,
|
||||
BLEED,
|
||||
GLASS,
|
||||
TIRED;
|
||||
|
||||
public boolean usesCustomPitch()
|
||||
|
@ -4,6 +4,10 @@ Sounds:
|
||||
# 1.0 = Max volume
|
||||
# 0.0 = No Volume
|
||||
MasterVolume: 1.0
|
||||
GLASS:
|
||||
Enable: true
|
||||
Volume: 1.0
|
||||
Pitch: 1.0
|
||||
ANVIL:
|
||||
Enable: true
|
||||
Volume: 1.0
|
||||
|
Loading…
Reference in New Issue
Block a user