From cfc36c0c27ea2e67314b1982a6b2579c88075bf9 Mon Sep 17 00:00:00 2001 From: MagicBot Date: Fri, 29 Mar 2024 13:23:56 -0400 Subject: [PATCH] Equipslot stored as string --- src/engine/db/handlers/dbItemHandler.java | 5 ++++- src/engine/objects/Item.java | 7 ++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/engine/db/handlers/dbItemHandler.java b/src/engine/db/handlers/dbItemHandler.java index e21f87da..117b3602 100644 --- a/src/engine/db/handlers/dbItemHandler.java +++ b/src/engine/db/handlers/dbItemHandler.java @@ -92,7 +92,10 @@ public class dbItemHandler extends dbHandlerBase { break; } - preparedStatement.setByte(7, (byte) toAdd.equipSlot.ordinal()); + if (toAdd.equipSlot.equals(Enum.EquipSlotType.NONE)) + preparedStatement.setString(7, ""); + else + preparedStatement.setString(7, toAdd.equipSlot.name()); String flagString = ""; diff --git a/src/engine/objects/Item.java b/src/engine/objects/Item.java index dbe828d3..8b3c3e12 100644 --- a/src/engine/objects/Item.java +++ b/src/engine/objects/Item.java @@ -147,7 +147,12 @@ public class Item extends AbstractWorldObject { this.canDestroy = true; - this.equipSlot = EquipSlotType.values()[rs.getByte("equipSlot")]; + String equipString = rs.getString("equipSlot"); + + if (equipString.isEmpty()) + this.equipSlot = EquipSlotType.NONE; + else + this.equipSlot = EquipSlotType.valueOf(equipString); this.numberOfItems = rs.getInt("numberOfItems");