Merge branch 'project-cosmetics' into develop

This commit is contained in:
cnr 2016-09-30 21:47:08 -07:00
commit 6e2512e0cf
16 changed files with 675 additions and 226 deletions

View File

@ -55,8 +55,9 @@ public class SkinData
public final static SkinData SNOWMAN = new SkinData("eyJ0aW1lc3RhbXAiOjE0NTAwMTk4Nzk5NDIsInByb2ZpbGVJZCI6ImE5ZDBjMDcyYmYxOTQwYTFhMTkzNjhkMDlkNTAwMjZlIiwicHJvZmlsZU5hbWUiOiJTcGlyaXR1c1NhbmN0dXMiLCJzaWduYXR1cmVSZXF1aXJlZCI6dHJ1ZSwidGV4dHVyZXMiOnsiU0tJTiI6eyJ1cmwiOiJodHRwOi8vdGV4dHVyZXMubWluZWNyYWZ0Lm5ldC90ZXh0dXJlLzEzMTgxYWViODQzODk3NzM1ZDQwMmIyNDk2OTQxNmZkYjBjZTM0YTZiOTM3ODE2MjQzNzU2ZTlkYWU1OGUzIn19fQ==", "NZvsNu+HQ5uvGWq6O8VNDGq9A145bmk2IkHiz916uRVPMRqqCI/zwhKWNLlFACE/feuLkhYAois29ec6sVVOtHIoNA+S5q1Mb/Vjc3TJQxzqmx2FZOhJiIttFwYuo9WomQKBqrPMSJ9tpQig4wzoqldeeTjWC3dLz7JeX+gkzinryVjG7NNN9L5hXK5/BBxRcrtwmXJfUlSANyrd8RZW7mEUgU8yxlzdqTu0w7bZLjQNd4vciwoF3NelXDorMIIqiHTkuQesG91Njtu25VCUDK3nXbqEnZw2ZtxB5fT5G2Omm/vkNSRXc0P7iqchVowdYQcMlQUsp65xpkBbFS4LwjzDkYIfLmF++hePb8z72Gz77FxhO5sRLGreSH227McyL/0CtWNKm9ZZIfQtZZjEZTj9+eiJMCloCMg3yWa1VBOiLHzz0wY6gGklccIImPyXEg7E0dIK8qYseJMhmmBNZ8pDOkbUDp3mRlrQ2iyClgQkbuR63j79IBUaCxmsa3NnrAtaJklzd9mzkHXfMBh2XT7Gl8AhJS6JK5kCvip1rBBI8yjrsjE/E+lyJFIbC4rXx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n0zpITEaG5HjUpRSaJg=");
public final static SkinData WITCH = new SkinData("eyJ0aW1lc3RhbXAiOjE0NzM5OTEyMTE1NDQsInByb2ZpbGVJZCI6IjlmY2FlZDhiMTRiNTRmN2ZhNjRjYjYwNDBlNzA1MjcyIiwicHJvZmlsZU5hbWUiOiJMQ2FzdHIxIiwic2lnbmF0dXJlUmVxdWlyZWQiOnRydWUsInRleHR1cmVzIjp7IlNLSU4iOnsidXJsIjoiaHR0cDovL3RleHR1cmVzLm1pbmVjcmFmdC5uZXQvdGV4dHVyZS81NDg1ZDZlMTBhNmNmMmY3Mzg2NmZhMGRiNjEzOWQ5NWViZDM0ZGZiMGY0YzAxMmRkM2YzYWYxMWQ5ZjQxYyJ9fX0=", "cojkGLflVWxwnhDXmHMke7crkeA78iUYOWY7H3YvMJFD+VZi9E7vUahLTTx5ELH+PvcaHJerSDmuV+Nasc3K2n6zlXXb0B7RB/ose/kdPxHAIJee7IbZX0iFNDn6irUSOS4wOYF/BwaqG3HmpoSxV52SGMs6kqTer2Rjg3X+XwYFFiDHAR/gwhfXLzrM1iBc171vgu6T+kx65iBHa/YB/V/mj8FSxwM0f5IsLpgAEdxDL9PvEKQWgWeZ1CAqEXlGnjPkd9oGzW0TgDz2MksBbYZ2kmn/S53kK9vCrVB7egZPS4VBtKpq1P7Jeu8rtgjnAKVFQJZ2lMHnVRuvGTd8JKoPHarUPpU2LURUMaCtHzSv9v/4gjkafnDhqxG4TTcr5hxFV+ho72HQchoeaUXzIO+Yo71zrVqkrS0hw6OtgMIBlvaGaEUsFvGiCZePBEiHojO43AKqJcJAVeT2RAzHcAaBAO79ACGjNKw/oj02rOurLha9i+99bKui96Eg7SS/nPchbmu5YQ9nSpkW+JeYXnBzGGzNG4y02VWgz15L718+8161zXobhuK07qlY9i1nipFbEJedqG0cfS+AUzauETFvS9nMtxhtftYPCIxm40GQj6e77asNCAEElGssaUGKO3bjm348+oF9tR/eBOYWJQ8kL46IQLDRoop7UhG4ewY=");
// Comments this out for now, so it doesn't load the player profile // Comments this out for now, so it doesn't load the player profile
// A better way to do this would check for the properties when getting the skull or the skin // A better way to do this would check for the properties when getting the skull or the skin

View File

@ -5,11 +5,13 @@ import mineplex.core.command.CommandBase;
import mineplex.core.common.Rank; import mineplex.core.common.Rank;
import mineplex.core.common.util.F; import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilPlayer;
import mineplex.core.powerplayclub.PowerPlayData;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import java.time.LocalDate; import java.time.LocalDate;
import java.time.YearMonth;
public class PowerPlayCommand extends CommandBase<BonusManager> public class PowerPlayCommand extends CommandBase<BonusManager>
{ {
@ -37,7 +39,8 @@ public class PowerPlayCommand extends CommandBase<BonusManager>
return; return;
} }
_bonusManager.getPowerPlayClubRepository().Get(player).setSubscribed(true); PowerPlayData cached = _bonusManager.getPowerPlayClubRepository().getCachedData(player);
cached.getUnclaimedMonths().add(YearMonth.now());
_bonusManager.getPowerPlayClubRepository().addSubscription(_bonusManager.getClientManager().Get(player).getAccountId(), LocalDate.now(), "month"); _bonusManager.getPowerPlayClubRepository().addSubscription(_bonusManager.getClientManager().Get(player).getAccountId(), LocalDate.now(), "month");
caller.sendMessage(ChatColor.GREEN + "Gave a month's subscription to " + player.getName()); caller.sendMessage(ChatColor.GREEN + "Gave a month's subscription to " + player.getName());

