Oops
This commit is contained in:
parent
ed0a9659f7
commit
25bffc9509
1 changed files with 12 additions and 0 deletions
|
@ -14,6 +14,7 @@ import org.bukkit.scoreboard.Team;
|
|||
public class FallEvent extends Event {
|
||||
|
||||
private final int extraHeight;
|
||||
private int targetHeight;
|
||||
|
||||
public FallEvent(Team team, Difficulty difficulty, int scoreOnSuccess) {
|
||||
super(team, difficulty, scoreOnSuccess);
|
||||
|
@ -39,6 +40,7 @@ public class FallEvent extends Event {
|
|||
while (location.y() > 50 && world.getBlockAt(location).getType() == Material.AIR) {
|
||||
location.setY(location.getY() - 1);
|
||||
}
|
||||
targetHeight = (int) location.getY() + 5;
|
||||
int blocksToIncrease = extraHeight;
|
||||
while (location.y() < 315 && blocksToIncrease > 0) {
|
||||
location.setY(location.getY() + 1);
|
||||
|
@ -54,6 +56,16 @@ public class FallEvent extends Event {
|
|||
super.start();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
for (Player player : MC13DTL.board.getPlayers(team)) {
|
||||
if (player.getLocation().y() > targetHeight) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
eventSuccess();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getMessage() {
|
||||
return "And now you should get down again... safely";
|
||||
|
|
Loading…
Reference in a new issue