Varius tweaks and changes.

This commit is contained in:
Mysticate 2016-02-04 21:58:55 -05:00
parent e94222a68e
commit b414642990
7 changed files with 120 additions and 68 deletions

View File

@ -115,7 +115,6 @@ public class MountPage extends ShopPageBase<CosmeticManager, CosmeticShop>
}
}
if (getDonationManager().Get(getPlayer().getName()).OwnsUnknownPackage(mount.GetName()))
{
if (mount.GetActive().containsKey(getPlayer()))
@ -146,18 +145,18 @@ public class MountPage extends ShopPageBase<CosmeticManager, CosmeticShop>
itemLore.add(C.cBlack);
itemLore.add(C.cGreen + "Click to Purchase");
addButton(slot, new ShopItem(mount.GetDisplayMaterial(), mount.GetDisplayData(), mount.GetName(), itemLore.toArray(new String[itemLore.size()]), 1, true, false), new MountButton(mount, this));
addButton(slot, new ShopItem(Material.INK_SACK, (byte) 7, mount.GetName(), itemLore.toArray(new String[itemLore.size()]), 1, true, false), new MountButton(mount, this));
}
else if (mount.GetCost(CurrencyType.Coins) > 0)
{
itemLore.add(C.cBlack);
itemLore.add(C.cRed + "Not enough Treasure Shards.");
setItem(slot, new ShopItem(mount.GetDisplayMaterial(), mount.GetDisplayData(), mount.GetName(), itemLore.toArray(new String[itemLore.size()]), 1, true, false));
setItem(slot, new ShopItem(Material.INK_SACK, (byte) 7, mount.GetName(), itemLore.toArray(new String[itemLore.size()]), 1, true, false));
}
else
{
setItem(slot, new ShopItem(mount.GetDisplayMaterial(), mount.GetDisplayData(), mount.GetName(), itemLore.toArray(new String[itemLore.size()]), 1, true, false));
setItem(slot, new ShopItem(Material.INK_SACK, (byte) 7, mount.GetName(), itemLore.toArray(new String[itemLore.size()]), 1, true, false));
}
}

View File

@ -51,6 +51,7 @@ import mineplex.core.gadget.gadgets.hat.HatRudolph;
import mineplex.core.gadget.gadgets.hat.HatSanta;
import mineplex.core.gadget.gadgets.hat.HatSnowman;
import mineplex.core.gadget.gadgets.item.ItemBatGun;
import mineplex.core.gadget.gadgets.item.ItemBow;
import mineplex.core.gadget.gadgets.item.ItemCoal;
import mineplex.core.gadget.gadgets.item.ItemCoinBomb;
import mineplex.core.gadget.gadgets.item.ItemDuelingSword;
@ -206,6 +207,7 @@ public class GadgetManager extends MiniPlugin
addGadget(new ItemCoal(this));
addGadget(new ItemFreezeCannon(this));
addGadget(new ItemSnowball(this));
addGadget(new ItemBow(this));
// Costume
addGadget(new OutfitRaveSuitHelmet(this));

View File

