Merge pull request #8639 from Hydrox6/ammo3

ammo: fix the infobox not getting removed
This commit is contained in:
Tomas Slusny
2019-04-25 19:53:00 +02:00
committed by GitHub

View File

@@ -110,6 +110,7 @@ public class AmmoPlugin extends Plugin
if (items.length <= EquipmentInventorySlot.AMMO.getSlotIdx()) if (items.length <= EquipmentInventorySlot.AMMO.getSlotIdx())
{ {
removeInfobox();
return; return;
} }
@@ -118,8 +119,7 @@ public class AmmoPlugin extends Plugin
if (!comp.isStackable()) if (!comp.isStackable())
{ {
infoBoxManager.removeInfoBox(counterBox); removeInfobox();
counterBox = null;
return; return;
} }
@@ -134,9 +134,15 @@ public class AmmoPlugin extends Plugin
return; return;
} }
infoBoxManager.removeInfoBox(counterBox); removeInfobox();
final BufferedImage image = itemManager.getImage(item.getId(), 5, false); final BufferedImage image = itemManager.getImage(item.getId(), 5, false);
counterBox = new AmmoCounter(this, item.getId(), item.getQuantity(), comp.getName(), image); counterBox = new AmmoCounter(this, item.getId(), item.getQuantity(), comp.getName(), image);
infoBoxManager.addInfoBox(counterBox); infoBoxManager.addInfoBox(counterBox);
} }
private void removeInfobox()
{
infoBoxManager.removeInfoBox(counterBox);
counterBox = null;
}
} }