PowerPlayClub update

This commit is contained in:
LCastr0 2016-08-29 21:32:11 -03:00
parent 3e38eb5990
commit 3687c7ad98
24 changed files with 755 additions and 189 deletions

View File

@ -56,6 +56,7 @@ public class SkinData
public final static SkinData TEDDY_BEAR = new SkinData("eyJ0aW1lc3RhbXAiOjE0NTUxMDkzOTE4MjYsInByb2ZpbGVJZCI6ImE5ZDBjMDcyYmYxOTQwYTFhMTkzNjhkMDlkNTAwMjZlIiwicHJvZmlsZU5hbWUiOiJTcGlyaXR1c1NhbmN0dXMiLCJzaWduYXR1cmVSZXF1aXJlZCI6dHJ1ZSwidGV4dHVyZXMiOnsiU0tJTiI6eyJ1cmwiOiJodHRwOi8vdGV4dHVyZXMubWluZWNyYWZ0Lm5ldC90ZXh0dXJlLzQ0OTU4ZDdjNjlhZTQ4NGM2NWYzMTM0N2NkY2M5MmM2OWY1NDA2ODA1YjUzNjUyYTc1YThlZDc5OWRmNyJ9fX0=", "sNTRV9jTjLszUmyaqyEG7N8d5RM1jbwMSXi34S2EkVmIjWsowfSMnHRQqqgZfxcyqBM5I7MljtB84IeQWu4rqhyFrM9blWvtowjijFIOgKCs97q2sswv9iauU6ohvgTpgN5B0Q16MJmMIgZU8d8TATtEaIzq2eg6Ve1AJlNnW4huGNsoNfm8WdVU1tZmsYAwtVP/ryvhyj7mHyVF27m0Sm4fZRf/lHH5gEJYB4JHSAoEhjPIQOdkgRMJRrWGOfhhiGs3kEWmsRGfIPFo2ZJfcu+TFV2rd4Q+A1LmY8kimnzdKX3InXeKbk8qzcgqGNro4XFnSiHo1d6/B+N0JeYOTITYRQ6u24rNSUh5ezbG01iikVFCfrgb7UR6utoLK15F4/fmhpex+BJpmyZoXAqk08tZws/5wsIWQ1okrGcbBKWEHhw2ekUc82US21/W53vd657UBg7FuqM4FhkAqmsYPvYLMpNYxxmDJaI8uJyU7cnGFYyBaFlqUxfJUfcFTwWo10JO3yp5FjqeCQa7rFvfpsqw3w2mBpJmlZ5HRjfS5pmhk0QiY0TRf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ZfWzKjU2P5VseKokMjHXrzZX9Uqtn0zpITEaG5HjUpRSaJg=");
// 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

@ -17,11 +17,13 @@ import mineplex.core.bonuses.commands.GuiCommand;
import mineplex.core.bonuses.commands.PowerPlayCommand; import mineplex.core.bonuses.commands.PowerPlayCommand;
import mineplex.core.bonuses.commands.TicketCommand; import mineplex.core.bonuses.commands.TicketCommand;
import mineplex.core.bonuses.event.CarlSpinnerEvent; import mineplex.core.bonuses.event.CarlSpinnerEvent;
import mineplex.core.bonuses.event.PowerPlayClubClaimEvent;
import mineplex.core.bonuses.gui.BonusGui; import mineplex.core.bonuses.gui.BonusGui;
import mineplex.core.bonuses.gui.SpinGui; import mineplex.core.bonuses.gui.SpinGui;
import mineplex.core.bonuses.gui.buttons.PowerPlayClubButton;
import mineplex.core.bonuses.powerplay.ClaimRegister;
import mineplex.core.bonuses.redis.VoteHandler; import mineplex.core.bonuses.redis.VoteHandler;
import mineplex.core.bonuses.redis.VotifierCommand; import mineplex.core.bonuses.redis.VotifierCommand;
import mineplex.core.boosters.BoosterManager;
import mineplex.core.common.Rank; import mineplex.core.common.Rank;
import mineplex.core.common.util.*; import mineplex.core.common.util.*;
import mineplex.core.common.util.UtilParticle.ParticleType; import mineplex.core.common.util.UtilParticle.ParticleType;
@ -132,6 +134,7 @@ public class BonusManager extends MiniClientPlugin<BonusClientData> implements I
private Npc _carlNpc; private Npc _carlNpc;
private AnimationCarl _animation; private AnimationCarl _animation;
private int _visualTick; private int _visualTick;
private ClaimRegister _claimRegister;
// Streak // Streak
// private StreakRecord _dailyStreak; // private StreakRecord _dailyStreak;
@ -167,6 +170,8 @@ public class BonusManager extends MiniClientPlugin<BonusClientData> implements I
_coinQueue = new LinkedList<GiveDonorData>(); _coinQueue = new LinkedList<GiveDonorData>();
_gemQueue = new LinkedList<GiveDonorData>(); _gemQueue = new LinkedList<GiveDonorData>();
_claimRegister = new ClaimRegister();
updateOffSet(); updateOffSet();
} }
@ -181,8 +186,10 @@ public class BonusManager extends MiniClientPlugin<BonusClientData> implements I
_inventoryManager = inventoryManager; _inventoryManager = inventoryManager;
_thankManager = thankManager; _thankManager = thankManager;
System.out.print("HUB: "); if (gadgetManager == null)
System.out.print("DONATION MANAGER - > " + _donationManager.toString()); {
System.out.print("GM NULL");
}
_rewardManager = new RewardManager(_clientManager, _donationManager, _inventoryManager, petManager, statsManager, gadgetManager); _rewardManager = new RewardManager(_clientManager, _donationManager, _inventoryManager, petManager, statsManager, gadgetManager);
@ -202,6 +209,8 @@ public class BonusManager extends MiniClientPlugin<BonusClientData> implements I
_coinQueue = new LinkedList<GiveDonorData>(); _coinQueue = new LinkedList<GiveDonorData>();
_gemQueue = new LinkedList<GiveDonorData>(); _gemQueue = new LinkedList<GiveDonorData>();
_claimRegister = new ClaimRegister();
if (npcManager != null) if (npcManager != null)
{ {
@ -522,7 +531,7 @@ public class BonusManager extends MiniClientPlugin<BonusClientData> implements I
} }
else else
{ {
UtilPlayer.message(player, F.main("Carl", "There waa an error processing your request. Try again later")); UtilPlayer.message(player, F.main("Carl", "There was an error processing your request. Try again later"));
} }
} }
}); });
@ -923,6 +932,7 @@ public class BonusManager extends MiniClientPlugin<BonusClientData> implements I
if (getPollManager().getNextPoll(_pollManager.Get(player), _clientManager.Get(player).GetRank()) != null) availableRewards++; if (getPollManager().getNextPoll(_pollManager.Get(player), _clientManager.Get(player).GetRank()) != null) availableRewards++;
if (!_facebookManager.hasRedeemed(player)) availableRewards++; if (!_facebookManager.hasRedeemed(player)) availableRewards++;
if (_thankManager.Get(player).getThankToClaim() > 0) availableRewards++; if (_thankManager.Get(player).getThankToClaim() > 0) availableRewards++;
if (PowerPlayClubButton.isAvailable(player, _powerPlayClubManager)) availableRewards++;
Hologram hologram; Hologram hologram;
@ -1105,7 +1115,7 @@ public class BonusManager extends MiniClientPlugin<BonusClientData> implements I
{ {
if (Recharge.Instance.use(player, "Carl Inform", 240000, false, false)) if (Recharge.Instance.use(player, "Carl Inform", 240000, false, false))
{ {
if(_pollManager.hasPoll(player) || canVote(player) || (canRank(player) && _clientManager.hasRank(player, Rank.ULTRA) && isPastAugust()) || canDaily(player)) if(_pollManager.hasPoll(player) || canVote(player) || (canRank(player) && _clientManager.hasRank(player, Rank.ULTRA) && isPastAugust()) || canDaily(player) || PowerPlayClubButton.isAvailable(player, _powerPlayClubManager))
{ {
if(_showCarl.containsKey(player.getName())) if(_showCarl.containsKey(player.getName()))
{ {
@ -1114,9 +1124,40 @@ public class BonusManager extends MiniClientPlugin<BonusClientData> implements I
} }
} }
} }
if (Recharge.Instance.use(player, "Power Play Inform", 400000, false, false))
{
if (PowerPlayClubButton.isAvailable(player, _powerPlayClubManager) && PowerPlayClubButton.getMonthsLeft(player, true, _powerPlayClubManager) == 1)
{
if (_showCarl.containsKey(player.getName()))
{
if (_plugin.getConfig().getString("serverstatus.group").equalsIgnoreCase("Lobby") || _plugin.getConfig().getString("serverstatus.group").equalsIgnoreCase("Testing"))
{
UtilPlayer.message(player, F.main("Power Play Club", "This is your last month of Power Play Club! Resubscribe at" + C.cAqua + " www.mineplex.com/shop" + C.Reset + " before you lose your subscription!"));
}
}
}
}
} }
} }
@EventHandler
public void removeClaims(UpdateEvent event)
{
if (event.getType() != UpdateType.SEC_05)
return;
_claimRegister.removeAll();
}
@EventHandler
public void addClaims(PowerPlayClubClaimEvent event)
{
if (!event.isSuccessful())
return;
_claimRegister.registerEvent(event);
}
@EventHandler @EventHandler
public void processQueue(UpdateEvent event) public void processQueue(UpdateEvent event)
{ {
@ -1228,4 +1269,9 @@ public class BonusManager extends MiniClientPlugin<BonusClientData> implements I
return _inventoryManager; return _inventoryManager;
} }
public ClaimRegister getClaimRegister()
{
return _claimRegister;
}
} }

View File

