Fix deprecations

This commit is contained in:
Mathieu Strypsteen 2024-09-14 23:08:41 +02:00
parent defb527073
commit d665231215
2 changed files with 18 additions and 3 deletions

View file

@ -3,11 +3,16 @@ package gent.zeus.mc13dtl.group;
import gent.zeus.mc13dtl.MC13DTL;
import io.papermc.paper.command.brigadier.BasicCommand;
import io.papermc.paper.command.brigadier.CommandSourceStack;
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.format.NamedTextColor;
import java.util.ArrayList;
import java.util.List;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import org.bukkit.scoreboard.Team;
import org.jetbrains.annotations.NotNull;
import org.bukkit.ChatColor;
public class GroupAddCommand implements BasicCommand {
@ -22,8 +27,9 @@ public class GroupAddCommand implements BasicCommand {
Team team = null;
try {
team = MC13DTL.scoreboard.registerNewTeam(index.toString());
team.setColor(ChatColor.values()[index % ChatColor.values().length]);
team.setPrefix("Team " + index.toString() + " ");
List<NamedTextColor> colors = new ArrayList<>(NamedTextColor.NAMES.values());
team.color(colors.get(index % colors.size()));
team.prefix(Component.text("Team " + index.toString() + " "));
team.setAllowFriendlyFire(false);
} catch (IllegalArgumentException e) {
team = MC13DTL.scoreboard.getTeam(index.toString());
@ -45,4 +51,9 @@ public class GroupAddCommand implements BasicCommand {
commandSourceStack.getSender().sendMessage("usage: /groupadd <player> <NUMBER>");
}
}
@Override
public String permission() {
return "13dtl.manage-groups";
}
}

View file

@ -30,4 +30,8 @@ public class GroupRemoveCommand implements BasicCommand {
}
}
@Override
public String permission() {
return "13dtl.manage-groups";
}
}