View File

@ -1,13 +1,22 @@
package mineplex.core.bonuses.gui.buttons; package mineplex.core.bonuses.gui.buttons;
import java.time.LocalDate;
import java.time.YearMonth;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import mineplex.core.bonuses.BonusManager; import mineplex.core.bonuses.BonusManager;
import mineplex.core.common.util.C; import mineplex.core.common.util.C;
import mineplex.core.common.util.F; import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilPlayer;
import mineplex.core.donation.DonationManager;
import mineplex.core.gui.GuiItem; import mineplex.core.gui.GuiItem;
import mineplex.core.inventory.InventoryManager; import mineplex.core.inventory.InventoryManager;
import mineplex.core.powerplayclub.PowerPlayClubRepository; import mineplex.core.powerplayclub.PowerPlayClubRepository;
import mineplex.core.powerplayclub.PowerPlayClubRewards; import mineplex.core.powerplayclub.PowerPlayClubRewards;
import mineplex.core.powerplayclub.PowerPlayData;
import mineplex.core.shop.item.ShopItem; import mineplex.core.shop.item.ShopItem;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.Sound; import org.bukkit.Sound;
@ -15,8 +24,6 @@ import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType; import org.bukkit.event.inventory.ClickType;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import java.util.ArrayList;
public class PowerPlayClubButton implements GuiItem public class PowerPlayClubButton implements GuiItem
{ {
@ -24,6 +31,7 @@ public class PowerPlayClubButton implements GuiItem
private Player _player; private Player _player;
private PowerPlayClubRepository _powerPlayClubRepository; private PowerPlayClubRepository _powerPlayClubRepository;
private InventoryManager _inventoryManager; private InventoryManager _inventoryManager;
private DonationManager _donationManager;
private BonusManager _bonusManager; private BonusManager _bonusManager;
public PowerPlayClubButton(Player player, BonusManager manager) public PowerPlayClubButton(Player player, BonusManager manager)
@ -32,6 +40,7 @@ public class PowerPlayClubButton implements GuiItem
_bonusManager = manager; _bonusManager = manager;
_powerPlayClubRepository = manager.getPowerPlayClubRepository(); _powerPlayClubRepository = manager.getPowerPlayClubRepository();
_inventoryManager = manager.getInventoryManager(); _inventoryManager = manager.getInventoryManager();
_donationManager = manager.getDonationManager();
} }
@Override @Override
@ -49,18 +58,18 @@ public class PowerPlayClubButton implements GuiItem
@Override @Override
public void click(ClickType clickType) public void click(ClickType clickType)
{ {
if (isAvailable() && !_bonusManager.getPowerPlayClubRepository().alreadyClaimed(_player)) if (isAvailable())
{ {
_player.closeInventory(); _player.closeInventory();
_player.playSound(_player.getLocation(), Sound.NOTE_PLING, 1, 1.6f); _player.playSound(_player.getLocation(), Sound.NOTE_PLING, 1, 1.6f);
PowerPlayClubRewards.giveAllItems(_player, _inventoryManager, _powerPlayClubRepository); PowerPlayClubRewards.giveAllItems(_player, _donationManager, _inventoryManager, _powerPlayClubRepository);
} }
else else
{ {
_player.playSound(_player.getLocation(), Sound.ITEM_BREAK, 1, 10); _player.playSound(_player.getLocation(), Sound.ITEM_BREAK, 1, 10);
if (_powerPlayClubRepository.alreadyClaimed(_player)) if (_powerPlayClubRepository.getCachedData(_player).isSubscribed())
{ {
UtilPlayer.message(_player, F.main("Power Play Club", "Already claimed!")); UtilPlayer.message(_player, F.main("Power Play Club", "Already claimed! Come back next month!"));
} }
else else
{ {
@ -77,58 +86,72 @@ public class PowerPlayClubButton implements GuiItem
private void setItem() private void setItem()
{ {
ArrayList<String> lore = new ArrayList<>(); final Material material;
Material material; final String itemName;
byte data = 0; final List<String> lore;
String itemName;
if (isAvailable())
PowerPlayData cached = _powerPlayClubRepository.getCachedData(_player);
List<YearMonth> unclaimed = cached.getUnclaimedMonths();
if (!unclaimed.isEmpty())
{ {
// Player has unclaimed rewards, even if s/he's not currently subscribed
material = Material.GOLD_INGOT; material = Material.GOLD_INGOT;
itemName = C.cGreenB + "Power Play Club"; itemName = C.cGreenB + "Power Play Club";
lore = buildLore(unclaimed);
lore.add(" "); lore.add(" ");
lore.add(C.Reset + "Click to claim!"); lore.add(C.cGold + "Click to claim!");
}
else } else if (cached.isSubscribed())
{ {
// Player is subscribed and has claimed all of his/her rewards
material = Material.REDSTONE_BLOCK; material = Material.REDSTONE_BLOCK;
itemName = C.cRedB + "Power Play Club"; itemName = C.cRedB + "Power Play Club";
}
lore.add(C.cYellow + "Rewards"); lore = new ArrayList<>();
lore.add(" " + C.cWhite + "2 Game Amplifiers");
lore.add(" " + C.cWhite + "1 Omega Chest");
for (PowerPlayClubRewards.PowerPlayClubItem prize : PowerPlayClubRewards.septemberItems())
{
lore.add(" " + C.cWhite + prize.getAmount() + " " + prize.getPrize());
}
//lore.add(" ");
//lore.add(C.cYellow + "Months left: " + C.cWhite + getMonthsLeft(true)); //TODO: figure this out
if (!isAvailable())
{
lore.add(" ");
if (_powerPlayClubRepository.alreadyClaimed(_player))
{
lore.add(C.cRed + "Already claimed!"); lore.add(C.cRed + "Already claimed!");
}
else // TODO: 'come back later!'
} else
{ {
// Player isn't subscribed; show them the rewards for this current month and tell them to subscribe
material = Material.REDSTONE_BLOCK;
itemName = C.cRedB + "Power Play Club";
lore = buildLore(Collections.singletonList(YearMonth.now()));
lore.add(" ");
lore.add(C.cRed + "Get Power Play Club months at"); lore.add(C.cRed + "Get Power Play Club months at");
lore.add(C.cAqua + "mineplex.com/shop"); lore.add(C.cAqua + "mineplex.com/shop");
} }
_item = new ShopItem(material, (byte)0, itemName, lore.toArray(new String[lore.size()]), 1, false, false);
} }
_item = new ShopItem(material, data, itemName, lore.toArray(new String[0]), 1, false, false); private List<String> buildLore(List<YearMonth> unclaimed)
{
List<String> lore = new ArrayList<>();
lore.add(C.cYellow + "Rewards");
lore.add(" " + C.cWhite + (PowerPlayClubRewards.AMPLIFIERS_PER_MONTH * unclaimed.size()) + " Game Amplifier");
lore.add(" " + C.cWhite + (PowerPlayClubRewards.CHESTS_PER_MONTH * unclaimed.size()) + " Omega Chest");
PowerPlayClubRewards.rewardsForMonths(unclaimed).forEach(prize ->
{
lore.add(" " + C.cWhite + prize.getPrize());
});
return lore;
} }
private boolean isAvailable() private boolean isAvailable()
{ {
return _powerPlayClubRepository.canClaim(_player); return !_powerPlayClubRepository.getCachedData(_player).getUnclaimedMonths().isEmpty();
} }
public static boolean isAvailable(Player player, PowerPlayClubRepository repo) public static boolean isAvailable(Player player, PowerPlayClubRepository repo)
{ {
return repo.canClaim(player); return !repo.getCachedData(player).getUnclaimedMonths().isEmpty();
} }
} }

View File

@ -1,5 +1,9 @@
package mineplex.core.cosmetic.ui.page; package mineplex.core.cosmetic.ui.page;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import mineplex.core.account.CoreClientManager; import mineplex.core.account.CoreClientManager;
import mineplex.core.common.currency.GlobalCurrency; import mineplex.core.common.currency.GlobalCurrency;
import mineplex.core.common.util.C; import mineplex.core.common.util.C;
@ -15,6 +19,7 @@ import mineplex.core.cosmetic.ui.button.deactivate.DeactivateGadgetButton;
import mineplex.core.donation.DonationManager; import mineplex.core.donation.DonationManager;
import mineplex.core.gadget.event.GadgetChangeEvent; import mineplex.core.gadget.event.GadgetChangeEvent;
import mineplex.core.gadget.gadgets.morph.MorphBlock; import mineplex.core.gadget.gadgets.morph.MorphBlock;
import mineplex.core.gadget.gadgets.morph.MorphWitch;
import mineplex.core.gadget.types.Gadget; import mineplex.core.gadget.types.Gadget;
import mineplex.core.gadget.types.GadgetType; import mineplex.core.gadget.types.GadgetType;
import mineplex.core.gadget.types.HatGadget; import mineplex.core.gadget.types.HatGadget;
@ -31,10 +36,6 @@ import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.BannerMeta; import org.bukkit.inventory.meta.BannerMeta;
import org.bukkit.inventory.meta.ItemMeta; import org.bukkit.inventory.meta.ItemMeta;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
public class GadgetPage extends ShopPageBase<CosmeticManager, CosmeticShop> public class GadgetPage extends ShopPageBase<CosmeticManager, CosmeticShop>
{ {
public GadgetPage(CosmeticManager plugin, CosmeticShop shop, CoreClientManager clientManager, DonationManager donationManager, String name, Player player) public GadgetPage(CosmeticManager plugin, CosmeticShop shop, CoreClientManager clientManager, DonationManager donationManager, String name, Player player)
@ -277,7 +278,15 @@ public class GadgetPage extends ShopPageBase<CosmeticManager, CosmeticShop>
//Standard //Standard
if (gadget.ownsGadget(getPlayer())) if (gadget.ownsGadget(getPlayer()))
{ {
ItemStack gadgetItemStack = new ItemStack(gadget.getDisplayMaterial(), 1, gadget.getDisplayData()); ItemStack gadgetItemStack;
if (gadget instanceof MorphWitch)
{
gadgetItemStack = ((MorphWitch) gadget).getWitchItem();
}
else
{
gadgetItemStack = new ItemStack(gadget.getDisplayMaterial(), 1, gadget.getDisplayData());
}
ItemMeta meta = gadgetItemStack.getItemMeta(); ItemMeta meta = gadgetItemStack.getItemMeta();
meta.setDisplayName(C.cGreen + C.Bold + gadget.getName()); meta.setDisplayName(C.cGreen + C.Bold + gadget.getName());
if (gadget.getActive().contains(getPlayer())) if (gadget.getActive().contains(getPlayer()))

View File

@ -5,6 +5,7 @@ import java.util.function.Predicate;
import mineplex.core.gadget.event.PlayerToggleSwimEvent; import mineplex.core.gadget.event.PlayerToggleSwimEvent;
import mineplex.core.gadget.gadgets.morph.swim.SwimManager; import mineplex.core.gadget.gadgets.morph.swim.SwimManager;
import mineplex.core.treasure.TreasureManager;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Material; import org.bukkit.Material;
@ -206,6 +207,7 @@ public class GadgetManager extends MiniPlugin
private final HologramManager _hologramManager; private final HologramManager _hologramManager;
private final OutfitWindUpSuitBoosterManager _boosterManager; private final OutfitWindUpSuitBoosterManager _boosterManager;
private final IncognitoManager _incognitoManager; private final IncognitoManager _incognitoManager;
private TreasureManager _treasureManager;
private NautHashMap<GadgetType, List<Gadget>> _gadgets; private NautHashMap<GadgetType, List<Gadget>> _gadgets;
@ -341,8 +343,8 @@ public class GadgetManager extends MiniPlugin
addGadget(new MorphSnowman(this)); addGadget(new MorphSnowman(this));
addGadget(new MorphUncleSam(this)); addGadget(new MorphUncleSam(this));
addGadget(new MorphSquid(this)); addGadget(new MorphSquid(this));
// Not being added in this update! addGadget(new MorphWitch(this));
//addGadget(new MorphMetalMan(this)); //addGadget(new MorphMetalMan(this)); // Soon: reward for signup
// Particles // Particles
addGadget(new ParticleFoot(this)); addGadget(new ParticleFoot(this));
@ -1152,4 +1154,14 @@ public class GadgetManager extends MiniPlugin
} }
} }
} }
public void setTreasureManager(TreasureManager treasureManager)
{
_treasureManager = treasureManager;
}
public TreasureManager getTreasureManager()
{
return _treasureManager;
}
} }

