Added Spring Arrow Trail, added Spring Death Effect, moved each gadget to it's own package, added Spring Double Jump

This commit is contained in:
LCastr0 2017-03-20 16:29:30 -03:00
parent 5d2681ec97
commit 5ad0bdcab1
7 changed files with 261 additions and 6 deletions

View File

@ -45,7 +45,7 @@ import mineplex.core.gadget.event.GadgetCollideEntityEvent;
import mineplex.core.gadget.event.GadgetEnableEvent;
import mineplex.core.gadget.event.PlayerToggleSwimEvent;
import mineplex.core.gadget.event.TauntCommandEvent;
import mineplex.core.gadget.gadgets.arrowtrail.ArrowTrailHalloween;
import mineplex.core.gadget.gadgets.arrowtrail.halloween.ArrowTrailHalloween;
import mineplex.core.gadget.gadgets.arrowtrail.candycane.ArrowTrailCandyCane;
import mineplex.core.gadget.gadgets.arrowtrail.cupidslove.ArrowTrailCupid;
import mineplex.core.gadget.gadgets.arrowtrail.emerald.ArrowTrailEmerald;
@ -73,7 +73,7 @@ import mineplex.core.gadget.gadgets.death.shadow.DeathShadow;
import mineplex.core.gadget.gadgets.death.titan.DeathTitan;
import mineplex.core.gadget.gadgets.death.vampire.DeathBlood;
import mineplex.core.gadget.gadgets.death.wisdom.DeathEnchant;
import mineplex.core.gadget.gadgets.doublejump.DoubleJumpHalloween;
import mineplex.core.gadget.gadgets.doublejump.halloween.DoubleJumpHalloween;
import mineplex.core.gadget.gadgets.doublejump.candycane.DoubleJumpCandyCane;
import mineplex.core.gadget.gadgets.doublejump.cupidslove.DoubleJumpCupidsWings;
import mineplex.core.gadget.gadgets.doublejump.emerald.DoubleJumpEmerald;

View File

@ -1,4 +1,4 @@
package mineplex.core.gadget.gadgets.arrowtrail;
package mineplex.core.gadget.gadgets.arrowtrail.halloween;
import java.awt.Color;
import java.util.HashMap;

View File

@ -0,0 +1,74 @@
package mineplex.core.gadget.gadgets.arrowtrail.spring;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import org.bukkit.Material;
import org.bukkit.entity.Arrow;
import org.bukkit.entity.Item;
import org.bukkit.event.EventHandler;
import org.bukkit.event.player.PlayerPickupItemEvent;
import org.bukkit.inventory.ItemStack;
import mineplex.core.common.util.C;
import mineplex.core.common.util.LineFormat;
import mineplex.core.common.util.UtilText;
import mineplex.core.gadget.GadgetManager;
import mineplex.core.gadget.types.ArrowEffectGadget;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
public class ArrowTrailSpring extends ArrowEffectGadget
{
private List<Item> _items = new ArrayList<>();
public ArrowTrailSpring(GadgetManager manager)
{
// TODO NAME, LORE AND ICON
super(manager, "Flower Arrows", UtilText.splitLineToArray(C.cGray + "Placeholder", LineFormat.LORE),
-9, Material.GLASS, (byte) 0);
}
@Override
public void doTrail(Arrow arrow)
{
Item sunflower = arrow.getWorld().dropItem(arrow.getLocation(), new ItemStack(Material.DOUBLE_PLANT));
_items.add(sunflower);
}
@Override
public void doHitEffect(Arrow arrow)
{
}
@EventHandler
public void onPickup(PlayerPickupItemEvent event)
{
if (_items.contains(event.getItem()))
{
event.setCancelled(true);
}
}
@EventHandler
public void removeFlowers(UpdateEvent event)
{
if (event.getType() != UpdateType.TICK)
return;
Iterator<Item> iterator = _items.iterator();
while (iterator.hasNext())
{
Item item = iterator.next();
if (item.getTicksLived() >= 20)
{
item.remove();
iterator.remove();
}
}
}
}

View File

