Implement setting player skin

This commit is contained in:
Melledy
2025-11-19 03:50:04 -08:00
parent c97300f98a
commit 03c24e6dfa
2 changed files with 49 additions and 0 deletions

View File

@@ -284,6 +284,27 @@ public class Player implements GameDatabaseObject {
// Success
return true;
}
public boolean setSkin(int skinId) {
// Skip if we are setting the same skin
if (this.skinId == skinId) {
return true;
}
// Make sure we own this skin
if (!getInventory().hasSkin(skinId)) {
return false;
}
// Set skin
this.skinId = skinId;
// Update in database
Nebula.getGameDatabase().update(this, this.getUid(), "skinId", this.getSkinId());
// Success
return false;
}
public boolean setShowChars(RepeatedInt charIds) {
// Sanity check