View File

@ -20,7 +20,7 @@ public class UnlockCosmeticsCommand extends CommandBase<GadgetManager>
public UnlockCosmeticsCommand(GadgetManager plugin) public UnlockCosmeticsCommand(GadgetManager plugin)
{ {
super(plugin, Rank.JNR_DEV, new Rank[]{Rank.SNR_MODERATOR}, "unlockCosmetics"); super(plugin, Rank.JNR_DEV, "unlockCosmetics");
_plugin = plugin; _plugin = plugin;
} }

View File

@ -29,7 +29,8 @@ public class MorphMetalMan extends MorphGadget
public MorphMetalMan(GadgetManager manager) public MorphMetalMan(GadgetManager manager)
{ {
super(manager, "Metal Man Morph", UtilText.splitLinesToArray(new String[]{"Placeholder"}, LineFormat.LORE), super(manager, "Metal Man Morph", UtilText.splitLinesToArray(new String[]{C.cGray + "This powerful suit forged of metal makes the wearer strong enough to even battle the gods",
"", C.cWhite + "Left-click to shoot laser beam"}, LineFormat.LORE),
0, Material.IRON_INGOT, (byte) 0); 0, Material.IRON_INGOT, (byte) 0);
} }
@ -66,7 +67,10 @@ public class MorphMetalMan extends MorphGadget
if (!UtilEvent.isAction(event, UtilEvent.ActionType.L)) if (!UtilEvent.isAction(event, UtilEvent.ActionType.L))
return; return;
if (!Recharge.Instance.use(player, getName(), 1000, false, false, "Cosmetics")) if (player.getItemInHand().getType() != Material.AIR)
return;
if (!Recharge.Instance.use(player, getName(), 5000, true, false, "Cosmetics"))
return; return;
// Creates colored laser // Creates colored laser
@ -94,25 +98,9 @@ public class MorphMetalMan extends MorphGadget
{ {
color = _playerColors.get(player.getUniqueId()); color = _playerColors.get(player.getUniqueId());
} }
MetalManEffect metalManEffect = new MetalManEffect(player.getEyeLocation(), loc, color, Manager.getPlugin()); MetalManEffect metalManEffect = new MetalManEffect(player.getEyeLocation(), loc, color, this, player);
increaseColor(player.getUniqueId()); increaseColor(player.getUniqueId());
metalManEffect.start(); metalManEffect.start();
// Creates the explosion and knockback players
loc.getWorld().createExplosion(loc, 0f);
UtilParticle.PlayParticle(UtilParticle.ParticleType.HUGE_EXPLOSION, loc, 3f, 3f, 3f, 0, 32, UtilParticle.ViewDist.MAX, UtilServer.getPlayers());
HashMap<Player, Double> players = UtilPlayer.getInRadius(loc, 12d);
for (Player ent : players.keySet())
{
if (Manager.collideEvent(player, this, ent))
continue;
double mult = players.get(ent);
//Knockback
UtilAction.velocity(ent, UtilAlg.getTrajectory(loc, ent.getLocation()), 2 * mult, false, 0, 1 + 1 * mult, 10, true);
}
} }
public void increaseColor(UUID uuid) public void increaseColor(UUID uuid)
@ -128,7 +116,7 @@ public class MorphMetalMan extends MorphGadget
} }
else else
{ {
_playerColors.put(uuid, 0); _playerColors.put(uuid, 1);
} }
} }

