mirror of
https://github.com/Melledy/LunarCore.git
synced 2025-12-12 21:34:35 +01:00
Prevent the player from adding more than 1 main character
This commit is contained in:
@@ -3,6 +3,7 @@ package emu.lunarcore.game.avatar;
|
||||
import java.util.Iterator;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import emu.lunarcore.GameConstants;
|
||||
import emu.lunarcore.LunarRail;
|
||||
import emu.lunarcore.data.GameData;
|
||||
import emu.lunarcore.data.excel.AvatarExcel;
|
||||
@@ -39,10 +40,15 @@ public class AvatarStorage extends BasePlayerManager implements Iterable<GameAva
|
||||
}
|
||||
|
||||
public boolean addAvatar(GameAvatar avatar) {
|
||||
// Sanity
|
||||
// Sanity - Dont add avatars we already have OR avatars that dont have excel data
|
||||
if (avatar.getExcel() == null || this.hasAvatar(avatar.getAvatarId())) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Dont add more than 1 main character
|
||||
if (avatar.isHero() && this.hasAvatar(GameConstants.TRAILBLAZER_AVATAR_ID)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Set owner first
|
||||
avatar.setOwner(getPlayer());
|
||||
|
||||
Reference in New Issue
Block a user