@ -2,33 +2,25 @@ package mineplex.core.bonuses.animations;
import java.util.HashSet; import java.util.HashSet;
import java.util.Iterator; import java.util.Iterator;
import java.util.Random;
import mineplex.core.common.util.UtilAction; import mineplex.core.bonuses.powerplay.PowerPlayAnimation;
import mineplex.core.common.util.UtilFirework; import mineplex.core.common.skin.SkinData;
import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.*;
import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilParticle.ViewDist; import mineplex.core.common.util.UtilParticle.ViewDist;
import mineplex.core.itemstack.ItemStackFactory; import mineplex.core.itemstack.ItemStackFactory;
import mineplex.core.reward.Reward; import mineplex.core.reward.Reward;
import mineplex.core.reward.RewardData; import mineplex.core.reward.RewardData;
import mineplex.core.reward.RewardRarity; import mineplex.core.reward.RewardRarity;
import mineplex.core.treasure.animation.Animation; import mineplex.core.treasure.animation.Animation;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import org.bukkit.Color; import org.bukkit.Color;
import org.bukkit.FireworkEffect.Type;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.Sound; import org.bukkit.Sound;
import org.bukkit.FireworkEffect.Type;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;
import org.bukkit.entity.Item; import org.bukkit.entity.Item;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import org.bukkit.util.Vector; import org.bukkit.util.Vector;
@ -78,7 +70,7 @@ public class AnimationCarl extends Animation
} }
} }
if(!((String) _type).contentEquals("DAILY")&& !((String) _type).contentEquals("RANK")&& !((String) _type).contentEquals("POLL")) if(!((String) _type).contentEquals("DAILY") && !((String) _type).contentEquals("RANK") && !((String) _type).contentEquals("POLL"))
{ {
Item paper = _creeper.getWorld().dropItem(_creeper.getLocation().add(0.5, 1.5, 0.5), ItemStackFactory.Instance.CreateStack(Material.PAPER, (byte) 0, 1, " " + 64)); Item paper = _creeper.getWorld().dropItem(_creeper.getLocation().add(0.5, 1.5, 0.5), ItemStackFactory.Instance.CreateStack(Material.PAPER, (byte) 0, 1, " " + 64));
@ -130,6 +122,37 @@ public class AnimationCarl extends Animation
finish(); finish();
} }
} }
if (_type instanceof PowerPlayAnimation)
{
for (int i = 50; i < 65; i++)
{
// Gem amplifier
Item gem = _creeper.getWorld().dropItem(_creeper.getLocation().add(0.5, 1.5, 0.5), ItemStackFactory.Instance.CreateStack(Material.EMERALD, (byte) 0, 1, " " + i));
_items.add(gem);
Vector vel = new Vector(Math.sin(UtilMath.r(i) * 7/5d), 0, Math.cos(UtilMath.r(i) * 7/5d));
UtilAction.velocity(gem, vel, Math.abs(Math.sin(UtilMath.r(i) * 7/3000d)), false, 0, 0.2 + Math.abs(Math.cos(UtilMath.r(i) * 7/3000d))*0.6, 1, false);
// Omega chest
Item omega = _creeper.getWorld().dropItem(_creeper.getLocation().add(0.5, 1.5, 0.5), SkinData.OMEGA_CHEST.getSkull());
_items.add(omega);
vel = new Vector(Math.sin(UtilMath.r(i) * 7/5d), 0, Math.cos(UtilMath.r(i) * 7/5d));
UtilAction.velocity(omega, vel, Math.abs(Math.sin(UtilMath.r(i) * 7/3000d)), false, 0, 0.2 + Math.abs(Math.cos(UtilMath.r(i) * 7/3000d))*0.6, 1, false);
// Monthly items
PowerPlayAnimation powerPlayAnimation = (PowerPlayAnimation) _type;
for (ItemStack itemStack : powerPlayAnimation.getAnimationItems())
{
Item monthly = _creeper.getWorld().dropItem(_creeper.getLocation().add(0.5, 1.5, 0.5), itemStack);
_items.add(monthly);
vel = new Vector(Math.sin(UtilMath.r(i) * 7/5d), 0, Math.cos(UtilMath.r(i) * 7/5d));
UtilAction.velocity(monthly, vel, Math.abs(Math.sin(UtilMath.r(i) * 7/3000d)), false, 0, 0.2 + Math.abs(Math.cos(UtilMath.r(i) * 7/3000d))*0.6, 1, false);
}
}
finish();
}
} }
@Override @Override

View File

@ -24,7 +24,7 @@ public class PowerPlayCommand extends CommandBase<BonusManager>
public PowerPlayCommand(BonusManager manager) public PowerPlayCommand(BonusManager manager)
{ {
super(manager, Rank.SNR_MODERATOR, "powerplay"); super(manager, Rank.MODERATOR, "powerplay");
_bonusManager = manager; _bonusManager = manager;
} }

View File

@ -0,0 +1,48 @@
package mineplex.core.bonuses.event;
import org.bukkit.entity.Player;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
public class PowerPlayClubClaimEvent extends Event
{
private static final HandlerList handlers = new HandlerList();
private Player _player;
private long _time;
private boolean _successful;
public PowerPlayClubClaimEvent(Player player, boolean successful)
{
_player = player;
_successful = successful;
_time = System.currentTimeMillis();
}
public Player getPlayer()
{
return _player;
}
public boolean isSuccessful()
{
return _successful;
}
public long getTime()
{
return _time;
}
public HandlerList getHandlers()
{
return handlers;
}
public static HandlerList getHandlerList()
{
return handlers;
}
}

View File

@ -37,9 +37,9 @@ public class BonusGui extends SimpleGui
setItem(25, new ClaimTipsButton(getPlugin(), player, this, manager, thankManager)); setItem(25, new ClaimTipsButton(getPlugin(), player, this, manager, thankManager));
setItem(33, new CarlSpinButton(getPlugin(), player, manager, rewardManager));
setItem(29, new PowerPlayClubButton(player, manager)); setItem(29, new PowerPlayClubButton(player, manager));
setItem(33, new CarlSpinButton(getPlugin(), player, manager, rewardManager));
} }
@Override @Override

View File

