Adds a new item to allow arena re-tries

Prevents a NumberFormatException if the record number is invalid
Updates Spigot to 1.20
This commit is contained in:
2023-06-12 23:17:48 +02:00
parent 38839c0287
commit 57b3b85fbc
12 changed files with 97 additions and 20 deletions

View File

@@ -15,7 +15,7 @@ public abstract class AbstractArenaSession implements ArenaSession {
private final @NotNull ArenaGameMode gameMode;
private final @NotNull Player player;
protected int deaths;
protected final long startTime;
protected long startTime;
protected PlayerEntryState entryState;
/**
@@ -47,6 +47,14 @@ public abstract class AbstractArenaSession implements ArenaSession {
player.sendMessage(Message.SUCCESS_ARENA_QUIT.getMessage());
}
@Override
public void reset() {
this.deaths = 0;
this.startTime = System.currentTimeMillis();
PlayerTeleporter.teleportPlayer(this.player, this.arena.getSpawnLocation(), false, false);
this.entryState.setArenaState();
}
/**
* Announces a record set by this player
*

View File

@@ -47,4 +47,9 @@ public interface ArenaSession {
*/
@NotNull ArenaGUI getGUI();
/**
* Resets the session to allow a player to try again
*/
void reset();
}

View File

@@ -116,6 +116,12 @@ public class ParkourArenaSession extends AbstractArenaSession {
return new ParkourGUI(player);
}
@Override
public void reset() {
this.reachedCheckpoint = null;
super.reset();
}
@Override
protected void removeSession() {
// Remove this session for game sessions to stop listeners from fiddling more with the player