View File

@ -0,0 +1,158 @@
package mineplex.core.gadget.gadgets.morph;
import mineplex.core.common.skin.SkinData;
import mineplex.core.common.util.*;
import mineplex.core.disguise.disguises.DisguiseWitch;
import mineplex.core.gadget.GadgetManager;
import mineplex.core.gadget.event.GadgetSelectLocationEvent;
import mineplex.core.gadget.types.MorphGadget;
import mineplex.core.recharge.Recharge;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.player.PlayerToggleSneakEvent;
import org.bukkit.inventory.ItemStack;
public class MorphWitch extends MorphGadget
{
public MorphWitch(GadgetManager manager)
{
super(manager, "Witch Morph", UtilText.splitLinesToArray(new String[]{C.cWhite + "Press sneak to summon your trusty bat and start brewing"}, LineFormat.LORE), 0, Material.SKULL_ITEM, (byte) 3);
}
@Override
public void enableCustom(Player player, boolean message)
{
this.applyArmor(player, message);
DisguiseWitch disguiseWitch = new DisguiseWitch(player);
disguiseWitch.setName(player.getName(), Manager.getClientManager().Get(player).GetRank());
disguiseWitch.setCustomNameVisible(true);
Manager.getDisguiseManager().disguise(disguiseWitch);
}
@Override
public void disableCustom(Player player, boolean message)
{
this.removeArmor(player);
WitchEffectManager witchEffectManager = WitchEffectManager.getManager(player);
if (witchEffectManager != null)
{
witchEffectManager.stop();
}
Manager.getDisguiseManager().undisguise(player);
}
public ItemStack getWitchItem()
{
return SkinData.WITCH.getSkull();
}
@EventHandler
public void onSneak(PlayerToggleSneakEvent event)
{
WitchEffectManager witchEffectManager = WitchEffectManager.getManager(event.getPlayer());
if (!Recharge.Instance.usable(event.getPlayer(), "Witch Cauldron", true))
{
return;
}
if (!event.isSneaking())
return;
if (witchEffectManager != null)
{
if (witchEffectManager.hasStarted())
return;
}
if (!isActive(event.getPlayer()))
return;
if (!event.getPlayer().isOnGround())
{
UtilPlayer.message(event.getPlayer(), F.main("Witch Morph", "You can't place the cauldron there!"));
return;
}
// Checks if there is a block under the cauldron
Location cauldronLocation = event.getPlayer().getLocation().clone().add(event.getPlayer().getLocation().getDirection());
cauldronLocation.add(0, 1, 0);
if(cauldronLocation.getBlock().getType() != Material.AIR)
{
UtilPlayer.message(event.getPlayer(), F.main("Witch Morph", "You can't place the cauldron there!"));
return;
}
// Checks if player is opening a treasure chest/close to a treasure area
if (Manager.getTreasureManager() != null)
{
if (Manager.getTreasureManager().isOpening(event.getPlayer()))
{
UtilPlayer.message(event.getPlayer(), F.main("Witch Morph", "You can't place the cauldron there!"));
return;
}
}
// Checks if the player is close to a cactus
for (int x = -3; x < 3; x++)
{
for (int z = -3; z < 3; z++)
{
Location possibleCactus = cauldronLocation.clone().add(x, 0, z);
if (possibleCactus.getBlock().getType() == Material.CACTUS)
{
UtilPlayer.message(event.getPlayer(), F.main("Witch Morph", "You can't place the cauldron there!"));
return;
}
}
}
// Checks if the player is in a Soccer area
GadgetSelectLocationEvent gadgetSelectLocationEvent = new GadgetSelectLocationEvent(event.getPlayer(), this, cauldronLocation.clone().subtract(0, 1, 0));
gadgetSelectLocationEvent.setShowMessage(true);
Bukkit.getServer().getPluginManager().callEvent(gadgetSelectLocationEvent);
if (gadgetSelectLocationEvent.isCancelled())
{
UtilPlayer.message(event.getPlayer(), F.main("Witch Morph", "You can't place the cauldron there!"));
return;
}
if (!Recharge.Instance.use(event.getPlayer(), "Witch Cauldron", 15000, true, false, "Cosmetics"))
return;
WitchEffectManager newManager = new WitchEffectManager(event.getPlayer(), cauldronLocation);
newManager.start();
}
@EventHandler
public void onUpdate(UpdateEvent updateEvent)
{
if (updateEvent.getType() != UpdateType.TICK)
return;
long currentTime = System.currentTimeMillis();
long delay = 5000;
for (Player player : WitchEffectManager.getPlayers())
{
WitchEffectManager witchEffectManager = WitchEffectManager.getManager(player);
if (witchEffectManager != null)
{
if (witchEffectManager.hasStarted())
{
if (currentTime - witchEffectManager.getStarted() >= delay)
{
witchEffectManager.stop();
}
}
}
}
}
}

