Add event for day 3
This commit is contained in:
parent
4d0702e1cf
commit
e03c60356f
3 changed files with 43 additions and 2 deletions
|
@ -1,5 +1,6 @@
|
||||||
package gent.zeus.mc13dtl.events;
|
package gent.zeus.mc13dtl.events;
|
||||||
|
|
||||||
|
import gent.zeus.mc13dtl.events.catalog.CraftEvent;
|
||||||
import gent.zeus.mc13dtl.events.catalog.KillMobs1Event;
|
import gent.zeus.mc13dtl.events.catalog.KillMobs1Event;
|
||||||
import gent.zeus.mc13dtl.events.catalog.SuicideEvent;
|
import gent.zeus.mc13dtl.events.catalog.SuicideEvent;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
|
@ -17,7 +18,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);
|
public static List<Integer> startTimes = List.of(5000, 13000, 1000);
|
||||||
|
|
||||||
private long day;
|
private long day;
|
||||||
|
|
||||||
|
@ -44,6 +45,7 @@ public class EventRunner implements Runnable {
|
||||||
Event event = switch ((int) day) {
|
Event event = switch ((int) day) {
|
||||||
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());
|
||||||
default -> throw new IllegalStateException("Unexpected day: " + (int) day);
|
default -> throw new IllegalStateException("Unexpected day: " + (int) day);
|
||||||
};
|
};
|
||||||
event.start();
|
event.start();
|
||||||
|
|
|
@ -0,0 +1,39 @@
|
||||||
|
package gent.zeus.mc13dtl.events.catalog;
|
||||||
|
|
||||||
|
import gent.zeus.mc13dtl.MC13DTL;
|
||||||
|
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.inventory.CraftItemEvent;
|
||||||
|
import org.bukkit.scoreboard.Team;
|
||||||
|
|
||||||
|
|
||||||
|
public class CraftEvent extends Event {
|
||||||
|
|
||||||
|
private final Material item;
|
||||||
|
|
||||||
|
public CraftEvent(Team team, Difficulty difficulty, int scoreOnSuccess) {
|
||||||
|
super(team, difficulty, scoreOnSuccess);
|
||||||
|
item = switch (difficulty) {
|
||||||
|
case BABY -> Material.SHIELD;
|
||||||
|
case EASY -> Material.ENCHANTING_TABLE;
|
||||||
|
case MEDIUM -> Material.REDSTONE_LAMP;
|
||||||
|
case HARD -> Material.BREWING_STAND;
|
||||||
|
case SWEAT -> Material.STICKY_PISTON;
|
||||||
|
case IMPOSSIBLE -> Material.BEACON;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void onPlayerCraft(CraftItemEvent event) {
|
||||||
|
if (event.getRecipe().getResult().getType() == item && MC13DTL.board.getPlayers(team).contains(event.getWhoClicked())) {
|
||||||
|
eventSuccess();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getMessage() {
|
||||||
|
return "Craft the following item before dawn: " + item.toString();
|
||||||
|
}
|
||||||
|
}
|
|
@ -48,6 +48,6 @@ public class KillMobs1Event extends Event implements Listener {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected String getMessage() {
|
protected String getMessage() {
|
||||||
return "Your team has to kill " + killsLeft + " " + monster.toString();
|
return "Your team has to kill " + killsLeft + " " + monster.toString() + " before dawn";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue