add climb event
This commit is contained in:
parent
e03c60356f
commit
b6407a6b59
3 changed files with 68 additions and 1 deletions
5
out/production/resources/plugin.yml
Normal file
5
out/production/resources/plugin.yml
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
name: 13DTL
|
||||||
|
version: 0.0.1
|
||||||
|
main: gent.zeus.mc13dtl.MC13DTL
|
||||||
|
api-version: '1.21.1'
|
||||||
|
load: STARTUP
|
|
@ -1,5 +1,6 @@
|
||||||
package gent.zeus.mc13dtl.events;
|
package gent.zeus.mc13dtl.events;
|
||||||
|
|
||||||
|
import gent.zeus.mc13dtl.events.catalog.ClimbEvent;
|
||||||
import gent.zeus.mc13dtl.events.catalog.CraftEvent;
|
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;
|
||||||
|
@ -18,7 +19,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);
|
public static List<Integer> startTimes = List.of(5000, 13000, 1000, 13000);
|
||||||
|
|
||||||
private long day;
|
private long day;
|
||||||
|
|
||||||
|
@ -46,6 +47,7 @@ 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());
|
||||||
default -> throw new IllegalStateException("Unexpected day: " + (int) day);
|
default -> throw new IllegalStateException("Unexpected day: " + (int) day);
|
||||||
};
|
};
|
||||||
event.start();
|
event.start();
|
||||||
|
|
|
@ -0,0 +1,60 @@
|
||||||
|
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.Bukkit;
|
||||||
|
import org.bukkit.Location;
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.scoreboard.Team;
|
||||||
|
|
||||||
|
public class ClimbEvent extends Event {
|
||||||
|
|
||||||
|
private final int heightGoal;
|
||||||
|
|
||||||
|
public ClimbEvent(Team team, Difficulty difficulty, int scoreOnSuccess) {
|
||||||
|
super(team, difficulty, scoreOnSuccess);
|
||||||
|
heightGoal = switch (difficulty) {
|
||||||
|
case BABY -> -30;
|
||||||
|
case EASY -> 0;
|
||||||
|
case MEDIUM -> 11;
|
||||||
|
case HARD -> 100;
|
||||||
|
case SWEAT -> 250;
|
||||||
|
case IMPOSSIBLE -> 500;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void start() {
|
||||||
|
Player player = MC13DTL.board.getPlayers(team).getFirst();
|
||||||
|
|
||||||
|
player.getLocation().x();
|
||||||
|
Location location = new Location(Bukkit.getWorld("world"), player.getX(), -50, player.getZ());
|
||||||
|
location.getBlock().setType(Material.AIR);
|
||||||
|
location.add(0, -1, 0).getBlock().setType(Material.AIR);
|
||||||
|
|
||||||
|
for (Player p : MC13DTL.board.getPlayers(team)) {
|
||||||
|
p.teleport(location);
|
||||||
|
}
|
||||||
|
|
||||||
|
super.start();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void eventTimeEnded() {
|
||||||
|
for (Player player : MC13DTL.board.getPlayers(team)) {
|
||||||
|
if (player.getLocation().y() < heightGoal) {
|
||||||
|
eventFailed();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
eventSuccess();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getMessage() {
|
||||||
|
return "When dawn arrives everyone on your team needs to be above y level " + heightGoal;
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue