diff --git a/paper-api/src/main/java/org/bukkit/OfflinePlayer.java b/paper-api/src/main/java/org/bukkit/OfflinePlayer.java index ffc8ad3733..58313929f8 100644 --- a/paper-api/src/main/java/org/bukkit/OfflinePlayer.java +++ b/paper-api/src/main/java/org/bukkit/OfflinePlayer.java @@ -3,6 +3,7 @@ package org.bukkit; import java.util.UUID; import org.bukkit.configuration.serialization.ConfigurationSerializable; import org.bukkit.entity.AnimalTamer; +import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; import org.bukkit.permissions.ServerOperator; import org.jetbrains.annotations.NotNull; @@ -110,4 +111,246 @@ public interface OfflinePlayer extends ServerOperator, AnimalTamer, Configuratio @Nullable public Location getBedSpawnLocation(); + /** + * Increments the given statistic for this player. + *

+ * This is equivalent to the following code: + * incrementStatistic(Statistic, 1) + * + * @param statistic Statistic to increment + * @throws IllegalArgumentException if statistic is null + * @throws IllegalArgumentException if the statistic requires an + * additional parameter + */ + public void incrementStatistic(@NotNull Statistic statistic) throws IllegalArgumentException; + + /** + * Decrements the given statistic for this player. + *

+ * This is equivalent to the following code: + * decrementStatistic(Statistic, 1) + * + * @param statistic Statistic to decrement + * @throws IllegalArgumentException if statistic is null + * @throws IllegalArgumentException if the statistic requires an + * additional parameter + */ + public void decrementStatistic(@NotNull Statistic statistic) throws IllegalArgumentException; + + /** + * Increments the given statistic for this player. + * + * @param statistic Statistic to increment + * @param amount Amount to increment this statistic by + * @throws IllegalArgumentException if statistic is null + * @throws IllegalArgumentException if amount is negative + * @throws IllegalArgumentException if the statistic requires an + * additional parameter + */ + public void incrementStatistic(@NotNull Statistic statistic, int amount) throws IllegalArgumentException; + + /** + * Decrements the given statistic for this player. + * + * @param statistic Statistic to decrement + * @param amount Amount to decrement this statistic by + * @throws IllegalArgumentException if statistic is null + * @throws IllegalArgumentException if amount is negative + * @throws IllegalArgumentException if the statistic requires an + * additional parameter + */ + public void decrementStatistic(@NotNull Statistic statistic, int amount) throws IllegalArgumentException; + + /** + * Sets the given statistic for this player. + * + * @param statistic Statistic to set + * @param newValue The value to set this statistic to + * @throws IllegalArgumentException if statistic is null + * @throws IllegalArgumentException if newValue is negative + * @throws IllegalArgumentException if the statistic requires an + * additional parameter + */ + public void setStatistic(@NotNull Statistic statistic, int newValue) throws IllegalArgumentException; + + /** + * Gets the value of the given statistic for this player. + * + * @param statistic Statistic to check + * @return the value of the given statistic + * @throws IllegalArgumentException if statistic is null + * @throws IllegalArgumentException if the statistic requires an + * additional parameter + */ + public int getStatistic(@NotNull Statistic statistic) throws IllegalArgumentException; + + /** + * Increments the given statistic for this player for the given material. + *

+ * This is equivalent to the following code: + * incrementStatistic(Statistic, Material, 1) + * + * @param statistic Statistic to increment + * @param material Material to offset the statistic with + * @throws IllegalArgumentException if statistic is null + * @throws IllegalArgumentException if material is null + * @throws IllegalArgumentException if the given parameter is not valid + * for the statistic + */ + public void incrementStatistic(@NotNull Statistic statistic, @NotNull Material material) throws IllegalArgumentException; + + /** + * Decrements the given statistic for this player for the given material. + *

+ * This is equivalent to the following code: + * decrementStatistic(Statistic, Material, 1) + * + * @param statistic Statistic to decrement + * @param material Material to offset the statistic with + * @throws IllegalArgumentException if statistic is null + * @throws IllegalArgumentException if material is null + * @throws IllegalArgumentException if the given parameter is not valid + * for the statistic + */ + public void decrementStatistic(@NotNull Statistic statistic, @NotNull Material material) throws IllegalArgumentException; + + /** + * Gets the value of the given statistic for this player. + * + * @param statistic Statistic to check + * @param material Material offset of the statistic + * @return the value of the given statistic + * @throws IllegalArgumentException if statistic is null + * @throws IllegalArgumentException if material is null + * @throws IllegalArgumentException if the given parameter is not valid + * for the statistic + */ + public int getStatistic(@NotNull Statistic statistic, @NotNull Material material) throws IllegalArgumentException; + + /** + * Increments the given statistic for this player for the given material. + * + * @param statistic Statistic to increment + * @param material Material to offset the statistic with + * @param amount Amount to increment this statistic by + * @throws IllegalArgumentException if statistic is null + * @throws IllegalArgumentException if material is null + * @throws IllegalArgumentException if amount is negative + * @throws IllegalArgumentException if the given parameter is not valid + * for the statistic + */ + public void incrementStatistic(@NotNull Statistic statistic, @NotNull Material material, int amount) throws IllegalArgumentException; + + /** + * Decrements the given statistic for this player for the given material. + * + * @param statistic Statistic to decrement + * @param material Material to offset the statistic with + * @param amount Amount to decrement this statistic by + * @throws IllegalArgumentException if statistic is null + * @throws IllegalArgumentException if material is null + * @throws IllegalArgumentException if amount is negative + * @throws IllegalArgumentException if the given parameter is not valid + * for the statistic + */ + public void decrementStatistic(@NotNull Statistic statistic, @NotNull Material material, int amount) throws IllegalArgumentException; + + /** + * Sets the given statistic for this player for the given material. + * + * @param statistic Statistic to set + * @param material Material to offset the statistic with + * @param newValue The value to set this statistic to + * @throws IllegalArgumentException if statistic is null + * @throws IllegalArgumentException if material is null + * @throws IllegalArgumentException if newValue is negative + * @throws IllegalArgumentException if the given parameter is not valid + * for the statistic + */ + public void setStatistic(@NotNull Statistic statistic, @NotNull Material material, int newValue) throws IllegalArgumentException; + + /** + * Increments the given statistic for this player for the given entity. + *

+ * This is equivalent to the following code: + * incrementStatistic(Statistic, EntityType, 1) + * + * @param statistic Statistic to increment + * @param entityType EntityType to offset the statistic with + * @throws IllegalArgumentException if statistic is null + * @throws IllegalArgumentException if entityType is null + * @throws IllegalArgumentException if the given parameter is not valid + * for the statistic + */ + public void incrementStatistic(@NotNull Statistic statistic, @NotNull EntityType entityType) throws IllegalArgumentException; + + /** + * Decrements the given statistic for this player for the given entity. + *

+ * This is equivalent to the following code: + * decrementStatistic(Statistic, EntityType, 1) + * + * @param statistic Statistic to decrement + * @param entityType EntityType to offset the statistic with + * @throws IllegalArgumentException if statistic is null + * @throws IllegalArgumentException if entityType is null + * @throws IllegalArgumentException if the given parameter is not valid + * for the statistic + */ + public void decrementStatistic(@NotNull Statistic statistic, @NotNull EntityType entityType) throws IllegalArgumentException; + + /** + * Gets the value of the given statistic for this player. + * + * @param statistic Statistic to check + * @param entityType EntityType offset of the statistic + * @return the value of the given statistic + * @throws IllegalArgumentException if statistic is null + * @throws IllegalArgumentException if entityType is null + * @throws IllegalArgumentException if the given parameter is not valid + * for the statistic + */ + public int getStatistic(@NotNull Statistic statistic, @NotNull EntityType entityType) throws IllegalArgumentException; + + /** + * Increments the given statistic for this player for the given entity. + * + * @param statistic Statistic to increment + * @param entityType EntityType to offset the statistic with + * @param amount Amount to increment this statistic by + * @throws IllegalArgumentException if statistic is null + * @throws IllegalArgumentException if entityType is null + * @throws IllegalArgumentException if amount is negative + * @throws IllegalArgumentException if the given parameter is not valid + * for the statistic + */ + public void incrementStatistic(@NotNull Statistic statistic, @NotNull EntityType entityType, int amount) throws IllegalArgumentException; + + /** + * Decrements the given statistic for this player for the given entity. + * + * @param statistic Statistic to decrement + * @param entityType EntityType to offset the statistic with + * @param amount Amount to decrement this statistic by + * @throws IllegalArgumentException if statistic is null + * @throws IllegalArgumentException if entityType is null + * @throws IllegalArgumentException if amount is negative + * @throws IllegalArgumentException if the given parameter is not valid + * for the statistic + */ + public void decrementStatistic(@NotNull Statistic statistic, @NotNull EntityType entityType, int amount); + + /** + * Sets the given statistic for this player for the given entity. + * + * @param statistic Statistic to set + * @param entityType EntityType to offset the statistic with + * @param newValue The value to set this statistic to + * @throws IllegalArgumentException if statistic is null + * @throws IllegalArgumentException if entityType is null + * @throws IllegalArgumentException if newValue is negative + * @throws IllegalArgumentException if the given parameter is not valid + * for the statistic + */ + public void setStatistic(@NotNull Statistic statistic, @NotNull EntityType entityType, int newValue); } diff --git a/paper-api/src/main/java/org/bukkit/entity/Player.java b/paper-api/src/main/java/org/bukkit/entity/Player.java index 9dfe70a071..79f9534d34 100644 --- a/paper-api/src/main/java/org/bukkit/entity/Player.java +++ b/paper-api/src/main/java/org/bukkit/entity/Player.java @@ -12,7 +12,6 @@ import org.bukkit.OfflinePlayer; import org.bukkit.Particle; import org.bukkit.Sound; import org.bukkit.SoundCategory; -import org.bukkit.Statistic; import org.bukkit.WeatherType; import org.bukkit.advancement.Advancement; import org.bukkit.advancement.AdvancementProgress; @@ -451,249 +450,6 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM @Deprecated public void updateInventory(); - /** - * Increments the given statistic for this player. - *

- * This is equivalent to the following code: - * incrementStatistic(Statistic, 1) - * - * @param statistic Statistic to increment - * @throws IllegalArgumentException if statistic is null - * @throws IllegalArgumentException if the statistic requires an - * additional parameter - */ - public void incrementStatistic(@NotNull Statistic statistic) throws IllegalArgumentException; - - /** - * Decrements the given statistic for this player. - *

- * This is equivalent to the following code: - * decrementStatistic(Statistic, 1) - * - * @param statistic Statistic to decrement - * @throws IllegalArgumentException if statistic is null - * @throws IllegalArgumentException if the statistic requires an - * additional parameter - */ - public void decrementStatistic(@NotNull Statistic statistic) throws IllegalArgumentException; - - /** - * Increments the given statistic for this player. - * - * @param statistic Statistic to increment - * @param amount Amount to increment this statistic by - * @throws IllegalArgumentException if statistic is null - * @throws IllegalArgumentException if amount is negative - * @throws IllegalArgumentException if the statistic requires an - * additional parameter - */ - public void incrementStatistic(@NotNull Statistic statistic, int amount) throws IllegalArgumentException; - - /** - * Decrements the given statistic for this player. - * - * @param statistic Statistic to decrement - * @param amount Amount to decrement this statistic by - * @throws IllegalArgumentException if statistic is null - * @throws IllegalArgumentException if amount is negative - * @throws IllegalArgumentException if the statistic requires an - * additional parameter - */ - public void decrementStatistic(@NotNull Statistic statistic, int amount) throws IllegalArgumentException; - - /** - * Sets the given statistic for this player. - * - * @param statistic Statistic to set - * @param newValue The value to set this statistic to - * @throws IllegalArgumentException if statistic is null - * @throws IllegalArgumentException if newValue is negative - * @throws IllegalArgumentException if the statistic requires an - * additional parameter - */ - public void setStatistic(@NotNull Statistic statistic, int newValue) throws IllegalArgumentException; - - /** - * Gets the value of the given statistic for this player. - * - * @param statistic Statistic to check - * @return the value of the given statistic - * @throws IllegalArgumentException if statistic is null - * @throws IllegalArgumentException if the statistic requires an - * additional parameter - */ - public int getStatistic(@NotNull Statistic statistic) throws IllegalArgumentException; - - /** - * Increments the given statistic for this player for the given material. - *

- * This is equivalent to the following code: - * incrementStatistic(Statistic, Material, 1) - * - * @param statistic Statistic to increment - * @param material Material to offset the statistic with - * @throws IllegalArgumentException if statistic is null - * @throws IllegalArgumentException if material is null - * @throws IllegalArgumentException if the given parameter is not valid - * for the statistic - */ - public void incrementStatistic(@NotNull Statistic statistic, @NotNull Material material) throws IllegalArgumentException; - - /** - * Decrements the given statistic for this player for the given material. - *

- * This is equivalent to the following code: - * decrementStatistic(Statistic, Material, 1) - * - * @param statistic Statistic to decrement - * @param material Material to offset the statistic with - * @throws IllegalArgumentException if statistic is null - * @throws IllegalArgumentException if material is null - * @throws IllegalArgumentException if the given parameter is not valid - * for the statistic - */ - public void decrementStatistic(@NotNull Statistic statistic, @NotNull Material material) throws IllegalArgumentException; - - /** - * Gets the value of the given statistic for this player. - * - * @param statistic Statistic to check - * @param material Material offset of the statistic - * @return the value of the given statistic - * @throws IllegalArgumentException if statistic is null - * @throws IllegalArgumentException if material is null - * @throws IllegalArgumentException if the given parameter is not valid - * for the statistic - */ - public int getStatistic(@NotNull Statistic statistic, @NotNull Material material) throws IllegalArgumentException; - - /** - * Increments the given statistic for this player for the given material. - * - * @param statistic Statistic to increment - * @param material Material to offset the statistic with - * @param amount Amount to increment this statistic by - * @throws IllegalArgumentException if statistic is null - * @throws IllegalArgumentException if material is null - * @throws IllegalArgumentException if amount is negative - * @throws IllegalArgumentException if the given parameter is not valid - * for the statistic - */ - public void incrementStatistic(@NotNull Statistic statistic, @NotNull Material material, int amount) throws IllegalArgumentException; - - /** - * Decrements the given statistic for this player for the given material. - * - * @param statistic Statistic to decrement - * @param material Material to offset the statistic with - * @param amount Amount to decrement this statistic by - * @throws IllegalArgumentException if statistic is null - * @throws IllegalArgumentException if material is null - * @throws IllegalArgumentException if amount is negative - * @throws IllegalArgumentException if the given parameter is not valid - * for the statistic - */ - public void decrementStatistic(@NotNull Statistic statistic, @NotNull Material material, int amount) throws IllegalArgumentException; - - /** - * Sets the given statistic for this player for the given material. - * - * @param statistic Statistic to set - * @param material Material to offset the statistic with - * @param newValue The value to set this statistic to - * @throws IllegalArgumentException if statistic is null - * @throws IllegalArgumentException if material is null - * @throws IllegalArgumentException if newValue is negative - * @throws IllegalArgumentException if the given parameter is not valid - * for the statistic - */ - public void setStatistic(@NotNull Statistic statistic, @NotNull Material material, int newValue) throws IllegalArgumentException; - - /** - * Increments the given statistic for this player for the given entity. - *

- * This is equivalent to the following code: - * incrementStatistic(Statistic, EntityType, 1) - * - * @param statistic Statistic to increment - * @param entityType EntityType to offset the statistic with - * @throws IllegalArgumentException if statistic is null - * @throws IllegalArgumentException if entityType is null - * @throws IllegalArgumentException if the given parameter is not valid - * for the statistic - */ - public void incrementStatistic(@NotNull Statistic statistic, @NotNull EntityType entityType) throws IllegalArgumentException; - - /** - * Decrements the given statistic for this player for the given entity. - *

- * This is equivalent to the following code: - * decrementStatistic(Statistic, EntityType, 1) - * - * @param statistic Statistic to decrement - * @param entityType EntityType to offset the statistic with - * @throws IllegalArgumentException if statistic is null - * @throws IllegalArgumentException if entityType is null - * @throws IllegalArgumentException if the given parameter is not valid - * for the statistic - */ - public void decrementStatistic(@NotNull Statistic statistic, @NotNull EntityType entityType) throws IllegalArgumentException; - - /** - * Gets the value of the given statistic for this player. - * - * @param statistic Statistic to check - * @param entityType EntityType offset of the statistic - * @return the value of the given statistic - * @throws IllegalArgumentException if statistic is null - * @throws IllegalArgumentException if entityType is null - * @throws IllegalArgumentException if the given parameter is not valid - * for the statistic - */ - public int getStatistic(@NotNull Statistic statistic, @NotNull EntityType entityType) throws IllegalArgumentException; - - /** - * Increments the given statistic for this player for the given entity. - * - * @param statistic Statistic to increment - * @param entityType EntityType to offset the statistic with - * @param amount Amount to increment this statistic by - * @throws IllegalArgumentException if statistic is null - * @throws IllegalArgumentException if entityType is null - * @throws IllegalArgumentException if amount is negative - * @throws IllegalArgumentException if the given parameter is not valid - * for the statistic - */ - public void incrementStatistic(@NotNull Statistic statistic, @NotNull EntityType entityType, int amount) throws IllegalArgumentException; - - /** - * Decrements the given statistic for this player for the given entity. - * - * @param statistic Statistic to decrement - * @param entityType EntityType to offset the statistic with - * @param amount Amount to decrement this statistic by - * @throws IllegalArgumentException if statistic is null - * @throws IllegalArgumentException if entityType is null - * @throws IllegalArgumentException if amount is negative - * @throws IllegalArgumentException if the given parameter is not valid - * for the statistic - */ - public void decrementStatistic(@NotNull Statistic statistic, @NotNull EntityType entityType, int amount); - - /** - * Sets the given statistic for this player for the given entity. - * - * @param statistic Statistic to set - * @param entityType EntityType to offset the statistic with - * @param newValue The value to set this statistic to - * @throws IllegalArgumentException if statistic is null - * @throws IllegalArgumentException if entityType is null - * @throws IllegalArgumentException if newValue is negative - * @throws IllegalArgumentException if the given parameter is not valid - * for the statistic - */ - public void setStatistic(@NotNull Statistic statistic, @NotNull EntityType entityType, int newValue); - /** * Sets the current time on the player's client. When relative is true the * player's time will be kept synchronized to its world time with the