diff --git a/src/engine/net/client/handlers/ItemProductionMsgHandler.java b/src/engine/net/client/handlers/ItemProductionMsgHandler.java index 6efb1bd8..3a51967b 100644 --- a/src/engine/net/client/handlers/ItemProductionMsgHandler.java +++ b/src/engine/net/client/handlers/ItemProductionMsgHandler.java @@ -130,6 +130,11 @@ public class ItemProductionMsgHandler extends AbstractClientMsgHandler { WorkOrder workOrder = ForgeManager.itemWorkOrderLookup.get(virtualItem); City city = workOrder.vendor.building.getCity(); + + if (city == null) + return; + ; + city.transactionLock.writeLock().lock(); try { @@ -286,7 +291,7 @@ public class ItemProductionMsgHandler extends AbstractClientMsgHandler { } // Method completes an item that has been previously rolled - // adding it to the NPC's inventory + // adding it to the Vendor inventory private static void recycleItem(HashMap itemList, NPC vendor, ClientConnection origin) { @@ -398,9 +403,8 @@ public class ItemProductionMsgHandler extends AbstractClientMsgHandler { if (workOrder == null) return; - if (workOrder.cooking.contains(virtualItem) == false) + if (!workOrder.cooking.contains(virtualItem)) return; - ; City city = workOrder.vendor.building.getCity(); @@ -418,11 +422,11 @@ public class ItemProductionMsgHandler extends AbstractClientMsgHandler { // Update total_to_produce accounting for the slot being // removed while workOrder is not completed. - if (workOrder.runCompleted == false) + if (!workOrder.runCompleted) if (workOrder.multiple_slot_request && workOrder.slots_used > 1) { - int itemsPerSlot = workOrder.total_to_produce / workOrder.slots_used; - workOrder.total_to_produce = workOrder.total_to_produce - itemsPerSlot; - } + int itemsPerSlot = workOrder.total_to_produce / workOrder.slots_used; + workOrder.total_to_produce = workOrder.total_to_produce - itemsPerSlot; + } // Slot is no longer allocated to this workOrder. @@ -476,9 +480,7 @@ public class ItemProductionMsgHandler extends AbstractClientMsgHandler { player.charItemManager.buyFromNPC(targetItem, vendor); } - player.charItemManager.updateInventory(); - } }