Make trick or treat chest dynamically controlled (#256)
* Implement trick or treat chest in customer support server * Add several new reward types, implement trick or treat chest and all its animations, and fix playwire nested threads
This commit is contained in:
parent
39f0cd79bb
commit
d13387df52
@ -105,11 +105,10 @@ public class PlayWireManager extends MiniDbClientPlugin<PlayWireClientData>
|
||||
if (rs.next())
|
||||
{
|
||||
final int newTickets = rs.getInt(1);
|
||||
|
||||
runSync(() ->
|
||||
{
|
||||
ticketCallback.run(newTickets);
|
||||
});
|
||||
{
|
||||
ticketCallback.run(newTickets);
|
||||
});
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
|
@ -82,11 +82,10 @@ public class SpinTicketReward extends Reward
|
||||
if (rs.next())
|
||||
{
|
||||
final int newTickets = rs.getInt(1);
|
||||
|
||||
_clientManager.runSync(() ->
|
||||
{
|
||||
ticketCallback.run(newTickets);
|
||||
});
|
||||
{
|
||||
ticketCallback.run(newTickets);
|
||||
});
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
@ -120,4 +119,4 @@ public class SpinTicketReward extends Reward
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,5 +1,11 @@
|
||||
package mineplex.core.treasure.gui;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.inventory.ClickType;
|
||||
|
||||
import mineplex.core.common.currency.GlobalCurrency;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.inventory.InventoryManager;
|
||||
@ -10,29 +16,25 @@ import mineplex.core.shop.item.SalesPackageBase;
|
||||
import mineplex.core.shop.item.SalesPackageProcessor;
|
||||
import mineplex.core.treasure.ChestPackage;
|
||||
import mineplex.core.treasure.TreasureType;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.inventory.ClickType;
|
||||
import java.util.Calendar;
|
||||
|
||||
public class BuyChestButton implements IButton
|
||||
{
|
||||
private InventoryManager _inventoryManager;
|
||||
|
||||
private TreasurePage _page;
|
||||
|
||||
|
||||
private String _chestName;
|
||||
private Material _chestMat;
|
||||
private int _chestCost;
|
||||
private TreasureType _chestType;
|
||||
|
||||
|
||||
public BuyChestButton(InventoryManager inventoryManager, TreasurePage page,
|
||||
String chestName, Material chestMat, int chestCost, TreasureType chestType)
|
||||
{
|
||||
_inventoryManager = inventoryManager;
|
||||
|
||||
_page = page;
|
||||
|
||||
|
||||
_chestName = chestName;
|
||||
_chestMat = chestMat;
|
||||
_chestCost = chestCost;
|
||||
@ -46,15 +48,15 @@ public class BuyChestButton implements IButton
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (_chestType == TreasureType.TRICK_OR_TREAT)
|
||||
{
|
||||
if (Calendar.MONTH != Calendar.OCTOBER || Calendar.DAY_OF_WEEK < CALENDAR.FRIDAY)
|
||||
{
|
||||
player.sendMessage(F.main("Treasure", "That chest is no longer available for purchase!"));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (_chestType == TreasureType.TRICK_OR_TREAT)
|
||||
{
|
||||
if (!new File("../../update/files/EnableTrickOrTreat.dat").exists())
|
||||
{
|
||||
player.sendMessage(F.main("Treasure", "That chest is no longer available for purchase!"));
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (_chestType == TreasureType.FREEDOM)
|
||||
{
|
||||
if (!_page.getPlugin().hasItemsToGivePlayer(_chestType.getRewardPool(), player))
|
||||
|
Loading…
Reference in New Issue
Block a user