From 9a58cd792e23033965bff4bd5dab2795cc0151d4 Mon Sep 17 00:00:00 2001 From: AlexTheCoder Date: Tue, 11 Apr 2017 20:18:09 -0400 Subject: [PATCH] Implement easter egg baskets in games which can give fantastic rewards --- .../core/achievement/Achievement.java | 7 +++ .../core/achievement/AchievementManager.java | 6 -- .../redis/GiveawayMessageHandler.java | 2 +- .../nautilus/game/arcade/ArcadeManager.java | 2 +- .../game/arcade/managers/HolidayManager.java | 60 ++++++++++++------- 5 files changed, 46 insertions(+), 31 deletions(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/achievement/Achievement.java b/Plugins/Mineplex.Core/src/mineplex/core/achievement/Achievement.java index 745df2fee..419b8b977 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/achievement/Achievement.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/achievement/Achievement.java @@ -56,6 +56,13 @@ public enum Achievement "during Thanksgiving 2016!"}, new int[]{200}, 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_WINS("Bridge Champion", 600, diff --git a/Plugins/Mineplex.Core/src/mineplex/core/achievement/AchievementManager.java b/Plugins/Mineplex.Core/src/mineplex/core/achievement/AchievementManager.java index 1c2ac0f69..0be8e250e 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/achievement/AchievementManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/achievement/AchievementManager.java @@ -208,9 +208,6 @@ public class AchievementManager extends MiniPlugin return level; } - if (sender.getName().equalsIgnoreCase("B2_mp")) - return 101; - if (rank.has(Rank.MODERATOR)) level = Math.max(level, 5); 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()); if (rank.has(Rank.OWNER)) level = Math.max(level, 50 + get(sender, Achievement.GLOBAL_GEM_HUNTER).getLevel()); - - if (sender.getName().equalsIgnoreCase("Phinary")) - level = 0; return level; } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/rankGiveaway/redis/GiveawayMessageHandler.java b/Plugins/Mineplex.Core/src/mineplex/core/rankGiveaway/redis/GiveawayMessageHandler.java index ccea12e19..8bf01da12 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/rankGiveaway/redis/GiveawayMessageHandler.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/rankGiveaway/redis/GiveawayMessageHandler.java @@ -50,7 +50,7 @@ public class GiveawayMessageHandler implements CommandCallback String playerName = message.getPlayerName(); int count = message.getEternalCount(); 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()); World world = UtilServer.getPlayers().length > 0 ? UtilServer.getPlayers()[0].getWorld() : Bukkit.getWorlds().get(0); LightFlicker lightFlicker = new LightFlicker(world); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java index af4d8cea5..9c6f65117 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java @@ -353,7 +353,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation TitanGiveawayManager titanGiveaway = new TitanGiveawayManager(getPlugin(), clientManager, serverStatusManager); EternalGiveawayManager eternalGiveawayManager = new EternalGiveawayManager(getPlugin(), clientManager, serverStatusManager); - IsHolidayEnabled = false; + IsHolidayEnabled = true; if (IsHolidayEnabled) new HolidayManager(this, titanGiveaway, eternalGiveawayManager); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/HolidayManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/HolidayManager.java index 234e44f46..ce6140e22 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/HolidayManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/HolidayManager.java @@ -97,8 +97,8 @@ public class HolidayManager implements Listener } } - private HolidayType _type = HolidayType.THANKSGIVING; - private String _statName = "Thanksgiving Chickens 2016"; + private HolidayType _type = HolidayType.EASTER; + private String _statName = "Easter Eggs 2017"; private ArcadeManager _arcadeManager; private TitanGiveawayManager _titanManager; @@ -109,7 +109,7 @@ public class HolidayManager implements Listener private HashSet _items = new HashSet<>(); - private HashSet _coins = new HashSet<>(); + private HashSet _shards = new HashSet<>(); private HashSet _gems = new HashSet<>(); private static final double CHEST_CHANCE = 0.001; @@ -478,25 +478,25 @@ public class HolidayManager implements Listener if (player != null && _arcadeManager.GetGame() != null) { _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++) { - Item coin = block.getWorld().dropItem(block.getLocation().add(0.5, 1, 0.5), - ItemStackFactory.Instance.CreateStack(Material.PRISMARINE_SHARD, (byte) 0, 1, UtilMath.r(999999) + "Coin")); + 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) + "Shard")); Vector vel = new Vector( (Math.random() - 0.5) * 0.5, 0.1 + Math.random() * 0.3, (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 @@ -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) { @@ -540,9 +554,9 @@ public class HolidayManager implements Listener if (hasItemsToGivePlayer(TreasureType.HAUNTED.getRewardPool(), player)) { FireworkEffect fireworkEffect = FireworkEffect.builder().with(FireworkEffect.Type.BALL_LARGE) - .withColor(Color.ORANGE).withColor(Color.BLACK).withFade(Color.ORANGE) - .withFade(Color.BLACK).flicker(true).build(); - manager.addItemToInventory(player, "Haunted Chest", 1); + .withColor(Color.LIME).withColor(Color.WHITE).withFade(Color.YELLOW) + .withFade(Color.WHITE).flicker(true).build(); + manager.addItemToInventory(player, "Spring Chest", 1); HalloweenSmashedEffect halloweenSmashedEffect = new HalloweenSmashedEffect(block.getLocation() .add(.5, .5, .5), fireworkEffect, _arcadeManager.getPlugin()); halloweenSmashedEffect.start(); @@ -569,25 +583,25 @@ public class HolidayManager implements Listener if (player != null && _arcadeManager.GetGame() != null) { _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 for (int i=0 ; i < 4 + Math.random()*8 ; i++) { - Item coin = entity.getWorld().dropItem(entity.getLocation().add(0.5, 1, 0.5), - ItemStackFactory.Instance.CreateStack(Material.PRISMARINE_SHARD, (byte)0, 1, UtilMath.r(999999) + "Coin")); + 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) + "Shard")); Vector vel = new Vector( (Math.random() - 0.5) * 0.5, 0.1 + Math.random() * 0.3, (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 @@ -629,12 +643,12 @@ public class HolidayManager implements Listener if (UtilPlayer.isSpectator(event.getPlayer())) return; - if (_coins.contains(event.getItem())) + if (_shards.contains(event.getItem())) { event.setCancelled(true); 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); } @@ -660,7 +674,7 @@ public class HolidayManager implements Listener if (event.getType() != UpdateType.FAST) return; - Iterator coinIterator = _coins.iterator(); + Iterator coinIterator = _shards.iterator(); while (coinIterator.hasNext()) { @@ -703,7 +717,7 @@ public class HolidayManager implements Listener @EventHandler 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()); event.setCancelled(true);