Add deepslate ores

This commit is contained in:
Mathieu Strypsteen 2024-09-23 10:02:17 +02:00
parent 326934c829
commit 7d534bb73a

View file

@ -7,33 +7,34 @@ import org.bukkit.Material;
import org.bukkit.event.EventHandler;
import org.bukkit.event.block.BlockBreakEvent;
import org.bukkit.scoreboard.Team;
import java.util.Arrays;
public class MineEvent extends Event {
private final Material block;
private final Material[] blocks;
public MineEvent(Team team, Difficulty difficulty, int scoreOnSuccess) {
super(team, difficulty, scoreOnSuccess);
block = switch (difficulty) {
case BABY -> Material.COAL_ORE;
case EASY -> Material.IRON_ORE;
case MEDIUM -> Material.REDSTONE_ORE;
case HARD -> Material.DIAMOND_ORE;
case SWEAT -> Material.EMERALD_ORE;
case IMPOSSIBLE -> Material.BEDROCK;
blocks = switch (difficulty) {
case BABY -> new Material[] { Material.COAL_ORE, Material.DEEPSLATE_COAL_ORE };
case EASY -> new Material[] { Material.IRON_ORE, Material.DEEPSLATE_IRON_ORE };
case MEDIUM -> new Material[] { Material.REDSTONE_ORE, Material.DEEPSLATE_REDSTONE_ORE };
case HARD -> new Material[] { Material.DIAMOND_ORE, Material.DEEPSLATE_DIAMOND_ORE };
case SWEAT -> new Material[] { Material.EMERALD_ORE, Material.DEEPSLATE_EMERALD_ORE };
case IMPOSSIBLE -> new Material[] { Material.BEDROCK };
};
}
@EventHandler
public void onBlockBreak(BlockBreakEvent event) {
if (MC13DTL.board.getPlayers(team).contains(event.getPlayer()) && event.getBlock().getType() == block) {
if (MC13DTL.board.getPlayers(team).contains(event.getPlayer()) && Arrays.asList(blocks).contains(event.getBlock().getType())) {
eventSuccess();
}
}
@Override
protected String getMessage() {
return "Mine the following block before dawn: " + block.toString();
return "Mine the following block before dawn: " + blocks[0].toString();
}
}