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
for (ItemDef data : GameData.getItemDataTable()) {
if (!MATERIAL_ITEM_SUBTYPES.contains(data.getItemSubType())) {
if (data.getItemSubType() == null || !MATERIAL_ITEM_SUBTYPES.contains(data.getItemSubType())) {
continue;
}
@@ -5,51 +5,53 @@ import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
import lombok.Getter;
public enum ItemSubType {
Res (1),
Item (2),
Char (3),
Energy (4),
WorldRankExp (5),
CharShard (6),
Disc (8),
TalentStrengthen (9),
DiscStrengthen (12),
DiscPromote (13),
TreasureBox (17),
GearTreasureBox (18),
SubNoteSkill (19),
SkillStrengthen (24),
CharacterLimitBreak (25),
MonthlyCard (30),
EnergyItem (31),
ComCYO (32),
OutfitCYO (33),
RandomPackage (34),
Equipment (35),
FateCard (37),
EquipmentExp (38),
DiscLimitBreak (40),
Potential (41),
SpecificPotential (42),
Honor (43),
CharacterYO (44),
PlayHead (45),
CharacterSkin (46);
Res (1),
Item (2),
Char (3),
Energy (4),
WorldRankExp (5),
CharShard (6),
Disc (8),
TalentStrengthen (9),
DiscStrengthen (12),
DiscPromote (13),
TreasureBox (17),
GearTreasureBox (18),
SubNoteSkill (19),
SkillStrengthen (24),
CharacterLimitBreak (25),
MonthlyCard (30),
EnergyItem (31),
ComCYO (32),
OutfitCYO (33),
RandomPackage (34),
Equipment (35),
FateCard (37),
EquipmentExp (38),
DiscLimitBreak (40),
Potential (41),
SpecificPotential (42),
Honor (43),
CharacterYO (44),
PlayHead (45),
CharacterSkin (46),
SouvenirEnergyItem (47),
Build (48);
@Getter
private final int value;
private final static Int2ObjectMap<ItemSubType> map = new Int2ObjectOpenHashMap<>();
static {
for (ItemSubType type : ItemSubType.values()) {
map.put(type.getValue(), type);
}
}
private ItemSubType(int value) {
this.value = value;
}
public static ItemSubType getByValue(int value) {
return map.get(value);
}
@@ -5,34 +5,34 @@ import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
import lombok.Getter;
public enum ItemType {
Res (1),
Item (2),
Char (3),
Energy (4),
WorldRankExp (5),
RogueItem (6),
Disc (7),
Equipment (9),
CharacterSkin (10),
MonthlyCard (11),
Title (12),
Honor (13),
HeadItem (14);
Res (1),
Item (2),
Char (3),
Energy (4),
WorldRankExp (5),
RogueItem (6),
Disc (7),
Equipment (9),
CharacterSkin (10),
MonthlyCard (11),
Title (12),
Honor (13),
HeadItem (14);
@Getter
private final int value;
private final static Int2ObjectMap<ItemType> map = new Int2ObjectOpenHashMap<>();
static {
for (ItemType type : ItemType.values()) {
map.put(type.getValue(), type);
}
}
private ItemType(int value) {
this.value = value;
}
public static ItemType getByValue(int value) {
return map.get(value);
}