@ -24,24 +24,20 @@ public class ArrowTrailHearts extends ArrowEffectGadget
{
super(manager, "Arrows of Cupid",
UtilText.splitLineToArray(C.cGray + "Tether your love to an arrow, then spear someone with it. Maybe they'll fall in love!", LineFormat.LORE),
-6,
1,
Material.APPLE, (byte) 0);
}
@Override
public void doTrail(Arrow arrow)
{
if (UtilMath.random.nextDouble() > .6)
{
UtilParticle.PlayParticleToAll(ParticleType.HEART, arrow.getLocation(), .1F, .1F, .1F, 0F, 1, ViewDist.LONGER);
return;
}
UtilParticle.PlayParticleToAll(ParticleType.HEART, arrow.getLocation(), .1F, .1F, .1F, 0F, 1, ViewDist.LONGER);
byte data = 14;
if (UtilMath.random.nextDouble() > .5)
data = 6;
UtilParticle.PlayParticleToAll(ParticleType.ICON_CRACK.getParticle(Material.WOOL, data), arrow.getLocation(), 0, 0, 0, 0.0f, 1, ViewDist.NORMAL);
UtilParticle.PlayParticleToAll(ParticleType.ICON_CRACK.getParticle(Material.WOOL, data), arrow.getLocation(), 0, 0, 0, 0.0f, 5, ViewDist.NORMAL);
}
@Override
@ -49,7 +45,7 @@ public class ArrowTrailHearts extends ArrowEffectGadget
{
UtilParticle.PlayParticleToAll(ParticleType.HEART, arrow.getLocation(), .5F, .5F, .5F, 0F, 4, ViewDist.LONGER);
UtilParticle.PlayParticleToAll(ParticleType.ICON_CRACK.getParticle(Material.WOOL, 14), arrow.getLocation(), .5F, .5F, .5F, 0.0f, 2, ViewDist.NORMAL);
UtilParticle.PlayParticleToAll(ParticleType.ICON_CRACK.getParticle(Material.WOOL, 6), arrow.getLocation(), .5F, .5F, .5F, 0.0f, 2, ViewDist.NORMAL);
UtilParticle.PlayParticleToAll(ParticleType.ICON_CRACK.getParticle(Material.WOOL, 14), arrow.getLocation(), .5F, .5F, .5F, 0.0f, 5, ViewDist.NORMAL);
UtilParticle.PlayParticleToAll(ParticleType.ICON_CRACK.getParticle(Material.WOOL, 6), arrow.getLocation(), .5F, .5F, .5F, 0.0f, 5, ViewDist.NORMAL);
}
}

View File

@ -1,5 +1,7 @@
package mineplex.core.gadget.gadgets.death;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
@ -8,9 +10,9 @@ import mineplex.core.blood.BloodEvent;
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.common.util.UtilParticle.ParticleType;
import mineplex.core.common.util.UtilParticle.ViewDist;
import mineplex.core.common.util.UtilText;
import mineplex.core.gadget.GadgetManager;
import mineplex.core.gadget.types.DeathEffectGadget;
@ -25,13 +27,14 @@ public class DeathHearts extends DeathEffectGadget
{
super(manager, "Broken Hearted",
UtilText.splitLineToArray(C.cGray + "Nothing hurts more than having your heart broken. Apart from being killed, that is.", LineFormat.LORE),
-6, Material.DOUBLE_PLANT, (byte) 4);
1, Material.DOUBLE_PLANT, (byte) 4);
}
@EventHandler
public void onBlood(BloodEvent event)
{
event.setItem(Material.RED_ROSE, (byte) 0);
if (IsActive(event.getPlayer()))
event.setItem(Material.AIR, (byte) 0);
}
@EventHandler(priority = EventPriority.MONITOR)
@ -39,7 +42,24 @@ public class DeathHearts extends DeathEffectGadget
{
if (event.isCancelled())
return;
UtilParticle.PlayParticleToAll(ParticleType.ANGRY_VILLAGER, event.getLocation(), .5F, .5F, .5F, 0F, 5, ViewDist.NORMAL);
if (IsActive(event.getPlayer()))
{
Location loc = event.getLocation().clone().add(0, .5, 0);
UtilParticle.PlayParticleToAll(ParticleType.HEART, loc, 0F, 0F, 0F, 0F, 1, ViewDist.NORMAL);
Bukkit.getScheduler().runTaskLater(Manager.getPlugin(), new Runnable()
{
@Override
public void run()
{
loc.add(0, .2, 0);
UtilParticle.PlayParticleToAll(ParticleType.ICON_CRACK.getParticle(Material.WOOL, 14), loc, .1F, .1F, .1F, 0.0f, 5, ViewDist.NORMAL);
UtilParticle.PlayParticleToAll(ParticleType.ICON_CRACK.getParticle(Material.WOOL, 6), loc, .1F, .1F, .1F, 0.0f, 5, ViewDist.NORMAL);
}
}, 10);
}
}
}

