Fixed many issues with teamManager

This commit is contained in:
2vb 2024-07-07 03:24:05 -07:00
parent d70f85c52c
commit 7f6a6b2c76
4 changed files with 5 additions and 28 deletions

View File

@ -8,12 +8,9 @@ import dev.rollczi.litecommands.annotations.command.Command;
import dev.rollczi.litecommands.annotations.context.Context; import dev.rollczi.litecommands.annotations.context.Context;
import dev.rollczi.litecommands.annotations.execute.Execute; import dev.rollczi.litecommands.annotations.execute.Execute;
import dev.rollczi.litecommands.annotations.permission.Permission; import dev.rollczi.litecommands.annotations.permission.Permission;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import xyz.twovb.sgm.SGM; import xyz.twovb.sgm.SGM;
import xyz.twovb.sgm.games.impl.capturethebrick.CTB; import xyz.twovb.sgm.games.impl.capturethebrick.CTB;
import xyz.twovb.toolbox.managers.PlaceholderManager;
import xyz.twovb.toolbox.utils.ChatUtils;
@Command(name = "jail") @Command(name = "jail")
@Permission("twovb.debug") @Permission("twovb.debug")

View File

@ -69,7 +69,6 @@ public class GameManager {
} }
game.addPlayer(player); game.addPlayer(player);
} else { } else {
SGM.getInstance().getCLogger().log(game.getState().toString()); SGM.getInstance().getCLogger().log(game.getState().toString());
} }
} }

View File

@ -118,8 +118,6 @@ public class CTB implements Minigame {
return Component.text(time, NamedTextColor.GRAY); return Component.text(time, NamedTextColor.GRAY);
}) })
.addBlankLine() .addBlankLine()
// .addDynamicLine(() -> ChatUtils.translate("<red><bold>Red: " + getBrickCount(redTeam)))
// .addDynamicLine(() -> ChatUtils.translate("<blue><bold>Blue: " + getBrickCount(blueTeam)))
.addDynamicLine(() -> ChatUtils.translate("<red>Red: <bold>" + getBrickCount(redTeam))) .addDynamicLine(() -> ChatUtils.translate("<red>Red: <bold>" + getBrickCount(redTeam)))
.addDynamicLine(() -> ChatUtils.translate("<blue>Blue: <bold>" + getBrickCount(blueTeam))) .addDynamicLine(() -> ChatUtils.translate("<blue>Blue: <bold>" + getBrickCount(blueTeam)))
.addBlankLine() .addBlankLine()
@ -169,23 +167,6 @@ public class CTB implements Minigame {
for (Player player : players) { for (Player player : players) {
CtbData.Territory territory = getTerritory(player); CtbData.Territory territory = getTerritory(player);
player.sendActionBar(ChatUtils.translate(territory.getFancyText())); player.sendActionBar(ChatUtils.translate(territory.getFancyText()));
// Location playerLoc = player.getLocation();
// Location blockCheck = new Location(gameWorld, playerLoc.getBlockX(), territoryLevel, playerLoc.getBlockZ());
// Block territoryCheck = gameWorld.getBlockAt(blockCheck);
// switch (territoryCheck.getType()) {
// case RED_CONCRETE:
// player.sendActionBar(ChatUtils.translate("<red><bold>ʀᴇᴅ ᴛᴇʀʀɪᴛᴏʀʏ"));
// break;
// case BLUE_CONCRETE:
// player.sendActionBar(ChatUtils.translate("<blue><bold>ʙʟᴜᴇ ᴛᴇʀʀɪᴛᴏʀʏ"));
// break;
// case WHITE_CONCRETE:
// player.sendActionBar(ChatUtils.translate("<gray><bold>ɴᴇᴜᴛʀᴀʟ"));
// break;
// default:
// player.sendActionBar(ChatUtils.translate("<dark_gray><bold>???"));
// break;
// }
} }
} }
@ -200,7 +181,6 @@ public class CTB implements Minigame {
sb.addPlayer(player); sb.addPlayer(player);
playerStateMap.put(player, CtbData.PlayerState.Free); playerStateMap.put(player, CtbData.PlayerState.Free);
} }
// TODO: Fix incorrect amount of brick spawns.
for (int i = 0; i <= this.bricks - 1; i++) { for (int i = 0; i <= this.bricks - 1; i++) {
placeBrick(redBrickSpawns.get(i), redTeam); placeBrick(redBrickSpawns.get(i), redTeam);
placeBrick(blueBrickSpawns.get(i), blueTeam); placeBrick(blueBrickSpawns.get(i), blueTeam);
@ -393,7 +373,9 @@ public class CTB implements Minigame {
} }
public void addPlayerToTeam(Player player, CtbData.Teams team) { public void addPlayerToTeam(Player player, CtbData.Teams team) {
// TODO: VALIDATE IF ON TEAM ALREADY if (teamManager.players().contains(player)) {
getTeam(player).defaultDisplay().removeEntry(player.getName());
}
if (team.equals(CtbData.Teams.Blue)) { if (team.equals(CtbData.Teams.Blue)) {
blueTeam.defaultDisplay().addEntry(player.getName()); blueTeam.defaultDisplay().addEntry(player.getName());
} else if (team.equals(CtbData.Teams.Red)) { } else if (team.equals(CtbData.Teams.Red)) {
@ -403,8 +385,7 @@ public class CTB implements Minigame {
} }
public void removePlayerFromTeams(Player player) { public void removePlayerFromTeams(Player player) {
redTeam.defaultDisplay().removeEntry(player.getName()); getTeam(player).defaultDisplay().removeEntry(player.getName());
blueTeam.defaultDisplay().removeEntry(player.getName());
this.teamManager.removePlayer(player); this.teamManager.removePlayer(player);
} }

View File

@ -7,4 +7,4 @@ system:
left: "&7%player% has left the game." left: "&7%player% has left the game."
jail: jail:
notify: "&7%player% has been jailed!" notify: "&7%player% has been jailed!"
info: "&7You have been jailed! You can not leave until you get freed by a player or Jailbreak." info: "&7You have been jailed! You can not leave until you get freed by a player or Jailbreak."