SPIGOT-4443: Scoreboard RenderType API

By: md_5 <git@md-5.net>
This commit is contained in:
Bukkit/Spigot 2018-10-26 19:38:20 +11:00
parent 5901e5584a
commit 0283ef18f5
3 changed files with 56 additions and 0 deletions

View File

@ -85,6 +85,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
*

View File

@ -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;
}

View File

@ -45,6 +45,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
*