make ScoreBoard private for TeamScoreBoard

This commit is contained in:
Xander 2024-09-15 00:50:24 +02:00
parent 93739344b7
commit dfb5999d02
No known key found for this signature in database
GPG key ID: 79979C7BA303E003
3 changed files with 14 additions and 5 deletions

View file

@ -8,11 +8,12 @@ import org.bukkit.scoreboard.*;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
public class TeamScoreBoard {
public ScoreboardManager sm;
public Scoreboard scoreboard;
private ScoreboardManager sm;
private Scoreboard scoreboard;
private Objective objective;
@ -54,11 +55,19 @@ public class TeamScoreBoard {
return team;
}
public Set<Team> getTeams() {
return scoreboard.getTeams();
}
public Team getTeam(Player player) {
return this.scoreboard.getEntryTeam(player.getUniqueId().toString());
}
public void addToTeam(Player player, Team team) {
team.addPlayer(player);
team.addEntry(player.getUniqueId().toString());
player.sendRichMessage("<rainbow>You have been added to team " + team.getName());
MC13DTL.board.setScore(team, 0);
this.setScore(team, 0);
player.setGlowing(true);
}

View file

@ -16,7 +16,7 @@ public class RandomEventRunner implements Runnable {
long lastRunDay = world.getPersistentDataContainer().get(eventKey, PersistentDataType.LONG);
long day = Bukkit.getWorld("world").getFullTime() / 24000;
if (day > lastRunDay && Bukkit.getWorld("world").getTime() >= 14000) {
for (Team i : MC13DTL.board.scoreboard.getTeams()) {
for (Team i : MC13DTL.board.getTeams()) {
RandomEventExecutor.executeRandomEvent(i);
}
world.getPersistentDataContainer().set(eventKey, PersistentDataType.LONG, day);

View file

@ -15,7 +15,7 @@ public class GroupRemoveCommand implements BasicCommand {
if (args.length > 0) {
Player player = Bukkit.getPlayerExact(args[0]);
if (player != null) {
Team team = MC13DTL.board.scoreboard.getEntryTeam(player.getUniqueId().toString());
Team team = MC13DTL.board.getTeam(player);
if (team != null) {
team.removeEntry(player.getName());
player.sendMessage("You have been removed from your team");