Add configurable respawn time to GameConfig
Introduced a new RESPAWN section in GameConfig for managing respawn time settings. Updated OnPlayerDeath to use the configurable value instead of a hardcoded duration. This allows greater flexibility for game configuration.
This commit is contained in:
parent
74cf3589c0
commit
728e8b7486
|
|
@ -96,4 +96,15 @@ public class GameConfig extends AbstractConfig {
|
|||
}
|
||||
}
|
||||
|
||||
public static class RESPAWN {
|
||||
private static final String prefix = "respawn.";
|
||||
|
||||
public static int TIME = 10;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private static void load() {
|
||||
TIME = config.getInt(prefix, "time", TIME);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package com.alttd.ctf.events;
|
|||
|
||||
import com.alttd.ctf.Main;
|
||||
import com.alttd.ctf.config.Config;
|
||||
import com.alttd.ctf.config.GameConfig;
|
||||
import com.alttd.ctf.game.GameManager;
|
||||
import com.alttd.ctf.game.GamePhase;
|
||||
import com.alttd.ctf.team.TeamPlayer;
|
||||
|
|
@ -55,7 +56,7 @@ public class OnPlayerDeath implements Listener {
|
|||
}
|
||||
TeamPlayer teamPlayer = optionalTeamPlayer.get();
|
||||
event.setRespawnLocation(player.getWorld().getSpawnLocation());
|
||||
Bukkit.getScheduler().runTaskLater(main, () -> teamPlayer.getGameClass().apply(teamPlayer, worldBorderApi, gamePhase.get(), true), Config.SETTINGS * 20);//10 x 20 ticks aka 10 seconds
|
||||
Bukkit.getScheduler().runTaskLater(main, () -> teamPlayer.getGameClass().apply(teamPlayer, worldBorderApi, gamePhase.get(), true), GameConfig.RESPAWN.TIME * 20L);//10 x 20 ticks aka 10 seconds
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user