Add start of MineEvent

This commit is contained in:
Mathieu Strypsteen 2024-09-22 15:47:28 +02:00
parent 6d2af423fd
commit eb42f29d5b
2 changed files with 43 additions and 7 deletions

View file

@ -15,7 +15,7 @@ import gent.zeus.mc13dtl.MC13DTL;
public class EventRunner implements Runnable { public class EventRunner implements Runnable {
static List<Event> currentEvents = new ArrayList<>(); static List<Event> currentEvents = new ArrayList<>();
public static List<Integer> startTimes = List.of(5000, 13000, 1000, 13000, 100, 1000, 500, 10000, 5000, 100); public static List<Integer> startTimes = List.of(5000, 13000, 1000, 1000, 13000, 100, 1000, 500, 10000, 5000, 100);
private long day; private long day;
@ -43,13 +43,14 @@ public class EventRunner implements Runnable {
case 0 -> new SuicideEvent(team, difficulty, getDayScore()); case 0 -> new SuicideEvent(team, difficulty, getDayScore());
case 1 -> new KillMobs1Event(team, difficulty, getDayScore()); case 1 -> new KillMobs1Event(team, difficulty, getDayScore());
case 2 -> new CraftEvent(team, difficulty, getDayScore()); case 2 -> new CraftEvent(team, difficulty, getDayScore());
case 3 -> new ClimbEvent(team, difficulty, getDayScore()); case 3 -> new MineEvent(team, difficulty, getDayScore());
case 4 -> new FallEvent(team, difficulty, getDayScore()); case 4 -> new ClimbEvent(team, difficulty, getDayScore());
case 5 -> new KillPlayerEvent(team, difficulty, getDayScore()); case 5 -> new FallEvent(team, difficulty, getDayScore());
case 6 -> new StructureEvent(team, difficulty, getDayScore()); case 6 -> new KillPlayerEvent(team, difficulty, getDayScore());
case 7 -> new KillSurvivingTeamEvent(team, difficulty, getDayScore()); case 7 -> new StructureEvent(team, difficulty, getDayScore());
case 8 -> new KillSurvivingTeamEvent(team, difficulty, getDayScore()); case 8 -> new KillSurvivingTeamEvent(team, difficulty, getDayScore());
case 9 -> new EndEvent(team, difficulty, getDayScore()); // TODO: Move to last day case 9 -> new KillMobs2Event(team, difficulty, getDayScore());
case 10 -> new EndEvent(team, difficulty, getDayScore()); // TODO: Move to last day
default -> throw new IllegalStateException("Unexpected day: " + (int) day); default -> throw new IllegalStateException("Unexpected day: " + (int) day);
}; };
event.start(); event.start();

View file

@ -0,0 +1,35 @@
package gent.zeus.mc13dtl.events.catalog;
import gent.zeus.mc13dtl.events.Difficulty;
import gent.zeus.mc13dtl.events.Event;
import org.bukkit.Material;
import org.bukkit.event.EventHandler;
import org.bukkit.event.block.BlockBreakEvent;
import org.bukkit.scoreboard.Team;
public class MineEvent extends Event {
private final Material block;
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;
};
}
@EventHandler
public void onBlockBreak(BlockBreakEvent event) {
}
@Override
protected String getMessage() {
return "Mine the following block before dawn: " + block.toString();
}
}