@ -2,14 +2,20 @@ package mineplex.core.bonuses.gui.buttons;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Calendar; import java.util.Calendar;
import java.util.List;
import java.util.Locale; import java.util.Locale;
import mineplex.core.bonuses.BonusManager; import mineplex.core.bonuses.BonusManager;
import mineplex.core.bonuses.event.PowerPlayClubClaimEvent;
import mineplex.core.bonuses.powerplay.PowerPlayAnimation;
import mineplex.core.common.util.C; import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.gui.GuiItem; import mineplex.core.gui.GuiItem;
import mineplex.core.inventory.InventoryManager; import mineplex.core.inventory.InventoryManager;
import mineplex.core.powerplayclub.PowerPlayClubManager; import mineplex.core.powerplayclub.PowerPlayClubManager;
import mineplex.core.shop.item.ShopItem; import mineplex.core.shop.item.ShopItem;
import org.bukkit.Bukkit;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.Sound; import org.bukkit.Sound;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -23,10 +29,12 @@ public class PowerPlayClubButton implements GuiItem
private Player _player; private Player _player;
private PowerPlayClubManager _powerPlayClubManager; private PowerPlayClubManager _powerPlayClubManager;
private InventoryManager _inventoryManager; private InventoryManager _inventoryManager;
private BonusManager _bonusManager;
public PowerPlayClubButton(Player player, BonusManager manager) public PowerPlayClubButton(Player player, BonusManager manager)
{ {
_player = player; _player = player;
_bonusManager = manager;
_powerPlayClubManager = manager.getPowerPlayClubManager(); _powerPlayClubManager = manager.getPowerPlayClubManager();
_inventoryManager = manager.getInventoryManager(); _inventoryManager = manager.getInventoryManager();
} }
@ -46,16 +54,26 @@ public class PowerPlayClubButton implements GuiItem
@Override @Override
public void click(ClickType clickType) public void click(ClickType clickType)
{ {
if (isAvailable()) if (isAvailable() && !_bonusManager.getClaimRegister().alreadyClaimed(_player.getUniqueId()))
{ {
_player.closeInventory(); _player.closeInventory();
_player.playSound(_player.getLocation(), Sound.NOTE_PLING, 1, 1.6f); _player.playSound(_player.getLocation(), Sound.NOTE_PLING, 1, 1.6f);
getMonthlyRewards().giveAllItems(_player, _inventoryManager); getMonthlyRewards().giveAllItems(_player, _inventoryManager);
updateLastClaimedMonth(); updateLastClaimedMonth();
Bukkit.getPluginManager().callEvent(new PowerPlayClubClaimEvent(_player, true));
} }
else else
{ {
_player.playSound(_player.getLocation(), Sound.ITEM_BREAK, 1, 10); _player.playSound(_player.getLocation(), Sound.ITEM_BREAK, 1, 10);
if (getMonthsLeft(true) > 0)
{
UtilPlayer.message(_player, F.main("Power Play Club", "Already claimed!"));
}
else
{
UtilPlayer.message(_player, F.main("Power Play Club", "You have no months left! Buy more months at " + C.cAqua + "www.mineplex.com/shop" + C.Reset + "!"));
}
Bukkit.getPluginManager().callEvent(new PowerPlayClubClaimEvent(_player, false));
} }
} }
@ -83,16 +101,29 @@ public class PowerPlayClubButton implements GuiItem
{ {
material = Material.REDSTONE_BLOCK; material = Material.REDSTONE_BLOCK;
itemName = C.cRedB + "Power Play Club"; itemName = C.cRedB + "Power Play Club";
lore.add("");
lore.add(C.Reset + "Months left: " + _powerPlayClubManager.getPlayerMonths(_player.getUniqueId(), true) + "!");
} }
lore.add(C.cYellow + "Rewards"); lore.add(C.cYellow + "Rewards");
lore.add(" " + C.cWhite + "2x Game Amplifiers"); lore.add(" " + C.cWhite + "2 Game Amplifiers");
lore.add(" " + C.cWhite + "1x Omega Chest"); lore.add(" " + C.cWhite + "1 Omega Chest");
for (PowerPlayClubManager.PowerPlayClubItem prize : getMonthlyRewards().getItems()) for (PowerPlayClubManager.PowerPlayClubItem prize : getMonthlyRewards().getItems())
{ {
lore.add(" " + C.cWhite + prize.getPrize()); lore.add(" " + C.cWhite + prize.getAmount() + " " + prize.getPrize());
}
lore.add(" ");
lore.add(C.cYellow + "Months left: " + C.cWhite + getMonthsLeft(true));
if (!isAvailable())
{
lore.add(" ");
if (getMonthsLeft(true) > 0)
{
lore.add(C.cRed + "Already claimed!");
}
else
{
lore.add(C.cRed + "Get Power Play Club months at");
lore.add(C.cAqua + "mineplex.com/shop");
}
} }
_item = new ShopItem(material, data, itemName, lore.toArray(new String[0]), 1, false, false); _item = new ShopItem(material, data, itemName, lore.toArray(new String[0]), 1, false, false);
@ -100,13 +131,17 @@ public class PowerPlayClubButton implements GuiItem
private boolean isAvailable() private boolean isAvailable()
{ {
int monthsLeft = _powerPlayClubManager.getPlayerMonths(_player.getUniqueId(), true); int monthsLeft = getMonthsLeft(true);
int lastClaimed = _powerPlayClubManager.getLastClaimedMonth(_player.getUniqueId(), true); int lastClaimed = _powerPlayClubManager.getLastClaimedMonth(_player.getUniqueId(), true);
int month = Calendar.getInstance().get(Calendar.MONTH); int month = Calendar.getInstance().get(Calendar.MONTH);
int actualYear = Calendar.getInstance().get(Calendar.YEAR);
int lastClaimedYear = _powerPlayClubManager.getLastClaimedYear(_player.getUniqueId(), true);
if (monthsLeft > 0) if (monthsLeft > 0)
{ {
if (lastClaimed == -1) if (lastClaimed == -1)
return true; return true;
if (lastClaimedYear < actualYear)
return true;
return lastClaimed != month; return lastClaimed != month;
} }
return false; return false;
@ -120,9 +155,47 @@ public class PowerPlayClubButton implements GuiItem
private void updateLastClaimedMonth() private void updateLastClaimedMonth()
{ {
// Send carl animation
List<ItemStack> animationItems = new ArrayList<>();
for (PowerPlayClubManager.PowerPlayClubItem prize : getMonthlyRewards().getItems())
{
animationItems.add(prize.getDisplay());
}
PowerPlayAnimation powerPlayAnimation = new PowerPlayAnimation(_player, animationItems);
_bonusManager.addPendingExplosion(_player, powerPlayAnimation);
int month = Calendar.getInstance().get(Calendar.MONTH); int month = Calendar.getInstance().get(Calendar.MONTH);
int year = Calendar.getInstance().get(Calendar.YEAR);
_powerPlayClubManager.setLastClaimedMonth(_player.getUniqueId(), month); _powerPlayClubManager.setLastClaimedMonth(_player.getUniqueId(), month);
_powerPlayClubManager.decreasePlayerMonth(_player.getUniqueId()); _powerPlayClubManager.decreasePlayerMonth(_player.getUniqueId());
_powerPlayClubManager.setLastClaimedYear(_player.getUniqueId(), year);
}
private int getMonthsLeft(boolean update)
{
return _powerPlayClubManager.getPlayerMonths(_player.getUniqueId(), update);
}
public static int getMonthsLeft(Player player, boolean update, PowerPlayClubManager manager)
{
return manager.getPlayerMonths(player.getUniqueId(), update);
}
public static boolean isAvailable(Player player, PowerPlayClubManager manager)
{
int monthsLeft = getMonthsLeft(player, true, manager);
int lastClaimed = manager.getLastClaimedMonth(player.getUniqueId(), true);
int month = Calendar.getInstance().get(Calendar.MONTH);
int actualYear = Calendar.getInstance().get(Calendar.YEAR);
int lastClaimedYear = manager.getLastClaimedYear(player.getUniqueId(), true);
if (monthsLeft > 0)
{
if (lastClaimed == -1)
return true;
if (lastClaimedYear < actualYear)
return true;
return lastClaimed != month;
}
return false;
} }
} }

View File

@ -0,0 +1,46 @@
package mineplex.core.bonuses.powerplay;
import java.util.*;
import mineplex.core.bonuses.event.PowerPlayClubClaimEvent;
public class ClaimRegister
{
/**
* Fixes the problem where the database isn't sync'd with the server so the player can still claim it if they try
* to click really quickly after it was already claimed.
* This stores the player information for 5 seconds, so if they try to claim again they won't be able to.
*/
private Map<UUID, PowerPlayClubClaimEvent> _events = new HashMap<>();
public void registerEvent(PowerPlayClubClaimEvent event)
{
_events.put(event.getPlayer().getUniqueId(), event);
}
public void removeAll()
{
List<UUID> toRemove = new ArrayList<>();
long currentTime = System.currentTimeMillis();
for (Map.Entry<UUID, PowerPlayClubClaimEvent> eventEntry : _events.entrySet())
{
PowerPlayClubClaimEvent event = eventEntry.getValue();
if (currentTime - event.getTime() >= 5000)
{
toRemove.add(eventEntry.getKey());
}
}
for (UUID uuid : toRemove)
{
_events.remove(uuid);
}
}
public boolean alreadyClaimed(UUID uuid)
{
return _events.containsKey(uuid);
}
}

View File

@ -0,0 +1,29 @@
package mineplex.core.bonuses.powerplay;
import java.util.List;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
public class PowerPlayAnimation
{
private List<ItemStack> _animationItems;
private Player _player;
public PowerPlayAnimation(Player player, List<ItemStack> animationItems)
{
_animationItems = animationItems;
_player = player;
}
public List<ItemStack> getAnimationItems()
{
return _animationItems;
}
public Player getPlayer()
{
return _player;
}
}

View File

@ -1,12 +1,10 @@
package mineplex.core.gadget; package mineplex.core.gadget;
import java.util.ArrayList; import java.util.*;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.function.Predicate; import java.util.function.Predicate;
import mineplex.core.gadget.event.PlayerToggleSwimEvent;
import mineplex.core.gadget.gadgets.morph.swim.SwimManager;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Material; import org.bukkit.Material;
@ -1131,4 +1129,27 @@ public class GadgetManager extends MiniPlugin
{ {
return _userGadgetPersistence; return _userGadgetPersistence;
} }
@EventHandler
public void checkPlayerSwim(PlayerMoveEvent event)
{
Material material = event.getPlayer().getLocation().getBlock().getType();
UUID uuid = event.getPlayer().getUniqueId();
if (material == Material.WATER || material == Material.STATIONARY_WATER)
{
if (!SwimManager.isSwimming(uuid))
{
SwimManager.addPlayer(uuid);
Bukkit.getPluginManager().callEvent(new PlayerToggleSwimEvent(event.getPlayer(), true));
}
}
else
{
if (SwimManager.isSwimming(uuid))
{
SwimManager.removePlayer(uuid);
Bukkit.getPluginManager().callEvent(new PlayerToggleSwimEvent(event.getPlayer(), false));
}
}
}
} }

View File

