Fix deprecations
This commit is contained in:
parent
defb527073
commit
d665231215
2 changed files with 18 additions and 3 deletions
|
@ -3,11 +3,16 @@ package gent.zeus.mc13dtl.group;
|
||||||
import gent.zeus.mc13dtl.MC13DTL;
|
import gent.zeus.mc13dtl.MC13DTL;
|
||||||
import io.papermc.paper.command.brigadier.BasicCommand;
|
import io.papermc.paper.command.brigadier.BasicCommand;
|
||||||
import io.papermc.paper.command.brigadier.CommandSourceStack;
|
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.Bukkit;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.scoreboard.Team;
|
import org.bukkit.scoreboard.Team;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.bukkit.ChatColor;
|
|
||||||
|
|
||||||
public class GroupAddCommand implements BasicCommand {
|
public class GroupAddCommand implements BasicCommand {
|
||||||
|
|
||||||
|
@ -22,8 +27,9 @@ public class GroupAddCommand implements BasicCommand {
|
||||||
Team team = null;
|
Team team = null;
|
||||||
try {
|
try {
|
||||||
team = MC13DTL.scoreboard.registerNewTeam(index.toString());
|
team = MC13DTL.scoreboard.registerNewTeam(index.toString());
|
||||||
team.setColor(ChatColor.values()[index % ChatColor.values().length]);
|
List<NamedTextColor> colors = new ArrayList<>(NamedTextColor.NAMES.values());
|
||||||
team.setPrefix("Team " + index.toString() + " ");
|
team.color(colors.get(index % colors.size()));
|
||||||
|
team.prefix(Component.text("Team " + index.toString() + " "));
|
||||||
team.setAllowFriendlyFire(false);
|
team.setAllowFriendlyFire(false);
|
||||||
} catch (IllegalArgumentException e) {
|
} catch (IllegalArgumentException e) {
|
||||||
team = MC13DTL.scoreboard.getTeam(index.toString());
|
team = MC13DTL.scoreboard.getTeam(index.toString());
|
||||||
|
@ -45,4 +51,9 @@ public class GroupAddCommand implements BasicCommand {
|
||||||
commandSourceStack.getSender().sendMessage("usage: /groupadd <player> <NUMBER>");
|
commandSourceStack.getSender().sendMessage("usage: /groupadd <player> <NUMBER>");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String permission() {
|
||||||
|
return "13dtl.manage-groups";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,4 +30,8 @@ public class GroupRemoveCommand implements BasicCommand {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String permission() {
|
||||||
|
return "13dtl.manage-groups";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue