summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormd_5 <git@md-5.net>2018-10-26 19:38:20 +1100
committermd_5 <git@md-5.net>2018-10-26 19:38:20 +1100
commite6583aca258eee05ee4dda7641ea1d2fb0707294 (patch)
tree06f3b4e950416726ba8b59abf839dd668ec645af
parent162807b39b55cb2ceb340fa73d551ab5c462d2c8 (diff)
downloadbukkit-e6583aca258eee05ee4dda7641ea1d2fb0707294.tar
bukkit-e6583aca258eee05ee4dda7641ea1d2fb0707294.tar.gz
bukkit-e6583aca258eee05ee4dda7641ea1d2fb0707294.tar.lz
bukkit-e6583aca258eee05ee4dda7641ea1d2fb0707294.tar.xz
bukkit-e6583aca258eee05ee4dda7641ea1d2fb0707294.zip
SPIGOT-4443: Scoreboard RenderType API
-rw-r--r--src/main/java/org/bukkit/scoreboard/Objective.java16
-rw-r--r--src/main/java/org/bukkit/scoreboard/RenderType.java19
-rw-r--r--src/main/java/org/bukkit/scoreboard/Scoreboard.java21
3 files changed, 56 insertions, 0 deletions
diff --git a/src/main/java/org/bukkit/scoreboard/Objective.java b/src/main/java/org/bukkit/scoreboard/Objective.java
index 1802d1db..cc3a3e04 100644
--- a/src/main/java/org/bukkit/scoreboard/Objective.java
+++ b/src/main/java/org/bukkit/scoreboard/Objective.java
@@ -86,6 +86,22 @@ public interface Objective {
DisplaySlot getDisplaySlot() throws IllegalStateException;
/**
+ * Sets manner in which this objective will be rendered.
+ *
+ * @param renderType new render type
+ * @throws IllegalStateException if this objective has been unregistered
+ */
+ void setRenderType(RenderType renderType) throws IllegalStateException;
+
+ /**
+ * Sets manner in which this objective will be rendered.
+ *
+ * @return the render type
+ * @throws IllegalStateException if this objective has been unregistered
+ */
+ RenderType getRenderType() throws IllegalStateException;
+
+ /**
* Gets a player's Score for an Objective on this Scoreboard
*
* @param player Player for the Score
diff --git a/src/main/java/org/bukkit/scoreboard/RenderType.java b/src/main/java/org/bukkit/scoreboard/RenderType.java
new file mode 100644
index 00000000..df267cce
--- /dev/null
+++ b/src/main/java/org/bukkit/scoreboard/RenderType.java
@@ -0,0 +1,19 @@
+package org.bukkit.scoreboard;
+
+/**
+ * Controls the way in which an {@link Objective} is rendered client side.
+ *
+ * @deprecated draft API
+ */
+@Deprecated
+public enum RenderType {
+
+ /**
+ * Display integer value.
+ */
+ INTEGER,
+ /**
+ * Display number of hearts corresponding to value.
+ */
+ HEARTS;
+}
diff --git a/src/main/java/org/bukkit/scoreboard/Scoreboard.java b/src/main/java/org/bukkit/scoreboard/Scoreboard.java
index 40f36b47..85471b3f 100644
--- a/src/main/java/org/bukkit/scoreboard/Scoreboard.java
+++ b/src/main/java/org/bukkit/scoreboard/Scoreboard.java
@@ -46,6 +46,27 @@ public interface Scoreboard {
Objective registerNewObjective(String name, String criteria, String displayName) throws IllegalArgumentException;
/**
+ * Registers an Objective on this Scoreboard
+ *
+ * @param name Name of the Objective
+ * @param criteria Criteria for the Objective
+ * @param displayName Name displayed to players for the Objective.
+ * @param renderType Manner of rendering the Objective
+ * @return The registered Objective
+ * @throws IllegalArgumentException if name is null
+ * @throws IllegalArgumentException if name is longer than 16
+ * characters.
+ * @throws IllegalArgumentException if criteria is null
+ * @throws IllegalArgumentException if displayName is null
+ * @throws IllegalArgumentException if displayName is longer than 128
+ * characters.
+ * @throws IllegalArgumentException if renderType is null
+ * @throws IllegalArgumentException if an objective by that name already
+ * exists
+ */
+ Objective registerNewObjective(String name, String criteria, String displayName, RenderType renderType) throws IllegalArgumentException;
+
+ /**
* Gets an Objective on this Scoreboard by name
*
* @param name Name of the Objective