@ -10,6 +10,7 @@ import mineplex.core.gadget.GadgetManager;
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.inventory.ClientInventory; import mineplex.core.inventory.ClientInventory;
import mineplex.core.inventory.ClientItem;
import mineplex.core.mount.Mount; import mineplex.core.mount.Mount;
import mineplex.core.pet.Pet; import mineplex.core.pet.Pet;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -21,7 +22,7 @@ public class LockCosmeticsCommand extends CommandBase<GadgetManager>
public LockCosmeticsCommand(GadgetManager plugin) public LockCosmeticsCommand(GadgetManager plugin)
{ {
super(plugin, Rank.JNR_DEV, new Rank[]{Rank.SNR_MODERATOR}, "lockCosmetics"); super(plugin, Rank.JNR_DEV, new Rank[]{Rank.MODERATOR, Rank.SNR_MODERATOR}, "lockCosmetics");
_plugin = plugin; _plugin = plugin;
} }
@ -71,6 +72,8 @@ public class LockCosmeticsCommand extends CommandBase<GadgetManager>
{ {
for (GadgetType type : GadgetType.values()) for (GadgetType type : GadgetType.values())
{ {
if (type == GadgetType.ITEM)
continue;
removeCosmetics(type, caller); removeCosmetics(type, caller);
} }
removeMounts(caller); removeMounts(caller);
@ -86,12 +89,16 @@ public class LockCosmeticsCommand extends CommandBase<GadgetManager>
continue; continue;
if (gadget.ownsGadget(caller)) if (gadget.ownsGadget(caller))
{ {
clientInventory.removeItem(clientInventory.getClientItem(gadget.getName())); ClientItem clientItem = clientInventory.getClientItem(gadget.getName());
removed++; if (clientItem != null)
{
clientInventory.removeItem(clientItem);
removed++;
}
} }
} }
UtilPlayer.message(caller, F.main("Cosmetics", "Removed all the " + gadgetType.name().toLowerCase() UtilPlayer.message(caller, F.main("Cosmetics", "Removed all the " + gadgetType.name().toLowerCase()
.replace("_", " ") + "! (Removed " + C.cRed + removed + C.cGray + " " + .replace("_", " ") + " gadgets! (Removed " + C.cRed + removed + C.cGray + " " +
UtilText.plural("item", removed) + ")")); UtilText.plural("item", removed) + ")"));
} }
@ -103,8 +110,12 @@ public class LockCosmeticsCommand extends CommandBase<GadgetManager>
{ {
if (mount.hasMount(caller)) if (mount.hasMount(caller))
{ {
clientInventory.removeItem(clientInventory.getClientItem(mount.getName())); ClientItem clientItem = clientInventory.getClientItem(mount.getName());
removed++; if (clientItem != null)
{
clientInventory.removeItem(clientInventory.getClientItem(mount.getName()));
removed++;
}
} }
} }
UtilPlayer.message(caller, F.main("Cosmetics", "Removed " + C.cRed + removed + C.cGray + " " + UtilPlayer.message(caller, F.main("Cosmetics", "Removed " + C.cRed + removed + C.cGray + " " +

View File

@ -0,0 +1,41 @@
package mineplex.core.gadget.event;
import org.bukkit.entity.Player;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
public class PlayerToggleSwimEvent extends Event
{
private static final HandlerList handlers = new HandlerList();
private Player _player;
private boolean _swimming;
public PlayerToggleSwimEvent(Player player, boolean swimming)
{
_player = player;
_swimming = swimming;
}
public Player getPlayer()
{
return _player;
}
public boolean isSwimming()
{
return _swimming;
}
public HandlerList getHandlers()
{
return handlers;
}
public static HandlerList getHandlerList()
{
return handlers;
}
}

View File

@ -1,31 +1,42 @@
package mineplex.core.gadget.gadgets.morph; package mineplex.core.gadget.gadgets.morph;
import mineplex.core.common.util.LineFormat; import mineplex.core.common.util.*;
import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilText;
import mineplex.core.disguise.disguises.DisguiseSquid; import mineplex.core.disguise.disguises.DisguiseSquid;
import mineplex.core.gadget.GadgetManager; import mineplex.core.gadget.GadgetManager;
import mineplex.core.gadget.event.PlayerToggleSwimEvent;
import mineplex.core.gadget.gadgets.morph.swim.SwimManager;
import mineplex.core.gadget.types.MorphGadget; import mineplex.core.gadget.types.MorphGadget;
import mineplex.core.gadget.types.OutfitGadget;
import mineplex.core.itemstack.ItemStackFactory; import mineplex.core.itemstack.ItemStackFactory;
import mineplex.core.projectile.IThrown; import mineplex.core.projectile.IThrown;
import mineplex.core.projectile.ProjectileUser; import mineplex.core.projectile.ProjectileUser;
import mineplex.core.recharge.Recharge; import mineplex.core.recharge.Recharge;
import mineplex.core.updater.UpdateType; import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.entity.Item; import org.bukkit.entity.Item;
import org.bukkit.entity.LivingEntity; import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.player.PlayerToggleSneakEvent; import org.bukkit.event.player.PlayerToggleSneakEvent;
import org.bukkit.inventory.ItemStack;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
public class MorphSquid extends MorphGadget implements IThrown public class MorphSquid extends MorphGadget implements IThrown
{ {
public MorphSquid(GadgetManager manager) public MorphSquid(GadgetManager manager)
{ {
super(manager, "Squid Morph", UtilText.splitLinesToArray(new String[]{"Placeholder"}, LineFormat.LORE), super(manager, "Squid Morph", UtilText.splitLinesToArray(new String[]{
0, Material.MONSTER_EGG, (byte) 0); C.cGray + "It's more fun to be a squid than to eat one. They're really rubbery.",
C.blankLine,
C.cWhite + "Swim to enable Fast Swimming",
C.cWhite + "Sneak to shoot a fish above you"
}, LineFormat.LORE),
0, Material.INK_SACK, (byte) 0);
} }
@Override @Override
@ -35,6 +46,7 @@ public class MorphSquid extends MorphGadget implements IThrown
DisguiseSquid disguiseSquid = new DisguiseSquid(player); DisguiseSquid disguiseSquid = new DisguiseSquid(player);
disguiseSquid.setName(player.getName(), Manager.getClientManager().Get(player).GetRank()); disguiseSquid.setName(player.getName(), Manager.getClientManager().Get(player).GetRank());
Manager.getDisguiseManager().disguise(disguiseSquid); Manager.getDisguiseManager().disguise(disguiseSquid);
onToggleSwim(new PlayerToggleSwimEvent(player, SwimManager.isSwimming(player.getUniqueId())));
} }
@Override @Override
@ -44,6 +56,47 @@ public class MorphSquid extends MorphGadget implements IThrown
Manager.getDisguiseManager().undisguise(player); Manager.getDisguiseManager().undisguise(player);
} }
@EventHandler
public void onUpdate(UpdateEvent event)
{
if (event.getType() != UpdateType.TICK)
return;
for (Player player : UtilServer.getPlayers())
{
if (!isActive(player))
continue;
UtilParticle.PlayParticle(UtilParticle.ParticleType.WATER_WAKE, player.getLocation().clone().add(0, .5, 0), 0.01f, 0.01f, 0.01f,
0.001f, 1, UtilParticle.ViewDist.NORMAL);
}
}
@EventHandler
public void onToggleSwim(PlayerToggleSwimEvent event)
{
if (!isActive(event.getPlayer()))
return;
if (event.isSwimming())
{
// Removes any costume player could be wearing
Manager.removeOutfit(event.getPlayer(), OutfitGadget.ArmorSlot.Boots);
// Adds enchanted boot
ItemStack enchantedBoot = new ItemStack(Material.DIAMOND_BOOTS, 1);
enchantedBoot.addEnchantment(Enchantment.DEPTH_STRIDER, 3);
event.getPlayer().getInventory().setBoots(enchantedBoot);
// Adds swiftness potion
event.getPlayer().addPotionEffect(new PotionEffect(PotionEffectType.SPEED, 1000000, 3, true, true));
}
else
{
event.getPlayer().getInventory().setBoots(new ItemStack(Material.AIR));
event.getPlayer().removePotionEffect(PotionEffectType.SPEED);
}
}
@EventHandler @EventHandler
public void onSneak(PlayerToggleSneakEvent event) public void onSneak(PlayerToggleSneakEvent event)
{ {
@ -59,8 +112,6 @@ public class MorphSquid extends MorphGadget implements IThrown
if (!Recharge.Instance.use(player, getName(), 1000, false, false, "Cosmetics")) if (!Recharge.Instance.use(player, getName(), 1000, false, false, "Cosmetics"))
return; return;
UtilAction.velocity(player, player.getLocation().getDirection(), 0.8, false, 0, 0.5, 0.8, true);
Item item = player.getWorld().dropItem(player.getEyeLocation().add(player.getLocation().getDirection()), Item item = player.getWorld().dropItem(player.getEyeLocation().add(player.getLocation().getDirection()),
ItemStackFactory.Instance.CreateStack(Material.RAW_FISH)); ItemStackFactory.Instance.CreateStack(Material.RAW_FISH));
UtilAction.velocity(item, player.getLocation().getDirection(), UtilAction.velocity(item, player.getLocation().getDirection(),

View File

@ -0,0 +1,30 @@
package mineplex.core.gadget.gadgets.morph.swim;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
public class SwimManager
{
private static List<UUID> _swimming = new ArrayList<>();
public static void addPlayer(UUID uuid)
{
_swimming.add(uuid);
}
public static void removePlayer(UUID uuid)
{
if (_swimming.contains(uuid))
{
_swimming.remove(uuid);
}
}
public static boolean isSwimming(UUID uuid)
{
return _swimming.contains(uuid);
}
}

View File

@ -4,18 +4,17 @@ import java.sql.PreparedStatement;
import java.sql.ResultSet; import java.sql.ResultSet;
import java.util.*; import java.util.*;
import mineplex.core.common.util.BukkitFuture; import mineplex.core.common.util.*;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer;
import mineplex.core.database.PlayerKeyValueRepository; import mineplex.core.database.PlayerKeyValueRepository;
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.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener; import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerJoinEvent; import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.inventory.ItemStack;
public class PowerPlayClubManager implements Listener public class PowerPlayClubManager implements Listener
{ {
@ -56,11 +55,34 @@ public class PowerPlayClubManager implements Listener
public void setLastClaimedMonth(UUID uuid, int month) public void setLastClaimedMonth(UUID uuid, int month)
{ {
_repository.put(uuid, "lastClaimed", month); _repository.put(uuid, "lastClaimed", month);
updatePlayer(uuid);
PlayerMonths playerMonths = _playerMonths.get(uuid); PlayerMonths playerMonths = _playerMonths.get(uuid);
playerMonths.setLastClaimed(month); playerMonths.setLastClaimed(month);
_playerMonths.put(uuid, playerMonths); _playerMonths.put(uuid, playerMonths);
} }
public int getLastClaimedYear(UUID uuid, boolean update)
{
if (update)
{
updatePlayer(uuid);
}
if (_playerMonths.containsKey(uuid))
{
return _playerMonths.get(uuid).getYear();
}
return Calendar.getInstance().get(Calendar.YEAR);
}
public void setLastClaimedYear(UUID uuid, int year)
{
_repository.put(uuid, "year", year);
updatePlayer(uuid);
PlayerMonths playerMonths = _playerMonths.get(uuid);
playerMonths.setYear(year);
_playerMonths.put(uuid, playerMonths);
}
public int getPlayerMonths(UUID uuid, boolean update) public int getPlayerMonths(UUID uuid, boolean update)
{ {
if (update) if (update)
@ -78,6 +100,7 @@ public class PowerPlayClubManager implements Listener
{ {
int currentMonths = getPlayerMonths(uuid, true); int currentMonths = getPlayerMonths(uuid, true);
_repository.put(uuid, "monthsLeft", currentMonths + months); _repository.put(uuid, "monthsLeft", currentMonths + months);
updatePlayer(uuid);
PlayerMonths playerMonths = _playerMonths.get(uuid); PlayerMonths playerMonths = _playerMonths.get(uuid);
playerMonths.setMonths(currentMonths + months); playerMonths.setMonths(currentMonths + months);
_playerMonths.put(uuid, playerMonths); _playerMonths.put(uuid, playerMonths);
@ -96,8 +119,13 @@ public class PowerPlayClubManager implements Listener
{ {
_repository.getAll(uuid).thenCompose(BukkitFuture.accept(values -> _repository.getAll(uuid).thenCompose(BukkitFuture.accept(values ->
{ {
int year = Calendar.getInstance().get(Calendar.YEAR);
int lastClaimed = -1; int lastClaimed = -1;
int months = 0; int months = 0;
if (values.containsKey("claimedYear"))
{
year = values.get("claimedYear");
}
if (values.containsKey("lastClaimed")) if (values.containsKey("lastClaimed"))
{ {
lastClaimed = values.get("lastClaimed"); lastClaimed = values.get("lastClaimed");
@ -108,7 +136,7 @@ public class PowerPlayClubManager implements Listener
months = values.get("monthsLeft"); months = values.get("monthsLeft");
} }
PlayerMonths playerMonths = new PlayerMonths(months, lastClaimed); PlayerMonths playerMonths = new PlayerMonths(months, lastClaimed, year);
_playerMonths.put(uuid, playerMonths); _playerMonths.put(uuid, playerMonths);
})); }));
} }
@ -124,8 +152,8 @@ public class PowerPlayClubManager implements Listener
APRIL, APRIL,
MAY, MAY,
JUNE, JUNE,
JULY(new PowerPlayClubItem("Squid Morph", 1)), JULY(new PowerPlayClubItem("Squid Morph", 1, new ItemStack(Material.INK_SACK))),
AUGUST(new PowerPlayClubItem("Squid Morph", 1)), AUGUST(new PowerPlayClubItem("Squid Morph", 1, new ItemStack(Material.INK_SACK))),
SEPTEMBER, SEPTEMBER,
OCTOBER, OCTOBER,
NOVEMBER, NOVEMBER,
@ -196,11 +224,13 @@ public class PowerPlayClubManager implements Listener
{ {
private final String _prize; private final String _prize;
private final int _amount; private final int _amount;
private final ItemStack _display;
public PowerPlayClubItem(String prize, int amount) public PowerPlayClubItem(String prize, int amount, ItemStack display)
{ {
_prize = prize; _prize = prize;
_amount = amount; _amount = amount;
_display = display;
} }
public String getPrize() public String getPrize()
@ -212,6 +242,11 @@ public class PowerPlayClubManager implements Listener
{ {
return _amount; return _amount;
} }
public ItemStack getDisplay()
{
return _display;
}
} }
/** /**
@ -222,11 +257,13 @@ public class PowerPlayClubManager implements Listener
private int _months; private int _months;
private int _lastClaimed; private int _lastClaimed;
private int _year;
public PlayerMonths(int months, int lastClaimed) public PlayerMonths(int months, int lastClaimed, int year)
{ {
_months = months; _months = months;
_lastClaimed = lastClaimed; _lastClaimed = lastClaimed;
_year = year;
} }
public int getMonths() public int getMonths()
@ -239,6 +276,11 @@ public class PowerPlayClubManager implements Listener
return _lastClaimed; return _lastClaimed;
} }
public int getYear()
{
return _year;
}
public void setMonths(int months) public void setMonths(int months)
{ {
_months = months; _months = months;
@ -249,6 +291,11 @@ public class PowerPlayClubManager implements Listener
_lastClaimed = lastClaimed; _lastClaimed = lastClaimed;
} }
public void setYear(int year)
{
_year = year;
}
} }
} }

View File

@ -10,6 +10,7 @@ import mineplex.core.common.Rank;
import mineplex.core.common.util.banner.CountryFlag; import mineplex.core.common.util.banner.CountryFlag;
import mineplex.core.donation.DonationManager; import mineplex.core.donation.DonationManager;
import mineplex.core.gadget.GadgetManager; import mineplex.core.gadget.GadgetManager;
import mineplex.core.gadget.gadgets.arrowtrail.candycane.ArrowTrailCandyCane;
import mineplex.core.gadget.gadgets.arrowtrail.cupidslove.ArrowTrailCupid; import mineplex.core.gadget.gadgets.arrowtrail.cupidslove.ArrowTrailCupid;
import mineplex.core.gadget.gadgets.arrowtrail.emerald.ArrowTrailEmerald; import mineplex.core.gadget.gadgets.arrowtrail.emerald.ArrowTrailEmerald;
import mineplex.core.gadget.gadgets.arrowtrail.freedom.ArrowTrailFreedom; import mineplex.core.gadget.gadgets.arrowtrail.freedom.ArrowTrailFreedom;
@ -31,6 +32,7 @@ import mineplex.core.gadget.gadgets.death.party.DeathPinataBurst;
import mineplex.core.gadget.gadgets.death.shadow.DeathShadow; import mineplex.core.gadget.gadgets.death.shadow.DeathShadow;
import mineplex.core.gadget.gadgets.death.vampire.DeathBlood; import mineplex.core.gadget.gadgets.death.vampire.DeathBlood;
import mineplex.core.gadget.gadgets.death.wisdom.DeathEnchant; import mineplex.core.gadget.gadgets.death.wisdom.DeathEnchant;
import mineplex.core.gadget.gadgets.doublejump.candycane.DoubleJumpCandyCane;
import mineplex.core.gadget.gadgets.doublejump.cupidslove.DoubleJumpCupidsWings; import mineplex.core.gadget.gadgets.doublejump.cupidslove.DoubleJumpCupidsWings;
import mineplex.core.gadget.gadgets.doublejump.emerald.DoubleJumpEmerald; import mineplex.core.gadget.gadgets.doublejump.emerald.DoubleJumpEmerald;
import mineplex.core.gadget.gadgets.doublejump.freedom.DoubleJumpFreedom; import mineplex.core.gadget.gadgets.doublejump.freedom.DoubleJumpFreedom;
@ -212,6 +214,20 @@ public class RewardManager
addHat(Type.WINTER_HOLIDAY, HatType.Present, rarity, 5); addHat(Type.WINTER_HOLIDAY, HatType.Present, rarity, 5);
addHat(Type.WINTER_HOLIDAY, HatType.Snowman, rarity, 5); addHat(Type.WINTER_HOLIDAY, HatType.Snowman, rarity, 5);
// Omega items
addMusicReward(Type.OMEGA, "Block Disk", rarity, 25);
addMusicReward(Type.OMEGA, "Cat Disk", rarity, 25);
addMusicReward(Type.OMEGA, "Chirp Disk", rarity, 25);
addMusicReward(Type.OMEGA, "Far Disk", rarity, 25);
addMusicReward(Type.OMEGA, "Mall Disk", rarity, 25);
addMusicReward(Type.OMEGA, "Mellohi Disk", rarity, 25);
addMusicReward(Type.OMEGA, "Stal Disk", rarity, 25);
addMusicReward(Type.OMEGA, "Stard Disk", rarity, 25);
addMusicReward(Type.OMEGA, "Wait Disk", rarity, 25);
addMusicReward(Type.OMEGA, "Ward Disk", rarity, 25);
addHat(Type.OMEGA, HatType.Present, rarity, 5);
addHat(Type.OMEGA, HatType.Snowman, rarity, 5);
} }
@ -307,6 +323,67 @@ public class RewardManager
addGadget(Type.FREEDOM, getGadget(DoubleJumpFreedom.class), rarity, 50); addGadget(Type.FREEDOM, getGadget(DoubleJumpFreedom.class), rarity, 50);
addGadget(Type.FREEDOM, getGadget(ArrowTrailFreedom.class), rarity, 10); addGadget(Type.FREEDOM, getGadget(ArrowTrailFreedom.class), rarity, 10);
addGadget(Type.FREEDOM, getGadget(DeathFreedom.class), rarity, 75); addGadget(Type.FREEDOM, getGadget(DeathFreedom.class), rarity, 75);
// Omega Chest
addGadget(Type.OMEGA, getGadget(DoubleJumpFreedom.class), rarity, 5);
addGadget(Type.OMEGA, getGadget(DoubleJumpBlood.class), rarity, 50);
addGadget(Type.OMEGA, getGadget(DoubleJumpFirecracker.class), rarity, 33);
addGadget(Type.OMEGA, getGadget(DoubleJumpEmerald.class), rarity, 25);
addGadget(Type.OMEGA, getGadget(DoubleJumpMusic.class), rarity, 20);
addGadget(Type.OMEGA, getGadget(DoubleJumpShadow.class), rarity, 15);
addGadget(Type.OMEGA, getGadget(DoubleJumpStorm.class), rarity, 30);
addGadget(Type.OMEGA, getGadget(DoubleJumpCandyCane.class), rarity, 20);
addGadget(Type.OMEGA, getGadget(DeathFreedom.class), rarity, 15);
addGadget(Type.OMEGA, getGadget(DeathStorm.class), rarity, 30);
addGadget(Type.OMEGA, getGadget(DeathBlood.class), rarity, 50);
addGadget(Type.OMEGA, getGadget(DeathEmerald.class), rarity, 25);
addGadget(Type.OMEGA, getGadget(DeathMusic.class), rarity, 20);
addGadget(Type.OMEGA, getGadget(DeathPinataBurst.class), rarity, 27);
addGadget(Type.OMEGA, getGadget(DeathShadow.class), rarity, 15);
addGadget(Type.OMEGA, getGadget(DeathCandyCane.class), rarity, 25);
addGadget(Type.OMEGA, getGadget(ArrowTrailFreedom.class), rarity, 10);
addGadget(Type.OMEGA, getGadget(ArrowTrailConfetti.class), rarity, 27);
addGadget(Type.OMEGA, getGadget(ArrowTrailBlood.class), rarity, 50);
addGadget(Type.OMEGA, getGadget(ArrowTrailEmerald.class), rarity, 25);
addGadget(Type.OMEGA, getGadget(ArrowTrailMusic.class), rarity, 27);
addGadget(Type.OMEGA, getGadget(ArrowTrailStorm.class), rarity, 30);
addGadget(Type.OMEGA, getGadget(ArrowTrailShadow.class), rarity, 15);
addGadget(Type.OMEGA, getGadget(ArrowTrailCandyCane.class), rarity, 10);
addHat(Type.OMEGA, HatType.Uncle_Sam, rarity, 25);
addHat(Type.OMEGA, HatType.Companion_Block, rarity, 15);
addHat(Type.OMEGA, HatType.Lovestruck, rarity, 20);
addHat(Type.OMEGA, HatType.Secret_Package, rarity, 25);
addHat(Type.OMEGA, HatType.Teddy_Bear, rarity, 25);
addHat(Type.OMEGA, HatType.Santa, rarity, 25);
addHat(Type.OMEGA, HatType.Rudolph, rarity, 25);
addHat(Type.OMEGA, HatType.Coal, rarity, 25);
addGadget(Type.OMEGA, getGadget(MorphChicken.class), rarity, 50);
addGadget(Type.OMEGA, getGadget(MorphCow.class), rarity, 167);
addGadget(Type.OMEGA, getGadget(MorphEnderman.class), rarity, 33);
addGadget(Type.OMEGA, getGadget(MorphVillager.class), rarity, 83);
addGadget(Type.OMEGA, getGadget(WinEffectFlames.class), rarity, 100);
addGadget(Type.OMEGA, getGadget(WinEffectSnowTrails.class), rarity, 100);
addMount(Type.OMEGA, getMount(MountFrost.class), rarity, 50);
addMount(Type.OMEGA, getMount(MountCart.class), rarity, 100);
addMount(Type.OMEGA, getMount(MountMule.class), rarity, 200);
addMount(Type.OMEGA, getMount(MountSlime.class), rarity, 67);
addGadget(Type.OMEGA, getGadget(OutfitRaveSuitBoots.class), rarity, 30);
addGadget(Type.OMEGA, getGadget(OutfitRaveSuitChestplate.class), rarity, 30);
addGadget(Type.OMEGA, getGadget(OutfitRaveSuitLeggings.class), rarity, 30);
addGadget(Type.OMEGA, getGadget(OutfitRaveSuitHelmet.class), rarity, 30);
addGadget(Type.OMEGA, getGadget(OutfitSpaceSuitBoots.class), rarity, 50);
addGadget(Type.OMEGA, getGadget(OutfitSpaceSuitChestplate.class), rarity, 50);
addGadget(Type.OMEGA, getGadget(OutfitSpaceSuitLeggings.class), rarity, 50);
addGadget(Type.OMEGA, getGadget(OutfitSpaceSuitHelmet.class), rarity, 50);
addGadget(Type.OMEGA, getGadget(ParticleCandyCane.class), rarity, 25);
} }
public void addLegendary() public void addLegendary()
@ -394,7 +471,65 @@ public class RewardManager
addMount(Type.FREEDOM, getMount(MountFreedomHorse.class), rarity, 1); addMount(Type.FREEDOM, getMount(MountFreedomHorse.class), rarity, 1);
addGadget(Type.FREEDOM, getGadget(MorphUncleSam.class), rarity, 5); addGadget(Type.FREEDOM, getGadget(MorphUncleSam.class), rarity, 5);
addGadget(Type.FREEDOM, getGadget(ParticleFreedom.class), rarity, 50); addGadget(Type.FREEDOM, getGadget(ParticleFreedom.class), rarity, 50);
// Omega items
addPetReward(Type.OMEGA, EntityType.VILLAGER, rarity, 1);
addPetReward(Type.OMEGA, EntityType.ZOMBIE, rarity, 10);
addPetReward(Type.OMEGA, EntityType.PIG_ZOMBIE, rarity, 1);
addGadget(Type.OMEGA, getGadget(MorphBunny.class), rarity, 1);
addGadget(Type.OMEGA, getGadget(MorphUncleSam.class), rarity, 5);
addGadget(Type.OMEGA, getGadget(MorphPumpkinKing.class), rarity, 1);
addGadget(Type.OMEGA, getGadget(MorphBat.class), rarity, 25);
addGadget(Type.OMEGA, getGadget(MorphSlime.class), rarity, 10);
addGadget(Type.OMEGA, getGadget(MorphBlock.class), rarity, 20);
addGadget(Type.OMEGA, getGadget(MorphSnowman.class), rarity, 10);
addGadget(Type.OMEGA, getGadget(ParticleFreedom.class), rarity, 15);
addGadget(Type.OMEGA, getGadget(ParticleWingsAngel.class), rarity, 15);
addGadget(Type.OMEGA, getGadget(ParticleBlood.class), rarity, 10);
addGadget(Type.OMEGA, getGadget(ParticleWingsDemons.class), rarity, 15);
addGadget(Type.OMEGA, getGadget(ParticleEnchant.class), rarity, 25);
addGadget(Type.OMEGA, getGadget(ParticleFairy.class), rarity, 4);
addGadget(Type.OMEGA, getGadget(ParticleFireRings.class), rarity, 17);
addGadget(Type.OMEGA, getGadget(ParticleEmerald.class), rarity, 8);
addGadget(Type.OMEGA, getGadget(ParticleHeart.class), rarity, 2);
addGadget(Type.OMEGA, getGadget(ParticleWingsInfernal.class), rarity, 4);
addGadget(Type.OMEGA, getGadget(ParticleMusic.class), rarity, 15);
addGadget(Type.OMEGA, getGadget(ParticleWingsPixie.class), rarity, 4);
addGadget(Type.OMEGA, getGadget(ParticleRain.class), rarity, 13);
addGadget(Type.OMEGA, getGadget(ParticleFoot.class), rarity, 33);
addGadget(Type.OMEGA, getGadget(ParticleYinYang.class), rarity, 20);
addGadget(Type.OMEGA, getGadget(ParticleCoalFumes.class), rarity, 1);
addGadget(Type.OMEGA, getGadget(ParticleFrostLord.class), rarity, 10);
addGadget(Type.OMEGA, getGadget(ParticlePartyTime.class), rarity, 25);
addMount(Type.OMEGA, getMount(MountFreedomHorse.class), rarity, 1);
addMount(Type.OMEGA, getMount(MountZombie.class), rarity, 1);
addMount(Type.OMEGA, getMount(MountSpider.class), rarity, 1);
addMount(Type.OMEGA, getMount(MountUndead.class), rarity, 1);
addMount(Type.OMEGA, getMount(MountValentinesSheep.class), rarity, 33);
addMount(Type.OMEGA, getMount(MountBabyReindeer.class), rarity, 1);
addGadget(Type.OMEGA, getGadget(WinEffectBabyChicken.class), rarity, 10);
addGadget(Type.OMEGA, getGadget(WinEffectLavaTrap.class), rarity, 20);
addGadget(Type.OMEGA, getGadget(WinEffectRiseOfTheElderGuardian.class), rarity, 4);
addGadget(Type.OMEGA, getGadget(WinEffectLightningStrike.class), rarity, 20);
addGadget(Type.OMEGA, getGadget(WinEffectMrPunchMan.class), rarity, 33);
addGadget(Type.OMEGA, getGadget(DeathEnchant.class), rarity, 10);
addGadget(Type.OMEGA, getGadget(DeathCupidsBrokenHeart.class), rarity, 25);
addGadget(Type.OMEGA, getGadget(DeathFrostLord.class), rarity, 20);
addGadget(Type.OMEGA, getGadget(DoubleJumpEnchant.class), rarity, 10);
addGadget(Type.OMEGA, getGadget(DoubleJumpCupidsWings.class), rarity, 5);
addGadget(Type.OMEGA, getGadget(DoubleJumpFrostLord.class), rarity, 10);
addGadget(Type.OMEGA, getGadget(ArrowTrailEnchant.class), rarity, 10);
addGadget(Type.OMEGA, getGadget(ArrowTrailFrostLord.class), rarity, 20);
addGadget(Type.OMEGA, getGadget(ArrowTrailCupid.class), rarity, 15);
addHat(Type.OMEGA, HatType.Grinch, rarity, 25);
} }
@ -599,19 +734,6 @@ public class RewardManager
_rewardPools.get(Type.ILLUMINATED).add(reward); _rewardPools.get(Type.ILLUMINATED).add(reward);
} }
} }
// OMEGA ITEMS
if (reward instanceof UnknownPackageReward)
{
UnknownPackageReward unknownPackageReward = (UnknownPackageReward) reward;
if (!unknownPackageReward.getHeader().equalsIgnoreCase("Game Modifiers"))
{
_rewardPools.get(Type.OMEGA).add(reward);
}
}
else if (!(reward instanceof InventoryReward) && !(reward instanceof TreasureShardReward))
{
_rewardPools.get(Type.OMEGA).add(reward);
}
_rewardPools.get(pool).add(reward); _rewardPools.get(pool).add(reward);
} }

View File

@ -1,39 +1,29 @@
package mineplex.core.treasure; package mineplex.core.treasure;
import java.awt.*; import java.awt.*;
import java.awt.Color; import java.util.*;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List; import java.util.List;
import java.util.Random;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
import mineplex.core.common.skin.SkinData;
import mineplex.core.common.util.*;
import mineplex.core.common.util.particles.ColoredParticle;
import mineplex.core.common.util.particles.DustSpellColor;
import mineplex.core.treasure.animation.*;
import org.bukkit.*;
import org.bukkit.block.Block;
import org.bukkit.block.Skull;
import org.bukkit.craftbukkit.v1_8_R3.util.CraftMagicNumbers;
import org.bukkit.entity.Player;
import mineplex.core.blockrestore.BlockRestore; import mineplex.core.blockrestore.BlockRestore;
import mineplex.core.common.Rank; import mineplex.core.common.Rank;
import mineplex.core.common.util.*;
import mineplex.core.common.util.UtilParticle.ViewDist; import mineplex.core.common.util.UtilParticle.ViewDist;
import mineplex.core.common.util.particles.ColoredParticle;
import mineplex.core.common.util.particles.DustSpellColor;
import mineplex.core.hologram.HologramManager; import mineplex.core.hologram.HologramManager;
import mineplex.core.reward.RankRewardData; import mineplex.core.reward.*;
import mineplex.core.reward.Reward;
import mineplex.core.reward.RewardData;
import mineplex.core.reward.RewardRarity;
import mineplex.core.reward.RewardType;
import mineplex.core.status.ServerStatusManager; import mineplex.core.status.ServerStatusManager;
import mineplex.core.titangiveaway.redis.TitanChestGiveawayMessage; import mineplex.core.titangiveaway.redis.TitanChestGiveawayMessage;
import mineplex.core.treasure.animation.*;
import net.minecraft.server.v1_8_R3.BlockPosition; import net.minecraft.server.v1_8_R3.BlockPosition;
import net.minecraft.server.v1_8_R3.PacketPlayOutBlockAction; import net.minecraft.server.v1_8_R3.PacketPlayOutBlockAction;
import org.bukkit.Bukkit;
import org.bukkit.Effect;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.craftbukkit.v1_8_R3.util.CraftMagicNumbers;
import org.bukkit.entity.Player;
/** /**
* Created by Shaun on 8/27/2014. * Created by Shaun on 8/27/2014.
@ -92,8 +82,9 @@ public class Treasure
_rewardType = rewardType; _rewardType = rewardType;
_rewards = rewards; _rewards = rewards;
_chestData = new ChestData[chestBlocks.length]; int max = chestBlocks.length;
for (int i = 0; i < _chestData.length; i++) _chestData = new ChestData[max];
for (int i = 0; i < max; i++)
{ {
_chestData[i] = new ChestData(chestBlocks[i]); _chestData[i] = new ChestData(chestBlocks[i]);
} }

View File

@ -1,21 +1,9 @@
package mineplex.core.treasure; package mineplex.core.treasure;
<<<<<<< HEAD
import java.util.List; import java.util.List;
import mineplex.core.account.CoreClientManager; import mineplex.core.account.CoreClientManager;
import mineplex.core.common.util.*; import mineplex.core.common.util.*;
=======
import mineplex.core.account.CoreClientManager;
import mineplex.core.common.util.C;
import mineplex.core.common.util.Callback;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilAlg;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilText;
import mineplex.core.common.util.UtilTextMiddle;
>>>>>>> e9ea8320890301d21c721216ab46bd4dcd98ca06
import mineplex.core.donation.DonationManager; import mineplex.core.donation.DonationManager;
import mineplex.core.gadget.GadgetManager; import mineplex.core.gadget.GadgetManager;
import mineplex.core.gadget.event.GadgetBlockEvent; import mineplex.core.gadget.event.GadgetBlockEvent;
@ -47,11 +35,6 @@ import org.bukkit.event.player.PlayerMoveEvent;
import org.bukkit.event.player.PlayerQuitEvent; import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.event.player.PlayerVelocityEvent; import org.bukkit.event.player.PlayerVelocityEvent;
<<<<<<< HEAD
=======
import java.util.List;
>>>>>>> e9ea8320890301d21c721216ab46bd4dcd98ca06
public class TreasureLocation implements Listener public class TreasureLocation implements Listener
{ {
private TreasureManager _treasureManager; private TreasureManager _treasureManager;
@ -169,7 +152,10 @@ public class TreasureLocation implements Listener
if (treasureType != TreasureType.OLD) if (treasureType != TreasureType.OLD)
{ {
Bukkit.broadcastMessage(F.main("Treasure", F.name(player.getName()) + " is opening " + UtilText.prefixPronoun(treasureType.getName()))); String pron = "a ";
if (treasureType == TreasureType.ANCIENT || treasureType == TreasureType.ILLUMINATED || treasureType == TreasureType.OMEGA)
pron = "an ";
Bukkit.broadcastMessage(F.main("Treasure", F.name(player.getName()) + " is opening " + pron + treasureType.getName()));
} }
Treasure treasure = new Treasure(player, rewards, treasureType.getRewardType(), _chestBlock, _chestSpawns, treasureType, _treasureManager.getBlockRestore(), _hologramManager, _statusManager); Treasure treasure = new Treasure(player, rewards, treasureType.getRewardType(), _chestBlock, _chestSpawns, treasureType, _treasureManager.getBlockRestore(), _hologramManager, _statusManager);

View File

@ -1,5 +1,8 @@
package mineplex.core.treasure; package mineplex.core.treasure;
import java.util.ArrayList;
import java.util.List;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import mineplex.core.MiniPlugin; import mineplex.core.MiniPlugin;
import mineplex.core.account.CoreClientManager; import mineplex.core.account.CoreClientManager;
@ -23,9 +26,6 @@ import org.bukkit.entity.Player;
import org.bukkit.event.HandlerList; import org.bukkit.event.HandlerList;
import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.plugin.java.JavaPlugin;
import java.util.ArrayList;
import java.util.List;
/** /**
* Created by Shaun on 8/27/2014. * Created by Shaun on 8/27/2014.
*/ */

View File

@ -70,6 +70,11 @@ public class BlockChangeAnimation extends Animation
mat = Material.WOOL; mat = Material.WOOL;
data = 11; data = 11;
} }
else if (getTreasure().getTreasureType() == TreasureType.OMEGA)
{
mat = Material.ENDER_STONE;
data = 0;
}
else else
continue; continue;
@ -97,6 +102,11 @@ public class BlockChangeAnimation extends Animation
mat = Material.WOOL; mat = Material.WOOL;
data = 14; data = 14;
} }
else if (getTreasure().getTreasureType() == TreasureType.OMEGA)
{
mat = Material.ENDER_STONE;
data = 0;
}
else else
continue; continue;
@ -129,6 +139,18 @@ public class BlockChangeAnimation extends Animation
} }
} }
} }
else if (getTreasure().getTreasureType() == TreasureType.FREEDOM)
{
for(Block c : _chests)
{
if(c.equals(b))
{
_blockInfoList.add(new BlockInfo(b));
b.setType(Material.ENDER_PORTAL_FRAME);
b.setData((byte) 0);
}
}
}
} }
} }