@ -0,0 +1,104 @@
package mineplex.core.gadget.gadgets.death.spring;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.entity.Item;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.player.PlayerPickupItemEvent;
import org.bukkit.util.Vector;
import mineplex.core.blood.BloodEvent;
import mineplex.core.common.util.C;
import mineplex.core.common.util.LineFormat;
import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilText;
import mineplex.core.gadget.GadgetManager;
import mineplex.core.gadget.types.DeathEffectGadget;
import mineplex.core.itemstack.ItemStackFactory;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
public class DeathSpring extends DeathEffectGadget
{
private List<Item> _items = new ArrayList<>();
public DeathSpring(GadgetManager manager)
{
// TODO NAME, LORE AND ICON
super(manager, "Flower Bouquet",
UtilText.splitLineToArray(C.cGray + "Placeholder", LineFormat.LORE),
-3,
Material.INK_SACK, (byte)1);
}
@Override
public void onBlood(Player player, BloodEvent event)
{
event.setCancelled(true);
final Location location = event.getLocation();
while (location.getBlock().getType() != Material.AIR
&& location.clone().add(0, 1, 0).getBlock().getType() != Material.AIR)
{
location.add(0, 1, 0);
}
location.getBlock().setType(Material.DOUBLE_PLANT);
location.getBlock().setData((byte) 4);
Bukkit.getScheduler().scheduleSyncDelayedTask(Manager.getPlugin(), new Runnable()
{
@Override
public void run()
{
location.getBlock().setType(Material.AIR);
// Creates red rose explosion
for (int i = 50; i < 60; i++)
{
Item rose = location.getWorld().dropItem(location.add(0.5, 1.5, 0.5), ItemStackFactory.Instance.CreateStack(Material.RED_ROSE, (byte) 0, 1, " " + i));
_items.add(rose);
Vector vel = new Vector(Math.sin(i * 9/5d), 0, Math.cos(i * 9/5d));
UtilAction.velocity(rose, vel, Math.abs(Math.sin(i * 12/3000d)), false, 0, 0.2 + Math.abs(Math.cos(i * 12/3000d))*0.6, 1, false);
}
}
}, 60L);
}
@EventHandler
public void onPickup(PlayerPickupItemEvent event)
{
if (_items.contains(event.getItem()))
{
event.setCancelled(true);
}
}
@EventHandler
public void removeFlowers(UpdateEvent event)
{
if (event.getType() != UpdateType.TICK)
return;
Iterator<Item> iterator = _items.iterator();
while (iterator.hasNext())
{
Item item = iterator.next();
if (item.getTicksLived() >= 20)
{
item.remove();
iterator.remove();
}
}
}
}

View File

@ -1,4 +1,4 @@
package mineplex.core.gadget.gadgets.doublejump;
package mineplex.core.gadget.gadgets.doublejump.halloween;
import java.awt.Color;
import java.util.HashMap;

View File

@ -0,0 +1,77 @@
package mineplex.core.gadget.gadgets.doublejump.spring;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import org.bukkit.Material;
import org.bukkit.entity.Item;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.player.PlayerPickupItemEvent;
import org.bukkit.util.Vector;
import mineplex.core.common.util.C;
import mineplex.core.common.util.LineFormat;
import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilText;
import mineplex.core.gadget.GadgetManager;
import mineplex.core.gadget.types.DoubleJumpEffectGadget;
import mineplex.core.itemstack.ItemStackFactory;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
public class DoubleJumpSpring extends DoubleJumpEffectGadget
{
private List<Item> _items = new ArrayList<>();
public DoubleJumpSpring(GadgetManager manager)
{
// TODO NAME LORE ICON
super(manager, "Flower Power", UtilText.splitLineToArray(C.cGray + "Placeholder", LineFormat.LORE), -9,
Material.GLASS, (byte) 0);
}
@Override
public void doEffect(Player player)
{
for (int i = 50; i < 60; i++)
{
Item sunflower = player.getWorld().dropItem(player.getLocation().add(0.5, 1.5, 0.5), ItemStackFactory.Instance.CreateStack(Material.DOUBLE_PLANT, (byte) 0, 1, " " + i));
_items.add(sunflower);
Vector vel = new Vector(Math.sin(i * 9/5d), 0, Math.cos(i * 9/5d));
UtilAction.velocity(sunflower, vel, Math.abs(Math.sin(i * 12/3000d)), false, 0, 0.2 + Math.abs(Math.cos(i * 12/3000d))*0.6, 1, false);
}
}
@EventHandler
public void onPickup(PlayerPickupItemEvent event)
{
if (_items.contains(event.getItem()))
{
event.setCancelled(true);
}
}
@EventHandler
public void removeFlowers(UpdateEvent event)
{
if (event.getType() != UpdateType.TICK)
return;
Iterator<Item> iterator = _items.iterator();
while (iterator.hasNext())
{
Item item = iterator.next();
if (item.getTicksLived() >= 20)
{
item.remove();
iterator.remove();
}
}
}
}

View File

@ -15,7 +15,7 @@ import mineplex.core.common.Rank;
import mineplex.core.common.util.banner.CountryFlag;
import mineplex.core.donation.DonationManager;
import mineplex.core.gadget.GadgetManager;
import mineplex.core.gadget.gadgets.arrowtrail.ArrowTrailHalloween;
import mineplex.core.gadget.gadgets.arrowtrail.halloween.ArrowTrailHalloween;
import mineplex.core.gadget.gadgets.arrowtrail.candycane.ArrowTrailCandyCane;
import mineplex.core.gadget.gadgets.arrowtrail.cupidslove.ArrowTrailCupid;
import mineplex.core.gadget.gadgets.arrowtrail.emerald.ArrowTrailEmerald;
@ -40,7 +40,7 @@ import mineplex.core.gadget.gadgets.death.party.DeathPinataBurst;
import mineplex.core.gadget.gadgets.death.shadow.DeathShadow;
import mineplex.core.gadget.gadgets.death.vampire.DeathBlood;
import mineplex.core.gadget.gadgets.death.wisdom.DeathEnchant;
import mineplex.core.gadget.gadgets.doublejump.DoubleJumpHalloween;
import mineplex.core.gadget.gadgets.doublejump.halloween.DoubleJumpHalloween;
import mineplex.core.gadget.gadgets.doublejump.candycane.DoubleJumpCandyCane;
import mineplex.core.gadget.gadgets.doublejump.cupidslove.DoubleJumpCupidsWings;
import mineplex.core.gadget.gadgets.doublejump.emerald.DoubleJumpEmerald;