ammo: fix the infobox not getting removed

This commit is contained in:
Hydrox6
2019-04-25 18:05:48 +01:00
parent 927e02ff05
commit 669b47d898

View File

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