Implement easter egg baskets in games which can give fantastic rewards

This commit is contained in:
AlexTheCoder 2017-04-11 20:18:09 -04:00
parent 2d61dffaea
commit 9a58cd792e
5 changed files with 46 additions and 31 deletions

View File

@ -56,6 +56,13 @@ public enum Achievement
"during Thanksgiving 2016!"}, "during Thanksgiving 2016!"},
new int[]{200}, new int[]{200},
AchievementCategory.HOLIDAY), AchievementCategory.HOLIDAY),
GLOBAL_EGG_HUNTER_2017("2017 Egg Hunter", 4000,
new String[]{"Global.Easter Eggs 2017"},
new String[]{"Find 200 Easter Egg Baskets,",
"during Easter 2017"},
new int[]{200},
AchievementCategory.HOLIDAY),
//Bridges //Bridges
BRIDGES_WINS("Bridge Champion", 600, BRIDGES_WINS("Bridge Champion", 600,

View File

@ -208,9 +208,6 @@ public class AchievementManager extends MiniPlugin
return level; return level;
} }
if (sender.getName().equalsIgnoreCase("B2_mp"))
return 101;
if (rank.has(Rank.MODERATOR)) if (rank.has(Rank.MODERATOR))
level = Math.max(level, 5); level = Math.max(level, 5);
if (rank.has(Rank.SNR_MODERATOR)) if (rank.has(Rank.SNR_MODERATOR))
@ -221,9 +218,6 @@ public class AchievementManager extends MiniPlugin
level = Math.max(level, 30 + get(sender, Achievement.GLOBAL_GEM_HUNTER).getLevel()); level = Math.max(level, 30 + get(sender, Achievement.GLOBAL_GEM_HUNTER).getLevel());
if (rank.has(Rank.OWNER)) if (rank.has(Rank.OWNER))
level = Math.max(level, 50 + get(sender, Achievement.GLOBAL_GEM_HUNTER).getLevel()); level = Math.max(level, 50 + get(sender, Achievement.GLOBAL_GEM_HUNTER).getLevel());
if (sender.getName().equalsIgnoreCase("Phinary"))
level = 0;
return level; return level;
} }

View File

@ -50,7 +50,7 @@ public class GiveawayMessageHandler implements CommandCallback
String playerName = message.getPlayerName(); String playerName = message.getPlayerName();
int count = message.getEternalCount(); int count = message.getEternalCount();
String countString = count + UtilTime.getDayOfMonthSuffix(count); String countString = count + UtilTime.getDayOfMonthSuffix(count);
String chatMessage = C.cPurple + playerName + C.cWhite + " found Eternal Rank in a " + C.cPurple + "Thanksgiving Chicken"; String chatMessage = C.cPurple + playerName + C.cWhite + " found Eternal Rank in an " + C.cPurple + "Easter Egg Basket";
UtilTextMiddle.display(C.cDPurple + C.Bold + "ETERNAL", chatMessage, 20, 80, 20, UtilServer.getPlayers()); UtilTextMiddle.display(C.cDPurple + C.Bold + "ETERNAL", chatMessage, 20, 80, 20, UtilServer.getPlayers());
World world = UtilServer.getPlayers().length > 0 ? UtilServer.getPlayers()[0].getWorld() : Bukkit.getWorlds().get(0); World world = UtilServer.getPlayers().length > 0 ? UtilServer.getPlayers()[0].getWorld() : Bukkit.getWorlds().get(0);
LightFlicker lightFlicker = new LightFlicker(world); LightFlicker lightFlicker = new LightFlicker(world);

View File

@ -353,7 +353,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation
TitanGiveawayManager titanGiveaway = new TitanGiveawayManager(getPlugin(), clientManager, serverStatusManager); TitanGiveawayManager titanGiveaway = new TitanGiveawayManager(getPlugin(), clientManager, serverStatusManager);
EternalGiveawayManager eternalGiveawayManager = new EternalGiveawayManager(getPlugin(), clientManager, serverStatusManager); EternalGiveawayManager eternalGiveawayManager = new EternalGiveawayManager(getPlugin(), clientManager, serverStatusManager);
IsHolidayEnabled = false; IsHolidayEnabled = true;
if (IsHolidayEnabled) if (IsHolidayEnabled)
new HolidayManager(this, titanGiveaway, eternalGiveawayManager); new HolidayManager(this, titanGiveaway, eternalGiveawayManager);

