Correctly enable/disable chests

This commit is contained in:
Graphica 2017-07-27 18:30:38 -04:00 committed by cnr
parent bfee68007c
commit dadbd87f45
2 changed files with 29 additions and 11 deletions

View File

@ -51,24 +51,42 @@ public class BuyChestButton implements IButton
if (_chestType == TreasureType.TRICK_OR_TREAT)
{
if (!new File("../../update/files/EnableTrickOrTreat.dat").exists())
if (!new File("../../update/files/EnableTrickOrTreatChest.dat").exists())
{
player.sendMessage(F.main("Treasure", "That chest is no longer available for purchase!"));
return;
}
if (!_page.getPlugin().hasItemsToGivePlayer(_chestType.getRewardPool(), player))
{
player.sendMessage(F.main("Treasure", "You seem to have all treasures for this chest unlocked already!"));
return;
}
}
if (_chestType == TreasureType.THANKFUL)
{
if (!new File("../../update/files/EnableThankful.dat").exists())
if (!new File("../../update/files/EnableThankfulChest.dat").exists())
{
player.sendMessage(F.main("Treasure", "That chest is no longer available for purchase!"));
return;
}
if (!_page.getPlugin().hasItemsToGivePlayer(_chestType.getRewardPool(), player))
{
player.sendMessage(F.main("Treasure", "You seem to have all treasures for this chest unlocked already!"));
return;
}
}
if (_chestType == TreasureType.GINGERBREAD)
{
player.sendMessage(F.main("Treasure", "That chest is no longer available for purchase!"));
return;
if (!new File("../../update/files/EnableGingerbreadChest.dat").exists())
{
player.sendMessage(F.main("Treasure", "That chest is no longer available for purchase!"));
return;
}
if (!_page.getPlugin().hasItemsToGivePlayer(_chestType.getRewardPool(), player))
{
player.sendMessage(F.main("Treasure", "You seem to have all treasures for this chest unlocked already!"));
return;
}
}
if (_chestType == TreasureType.LOVE_CHEST)
{

View File

@ -149,13 +149,13 @@ public class TreasurePage extends ShopPageBase<TreasureManager, TreasureShop>
int stpatricksCount = _inventoryManager.Get(getPlayer()).getItemCount(TreasureType.ST_PATRICKS.getItemName());
int springCount = _inventoryManager.Get(getPlayer()).getItemCount(TreasureType.SPRING.getItemName());
boolean availableChristmas = false;
boolean availableFreedom = true;
boolean availableHaunted = false;
boolean availableTrick = false;
boolean availableThank = false;
boolean availableGingerbread = false;
boolean availableLove = false;
boolean availableChristmas = new File("../../update/files/EnableChristmasChest.dat").exists();
boolean availableFreedom = new File("../../update/files/EnableFreedomChest.dat").exists();
boolean availableHaunted = new File("../../update/files/EnableHauntedChest.dat").exists();
boolean availableTrick = new File("../../update/files/EnableTrickOrTreatChest.dat").exists();
boolean availableThank = new File("../../update/files/EnableThankfulChest.dat").exists();
boolean availableGingerbread = new File("../../update/files/EnableGingerbreadChest.dat").exists();
boolean availableLove = new File("../../update/files/EnableLoveChest.dat").exists();
boolean availableStPatricks = new File("../../update/files/EnableStPatricksChest.dat").exists();
boolean availableSpring = new File("../../update/files/EnableSpringChest.dat").exists();