Merge remote-tracking branch 'update/aprilppc' into develop

This commit is contained in:
cnr 2017-03-31 00:50:55 -05:00
commit 850b7b1aad
6 changed files with 206 additions and 1 deletions

View File

@ -71,6 +71,23 @@ public class ShapeWings extends ShapeGrid implements CosmeticShape
"00000$$0000000$$00000"
};
public static final String[] BEE_WING_PATTERN = new String[]
{
"00$$$000$$$00",
"0$###$0$###$0",
"$$$$$$$$$$$$$",
"$#####$#####$",
"$$$$$$$$$$$$$",
"0$#########$0",
"00$$$$$$$$$00",
"0$#########$0",
"$$$$$$$$$$$$$",
"$#####$#####$",
"$$$$$$$$$$$$$",
"0$###$0$###$0",
"00$$$000$$$00"
};
public static final String[] SMALL_BUTTERFLY_WING_PATTERN = new String[]
{
"0$$00000000$$0",

View File

@ -165,6 +165,7 @@ import mineplex.core.gadget.gadgets.particle.ParticleFairy;
import mineplex.core.gadget.gadgets.particle.ParticleFireRings;
import mineplex.core.gadget.gadgets.particle.ParticleLegend;
import mineplex.core.gadget.gadgets.particle.ParticleWingsAngel;
import mineplex.core.gadget.gadgets.particle.ParticleWingsBee;
import mineplex.core.gadget.gadgets.particle.ParticleWingsDemons;
import mineplex.core.gadget.gadgets.particle.ParticleWingsInfernal;
import mineplex.core.gadget.gadgets.particle.ParticleWingsLove;
@ -360,6 +361,8 @@ public class GadgetManager extends MiniPlugin
addGadget(new ItemBow(this));
addGadget(new ItemLovePotion(this));
addGadget(new ItemFlowerGift(this));
// NEXT MONTH'S PPC
//addGadget(new ItemBubbleBlaster(this));
// Costume
addGadget(new OutfitRaveSuitHelmet(this));
@ -447,6 +450,7 @@ public class GadgetManager extends MiniPlugin
addGadget(new ParticleFreedom(this));
addGadget(new ParticleChristmasTree(this));
addGadget(new ParticleWingsLove(this));
addGadget(new ParticleWingsBee(this));
// Arrow Trails
addGadget(new ArrowTrailFrostLord(this));

View File

@ -0,0 +1,121 @@
package mineplex.core.gadget.gadgets.item;
import java.awt.Color;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import org.bukkit.Material;
import org.bukkit.entity.ArmorStand;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.block.Action;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.inventory.ItemStack;
import org.bukkit.util.Vector;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.LineFormat;
import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilGear;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilText;
import mineplex.core.common.util.particles.ColoredParticle;
import mineplex.core.common.util.particles.DustSpellColor;
import mineplex.core.gadget.GadgetManager;
import mineplex.core.gadget.gadgets.Ammo;
import mineplex.core.gadget.types.ItemGadget;
import mineplex.core.itemstack.ItemStackFactory;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
public class ItemBubbleBlaster extends ItemGadget
{
private Map<ArmorStand, Player> _armorStands = new HashMap<>();
public ItemBubbleBlaster(GadgetManager manager)
{
super(manager, "Bubble Blaster", UtilText.splitLinesToArray(new String[]{C.cGray + "Placeholder"}, LineFormat.LORE),
-14, Material.DIAMOND_BARDING, (byte) 0, 5000, new Ammo("Bubble", "Bubble", Material.DIAMOND_BARDING, (byte) 0, new String[]{C.cGray + "Placeholder"}, -5, 1));
}
@Override
public void disableCustom(Player player, boolean message)
{
super.disableCustom(player, message);
}
@Override
public void ActivateCustom(Player player)
{
}
@Override
@EventHandler
public void Activate(PlayerInteractEvent event)
{
if (event.getAction() != Action.RIGHT_CLICK_AIR && event.getAction() != Action.RIGHT_CLICK_BLOCK)
return;
if (UtilBlock.usable(event.getClickedBlock()))
return;
if (!UtilGear.isMat(event.getPlayer().getItemInHand(), this.getDisplayMaterial()))
return;
Player player = event.getPlayer();
if (!isActive(player))
return;
event.setCancelled(true);
player.getInventory().setItem(Manager.getActiveItemSlot(), ItemStackFactory.Instance.CreateStack(getDisplayMaterial(), getDisplayData(), 1, F.item(Manager.getInventoryManager().Get(player).getItemCount(getName()) + " " + getName())));
// TODO CHANGE COLOR IF RAINBOW
// TODO COOLDOWN AFTER MAX OF 5 SECONDS HOLDING
// TODO LAUNCH MULTIPLE WHILE HOLDING
ArmorStand armorStand = player.getWorld().spawn(player.getLocation().add(0, 1, 0), ArmorStand.class);
armorStand.setItemInHand(new ItemStack(Material.STAINED_GLASS, 1, (byte) UtilMath.random.nextInt(15)));
armorStand.setSmall(true);
armorStand.setVisible(false);
_armorStands.put(armorStand, player);
double x = UtilMath.random(0.5, 1) - 1.25, z = UtilMath.random(0.5, 1) - 1.25;
double sub = UtilMath.random(0.5, 1);
if (sub > 0.75)
UtilAction.velocity(armorStand, player.getLocation().getDirection().add(new Vector(x, 0, z)), 0.25, false, 0, 0.5, 1, false);
else
UtilAction.velocity(armorStand, player.getLocation().getDirection().subtract(new Vector(x, 0, z)), 0.25, false, 0, 0.5, 1, false);
}
@EventHandler
public void updateArmorStand(UpdateEvent event)
{
if (event.getType() != UpdateType.TICK)
return;
Iterator<Map.Entry<ArmorStand, Player>> iterator = _armorStands.entrySet().iterator();
while (iterator.hasNext())
{
Map.Entry<ArmorStand, Player> entry = iterator.next();
ArmorStand armorStand = entry.getKey();
Player player = entry.getValue();
if (armorStand.getTicksLived() >= 20)
{
ColoredParticle coloredParticle = new ColoredParticle(UtilParticle.ParticleType.RED_DUST, new DustSpellColor(Color.WHITE), armorStand.getLocation());
coloredParticle.display();
armorStand.remove();
iterator.remove();
}
}
}
}

View File

@ -0,0 +1,55 @@
package mineplex.core.gadget.gadgets.particle;
import java.awt.Color;
import java.time.Month;
import java.time.YearMonth;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.util.Vector;
import mineplex.core.common.shape.ShapeWings;
import mineplex.core.common.util.C;
import mineplex.core.common.util.LineFormat;
import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilText;
import mineplex.core.gadget.GadgetManager;
import mineplex.core.gadget.types.ParticleGadget;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
public class ParticleWingsBee extends ParticleGadget
{
private ShapeWings _wingsBlack = new ShapeWings(UtilParticle.ParticleType.RED_DUST.particleName, new Vector(1, 1, 1), 1, 0, '$', ShapeWings.DEFAULT_ROTATION, ShapeWings.BEE_WING_PATTERN);
private ShapeWings _wingsYellow = new ShapeWings(UtilParticle.ParticleType.RED_DUST.particleName, new Vector(1, 1, 1), 1, 0, '#', ShapeWings.DEFAULT_ROTATION, ShapeWings.BEE_WING_PATTERN);
public ParticleWingsBee(GadgetManager manager)
{
super(manager, "Bumblebee's Wings",
UtilText.splitLineToArray(C.cGray + "Float like a butterfly and sting like a bee with these new spring wings!", LineFormat.LORE),
-14, Material.WOOL, (byte) 4, YearMonth.of(2017, Month.APRIL));
}
@Override
public void playParticle(Player player, UpdateEvent event)
{
Location loc = player.getLocation().add(0, 1, 0).add(player.getLocation().getDirection().multiply(-0.4));
if (Manager.isMoving(player))
{
if (event.getType() == UpdateType.TICK)
{
_wingsBlack.displayColoredParticle(loc, Color.BLACK);
_wingsYellow.displayColoredParticle(loc, Color.YELLOW);
}
return;
}
if (event.getType() == UpdateType.FAST)
{
_wingsBlack.displayColored(loc, Color.BLACK);
_wingsYellow.displayColored(loc, Color.YELLOW);
}
}
}

View File

@ -1,5 +1,7 @@
package mineplex.core.gadget.types;
import java.time.YearMonth;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
@ -28,7 +30,12 @@ public abstract class ParticleGadget extends Gadget
public ParticleGadget(GadgetManager manager, String name, String[] desc, int cost, Material mat, byte data, String...altNames)
{
super(manager, GadgetType.PARTICLE, name, desc, cost, mat, data, 1, altNames);
}
}
public ParticleGadget(GadgetManager manager, String name, String[] desc, int cost, Material mat, byte data, YearMonth yearMonth, String...altNames)
{
super(manager, GadgetType.PARTICLE, name, desc, cost, mat, data, yearMonth, 1, altNames);
}
@Override
public void enableCustom(Player player, boolean message)

View File

@ -36,6 +36,7 @@ public class PowerPlayClubRewards
.put(YearMonth.of(2017, Month.JANUARY), new UnknownSalesPackageItem("Over Easy Morph"))
.put(YearMonth.of(2017, Month.FEBRUARY), new PetItem(PetType.TRUE_LOVE_PET))
.put(YearMonth.of(2017, Month.MARCH), new UnknownSalesPackageItem("Gold Pot Morph"))
.put(YearMonth.of(2017, Month.APRIL), new UnknownSalesPackageItem("Bumblebee's Wings"))
.build();
public interface PowerPlayClubItem