View File

@ -24,7 +24,7 @@ public class DoubleJumpHearts extends DoubleJumpEffectGadget
{
super(manager, "Wings of Love",
UtilText.splitLineToArray(C.cGray + "Nothing hurts more than having your heart broken. Apart from being killed, that is.", LineFormat.LORE),
-6, Material.RED_MUSHROOM, (byte) 0);
1, Material.RED_MUSHROOM, (byte) 0);
}
@Override

View File

@ -5,10 +5,12 @@ import java.util.HashSet;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity;
import org.bukkit.entity.Arrow;
import org.bukkit.entity.Creeper;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
import org.bukkit.entity.Snowball;
import org.bukkit.event.EventHandler;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.bukkit.event.entity.ProjectileHitEvent;
@ -42,7 +44,7 @@ public class ItemBow extends ItemGadget
* Timestamp: February 4, 2016
*/
private HashSet<Arrow> _arrows = new HashSet<Arrow>();
private HashSet<Snowball> _arrows = new HashSet<Snowball>();
private boolean _spawning = false;
private String[] _responses = new String[]
@ -76,7 +78,7 @@ public class ItemBow extends ItemGadget
PacketPlayOutSpawnEntity packet = (PacketPlayOutSpawnEntity) packetInfo.getPacket();
for (Arrow arrow : _arrows)
for (Snowball arrow : _arrows)
{
if (arrow.getEntityId() == packet.a)
{
@ -92,17 +94,16 @@ public class ItemBow extends ItemGadget
{
super(manager, "Cupid's Arrows",
UtilText.splitLineToArray(C.cGray + "This symbol of love will live on with you forever! Mainly because we couldn't attach the cupid wings to it. I guess duct tape can't fix everything!", LineFormat.LORE),
-6, Material.BOW, (byte) 0, 1000, new Ammo("Cupid Arrow", "Cupid's Arrows", Material.ARROW, (byte) 0, UtilText.splitLineToArray(C.cGray + "Use these arrows to shoot love into people's hearts!", LineFormat.LORE), -6, 15));
-6, Material.BOW, (byte) 0, 1000, new Ammo("Cupid Arrow", "Cupid's Arrows", Material.ARROW, (byte) 0, UtilText.splitLineToArray(C.cGray + "Use these arrows to shoot love into people's hearts!", LineFormat.LORE), 1, 15));
Manager.getPacketManager().addPacketHandler(_packetHandler, PacketPlayOutSpawnEntity.class);
}
@SuppressWarnings("deprecation")
@Override
public void ActivateCustom(Player player)
{
_spawning = true;
Arrow arrow = player.shootArrow();
Snowball arrow = player.launchProjectile(Snowball.class);
_spawning = false;
_arrows.add(arrow);
@ -113,7 +114,7 @@ public class ItemBow extends ItemGadget
{
if (event.getType() == UpdateType.TICK)
{
for (Arrow arrow : new HashSet<Arrow>(_arrows))
for (Snowball arrow : new HashSet<Snowball>(_arrows))
{
if (!arrow.isValid())
{
@ -129,27 +130,35 @@ public class ItemBow extends ItemGadget
@EventHandler
public void onHit(ProjectileHitEvent event)
{
if (!(event.getEntity() instanceof Arrow))
if (!(event.getEntity() instanceof Snowball))
return;
Arrow arrow = (Arrow) event.getEntity();
Snowball arrow = (Snowball) event.getEntity();
if (!_arrows.contains(arrow))
return;
_arrows.remove(arrow);
arrow.remove();
UtilPlayer.message((Player) arrow.getShooter(), F.main(C.cRed + "Cupid", "You missed the shot!"));
Bukkit.getScheduler().runTaskLater(Manager.getPlugin(), new Runnable()
{
@Override
public void run()
{
if (_arrows.remove(arrow))
{
arrow.remove();
UtilPlayer.message((Player) arrow.getShooter(), F.main(C.cRed + "Cupid", "You missed the shot!"));
}
}
}, 1);
}
@EventHandler
public void onDamage(EntityDamageByEntityEvent event)
{
if (!(event.getDamager() instanceof Arrow))
if (!(event.getDamager() instanceof Snowball))
return;
Arrow arrow = (Arrow) event.getDamager();
Snowball arrow = (Snowball) event.getDamager();
if (!_arrows.contains(arrow))
return;
@ -158,35 +167,59 @@ public class ItemBow extends ItemGadget
arrow.remove();
Player shooter = (Player) arrow.getShooter();
UtilPlayer.message(shooter, F.main(C.cRed + "Cupid", "You hit " + F.name(UtilEnt.getName(event.getEntity())) + " with an arrow! I wonder how they're feeling..."));
if (event.getEntity() instanceof Creeper && event.getEntity().getCustomName().equalsIgnoreCase(C.cGreenB + "Carl the Creeper"))
{
UtilPlayer.message(shooter, F.main(C.cRed + "Cupid", "Nobody will ever replace Carla."));
return;
}
// Effects
if (event.getEntity() instanceof Player)
{
((Player) event.getEntity()).addPotionEffect(new PotionEffect(PotionEffectType.CONFUSION, 20, 1, true, false));
if (event.getEntity() == shooter)
{
UtilPlayer.message(shooter, F.main(C.cRed + "Cupid", "We've all been there."));
return;
}
UtilPlayer.message(shooter, F.main(C.cRed + "Cupid", "You hit " + F.name(UtilEnt.getName(event.getEntity())) + " with an arrow! I wonder how they're feeling..."));
((Player) event.getEntity()).addPotionEffect(new PotionEffect(PotionEffectType.CONFUSION, 40, 1, true, false));
UtilPlayer.message(event.getEntity(), F.main(C.cRed + "Cupid", F.name(UtilEnt.getName(shooter)) + " hit you with an arrow! " + UtilMath.randomElement(_responses)));
}
Entity damaged = event.getEntity();
AxisAlignedBB bb = ((CraftEntity) damaged).getHandle().getBoundingBox();
final Location loc = damaged.getLocation().clone();
final AxisAlignedBB bounding = new AxisAlignedBB(bb.a, bb.b, bb.c, bb.d, bb.e, bb.f); // Clone it
for (double rise = bounding.b ; rise < bounding.e ; rise += .2)
{
final float y = (float) (rise - bounding.b);
final float x = (float) Math.sin(y);
final float z = (float) Math.cos(y);
Bukkit.getScheduler().runTaskLater(Manager.getPlugin(), new Runnable()
{
@Override
public void run()
{
UtilParticle.PlayParticleToAll(ParticleType.HEART, loc.clone().add(x, y, z), 0F, 0F, 0F, 0F, 1, ViewDist.LONGER);
}
}, (int) Math.floor(rise * 5));
}
UtilParticle.PlayParticleToAll(ParticleType.HEART, arrow.getLocation(), .5F, .5F, .5F, 0F, 4, ViewDist.LONGER);
UtilParticle.PlayParticleToAll(ParticleType.ICON_CRACK.getParticle(Material.WOOL, 14), arrow.getLocation(), .5F, .5F, .5F, 0.0f, 5, ViewDist.NORMAL);
UtilParticle.PlayParticleToAll(ParticleType.ICON_CRACK.getParticle(Material.WOOL, 6), arrow.getLocation(), .5F, .5F, .5F, 0.0f, 5, ViewDist.NORMAL);
shooter.playSound(shooter.getLocation(), Sound.ORB_PICKUP, 0.5f, 0.5f);
// Entity damaged = event.getEntity();
// AxisAlignedBB bb = ((CraftEntity) damaged).getHandle().getBoundingBox();
//
// final Location loc = damaged.getLocation().clone();
// final AxisAlignedBB bounding = new AxisAlignedBB(bb.a, bb.b, bb.c, bb.d, bb.e, bb.f); // Clone it
//
// int i = 0;
// for (double rise = bounding.b ; rise < bounding.e ; rise += .2)
// {
// i++;
//
// final float y = (float) (rise - bounding.b);
// final float x = (float) (Math.sin(y) * 2);
// final float z = (float) (Math.cos(y) * 2);
//
// Bukkit.getScheduler().runTaskLater(Manager.getPlugin(), new Runnable()
// {
// @Override
// public void run()
// {
// UtilParticle.PlayParticleToAll(ParticleType.HEART, loc.clone().add(x, y, z), 0F, 0F, 0F, 0F, 1, ViewDist.LONGER);
// }
// }, i);
// }
}
}

View File

@ -1,11 +1,11 @@
package mineplex.core.mount.types;
import org.bukkit.DyeColor;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.entity.Horse;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.util.Vector;
import mineplex.core.common.util.C;
import mineplex.core.common.util.LineFormat;
@ -33,7 +33,7 @@ public class MountValentinesSheep extends HorseMount
{
super(manager, "Loving Sheeples",
UtilText.splitLineToArray(C.cGray + "This symbol of love will live on with you forever! Mainly because we couldn't attach the cupid wings to it. I guess duct tape can't fix everything!", LineFormat.LORE),
Material.WOOL, (byte) 6, -6, Horse.Color.BLACK, Horse.Style.NONE, Horse.Variant.HORSE, 1.0, null);
Material.WOOL, (byte) 6, 1, Horse.Color.BLACK, Horse.Style.NONE, Horse.Variant.HORSE, 1.0, null);
}
@Override
@ -42,31 +42,31 @@ public class MountValentinesSheep extends HorseMount
super.EnableCustom(player);
Horse horse = GetActive().get(player).getEntity();
horse.setCustomName(C.cRed + player.getName() + "'s " + GetName());
UtilEnt.silence(horse, true);
DisguiseSheep disguise = new DisguiseSheep(horse);
disguise.setColor(DyeColor.PINK);
disguise.setName("");
disguise.setColor(DyeColor.PINK);
Manager.getDisguiseManager().disguise(disguise);
}
@EventHandler
public void doAnimations(UpdateEvent event)
{
if (event.getType() != UpdateType.TICK)
return;
for (SingleEntityMountData<Horse> ent : GetActive().values())
{
if (!ent.getEntity().isValid())
continue;
if (event.getType() == UpdateType.TICK)
if (event.getType() == UpdateType.FASTEST)
{
UtilParticle.PlayParticleToAll(ParticleType.HEART, ent.getEntity().getLocation().clone().add(0, .5, 0), new Vector(), 0F, 1, ViewDist.NORMAL);
Location loc = ent.getEntity().getLocation().clone().add(0, .5, 0);
UtilParticle.PlayParticleToAll(ParticleType.HEART, loc, .5F, .4F, .5F, 0F, 1, ViewDist.NORMAL);
UtilParticle.PlayParticleToAll(ParticleType.ICON_CRACK.getParticle(Material.WOOL, 14), loc, .5F, .4F, .5F, 0.0f, 1, ViewDist.NORMAL);
UtilParticle.PlayParticleToAll(ParticleType.ICON_CRACK.getParticle(Material.WOOL, 6), loc, .5F, .4F, .5F, 0.0f, 1, ViewDist.NORMAL);
}
else if (event.getType() == UpdateType.FAST)
{
@ -75,7 +75,7 @@ public class MountValentinesSheep extends HorseMount
if (disguise instanceof DisguiseSheep)
{
DisguiseSheep sheep = (DisguiseSheep) disguise;
if (sheep.getColor() == 6) // Pink
{
sheep.setColor(DyeColor.RED);
@ -88,6 +88,8 @@ public class MountValentinesSheep extends HorseMount
{
sheep.setColor(DyeColor.PINK);
}
Manager.getDisguiseManager().updateDisguise(sheep);
}
}
}