From f8573a0ca2e384e889832dc30ed41712e046fd30 Mon Sep 17 00:00:00 2001 From: md_5 Date: Thu, 3 Mar 2016 19:06:52 +1100 Subject: SPIGOT-1666: Expand Team option API --- .../org/bukkit/scoreboard/NameTagVisibility.java | 4 ++ src/main/java/org/bukkit/scoreboard/Team.java | 67 +++++++++++++++++++++- 2 files changed, 70 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/bukkit/scoreboard/NameTagVisibility.java b/src/main/java/org/bukkit/scoreboard/NameTagVisibility.java index 3137bf6e..d9e9ae1a 100644 --- a/src/main/java/org/bukkit/scoreboard/NameTagVisibility.java +++ b/src/main/java/org/bukkit/scoreboard/NameTagVisibility.java @@ -1,5 +1,9 @@ package org.bukkit.scoreboard; +/** + * @deprecated replaced by {@link Team.OptionStatus} + */ +@Deprecated public enum NameTagVisibility { /** diff --git a/src/main/java/org/bukkit/scoreboard/Team.java b/src/main/java/org/bukkit/scoreboard/Team.java index 0fdcebd9..bddc8482 100644 --- a/src/main/java/org/bukkit/scoreboard/Team.java +++ b/src/main/java/org/bukkit/scoreboard/Team.java @@ -115,7 +115,9 @@ public interface Team { * * @return the current name tag visibilty for the team * @throws IllegalArgumentException if this team has been unregistered + * @deprecated see {@link #getOption()} */ + @Deprecated NameTagVisibility getNameTagVisibility() throws IllegalArgumentException; /** @@ -123,7 +125,10 @@ public interface Team { * * @param visibility The nameTagVisibilty to set * @throws IllegalArgumentException if this team has been unregistered + * @deprecated see + * {@link #setOption(org.bukkit.scoreboard.Team.Option, org.bukkit.scoreboard.Team.OptionStatus)} */ + @Deprecated void setNameTagVisibility(NameTagVisibility visibility) throws IllegalArgumentException; /** @@ -236,5 +241,65 @@ public interface Team { * @throws IllegalArgumentException if entry is null * @throws IllegalStateException if this team has been unregistered */ - boolean hasEntry(String entry) throws IllegalArgumentException,IllegalStateException; + boolean hasEntry(String entry) throws IllegalArgumentException, IllegalStateException; + + /** + * Get an option for this team + * + * @param option the option to get + * @return the option status + * @throws IllegalStateException if this team has been unregistered + */ + OptionStatus getOption(Option option) throws IllegalStateException; + + /** + * Set an option for this team + * + * @param option the option to set + * @param status the new option status + * @throws IllegalStateException if this team has been unregistered + */ + void setOption(Option option, OptionStatus status) throws IllegalStateException; + + /** + * Represents an option which may be applied to this team. + */ + public enum Option { + + /** + * How to display the name tags of players on this team. + */ + NAME_TAG_VISIBILITY, + /** + * How to display the death messages for players on this team. + */ + DEATH_MESSAGE_VISIBILITY, + /** + * How players of this team collide with others. + */ + COLLISION_RULE; + } + + /** + * How an option may be applied to members of this team. + */ + public enum OptionStatus { + + /** + * Apply this option to everyone. + */ + ALWAYS, + /** + * Never apply this option. + */ + NEVER, + /** + * Apply this option only for opposing teams. + */ + FOR_OTHER_TEAMS, + /** + * Apply this option for only team members. + */ + FOR_OWN_TEAM; + } } -- cgit v1.2.3