Refactor game class handling and fix GUI inventory usage.
Simplified game class retrieval by removing redundant data structures and combining logic. Updated GUI inventory to ensure tasks are run on the main thread using Bukkit's scheduler. Improved code organization by centralizing class selection logic in `TeamPlayer`.
This commit is contained in:
@@ -2,6 +2,8 @@ package com.alttd.ctf.team;
|
||||
|
||||
import com.alttd.ctf.game.GamePhase;
|
||||
import com.alttd.ctf.game_class.GameClass;
|
||||
import com.alttd.ctf.game_class.GameClassRetrieval;
|
||||
import com.alttd.ctf.gui.ClassSelectionGUI;
|
||||
import com.github.yannicklamprecht.worldborder.api.WorldBorderApi;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
@@ -10,8 +12,7 @@ import org.bukkit.Location;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.Objects;
|
||||
import java.util.UUID;
|
||||
import java.util.*;
|
||||
|
||||
@Slf4j
|
||||
@Getter
|
||||
@@ -34,6 +35,10 @@ public class TeamPlayer {
|
||||
public void respawn(Player player, WorldBorderApi worldBorderApi, GamePhase gamePhase, boolean teleport) {
|
||||
Location spawnLocation = team.getSpawnLocation();
|
||||
Location worldBorderCenter = team.getWorldBorderCenter();
|
||||
|
||||
List<GameClass> gameClasses = GameClassRetrieval.getGameClassesForTeam(team);
|
||||
new ClassSelectionGUI(gameClasses, this, worldBorderApi, GamePhase.CLASS_SELECTION).open(player);
|
||||
|
||||
if (!teleport) {
|
||||
resetWorldBorder(player, worldBorderApi, gamePhase, worldBorderCenter);
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user