diff --git a/Plugins/Mineplex.Core/src/mineplex/core/titangiveaway/GiveawayMessageHandler.java b/Plugins/Mineplex.Core/src/mineplex/core/titangiveaway/GiveawayMessageHandler.java index a388cfd7c..b2c47a912 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/titangiveaway/GiveawayMessageHandler.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/titangiveaway/GiveawayMessageHandler.java @@ -32,7 +32,7 @@ public class GiveawayMessageHandler implements CommandCallback int count = message.getTitanCount(); String countString = count + UtilTime.getDayOfMonthSuffix(count); String chatMessage = C.cRed + playerName + C.cWhite + " has become the " + C.cRed + countString + " Titan "; - UtilTextMiddle.display(C.cDRed + C.Bold + "TITAN", chatMessage, UtilServer.getPlayers()); + UtilTextMiddle.display(C.cDRed + C.Bold + "TITAN", 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); lightFlicker.runTaskTimer(_plugin, 1, 1); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/titangiveaway/TitanGiveawayAnimation.java b/Plugins/Mineplex.Core/src/mineplex/core/titangiveaway/TitanGiveawayAnimation.java index 7ef50a0fe..2a5e70db6 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/titangiveaway/TitanGiveawayAnimation.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/titangiveaway/TitanGiveawayAnimation.java @@ -28,7 +28,7 @@ public class TitanGiveawayAnimation implements Listener _location = start.clone(); _duration = duration; _startTime = System.currentTimeMillis(); - _worldTime = start.getWorld().getTime(); +// _worldTime = start.getWorld().getTime(); Bukkit.getPluginManager().registerEvents(this, manager.getPlugin()); } @@ -49,17 +49,17 @@ public class TitanGiveawayAnimation implements Listener return; } - _location.getWorld().setTime(UtilMath.random.nextLong()); +// _location.getWorld().setTime(UtilMath.random.nextLong()); for (Player player : UtilServer.getPlayers()) { - player.playSound(player.getLocation(), Sound.ORB_PICKUP, 5, 5); - UtilFirework.packetPlayFirework(player, player.getLocation(), Type.BURST, Color.RED, true, false); + player.playSound(_location, Sound.ORB_PICKUP, 5, 5); + UtilFirework.packetPlayFirework(player, _location, Type.BURST, Color.RED, true, false); } } private void remove() { - _location.getWorld().setTime(_worldTime); +// _location.getWorld().setTime(_worldTime); HandlerList.unregisterAll(this); } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/titangiveaway/TitanGiveawayManager.java b/Plugins/Mineplex.Core/src/mineplex/core/titangiveaway/TitanGiveawayManager.java index 1917b2d68..6b935affb 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/titangiveaway/TitanGiveawayManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/titangiveaway/TitanGiveawayManager.java @@ -2,6 +2,7 @@ package mineplex.core.titangiveaway; import java.util.Random; +import org.bukkit.Location; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.player.PlayerCommandPreprocessEvent; @@ -107,11 +108,19 @@ public class TitanGiveawayManager extends MiniPlugin } // @EventHandler -// public void onCommand(PlayerCommandPreprocessEvent event) +// public void onCommand(final PlayerCommandPreprocessEvent event) // { // if (event.getMessage().contains("pumpkin")) // { -// openPumpkin(event.getPlayer(), null); +// openPumpkin(event.getPlayer(), new Runnable() +// { +// @Override +// public void run() +// { +// Location location = event.getPlayer().getLocation().add(1, 0.5, 1); +// new TitanGiveawayAnimation(TitanGiveawayManager.this, location, 3000L); +// } +// }); // event.setCancelled(true); // } // } 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 2c2cb6f5c..adf0074cc 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 @@ -15,6 +15,7 @@ import mineplex.core.common.util.UtilParticle.ViewDist; import mineplex.core.common.util.UtilTime; import mineplex.core.common.util.UtilWorld; import mineplex.core.itemstack.ItemStackFactory; +import mineplex.core.titangiveaway.TitanGiveawayAnimation; import mineplex.core.titangiveaway.TitanGiveawayManager; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; @@ -27,6 +28,7 @@ import net.minecraft.server.v1_7_R4.TileEntity; import net.minecraft.server.v1_7_R4.TileEntityEnderChest; import org.bukkit.Effect; +import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.Sound; import org.bukkit.block.Block; @@ -89,6 +91,7 @@ public class HolidayManager implements Listener private HashSet _eggs = new HashSet(); private HashSet _coins = new HashSet(); + private HashSet _gems = new HashSet(); public long _lastSpawn = System.currentTimeMillis(); @@ -316,13 +319,13 @@ public class HolidayManager implements Listener specialBlockBreak(event.getPlayer(), event.getBlock()); } - private void specialBlockBreak(Player player, Block block) + private void specialBlockBreak(Player player, final Block block) { block.getWorld().playEffect(block.getLocation(), Effect.STEP_SOUND, type.getBlockType()); block.setType(Material.AIR); //Coins - for (int i=0 ; i < 4 + Math.random()*16 ; i++) + 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(175, (byte)0, 1, UtilMath.r(999999) + "Coin")); @@ -339,6 +342,24 @@ public class HolidayManager implements Listener _coins.add(coin); } + //Gems + for (int i=0 ; i < 4 + Math.random()*16 ; i++) + { + Item gem = block.getWorld().dropItem(block.getLocation().add(0.5, 1, 0.5), + ItemStackFactory.Instance.CreateStack(Material.EMERALD, (byte)0, 1, UtilMath.r(999999) + "Gem")); + + Vector vel = new Vector( + (Math.random() - 0.5) * 0.5, + 0.1 + Math.random() * 0.3, + (Math.random() - 0.5) * 0.5); + + gem.setVelocity(vel); + + gem.setPickupDelay(20); + + _gems.add(gem); + } + // Titan Giveaway if (player != null) { @@ -347,7 +368,8 @@ public class HolidayManager implements Listener @Override public void run() { - // TODO + Location location = block.getLocation().add(0.5, 0.5, 0.5); + new TitanGiveawayAnimation(_titanManager, location, 3000L); } }); } @@ -371,6 +393,15 @@ public class HolidayManager implements Listener event.getPlayer().getWorld().playSound(event.getPlayer().getLocation(), Sound.ORB_PICKUP, 1f, 2f); } + else if (_gems.contains(event.getItem())) + { + event.setCancelled(true); + event.getItem().remove(); + + Manager.GetDonation().RewardGems(null, type + " Gems", event.getPlayer().getName(), event.getPlayer().getUniqueId(), 4 * event.getItem().getItemStack().getAmount()); + + event.getPlayer().getWorld().playSound(event.getPlayer().getLocation(), Sound.ORB_PICKUP, 1f, 2f); + } else if (_eggs.contains(event.getItem())) { @@ -397,6 +428,19 @@ public class HolidayManager implements Listener } } + Iterator gemIterator = _gems.iterator(); + + while (gemIterator.hasNext()) + { + Item gem = gemIterator.next(); + + if (!gem.isValid() || gem.getTicksLived() > 1200) + { + gem.remove(); + gemIterator.remove(); + } + } + Iterator eggIterator = _eggs.iterator(); while (eggIterator.hasNext())