View File

@ -97,8 +97,8 @@ public class HolidayManager implements Listener
} }
} }
private HolidayType _type = HolidayType.THANKSGIVING; private HolidayType _type = HolidayType.EASTER;
private String _statName = "Thanksgiving Chickens 2016"; private String _statName = "Easter Eggs 2017";
private ArcadeManager _arcadeManager; private ArcadeManager _arcadeManager;
private TitanGiveawayManager _titanManager; private TitanGiveawayManager _titanManager;
@ -109,7 +109,7 @@ public class HolidayManager implements Listener
private HashSet<Item> _items = new HashSet<>(); private HashSet<Item> _items = new HashSet<>();
private HashSet<Item> _coins = new HashSet<>(); private HashSet<Item> _shards = new HashSet<>();
private HashSet<Item> _gems = new HashSet<>(); private HashSet<Item> _gems = new HashSet<>();
private static final double CHEST_CHANCE = 0.001; private static final double CHEST_CHANCE = 0.001;
@ -478,25 +478,25 @@ public class HolidayManager implements Listener
if (player != null && _arcadeManager.GetGame() != null) if (player != null && _arcadeManager.GetGame() != null)
{ {
_arcadeManager.GetGame().AddStat(player, _statName, 1, false, true); _arcadeManager.GetGame().AddStat(player, _statName, 1, false, true);
System.out.println("Recording Pumpkin Break for " + player.getName()); System.out.println("Recording Holiday Block Break for " + player.getName());
} }
//Coins //Shards
for (int i = 0; i < 4 + Math.random() * 8; i++) for (int i = 0; i < 4 + Math.random() * 8; i++)
{ {
Item coin = block.getWorld().dropItem(block.getLocation().add(0.5, 1, 0.5), Item shard = block.getWorld().dropItem(block.getLocation().add(0.5, 1, 0.5),
ItemStackFactory.Instance.CreateStack(Material.PRISMARINE_SHARD, (byte) 0, 1, UtilMath.r(999999) + "Coin")); ItemStackFactory.Instance.CreateStack(Material.PRISMARINE_SHARD, (byte) 0, 1, UtilMath.r(999999) + "Shard"));
Vector vel = new Vector( Vector vel = new Vector(
(Math.random() - 0.5) * 0.5, (Math.random() - 0.5) * 0.5,
0.1 + Math.random() * 0.3, 0.1 + Math.random() * 0.3,
(Math.random() - 0.5) * 0.5); (Math.random() - 0.5) * 0.5);
coin.setVelocity(vel); shard.setVelocity(vel);
coin.setPickupDelay(20); shard.setPickupDelay(20);
_coins.add(coin); _shards.add(shard);
} }
//Gems //Gems
@ -530,6 +530,20 @@ public class HolidayManager implements Listener
} }
}); });
}*/ }*/
// Eternal Giveaway
if (player != null)
{
_eternalGiveawayManager.openPumpkin(player, new Runnable()
{
@Override
public void run()
{
Location location = block.getLocation().add(0.5, 0.5, 0.5);
new EternalGiveawayAnimation(_eternalGiveawayManager, location, 3000L);
}
});
}
if (player != null) if (player != null)
{ {
@ -540,9 +554,9 @@ public class HolidayManager implements Listener
if (hasItemsToGivePlayer(TreasureType.HAUNTED.getRewardPool(), player)) if (hasItemsToGivePlayer(TreasureType.HAUNTED.getRewardPool(), player))
{ {
FireworkEffect fireworkEffect = FireworkEffect.builder().with(FireworkEffect.Type.BALL_LARGE) FireworkEffect fireworkEffect = FireworkEffect.builder().with(FireworkEffect.Type.BALL_LARGE)
.withColor(Color.ORANGE).withColor(Color.BLACK).withFade(Color.ORANGE) .withColor(Color.LIME).withColor(Color.WHITE).withFade(Color.YELLOW)
.withFade(Color.BLACK).flicker(true).build(); .withFade(Color.WHITE).flicker(true).build();
manager.addItemToInventory(player, "Haunted Chest", 1); manager.addItemToInventory(player, "Spring Chest", 1);
HalloweenSmashedEffect halloweenSmashedEffect = new HalloweenSmashedEffect(block.getLocation() HalloweenSmashedEffect halloweenSmashedEffect = new HalloweenSmashedEffect(block.getLocation()
.add(.5, .5, .5), fireworkEffect, _arcadeManager.getPlugin()); .add(.5, .5, .5), fireworkEffect, _arcadeManager.getPlugin());
halloweenSmashedEffect.start(); halloweenSmashedEffect.start();
@ -569,25 +583,25 @@ public class HolidayManager implements Listener
if (player != null && _arcadeManager.GetGame() != null) if (player != null && _arcadeManager.GetGame() != null)
{ {
_arcadeManager.GetGame().AddStat(player, _statName, 1, false, true); _arcadeManager.GetGame().AddStat(player, _statName, 1, false, true);
System.out.println("Recording Entity Killong for " + player.getName()); System.out.println("Recording Entity Killing for " + player.getName());
} }
//Coins //Coins
for (int i=0 ; i < 4 + Math.random()*8 ; i++) for (int i=0 ; i < 4 + Math.random()*8 ; i++)
{ {
Item coin = entity.getWorld().dropItem(entity.getLocation().add(0.5, 1, 0.5), Item shard = entity.getWorld().dropItem(entity.getLocation().add(0.5, 1, 0.5),
ItemStackFactory.Instance.CreateStack(Material.PRISMARINE_SHARD, (byte)0, 1, UtilMath.r(999999) + "Coin")); ItemStackFactory.Instance.CreateStack(Material.PRISMARINE_SHARD, (byte)0, 1, UtilMath.r(999999) + "Shard"));
Vector vel = new Vector( Vector vel = new Vector(
(Math.random() - 0.5) * 0.5, (Math.random() - 0.5) * 0.5,
0.1 + Math.random() * 0.3, 0.1 + Math.random() * 0.3,
(Math.random() - 0.5) * 0.5); (Math.random() - 0.5) * 0.5);
coin.setVelocity(vel); shard.setVelocity(vel);
coin.setPickupDelay(20); shard.setPickupDelay(20);
_coins.add(coin); _shards.add(shard);
} }
//Gems //Gems
@ -629,12 +643,12 @@ public class HolidayManager implements Listener
if (UtilPlayer.isSpectator(event.getPlayer())) if (UtilPlayer.isSpectator(event.getPlayer()))
return; return;
if (_coins.contains(event.getItem())) if (_shards.contains(event.getItem()))
{ {
event.setCancelled(true); event.setCancelled(true);
event.getItem().remove(); event.getItem().remove();
_arcadeManager.GetDonation().rewardCurrency(GlobalCurrency.TREASURE_SHARD, event.getPlayer(), _type + " Coins", 4 * event.getItem().getItemStack().getAmount()); _arcadeManager.GetDonation().rewardCurrency(GlobalCurrency.TREASURE_SHARD, event.getPlayer(), _type + " Shards", 4 * event.getItem().getItemStack().getAmount());
event.getPlayer().getWorld().playSound(event.getPlayer().getLocation(), Sound.ORB_PICKUP, 1f, 2f); event.getPlayer().getWorld().playSound(event.getPlayer().getLocation(), Sound.ORB_PICKUP, 1f, 2f);
} }
@ -660,7 +674,7 @@ public class HolidayManager implements Listener
if (event.getType() != UpdateType.FAST) if (event.getType() != UpdateType.FAST)
return; return;
Iterator<Item> coinIterator = _coins.iterator(); Iterator<Item> coinIterator = _shards.iterator();
while (coinIterator.hasNext()) while (coinIterator.hasNext())
{ {
@ -703,7 +717,7 @@ public class HolidayManager implements Listener
@EventHandler @EventHandler
public void spawnDebug(PlayerCommandPreprocessEvent event) public void spawnDebug(PlayerCommandPreprocessEvent event)
{ {
if (event.getPlayer().isOp() && event.getMessage().toLowerCase().startsWith("/pumpkin")) if (event.getPlayer().isOp() && event.getMessage().toLowerCase().startsWith("/holidayblock"))
{ {
spawnSpecialBlock(event.getPlayer().getLocation().getBlock()); spawnSpecialBlock(event.getPlayer().getLocation().getBlock());
event.setCancelled(true); event.setCancelled(true);