Fix exception when giving all materials

This commit is contained in:
Melledy
2026-01-02 03:32:50 -08:00
parent 9f8fd4464b
commit f949f3b619
3 changed files with 54 additions and 52 deletions
@@ -45,7 +45,7 @@ public class GiveAllCommand implements CommandHandler {
// Check sub type // Check sub type
for (ItemDef data : GameData.getItemDataTable()) { for (ItemDef data : GameData.getItemDataTable()) {
if (!MATERIAL_ITEM_SUBTYPES.contains(data.getItemSubType())) { if (data.getItemSubType() == null || !MATERIAL_ITEM_SUBTYPES.contains(data.getItemSubType())) {
continue; continue;
} }
@@ -5,51 +5,53 @@ import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
import lombok.Getter; import lombok.Getter;
public enum ItemSubType { public enum ItemSubType {
Res (1), Res (1),
Item (2), Item (2),
Char (3), Char (3),
Energy (4), Energy (4),
WorldRankExp (5), WorldRankExp (5),
CharShard (6), CharShard (6),
Disc (8), Disc (8),
TalentStrengthen (9), TalentStrengthen (9),
DiscStrengthen (12), DiscStrengthen (12),
DiscPromote (13), DiscPromote (13),
TreasureBox (17), TreasureBox (17),
GearTreasureBox (18), GearTreasureBox (18),
SubNoteSkill (19), SubNoteSkill (19),
SkillStrengthen (24), SkillStrengthen (24),
CharacterLimitBreak (25), CharacterLimitBreak (25),
MonthlyCard (30), MonthlyCard (30),
EnergyItem (31), EnergyItem (31),
ComCYO (32), ComCYO (32),
OutfitCYO (33), OutfitCYO (33),
RandomPackage (34), RandomPackage (34),
Equipment (35), Equipment (35),
FateCard (37), FateCard (37),
EquipmentExp (38), EquipmentExp (38),
DiscLimitBreak (40), DiscLimitBreak (40),
Potential (41), Potential (41),
SpecificPotential (42), SpecificPotential (42),
Honor (43), Honor (43),
CharacterYO (44), CharacterYO (44),
PlayHead (45), PlayHead (45),
CharacterSkin (46); CharacterSkin (46),
SouvenirEnergyItem (47),
Build (48);
@Getter @Getter
private final int value; private final int value;
private final static Int2ObjectMap<ItemSubType> map = new Int2ObjectOpenHashMap<>(); private final static Int2ObjectMap<ItemSubType> map = new Int2ObjectOpenHashMap<>();
static { static {
for (ItemSubType type : ItemSubType.values()) { for (ItemSubType type : ItemSubType.values()) {
map.put(type.getValue(), type); map.put(type.getValue(), type);
} }
} }
private ItemSubType(int value) { private ItemSubType(int value) {
this.value = value; this.value = value;
} }
public static ItemSubType getByValue(int value) { public static ItemSubType getByValue(int value) {
return map.get(value); return map.get(value);
} }
@@ -5,34 +5,34 @@ import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
import lombok.Getter; import lombok.Getter;
public enum ItemType { public enum ItemType {
Res (1), Res (1),
Item (2), Item (2),
Char (3), Char (3),
Energy (4), Energy (4),
WorldRankExp (5), WorldRankExp (5),
RogueItem (6), RogueItem (6),
Disc (7), Disc (7),
Equipment (9), Equipment (9),
CharacterSkin (10), CharacterSkin (10),
MonthlyCard (11), MonthlyCard (11),
Title (12), Title (12),
Honor (13), Honor (13),
HeadItem (14); HeadItem (14);
@Getter @Getter
private final int value; private final int value;
private final static Int2ObjectMap<ItemType> map = new Int2ObjectOpenHashMap<>(); private final static Int2ObjectMap<ItemType> map = new Int2ObjectOpenHashMap<>();
static { static {
for (ItemType type : ItemType.values()) { for (ItemType type : ItemType.values()) {
map.put(type.getValue(), type); map.put(type.getValue(), type);
} }
} }
private ItemType(int value) { private ItemType(int value) {
this.value = value; this.value = value;
} }
public static ItemType getByValue(int value) { public static ItemType getByValue(int value) {
return map.get(value); return map.get(value);
} }