Player - Expose player score (#12243)

This commit is contained in:
Shane Bee 2025-03-08 11:38:50 -08:00 committed by GitHub
parent 4519857817
commit 8e69d981fa
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 26 additions and 0 deletions

View File

@ -3902,4 +3902,20 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
* @return the result of this method, holding leftovers and spawned items.
*/
PlayerGiveResult give(Collection<ItemStack> items, boolean dropIfFull);
/**
* Get the score that shows in the death screen of the player.
* <p>This amount is added to when the player gains experience.</p>
*
* @return Death screen score of player
*/
int getDeathScreenScore();
/**
* Set the score that shows in the death screen of the player.
* <p>This amount is added to when the player gains experience.</p>
*
* @param score New death screen score of player
*/
void setDeathScreenScore(int score);
}

View File

@ -3599,4 +3599,14 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
return forwardMovement == backwardMovement ? 0 : forwardMovement ? 1 : -1;
}
@Override
public int getDeathScreenScore() {
return getHandle().getScore();
}
@Override
public void setDeathScreenScore(final int score) {
getHandle().setScore(score);
}
}