[Bleeding] Fix Achievement and Statistic API. Fixes BUKKIT-5305
By: t00thpick1 <t00thpick1dirko@gmail.com>
This commit is contained in:
@@ -323,43 +323,273 @@ public interface Player extends HumanEntity, Conversable, CommandSender, Offline
|
||||
public void updateInventory();
|
||||
|
||||
/**
|
||||
* Awards this player the given achievement
|
||||
* Awards the given achievement and any parent achievements that the
|
||||
* player does not have.
|
||||
*
|
||||
* @param achievement Achievement to award
|
||||
* @throws IllegalArgumentException if achievement is null
|
||||
*/
|
||||
public void awardAchievement(Achievement achievement);
|
||||
|
||||
/**
|
||||
* Increments the given statistic for this player
|
||||
* Removes the given achievement and any children achievements that the
|
||||
* player has.
|
||||
*
|
||||
* @param statistic Statistic to increment
|
||||
* @param achievement Achievement to remove
|
||||
* @throws IllegalArgumentException if achievement is null
|
||||
*/
|
||||
public void incrementStatistic(Statistic statistic);
|
||||
public void removeAchievement(Achievement achievement);
|
||||
|
||||
/**
|
||||
* Increments the given statistic for this player
|
||||
* Gets whether this player has the given achievement.
|
||||
*
|
||||
* @return whether the player has the achievement
|
||||
* @throws IllegalArgumentException if achievement is null
|
||||
*/
|
||||
public boolean hasAchievement(Achievement achievement);
|
||||
|
||||
/**
|
||||
* Increments the given statistic for this player.
|
||||
* <p>
|
||||
* This is equivalent to the following code:
|
||||
* <code>incrementStatistic(Statistic, 1)</code>
|
||||
*
|
||||
* @param statistic Statistic to increment
|
||||
* @throws IllegalArgumentException if statistic is null
|
||||
* @throws IllegalArgumentException if the statistic requires an
|
||||
* additional parameter
|
||||
*/
|
||||
public void incrementStatistic(Statistic statistic) throws IllegalArgumentException;
|
||||
|
||||
/**
|
||||
* Decrements the given statistic for this player.
|
||||
* <p>
|
||||
* This is equivalent to the following code:
|
||||
* <code>decrementStatistic(Statistic, 1)</code>
|
||||
*
|
||||
* @param statistic Statistic to decrement
|
||||
* @throws IllegalArgumentException if statistic is null
|
||||
* @throws IllegalArgumentException if the statistic requires an
|
||||
* additional parameter
|
||||
*/
|
||||
public void decrementStatistic(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(Statistic statistic, int amount);
|
||||
public void incrementStatistic(Statistic statistic, int amount) throws IllegalArgumentException;
|
||||
|
||||
/**
|
||||
* Increments the given statistic for this player for the given material
|
||||
* 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(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(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(Statistic statistic) throws IllegalArgumentException;
|
||||
|
||||
/**
|
||||
* Increments the given statistic for this player for the given material.
|
||||
* <p>
|
||||
* This is equivalent to the following code:
|
||||
* <code>incrementStatistic(Statistic, Material, 1)</code>
|
||||
*
|
||||
* @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(Statistic statistic, Material material);
|
||||
public void incrementStatistic(Statistic statistic, Material material) throws IllegalArgumentException;
|
||||
|
||||
/**
|
||||
* Increments the given statistic for this player for the given material
|
||||
* Decrements the given statistic for this player for the given material.
|
||||
* <p>
|
||||
* This is equivalent to the following code:
|
||||
* <code>decrementStatistic(Statistic, Material, 1)</code>
|
||||
*
|
||||
* @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(Statistic statistic, 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(Statistic statistic, 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(Statistic statistic, Material material, int amount);
|
||||
public void incrementStatistic(Statistic statistic, 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(Statistic statistic, 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(Statistic statistic, Material material, int newValue) throws IllegalArgumentException;
|
||||
|
||||
/**
|
||||
* Increments the given statistic for this player for the given entity.
|
||||
* <p>
|
||||
* This is equivalent to the following code:
|
||||
* <code>incrementStatistic(Statistic, EntityType, 1)</code>
|
||||
*
|
||||
* @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(Statistic statistic, EntityType entityType) throws IllegalArgumentException;
|
||||
|
||||
/**
|
||||
* Decrements the given statistic for this player for the given entity.
|
||||
* <p>
|
||||
* This is equivalent to the following code:
|
||||
* <code>decrementStatistic(Statistic, EntityType, 1)</code>
|
||||
*
|
||||
* @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(Statistic statistic, 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(Statistic statistic, 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(Statistic statistic, 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(Statistic statistic, 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(Statistic statistic, EntityType entityType, int newValue);
|
||||
|
||||
/**
|
||||
* Sets the current time on the player's client. When relative is true the
|
||||
|
||||
Reference in New Issue
Block a user