Fix bug preventing TNT generators from working if purchaser leaves the clan

This commit is contained in:
AlexTheCoder 2017-06-15 23:03:30 -04:00
parent bc61bdff5e
commit 724604c76a

View File

@ -84,7 +84,9 @@ public class TNTGenPage extends ShopPageBase<ClansManager, TNTGenShop>
nextTnt = UtilTime.MakeStr((TntGeneratorManager.SECONDS_PER_TNT - generator.getTicks()) * 1000);
}
addButton(13, new ItemBuilder(Material.BREWING_STAND_ITEM)
if (clan.getMembers().containsKey(generator.getBuyer()))
{
addButton(13, new ItemBuilder(Material.BREWING_STAND_ITEM)
.setTitle(C.cGreen + "TNT Generator")
.setLore(
" ",
@ -95,7 +97,24 @@ public class TNTGenPage extends ShopPageBase<ClansManager, TNTGenShop>
C.cWhite + "Next TNT: " + F.elem(nextTnt)).build(), (player, click) -> {
clearPage();
buildPage();
});
}
);
}
else
{
addButton(13, new ItemBuilder(Material.BREWING_STAND_ITEM)
.setTitle(C.cGreen + "TNT Generator")
.setLore(
" ",
C.cWhite + "TNT Available: " + F.elem(Integer.valueOf(generator.getStock())),
" ",
C.cWhite + "Next TNT: " + F.elem(nextTnt)).build(), (player, click) ->
{
clearPage();
buildPage();
}
);
}
if (generator.getStock() == 0)
{
@ -138,5 +157,4 @@ public class TNTGenPage extends ShopPageBase<ClansManager, TNTGenShop>
}
}
}
}
}