View File

@ -3,32 +3,22 @@ package mineplex.core.treasure.animation;
import java.awt.*; import java.awt.*;
import java.util.List; import java.util.List;
import mineplex.core.common.util.*;
import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.common.util.UtilParticle.ViewDist;
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.gadgets.particle.unrelated.BabyFireworkEffect; import mineplex.core.gadget.gadgets.particle.unrelated.BabyFireworkEffect;
import org.bukkit.Bukkit;
import org.bukkit.Effect;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.craftbukkit.v1_8_R3.CraftWorld;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.util.Vector;
import net.minecraft.server.v1_8_R3.BlockPosition;
import net.minecraft.server.v1_8_R3.MathHelper;
import mineplex.core.common.util.UtilAlg;
import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilParticle.ViewDist;
import mineplex.core.treasure.BlockInfo; import mineplex.core.treasure.BlockInfo;
import mineplex.core.treasure.Treasure; import mineplex.core.treasure.Treasure;
import mineplex.core.treasure.TreasureType; import mineplex.core.treasure.TreasureType;
import net.minecraft.server.v1_8_R3.BlockPosition;
import net.minecraft.server.v1_8_R3.MathHelper;
import org.bukkit.Location;
import org.bukkit.block.Block;
import org.bukkit.craftbukkit.v1_8_R3.CraftWorld;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.util.Vector;
/** /**
* Created by Shaun on 8/29/2014. * Created by Shaun on 8/29/2014.
@ -50,6 +40,8 @@ public class ChestSpawnAnimation extends Animation
private JavaPlugin _javaPlugin; private JavaPlugin _javaPlugin;
private int _babyFireworks = 0; private int _babyFireworks = 0;
private int _circleAmount = 0;
public ChestSpawnAnimation(Treasure treasure, Block block, List<BlockInfo> chestBlockInfo, Block openingCenter, double radialOffset, JavaPlugin javaPlugin) public ChestSpawnAnimation(Treasure treasure, Block block, List<BlockInfo> chestBlockInfo, Block openingCenter, double radialOffset, JavaPlugin javaPlugin)
{ {
@ -164,6 +156,25 @@ public class ChestSpawnAnimation extends Animation
_babyFireworks++; _babyFireworks++;
} }
} }
else if (getTreasure().getTreasureType() == TreasureType.OMEGA)
{
if (_circleAmount <= 15)
{
int particles = 50;
int radius = 1;
for (int i = 0; i < particles; i++)
{
double angle = (double) 2 * Math.PI * i / particles;
double x = Math.cos(angle) * radius;
double z = Math.sin(angle) * radius;
Location loc = _centerLocation.clone().add(x, .1 * _circleAmount, z);
UtilParticle.PlayParticleToAll(ParticleType.PORTAL, loc, null, 0, 2, ViewDist.NORMAL);
}
}
_circleAmount++;
}
//Spawn Chest //Spawn Chest
if (getTicks() >= ANIMATION_DURATION) if (getTicks() >= ANIMATION_DURATION)
@ -172,6 +183,7 @@ public class ChestSpawnAnimation extends Animation
{ {
UtilBlock.setQuick(_block.getWorld(), _block.getX(), _block.getY(), _block.getZ(), 0, (byte) 0); UtilBlock.setQuick(_block.getWorld(), _block.getX(), _block.getY(), _block.getZ(), 0, (byte) 0);
} }
_chestBlockInfo.add(new BlockInfo(_block)); _chestBlockInfo.add(new BlockInfo(_block));
getTreasure().setBlock(_block, getTreasure().getTreasureType().getMaterial(), _direction); getTreasure().setBlock(_block, getTreasure().getTreasureType().getMaterial(), _direction);
_block.getLocation().getWorld().playSound(_centerLocation, getTreasure().getTreasureType().getStyle().getChestSpawnSound(), 0.5f, 1f); _block.getLocation().getWorld().playSound(_centerLocation, getTreasure().getTreasureType().getStyle().getChestSpawnSound(), 0.5f, 1f);

View File

@ -2,7 +2,6 @@ package mineplex.core.treasure.gui;
import mineplex.core.common.currency.GlobalCurrency; import mineplex.core.common.currency.GlobalCurrency;
import mineplex.core.common.util.F; import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.inventory.InventoryManager; import mineplex.core.inventory.InventoryManager;
import mineplex.core.recharge.Recharge; import mineplex.core.recharge.Recharge;
import mineplex.core.shop.confirmation.ConfirmationPage; import mineplex.core.shop.confirmation.ConfirmationPage;
@ -60,18 +59,12 @@ public class BuyChestButton implements IButton
return; return;
} }
} }
if (!_page.getPlugin().hasItemsToGivePlayer(TreasureType.OMEGA.getRewardPool(), player) if (!_page.getPlugin().hasItemsToGivePlayer(_chestType.getRewardPool(), player)
&& _chestType == TreasureType.OMEGA) && (_chestType == TreasureType.ILLUMINATED || _chestType == TreasureType.OMEGA))
{ {
player.sendMessage(F.main("Treasure", "You seem to have all treasures for this chest unlocked already!")); player.sendMessage(F.main("Treasure", "You seem to have all treasures for this chest unlocked already!"));
return; return;
} }
if (!_page.getPlugin().hasItemsToGivePlayer(TreasureType.ILLUMINATED.getRewardPool(), player)
&& _chestType == TreasureType.ILLUMINATED)
{
player.sendMessage(F.main("Treasure", "You seem to have all treasures for this chest unlocked already!"));
return;
}
SalesPackageBase salesPackage = new ChestPackage(_chestName, _chestMat, _chestCost); SalesPackageBase salesPackage = new ChestPackage(_chestName, _chestMat, _chestCost);
_page.getShop().openPageForPlayer(player, new ConfirmationPage<>(player, _page, new SalesPackageProcessor(player, GlobalCurrency.TREASURE_SHARD, salesPackage, _page.getDonationManager(), () -> _page.getShop().openPageForPlayer(player, new ConfirmationPage<>(player, _page, new SalesPackageProcessor(player, GlobalCurrency.TREASURE_SHARD, salesPackage, _page.getDonationManager(), () ->
{ {

View File

@ -178,7 +178,19 @@ public class TreasurePage extends ShopPageBase<TreasureManager, TreasureShop>
freedomLore.add(ChatColor.RESET + C.cGreen + getFreedomUnlockedAmount(getPlayer()) + "/7 Unlocked"); freedomLore.add(ChatColor.RESET + C.cGreen + getFreedomUnlockedAmount(getPlayer()) + "/7 Unlocked");
List<String> omegaLore = new ArrayList<>(); List<String> omegaLore = new ArrayList<>();
omegaLore.add("PLACEHOLDER"); omegaLore.add(" ");
omegaLore.add(F.value("Omega Chests Owned", "" + omegaCount));
omegaLore.add(" ");
omegaLore.add(C.cGray + "The most powerful of all chests,");
omegaLore.add(C.cGray + "it is able to go back in time to find");
omegaLore.add(C.cGray + "loot that has been lost...");
omegaLore.add(" ");
if (omegaCount > 0)
omegaLore.add(ChatColor.RESET + C.cGreen + "Click to Open!");
else
{
}
ShopItem shards = new ShopItem(Material.PRISMARINE_SHARD, C.cAqua + C.Bold + treasureShards + " Treasure Shards", shardLore.toArray(new String[0]), 0, false); ShopItem shards = new ShopItem(Material.PRISMARINE_SHARD, C.cAqua + C.Bold + treasureShards + " Treasure Shards", shardLore.toArray(new String[0]), 0, false);
ShopItem basic = new ShopItem(Material.CHEST, C.cGreen + C.Bold + "Old Treasure", basicLore.toArray(new String[0]), 0, false, false); ShopItem basic = new ShopItem(Material.CHEST, C.cGreen + C.Bold + "Old Treasure", basicLore.toArray(new String[0]), 0, false, false);
@ -187,7 +199,8 @@ public class TreasurePage extends ShopPageBase<TreasureManager, TreasureShop>
ItemStack christmas = SkinData.PRESENT.getSkull(C.cDGreen + C.Bold + "Winter Holiday Treasure", christmasLore); ItemStack christmas = SkinData.PRESENT.getSkull(C.cDGreen + C.Bold + "Winter Holiday Treasure", christmasLore);
ItemStack illuminated = new ShopItem(Material.SEA_LANTERN, C.cDAqua + C.Bold + "Illuminated Treasure", illuminatedLore.toArray(new String[0]), 0, false, false); ItemStack illuminated = new ShopItem(Material.SEA_LANTERN, C.cDAqua + C.Bold + "Illuminated Treasure", illuminatedLore.toArray(new String[0]), 0, false, false);
ItemStack freedom = SkinData.FREEDOM_CHEST.getSkull(C.cRedB + "Freedom " + C.cBlueB + "Treasure", freedomLore); ItemStack freedom = SkinData.FREEDOM_CHEST.getSkull(C.cRedB + "Freedom " + C.cBlueB + "Treasure", freedomLore);
ShopItem omega = new ShopItem(Material.NETHER_STAR, C.cAquaB + "Omega Treasure", omegaLore.toArray(new String[0]), 0, false, false); //ShopItem omega = new ShopItem(Material.NETHER_STAR, C.cAquaB + "Omega Treasure", omegaLore.toArray(new String[0]), 0, false, false);
ItemStack omega = SkinData.OMEGA_CHEST.getSkull(C.cAquaB + "Omega Treasure", omegaLore);
addItem(40, shards); addItem(40, shards);

View File

@ -19,15 +19,7 @@ import mineplex.core.boosters.BoosterManager;
import mineplex.core.botspam.BotSpamManager; import mineplex.core.botspam.BotSpamManager;
import mineplex.core.common.Rank; import mineplex.core.common.Rank;
import mineplex.core.common.currency.GlobalCurrency; import mineplex.core.common.currency.GlobalCurrency;
import mineplex.core.common.util.C; import mineplex.core.common.util.*;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilInv;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilTextBottom;
import mineplex.core.common.util.UtilTime;
import mineplex.core.common.util.UtilWorld;
import mineplex.core.cosmetic.CosmeticManager; import mineplex.core.cosmetic.CosmeticManager;
import mineplex.core.customdata.CustomDataManager; import mineplex.core.customdata.CustomDataManager;
import mineplex.core.disguise.DisguiseManager; import mineplex.core.disguise.DisguiseManager;
@ -80,15 +72,7 @@ import mineplex.hub.commands.ForcefieldRadius;
import mineplex.hub.commands.GadgetToggle; import mineplex.hub.commands.GadgetToggle;
import mineplex.hub.commands.GameModeCommand; import mineplex.hub.commands.GameModeCommand;
import mineplex.hub.commands.NewsCommand; import mineplex.hub.commands.NewsCommand;
import mineplex.hub.modules.ForcefieldManager; import mineplex.hub.modules.*;
import mineplex.hub.modules.HubVisibilityManager;
import mineplex.hub.modules.JumpManager;
import mineplex.hub.modules.KothManager;
import mineplex.hub.modules.NewsManager;
import mineplex.hub.modules.ParkourManager;
import mineplex.hub.modules.SoccerManager;
import mineplex.hub.modules.ValentinesManager;
import mineplex.hub.modules.WorldManager;
import mineplex.hub.modules.nonpremium.NonPremiumManager; import mineplex.hub.modules.nonpremium.NonPremiumManager;
import mineplex.hub.profile.gui.GUIProfile; import mineplex.hub.profile.gui.GUIProfile;
import mineplex.minecraft.game.classcombat.Skill.event.SkillTriggerEvent; import mineplex.minecraft.game.classcombat.Skill.event.SkillTriggerEvent;
@ -102,11 +86,7 @@ import net.md_5.bungee.api.chat.HoverEvent.Action;
import net.md_5.bungee.api.chat.TextComponent; import net.md_5.bungee.api.chat.TextComponent;
import net.minecraft.server.v1_8_R3.EntityInsentient; import net.minecraft.server.v1_8_R3.EntityInsentient;
import net.minecraft.server.v1_8_R3.EntityPlayer; import net.minecraft.server.v1_8_R3.EntityPlayer;
import org.bukkit.Bukkit; import org.bukkit.*;
import org.bukkit.ChatColor;
import org.bukkit.GameMode;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.craftbukkit.v1_8_R3.CraftWorld; import org.bukkit.craftbukkit.v1_8_R3.CraftWorld;
import org.bukkit.entity.Egg; import org.bukkit.entity.Egg;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;
@ -120,31 +100,11 @@ import org.bukkit.event.entity.EntityTargetEvent.TargetReason;
import org.bukkit.event.entity.ItemSpawnEvent; import org.bukkit.event.entity.ItemSpawnEvent;
import org.bukkit.event.entity.PlayerDeathEvent; import org.bukkit.event.entity.PlayerDeathEvent;
import org.bukkit.event.inventory.InventoryClickEvent; import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.event.player.AsyncPlayerChatEvent; import org.bukkit.event.player.*;
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.player.PlayerLoginEvent;
import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.event.player.PlayerRespawnEvent;
import org.bukkit.event.player.PlayerVelocityEvent;
import org.bukkit.event.server.ServerListPingEvent; import org.bukkit.event.server.ServerListPingEvent;
import org.bukkit.event.world.ChunkLoadEvent; import org.bukkit.event.world.ChunkLoadEvent;
import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.plugin.java.JavaPlugin;
<<<<<<< HEAD
=======
import java.io.DataInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Random;
import java.util.UUID;
>>>>>>> e9ea8320890301d21c721216ab46bd4dcd98ca06
public class HubManager extends MiniClientPlugin<HubClient> public class HubManager extends MiniClientPlugin<HubClient>
{ {
// Snowman! // Snowman!