View File

@ -0,0 +1,80 @@
package mineplex.core.gadget.gadgets.morph;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
import mineplex.core.common.util.UtilServer;
import mineplex.core.gadget.gadgets.particle.unrelated.WitchParticleEffect;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.entity.Bat;
import org.bukkit.entity.Player;
public class WitchEffectManager
{
private static Map<Player, WitchEffectManager> _managers = new HashMap<>();
private Player _player;
private Bat _bat;
private Location _location;
private long _started = -1;
private WitchParticleEffect _witchParticleEffect;
public WitchEffectManager(Player player, Location location)
{
_player = player;
_location = location;
_managers.put(player, this);
}
public void start()
{
_started = System.currentTimeMillis();
_location.getBlock().setType(Material.CAULDRON);
_location.getBlock().setData((byte) 3);
_location.getWorld().strikeLightning(_location);
Bat bat = _location.getWorld().spawn(_location.clone().add(0, 1, 0), Bat.class);
bat.setCustomName(_player.getName() + "'s Magical Bat");
bat.setCustomNameVisible(true);
_bat = bat;
_witchParticleEffect = new WitchParticleEffect(_location, UtilServer.getPlugin());
_witchParticleEffect.start();
}
public void stop()
{
_bat.remove();
_location.getBlock().setType(Material.AIR);
_managers.remove(_player);
_witchParticleEffect.stop();
}
public boolean hasStarted()
{
return _started != -1;
}
public long getStarted()
{
return _started;
}
public static Set<Player> getPlayers()
{
return _managers.keySet();
}
public static WitchEffectManager getManager(Player player)
{
if (_managers.containsKey(player))
{
return _managers.get(player);
}
return null;
}
}

View File

@ -1,12 +1,15 @@
package mineplex.core.gadget.gadgets.particle.unrelated; package mineplex.core.gadget.gadgets.particle.unrelated;
import java.awt.*; import java.awt.*;
import java.util.HashMap;
import mineplex.core.common.util.UtilParticle; import mineplex.core.common.util.*;
import mineplex.core.common.util.particles.ColoredParticle; import mineplex.core.common.util.particles.ColoredParticle;
import mineplex.core.common.util.particles.DustSpellColor; import mineplex.core.common.util.particles.DustSpellColor;
import mineplex.core.gadget.types.Gadget;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.util.Vector; import org.bukkit.util.Vector;
public class MetalManEffect extends Effect public class MetalManEffect extends Effect
@ -14,12 +17,18 @@ public class MetalManEffect extends Effect
private int _particles = 100; private int _particles = 100;
private int _color; private int _color;
private int _count = 0;
private Vector _vector; private Vector _vector;
private Location _fixedLoc;
private Gadget _gadget;
private Player _player;
public MetalManEffect(Location location, Location target, int color, JavaPlugin javaPlugin) public MetalManEffect(Location location, Location target, int color, Gadget gadget, Player player)
{ {
super(20, new EffectLocation(location), javaPlugin); super(-1, new EffectLocation(location), gadget.Manager.getPlugin());
_color = color; _color = color;
_gadget = gadget;
_player = player;
setTargetLocation(new EffectLocation(target)); setTargetLocation(new EffectLocation(target));
} }
@ -35,16 +44,40 @@ public class MetalManEffect extends Effect
link.normalize(); link.normalize();
Vector vector = link.multiply(length / _particles); Vector vector = link.multiply(length / _particles);
_vector = vector; _vector = vector;
_fixedLoc = location.clone().subtract(_vector);
} }
ColoredParticle coloredParticle = new ColoredParticle(UtilParticle.ParticleType.RED_DUST, ColoredParticle coloredParticle = new ColoredParticle(UtilParticle.ParticleType.RED_DUST,
new DustSpellColor((_color == 0) ? Color.YELLOW : Color.RED), _effectLocation.getLocation().clone()); new DustSpellColor((_color == 0) ? Color.YELLOW : Color.RED), _effectLocation.getLocation().clone());
Location loc = location.clone().subtract(_vector); for (int i = 0; i < 5; i++){
for (int i = 0; i < _particles; i++) _fixedLoc.add(_vector);
{ coloredParticle.setLocation(_fixedLoc);
loc.add(_vector);
coloredParticle.setLocation(loc);
coloredParticle.display(UtilParticle.ViewDist.LONG); coloredParticle.display(UtilParticle.ViewDist.LONG);
} }
if (_fixedLoc.getBlock().getType() != Material.AIR || _count == 1000)
{
explode();
}
_count += 5;
}
private void explode()
{
this.stop();
// Creates the explosion and knockback players
Location loc = _fixedLoc;
loc.getWorld().createExplosion(loc, 0f);
UtilParticle.PlayParticle(UtilParticle.ParticleType.EXPLODE, loc, 3f, 3f, 3f, 0, 32, UtilParticle.ViewDist.MAX, UtilServer.getPlayers());
HashMap<Player, Double> players = UtilPlayer.getInRadius(loc, 5d);
for (Player ent : players.keySet())
{
if (_gadget.Manager.collideEvent(_player, _gadget, ent))
continue;
double mult = players.get(ent);
//Knockback
UtilAction.velocity(ent, UtilAlg.getTrajectory(loc, ent.getLocation()), 2 * mult, false, 0, 1 + 1 * mult, 10, true);
}
} }
} }

View File

@ -0,0 +1,25 @@
package mineplex.core.gadget.gadgets.particle.unrelated;
import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilServer;
import org.bukkit.Location;
import org.bukkit.plugin.java.JavaPlugin;
public class WitchParticleEffect extends Effect
{
public WitchParticleEffect(Location location, JavaPlugin javaPlugin)
{
super(-1, new EffectLocation(location), javaPlugin);
_delay = 5;
}
@Override
public void runEffect()
{
UtilParticle.PlayParticle(UtilParticle.ParticleType.WITCH_MAGIC, _effectLocation.getLocation().clone(),
1f, 1f, 1f, 0f, 20,
UtilParticle.ViewDist.NORMAL, UtilServer.getPlayers());
}
}

