From 700cf51206f00a42f19de8a34090b7593befbe1d Mon Sep 17 00:00:00 2001 From: Cheese Date: Sat, 28 Nov 2015 16:35:11 +1100 Subject: [PATCH] titan stuff almost done --- .../core/gadget/gadgets/ParticleBlizzard.java | 6 +- .../core/gadget/gadgets/ParticleTitan.java | 122 ++++++++++++++++-- .../mineplex/core/mount/types/MountTitan.java | 8 +- .../core/mount/types/MountTitanData.java | 2 +- 4 files changed, 121 insertions(+), 17 deletions(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/ParticleBlizzard.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/ParticleBlizzard.java index 22732373a..b6f57d15b 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/ParticleBlizzard.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/ParticleBlizzard.java @@ -94,7 +94,7 @@ public class ParticleBlizzard extends ParticleGadget if (!event.getPlayer().isFlying()) if (IsActive(event.getPlayer())) UtilParticle.PlayParticle(ParticleType.SNOW_SHOVEL, event.getPlayer().getLocation(), 0f, 0f, 0f, 0.6f, 100, - ViewDist.NORMAL, UtilServer.getPlayers()); + ViewDist.LONGER, UtilServer.getPlayers()); } @EventHandler @@ -122,7 +122,7 @@ public class ParticleBlizzard extends ParticleGadget return; UtilParticle.PlayParticle(ParticleType.SNOW_SHOVEL, event.getEntity().getLocation(), 0f, 0f, 0f, 0.4f, 12, - ViewDist.NORMAL, UtilServer.getPlayers()); + ViewDist.LONGER, UtilServer.getPlayers()); } @EventHandler @@ -142,7 +142,7 @@ public class ParticleBlizzard extends ParticleGadget else { UtilParticle.PlayParticle(ParticleType.SNOW_SHOVEL, arrow.getLocation(), 0f, 0f, 0f, 0f, 1, - ViewDist.NORMAL, UtilServer.getPlayers()); + ViewDist.LONGER, UtilServer.getPlayers()); } } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/ParticleTitan.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/ParticleTitan.java index a8f515735..9c21b812f 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/ParticleTitan.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/ParticleTitan.java @@ -1,13 +1,24 @@ package mineplex.core.gadget.gadgets; +import java.util.HashSet; +import java.util.Iterator; + import org.bukkit.Location; import org.bukkit.Material; +import org.bukkit.entity.Arrow; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; +import org.bukkit.event.entity.ProjectileHitEvent; +import org.bukkit.event.entity.ProjectileLaunchEvent; +import org.bukkit.event.player.PlayerJoinEvent; +import org.bukkit.event.player.PlayerToggleFlightEvent; import org.bukkit.util.Vector; +import mineplex.core.blood.BloodEvent; +import mineplex.core.common.Rank; import mineplex.core.common.util.C; import mineplex.core.common.util.UtilParticle; +import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilParticle.ParticleType; import mineplex.core.common.util.UtilParticle.ViewDist; import mineplex.core.gadget.GadgetManager; @@ -17,35 +28,38 @@ import mineplex.core.updater.event.UpdateEvent; public class ParticleTitan extends ParticleGadget { + private HashSet _arrows = new HashSet(); private int _tick; public ParticleTitan(GadgetManager manager) { - super(manager, "Titanic Particle", new String[] + super(manager, "Flame of the Titans", new String[] { - C.cWhite + "Coming Soon...", + C.cWhite + "These flames are said to be the", + C.cWhite + "souls of an lost civilisation of", + C.cWhite + "Titans, forgotten by time.", " ", C.cRed + "Unlocked with Titan Rank", }, -// Price for debuging purposes - 10, - Material.INK_SACK, (byte)8); + -2, + Material.FIREBALL, (byte)0); } @EventHandler public void onUpdate(UpdateEvent event) { if (event.getType() != UpdateType.TICK) - { + return; - } + _tick++; _tick = _tick%620; for(Player player : GetActive()) { - if (!shouldDisplay(player)) continue; + if (!shouldDisplay(player)) + continue; double total = 3; double step = (1/total)*Math.PI*2; @@ -55,7 +69,8 @@ public class ParticleTitan extends ParticleGadget double r = 3; boolean redstone = false; - if(Manager.isMoving(player)) r = 0.5; + if(Manager.isMoving(player)) + r = 0.5; for(int i = 0; i < total; i++) { @@ -95,4 +110,93 @@ public class ParticleTitan extends ParticleGadget } } } + + @EventHandler + public void jump(PlayerToggleFlightEvent event) + { + if (!shouldDisplay(event.getPlayer())) + return; + + if (!event.getPlayer().isFlying()) + if (IsActive(event.getPlayer())) + { + UtilParticle.PlayParticle(ParticleType.LAVA, event.getPlayer().getLocation(), 0f, 0f, 0f, 0.2f, 40, + ViewDist.NORMAL, UtilServer.getPlayers()); + } + + } + + @EventHandler + public void arrow(ProjectileLaunchEvent event) + { + if (Manager.hideParticles()) + return; + + if (event.getEntity() instanceof Arrow) + { + if (event.getEntity().getShooter() != null) + { + if (GetActive().contains(event.getEntity().getShooter())) + { + _arrows.add((Arrow)event.getEntity()); + } + } + } + } + + @EventHandler + public void arrow(ProjectileHitEvent event) + { + if (!_arrows.remove(event.getEntity())) + return; + + UtilParticle.PlayParticle(ParticleType.LAVA, event.getEntity().getLocation(), 0f, 0f, 0f, 0f, 24, + ViewDist.LONGER, UtilServer.getPlayers()); + } + + @EventHandler + public void arrowClean(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + return; + + for (Iterator arrowIterator = _arrows.iterator(); arrowIterator.hasNext();) + { + Arrow arrow = arrowIterator.next(); + + if (arrow.isDead() || !arrow.isValid() || arrow.isOnGround()) + { + arrowIterator.remove(); + } + else + { + UtilParticle.PlayParticle(ParticleType.FLAME, arrow.getLocation(), 0f, 0f, 0f, 0f, 1, + ViewDist.LONGER, UtilServer.getPlayers()); + } + } + } + + @EventHandler + public void death(BloodEvent event) + { + if (event.getPlayer() == null) + return; + + if (!IsActive(event.getPlayer())) + return; + + if (!shouldDisplay(event.getPlayer())) + return; + + event.setItem(Material.FIREBALL, (byte)0); + } + + @EventHandler + public void legendOwner(PlayerJoinEvent event) + { + if (Manager.getClientManager().Get(event.getPlayer()).GetRank().has(Rank.TITAN)) + { + Manager.getDonationManager().Get(event.getPlayer().getName()).AddUnknownSalesPackagesOwned(GetName()); + } + } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountTitan.java b/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountTitan.java index e3fb011bc..3611754a7 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountTitan.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountTitan.java @@ -31,11 +31,11 @@ public class MountTitan extends Mount { public MountTitan(MountManager manager) { - super(manager, "Molten Snake", Material.REDSTONE_BLOCK, (byte)0, new String[] + super(manager, "Molten Snake", Material.MAGMA_CREAM, (byte)0, new String[] { - C.cWhite + "From the distant ether realm,", - C.cWhite + "this prized dragon is said to", - C.cWhite + "obey only true Heroes!", + C.cWhite + "Deep under the earths surface, there", + C.cWhite + "exists a mythical species of Molten", + C.cWhite + "Snakes. This one will serve you eternally.", " ", C.cRed + "Unlocked with Titan Rank", }, -1); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountTitanData.java b/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountTitanData.java index a5bffc410..13868ca4d 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountTitanData.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountTitanData.java @@ -72,7 +72,7 @@ public class MountTitanData { //Head if (_head.getPassenger() != null) - _head.setVelocity(_head.getPassenger().getLocation().getDirection().multiply(0.5).add(new Vector(0,0.2,0))); + _head.setVelocity(_head.getPassenger().getLocation().getDirection().multiply(0.8).add(new Vector(0,0.2,0))); Location infront = _head.getLocation().add(0, -1.5, 0);