mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-24 03:25:15 +01:00
SPIGOT-1666: Expand Team option API
This commit is contained in:
parent
5a3813d7fe
commit
6742811d69
@ -12,6 +12,7 @@ import org.bukkit.scoreboard.Team;
|
|||||||
import com.google.common.collect.ImmutableSet;
|
import com.google.common.collect.ImmutableSet;
|
||||||
|
|
||||||
import net.minecraft.server.ScoreboardTeam;
|
import net.minecraft.server.ScoreboardTeam;
|
||||||
|
import net.minecraft.server.ScoreboardTeamBase;
|
||||||
|
|
||||||
final class CraftTeam extends CraftScoreboardComponent implements Team {
|
final class CraftTeam extends CraftScoreboardComponent implements Team {
|
||||||
private final ScoreboardTeam team;
|
private final ScoreboardTeam team;
|
||||||
@ -181,6 +182,41 @@ final class CraftTeam extends CraftScoreboardComponent implements Team {
|
|||||||
scoreboard.board.removeTeam(team);
|
scoreboard.board.removeTeam(team);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public OptionStatus getOption(Option option) throws IllegalStateException {
|
||||||
|
checkState();
|
||||||
|
|
||||||
|
switch (option) {
|
||||||
|
case NAME_TAG_VISIBILITY:
|
||||||
|
return OptionStatus.values()[team.getNameTagVisibility().ordinal()];
|
||||||
|
case DEATH_MESSAGE_VISIBILITY:
|
||||||
|
return OptionStatus.values()[team.j().ordinal()]; // PAIL: rename
|
||||||
|
case COLLISION_RULE:
|
||||||
|
return OptionStatus.values()[team.k().ordinal()]; // PAIL: rename
|
||||||
|
default:
|
||||||
|
throw new IllegalArgumentException("Unrecognised option " + option);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setOption(Option option, OptionStatus status) throws IllegalStateException {
|
||||||
|
checkState();
|
||||||
|
|
||||||
|
switch (option) {
|
||||||
|
case NAME_TAG_VISIBILITY:
|
||||||
|
team.setNameTagVisibility(EnumNameTagVisibility.values()[status.ordinal()]);
|
||||||
|
break;
|
||||||
|
case DEATH_MESSAGE_VISIBILITY:
|
||||||
|
team.b(EnumNameTagVisibility.values()[status.ordinal()]); // PAIL: rename
|
||||||
|
break;
|
||||||
|
case COLLISION_RULE:
|
||||||
|
team.a(ScoreboardTeamBase.EnumTeamPush.values()[status.ordinal()]); // PAIL: rename
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
throw new IllegalArgumentException("Unrecognised option " + option);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static EnumNameTagVisibility bukkitToNotch(NameTagVisibility visibility) {
|
public static EnumNameTagVisibility bukkitToNotch(NameTagVisibility visibility) {
|
||||||
switch (visibility) {
|
switch (visibility) {
|
||||||
case ALWAYS:
|
case ALWAYS:
|
||||||
|
Loading…
Reference in New Issue
Block a user