View File

@ -1,26 +0,0 @@
package mineplex.core.powerplayclub;
public class PPCPlayerData {
private boolean _subscribed;
private boolean _claimed;
public void setSubscribed(boolean subscribed)
{
_subscribed = subscribed;
}
public void setClaimed(boolean claimed)
{
_claimed = claimed;
}
public boolean hasClaimed()
{
return _claimed;
}
public boolean hasSubscribed()
{
return _subscribed;
}
}

View File

@ -1,26 +1,39 @@
package mineplex.core.powerplayclub; package mineplex.core.powerplayclub;
import mineplex.core.MiniClientPlugin;
import mineplex.core.account.CoreClientManager; import mineplex.core.account.CoreClientManager;
import mineplex.core.account.ILoginProcessor; import mineplex.core.account.ILoginProcessor;
import mineplex.serverdata.database.DBPool; import mineplex.serverdata.database.DBPool;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.plugin.java.JavaPlugin;
import java.sql.*; import java.sql.*;
import java.sql.Date;
import java.time.LocalDate; import java.time.LocalDate;
import java.util.UUID; import java.time.YearMonth;
import java.util.*;
import java.util.concurrent.CompletableFuture; import java.util.concurrent.CompletableFuture;
import java.util.concurrent.CompletionException;
public class PowerPlayClubRepository extends MiniClientPlugin<PPCPlayerData> { public class PowerPlayClubRepository implements Listener {
// Data loaded by the first ILoginProcessor, waiting for the second
private final Map<UUID, List<YearMonth>> _stageOneDataClaims = new HashMap<>();
// Cached data produced by combining the first and second ILoginProcessors.
// This data is not guaranteed to be fresh, and should be recalculated before
// giving a player his/her rewards.
private final Map<UUID, PowerPlayData> _cachedPlayerData = new HashMap<>();
private final CoreClientManager _clientManager; private final CoreClientManager _clientManager;
public PowerPlayClubRepository(JavaPlugin plugin, CoreClientManager clientManager) { public PowerPlayClubRepository(JavaPlugin plugin, CoreClientManager clientManager) {
super("PowerPlayClubRepository", plugin);
_clientManager = clientManager; _clientManager = clientManager;
Bukkit.getPluginManager().registerEvents(this, plugin);
clientManager.addStoredProcedureLoginProcessor(new ILoginProcessor() { clientManager.addStoredProcedureLoginProcessor(new ILoginProcessor() {
@Override @Override
public String getName() { public String getName() {
@ -29,7 +42,12 @@ public class PowerPlayClubRepository extends MiniClientPlugin<PPCPlayerData> {
@Override @Override
public void processLoginResultSet(String playerName, UUID uuid, int accountId, ResultSet resultSet) throws SQLException { public void processLoginResultSet(String playerName, UUID uuid, int accountId, ResultSet resultSet) throws SQLException {
PowerPlayClubRepository.this.Get(uuid).setClaimed(resultSet.next()); List<YearMonth> claims = new ArrayList<>();
while (resultSet.next())
{
claims.add(YearMonth.of(resultSet.getInt("claimYear"), resultSet.getInt("claimMonth")));
}
_stageOneDataClaims.put(uuid, claims);
} }
@Override @Override
@ -46,7 +64,16 @@ public class PowerPlayClubRepository extends MiniClientPlugin<PPCPlayerData> {
@Override @Override
public void processLoginResultSet(String playerName, UUID uuid, int accountId, ResultSet resultSet) throws SQLException { public void processLoginResultSet(String playerName, UUID uuid, int accountId, ResultSet resultSet) throws SQLException {
PowerPlayClubRepository.this.Get(uuid).setSubscribed(resultSet.next()); List<PowerPlayData.Subscription> subscriptions = new ArrayList<>();
while (resultSet.next())
{
LocalDate date = resultSet.getDate("startDate").toLocalDate();
PowerPlayData.SubscriptionDuration duration = PowerPlayData.SubscriptionDuration.valueOf(resultSet.getString("duration").toUpperCase());
subscriptions.add(new PowerPlayData.Subscription(date, duration));
}
// Now that we have the claims from the first processor and subscriptions from this one, combine them
_cachedPlayerData.put(uuid, PowerPlayData.fromSubsAndClaims(subscriptions, _stageOneDataClaims.remove(uuid)));
} }
@Override @Override
@ -56,6 +83,13 @@ public class PowerPlayClubRepository extends MiniClientPlugin<PPCPlayerData> {
}); });
} }
@EventHandler
public void onQuit(PlayerQuitEvent event)
{
_stageOneDataClaims.remove(event.getPlayer().getUniqueId()); // Just in case.
_cachedPlayerData.remove(event.getPlayer().getUniqueId());
}
public CompletableFuture<Void> addSubscription(int accountId, LocalDate date, String duration) public CompletableFuture<Void> addSubscription(int accountId, LocalDate date, String duration)
{ {
return CompletableFuture.supplyAsync(() -> return CompletableFuture.supplyAsync(() ->
@ -101,54 +135,75 @@ public class PowerPlayClubRepository extends MiniClientPlugin<PPCPlayerData> {
}); });
} }
public boolean alreadyClaimed(Player player) public CompletableFuture<PowerPlayData> loadData(Player player)
{ {
return Get(player).hasClaimed(); return loadSubscriptions(player).thenCombine(loadClaimMonths(player), PowerPlayData::fromSubsAndClaims);
} }
public boolean canClaim(Player player) public CompletableFuture<List<YearMonth>> loadClaimMonths(Player player)
{ {
return Get(player).hasSubscribed() && !Get(player).hasClaimed(); int accountId = _clientManager.Get(player).getAccountId();
}
public CompletableFuture<Boolean> hasSubscription(int accountId)
{
return CompletableFuture.supplyAsync(() ->
{
try (Connection connection = DBPool.getAccount().getConnection())
{
PreparedStatement statement = connection.prepareStatement("SELECT * FROM powerPlaySubs WHERE accountId = ?");
statement.setInt(1, accountId);
return statement.executeQuery().next();
} catch (SQLException e) {
e.printStackTrace();
}
return false;
});
}
public CompletableFuture<Boolean> hasClaimed(int accountId)
{
return CompletableFuture.supplyAsync(() -> return CompletableFuture.supplyAsync(() ->
{ {
try (Connection connection = DBPool.getAccount().getConnection()) try (Connection connection = DBPool.getAccount().getConnection())
{ {
PreparedStatement statement = connection.prepareStatement("SELECT * FROM powerPlayClaims WHERE accountId = ?"); PreparedStatement statement = connection.prepareStatement("SELECT * FROM powerPlayClaims WHERE accountId = ?");
statement.setInt(1, accountId); statement.setInt(1, accountId);
return statement.executeQuery().next(); ResultSet resultSet = statement.executeQuery();
} catch (SQLException e) { List<YearMonth> claims = new ArrayList<>();
e.printStackTrace(); while (resultSet.next())
{
claims.add(YearMonth.of(resultSet.getInt("claimYear"), resultSet.getInt("claimMonth")));
} }
return claims;
return false; } catch (SQLException e)
{
throw new CompletionException(e);
}
}); });
} }
@Override public CompletableFuture<List<PowerPlayData.Subscription>> loadSubscriptions(Player player)
protected PPCPlayerData addPlayer(UUID uuid) { {
return new PPCPlayerData(); int accountId = _clientManager.Get(player).getAccountId();
return CompletableFuture.supplyAsync(() ->
{
try (Connection connection = DBPool.getAccount().getConnection())
{
PreparedStatement statement = connection.prepareStatement("SELECT * FROM powerPlaySubs WHERE accountId = ?");
statement.setInt(1, accountId);
ResultSet resultSet = statement.executeQuery();
List<PowerPlayData.Subscription> subscriptions = new ArrayList<>();
while (resultSet.next())
{
LocalDate date = resultSet.getDate("startDate").toLocalDate();
PowerPlayData.SubscriptionDuration duration = PowerPlayData.SubscriptionDuration.valueOf(resultSet.getString("duration").toUpperCase());
subscriptions.add(new PowerPlayData.Subscription(date, duration));
}
return subscriptions;
} catch (SQLException e)
{
throw new CompletionException(e);
}
});
}
public PowerPlayData getCachedData(Player player)
{
return _cachedPlayerData.get(player.getUniqueId());
}
public void putCachedData(Player player, PowerPlayData data)
{
if (player.isOnline())
{
_cachedPlayerData.put(player.getUniqueId(), data);
}
} }
} }

View File

@ -1,78 +1,42 @@
package mineplex.core.powerplayclub; package mineplex.core.powerplayclub;
import java.time.Month;
import java.time.YearMonth;
import java.util.*;
import java.util.concurrent.CompletableFuture;
import java.util.stream.Collectors;
import com.google.common.collect.ImmutableMap;
import mineplex.core.common.currency.GlobalCurrency;
import mineplex.core.common.skin.SkinData;
import mineplex.core.common.util.BukkitFuture; import mineplex.core.common.util.BukkitFuture;
import mineplex.core.common.util.F; import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilPlayer;
import mineplex.core.donation.DonationManager;
import mineplex.core.inventory.InventoryManager; import mineplex.core.inventory.InventoryManager;
import mineplex.core.inventory.data.Item; import mineplex.core.inventory.data.Item;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import java.time.Month;
import java.time.Year;
import java.util.*;
public class PowerPlayClubRewards public class PowerPlayClubRewards
{ {
private static final Map<RewardMonth, List<PowerPlayClubItem>> rewards = new HashMap<>(); public static final int AMPLIFIERS_PER_MONTH = 2;
public static final int CHESTS_PER_MONTH = 1;
static private static final Map<YearMonth, PowerPlayClubItem> rewards = ImmutableMap.<YearMonth, PowerPlayClubItem>builder()
{ .put(YearMonth.of(2016, Month.SEPTEMBER), new PowerPlayClubItem("Squid Morph", new ItemStack(Material.INK_SACK)))
setRewards(2016, Month.SEPTEMBER, new PowerPlayClubItem("Squid Morph", 1, new ItemStack(Material.INK_SACK))); .put(YearMonth.of(2016, Month.OCTOBER), new PowerPlayClubItem("Witch Morph", SkinData.WITCH.getSkull()))
} .build();
public static List<PowerPlayClubItem> septemberItems() // TODO: figure this out
{
return rewards.values().iterator().next();
}
private static void setRewards(int year, Month month, PowerPlayClubItem... items)
{
rewards.put(new RewardMonth(Year.of(year), month), Arrays.asList(items));
}
private static class RewardMonth
{
private final Year year;
private final Month month;
static RewardMonth of(Year year, Month month)
{
return new RewardMonth(year, month);
}
RewardMonth(Year year, Month month)
{
this.year = year;
this.month = month;
}
@Override
public boolean equals(Object obj) {
if (obj == null || getClass() != obj.getClass()) return false;
RewardMonth that = (RewardMonth) obj;
return Objects.equals(this.year, that.year) && Objects.equals(this.month, that.month);
}
@Override
public int hashCode() {
return Objects.hash(year, month);
}
}
public static class PowerPlayClubItem public static class PowerPlayClubItem
{ {
private final String _prize; private final String _prize;
private final int _amount;
private final ItemStack _display; private final ItemStack _display;
public PowerPlayClubItem(String prize, int amount, ItemStack display) PowerPlayClubItem(String prize, ItemStack display)
{ {
_prize = prize; _prize = prize;
_amount = amount;
_display = display; _display = display;
} }
@ -81,67 +45,69 @@ public class PowerPlayClubRewards
return _prize; return _prize;
} }
public int getAmount()
{
return _amount;
}
public ItemStack getDisplay() public ItemStack getDisplay()
{ {
return _display; return _display;
} }
} }
public static List<PowerPlayClubItem> rewardsForMonths(List<YearMonth> months)
{
return months.stream().map(rewards::get).collect(Collectors.toList());
}
public static void giveAllItems(Player player, InventoryManager manager, PowerPlayClubRepository repo)
public static void giveAllItems(Player player, DonationManager donationManager, InventoryManager inventoryManager, PowerPlayClubRepository repo)
{ {
UtilPlayer.message(player, F.main("Power Play Club", "Verifying subscription..")); UtilPlayer.message(player, F.main("Power Play Club", "Verifying subscription.."));
repo.attemptClaim(player).thenCompose(BukkitFuture.accept(success -> repo.attemptClaim(player).thenCompose(success ->
{ {
if (!success) if (!success)
{ {
UtilPlayer.message(player, F.main("Power Play Club", "An unexpected error happened!")); UtilPlayer.message(player, F.main("Power Play Club", "An unexpected error happened!"));
return; return CompletableFuture.completedFuture(null);
} }
repo.Get(player).setClaimed(true); PowerPlayData cached = repo.getCachedData(player);
List<PowerPlayClubItem> items = rewardsForMonths(cached.getUnclaimedMonths());
for (PowerPlayClubItem item : septemberItems()) // TODO: figure this out
// Give normal power play items
items.forEach(item ->
{ {
Item fItem = manager.getItem(item.getPrize()); donationManager.PurchaseUnknownSalesPackage(null, player.getName(),
if (fItem == null) donationManager.getClientManager().Get(player).getAccountId(), item.getPrize(),
{ GlobalCurrency.TREASURE_SHARD, 0, true);
UtilPlayer.message(player, F.main("Power Play Club", "An unexpected error happened!")); UtilPlayer.message(player, F.main("Power Play Club", "You received the " +
} F.elem(item.getPrize()) + "."));
else });
{
manager.addItemToInventory(player, fItem.Name, 1); // Give amplifiers and chests
UtilPlayer.message(player, F.main("Power Play Club", "You received " + item.getAmount() + "x " + F.elem(item.getPrize()) + ".")); Item gameAmplifier = inventoryManager.getItem("Game Booster");
}
}
Item gameAmplifier = manager.getItem("Game Booster");
if (gameAmplifier == null) if (gameAmplifier == null)
{ {
UtilPlayer.message(player, F.main("Power Play Club", "An unexpected error happened!")); UtilPlayer.message(player, F.main("Power Play Club", "An unexpected error happened!"));
} }
else else
{ {
manager.addItemToInventory(player, gameAmplifier.Name, 2); inventoryManager.addItemToInventory(player, gameAmplifier.Name, AMPLIFIERS_PER_MONTH * items.size());
UtilPlayer.message(player, F.main("Power Play Club", "You received 2x " + F.elem("Game Boosters") + ".")); UtilPlayer.message(player, F.main("Power Play Club", "You received " + (AMPLIFIERS_PER_MONTH * items.size()) + "x " + F.elem("Game Amplifier") + "."));
} }
Item omegaChest = manager.getItem("Omega Chest"); Item omegaChest = inventoryManager.getItem("Omega Chest");
if (omegaChest == null) if (omegaChest == null)
{ {
UtilPlayer.message(player, F.main("Power Play Club", "An unexpected error happened!")); UtilPlayer.message(player, F.main("Power Play Club", "An unexpected error happened!"));
} }
else else
{ {
manager.addItemToInventory(player, omegaChest.Name, 1); inventoryManager.addItemToInventory(player, omegaChest.Name, CHESTS_PER_MONTH * items.size());
UtilPlayer.message(player, F.main("Power Play Club", "You received 1x " + F.elem("Omega Chest") + ".")); UtilPlayer.message(player, F.main("Power Play Club", "You received " + (CHESTS_PER_MONTH * items.size()) + "x " + F.elem("Omega Chest") + "."));
} }
}));
// Refresh Power Play data on the server
return repo.loadData(player).thenCompose(BukkitFuture.accept(data -> repo.putCachedData(player, data)));
});
} }
} }

View File

@ -0,0 +1,116 @@
package mineplex.core.powerplayclub;
import com.google.common.base.Objects;
import java.time.LocalDate;
import java.time.YearMonth;
import java.util.*;
import java.util.stream.Collectors;
public class PowerPlayData
{
private final boolean _subscribed;
private final List<YearMonth> _unclaimedMonths;
static PowerPlayData fromSubsAndClaims(List<Subscription> subscriptions, List<YearMonth> claimedMonths)
{
if (subscriptions.isEmpty())
{
return new PowerPlayData(false, Collections.emptyList());
}
// Build the list of potential claim dates from subscriptions
List<LocalDate> claimDates = subscriptions.stream()
.flatMap(sub -> buildMonths(sub).stream())
.sorted()
.collect(Collectors.toCollection(LinkedList::new));
// Determine if player is subscribed
LocalDate latestSub = claimDates.get(claimDates.size() - 1);
final boolean subscribed = latestSub.plusMonths(1).isAfter(LocalDate.now());
// Remove already-claimed months
Optional<YearMonth> latestClaimed = claimedMonths.stream().collect(Collectors.maxBy(YearMonth::compareTo));
latestClaimed.ifPresent(latest ->
{
while (!claimDates.isEmpty())
{
LocalDate claimDate = claimDates.get(0);
YearMonth claimMonth = YearMonth.from(claimDate);
if (latest.equals(claimMonth) || latest.isAfter(claimMonth))
{
claimDates.remove(0);
} else
{
break;
}
}
});
List<YearMonth> unclaimedMonths = claimDates.stream()
.filter(date -> date.isBefore(LocalDate.now()) || date.equals(LocalDate.now())) // Filter dates yet to come
.map(YearMonth::from)
.distinct()
.collect(Collectors.toList());
return new PowerPlayData(subscribed, unclaimedMonths);
}
private static List<LocalDate> buildMonths(Subscription subscription)
{
switch (subscription._duration)
{
case MONTH:
return Collections.singletonList(subscription._startDate);
case YEAR:
List<LocalDate> months = new ArrayList<>();
for (int i = 0; i < 12; i++)
{
months.add(subscription._startDate.plusMonths(i));
}
return months;
default:
throw new IllegalStateException("Invalid duration");
}
}
static class Subscription {
private final LocalDate _startDate;
private final SubscriptionDuration _duration;
Subscription(LocalDate startDate, SubscriptionDuration duration)
{
_startDate = startDate;
_duration = duration;
}
}
enum SubscriptionDuration {
MONTH, YEAR
}
private PowerPlayData(boolean subscribed, List<YearMonth> unclaimedMonths)
{
_subscribed = subscribed;
_unclaimedMonths = unclaimedMonths;
}
public List<YearMonth> getUnclaimedMonths()
{
return _unclaimedMonths;
}
public boolean isSubscribed()
{
return _subscribed;
}
@Override
public String toString()
{
return Objects.toStringHelper(this).add("subscribed", _subscribed).add("unclaimed", _unclaimedMonths).toString();
}
}

View File

@ -1,6 +1,5 @@
package mineplex.core.treasure; package mineplex.core.treasure;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
@ -63,6 +62,8 @@ public class TreasureManager extends MiniPlugin
{ {
_plugin.getServer().getPluginManager().registerEvents(treasureLocation, _plugin); _plugin.getServer().getPluginManager().registerEvents(treasureLocation, _plugin);
} }
gadgetManager.setTreasureManager(this);
} }
private Block[] setup(Block chestBlock) private Block[] setup(Block chestBlock)
@ -145,4 +146,9 @@ public class TreasureManager extends MiniPlugin
{ {
return _clientManager; return _clientManager;
} }
public List<TreasureLocation> getTreasureLocations()
{
return _treasureLocations;
}
} }