Love train mount

This commit is contained in:
LCastr0 2017-01-16 19:02:22 -02:00
parent 28442abbbd
commit 694b2f69b2
17 changed files with 215 additions and 37 deletions

View File

@ -1,9 +1,9 @@
package mineplex.core.gadget.gadgets.arrowtrail;
import java.awt.Color;
import java.util.HashMap;
import java.util.Map;
import org.bukkit.Color;
import org.bukkit.Material;
import org.bukkit.entity.Arrow;

View File

@ -1,7 +1,8 @@
package mineplex.core.gadget.gadgets.arrowtrail.freedom;
import java.awt.Color;
import org.bukkit.ChatColor;
import org.bukkit.Color;
import org.bukkit.Material;
import org.bukkit.entity.Arrow;

View File

@ -1,10 +1,10 @@
package mineplex.core.gadget.gadgets.doublejump;
import java.awt.Color;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import org.bukkit.Color;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.entity.Player;

View File

@ -1,9 +1,9 @@
package mineplex.core.gadget.gadgets.wineffect;
import java.awt.Color;
import java.util.ArrayList;
import java.util.List;
import org.bukkit.Color;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.Sound;
@ -26,8 +26,8 @@ import mineplex.core.common.util.particles.ColoredParticle;
import mineplex.core.common.util.particles.DustSpellColor;
import mineplex.core.disguise.disguises.DisguisePlayer;
import mineplex.core.gadget.GadgetManager;
import mineplex.core.particleeffects.BabyFireworkEffect;
import mineplex.core.gadget.types.WinEffectGadget;
import mineplex.core.particleeffects.BabyFireworkEffect;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.core.utils.UtilVariant;

View File

@ -30,6 +30,7 @@ import mineplex.core.mount.types.MountChicken;
import mineplex.core.mount.types.MountDragon;
import mineplex.core.mount.types.MountFreedomHorse;
import mineplex.core.mount.types.MountFrost;
import mineplex.core.mount.types.MountLoveTrain;
import mineplex.core.mount.types.MountMule;
import mineplex.core.mount.types.MountNightmareSteed;
import mineplex.core.mount.types.MountSlime;
@ -81,6 +82,7 @@ public class MountManager extends MiniPlugin
// Hidden in this update
_types.add(new MountChicken(this));
_types.add(new MountCake(this));
_types.add(new MountLoveTrain(this));
//_types.add(new MountSheep(this));
}

View File

@ -0,0 +1,137 @@
package mineplex.core.mount.types;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.entity.Horse;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.inventory.ItemStack;
import mineplex.core.common.util.F;
import mineplex.core.common.util.LineFormat;
import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilAlg;
import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilText;
import mineplex.core.disguise.disguises.DisguiseBlock;
import mineplex.core.mount.HorseMount;
import mineplex.core.mount.MountManager;
import mineplex.core.mount.SingleEntityMountData;
import mineplex.core.recharge.Recharge;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.core.utils.UtilVariant;
public class MountLoveTrain extends HorseMount
{
public MountLoveTrain(MountManager manager)
{
super(manager, "Love Train",
UtilText.splitLinesToArray(new String[]{"Placeholder"}, LineFormat.LORE),
Material.APPLE, (byte) 0, -17, Horse.Color.BLACK, Horse.Style.NONE, Horse.Variant.HORSE, 2.0, Material.AIR);
}
@Override
public void enableCustom(Player player)
{
player.leaveVehicle();
player.eject();
//Remove other mounts
Manager.DeregisterAll(player);
Horse horse = UtilVariant.spawnHorse(player.getLocation(), _variant);
horse.setAdult();
horse.setAgeLock(true);
horse.setColor(_color);
horse.setStyle(_style);
horse.setOwner(player);
horse.setMaxDomestication(1);
horse.setJumpStrength(_jump);
horse.setMaxHealth(20);
horse.setHealth(horse.getMaxHealth());
horse.getInventory().setSaddle(new ItemStack(Material.SADDLE));
if (horse.getVariant() == Horse.Variant.MULE)
horse.setCarryingChest(true);
if (_armor != null)
horse.getInventory().setArmor(new ItemStack(_armor));
horse.setCustomName(player.getName() + "'s " + getName());
//Inform
UtilPlayer.message(player, F.main("Mount", "You spawned " + F.elem(getName()) + "."));
//Store
SingleEntityMountData<Horse> mount = new SingleEntityMountData<>(player, horse);
_active.put(player, mount);
DisguiseBlock block = new DisguiseBlock(horse, Material.BARRIER.getId(), 0);
Manager.getDisguiseManager().disguise(block);
UtilEnt.silence(horse, true);
}
@EventHandler
public void updateBounce(UpdateEvent event)
{
if (event.getType() != UpdateType.TICK)
return;
//Collide
for (SingleEntityMountData<Horse> loveTrainData : getActive().values())
{
Horse loveTrain = loveTrainData.getEntity();
UtilParticle.PlayParticle(UtilParticle.ParticleType.HEART, loveTrain.getLocation(), 0.25f, 0.25f, 0.25f, 0.5f, 7, UtilParticle.ViewDist.NORMAL);
if (loveTrain.getPassenger() == null)
continue;
if (!(loveTrain.getPassenger() instanceof Player))
continue;
Player player = (Player) loveTrain.getPassenger();
if (!Recharge.Instance.usable(player, getName() + " Collide"))
continue;
for (SingleEntityMountData<Horse> otherData : getActive().values())
{
Horse other = otherData.getEntity();
if (other.equals(loveTrain))
continue;
if (other.getPassenger() == null)
continue;
if (!(other.getPassenger() instanceof Player))
continue;
Player otherPlayer = (Player)other.getPassenger();
if (!Recharge.Instance.usable(otherPlayer, getName() + " Collide"))
continue;
//Collide
if (UtilMath.offset(loveTrain, other) > 2)
continue;
Recharge.Instance.useForce(player, getName() + " Collide", 500);
Recharge.Instance.useForce(otherPlayer, getName() + " Collide", 500);
UtilAction.velocity(loveTrain, UtilAlg.getTrajectory(other, loveTrain), 1.2, false, 0, 0.8, 10, true);
UtilAction.velocity(other, UtilAlg.getTrajectory(loveTrain, other), 1.2, false, 0, 0.8, 10, true);
loveTrain.getWorld().playSound(loveTrain.getLocation(), Sound.SLIME_WALK, 1f, 0.75f);
other.getWorld().playSound(other.getLocation(), Sound.SLIME_WALK, 1f, 0.75f);
}
}
}
}

View File

@ -1,18 +1,10 @@
package mineplex.core.mount.types;
import java.awt.Color;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import mineplex.core.common.util.*;
import mineplex.core.common.util.particles.ColoredParticle;
import mineplex.core.common.util.particles.DustSpellColor;
import mineplex.core.mount.HorseMount;
import mineplex.core.mount.MountManager;
import mineplex.core.mount.SingleEntityMountData;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import org.bukkit.Color;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.BlockFace;
@ -21,6 +13,24 @@ import org.bukkit.entity.Horse;
import org.bukkit.event.EventHandler;
import org.bukkit.util.Vector;
import mineplex.core.common.util.C;
import mineplex.core.common.util.LineFormat;
import mineplex.core.common.util.UtilAlg;
import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilText;
import mineplex.core.common.util.UtilTime;
import mineplex.core.common.util.particles.ColoredParticle;
import mineplex.core.common.util.particles.DustSpellColor;
import mineplex.core.mount.HorseMount;
import mineplex.core.mount.MountManager;
import mineplex.core.mount.SingleEntityMountData;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
public class MountNightmareSteed extends HorseMount
{

View File

@ -1,8 +1,8 @@
package mineplex.core.particleeffects;
import java.awt.Color;
import java.util.Random;
import org.bukkit.Color;
import org.bukkit.Location;
import org.bukkit.plugin.java.JavaPlugin;

View File

@ -1,6 +1,7 @@
package mineplex.core.particleeffects;
import org.bukkit.Color;
import java.awt.Color;
import org.bukkit.Location;
import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin;
@ -39,7 +40,7 @@ public class ChristmasTreeEffect extends Effect
if (_manager.isMoving(_player))
{
Location loc = _player.getLocation().add(0, 1.2, 0).add(_player.getLocation().getDirection().multiply(-0.2));
ColoredParticle coloredParticle = new ColoredParticle(UtilParticle.ParticleType.RED_DUST, new DustSpellColor(Color.MAROON), loc);
ColoredParticle coloredParticle = new ColoredParticle(UtilParticle.ParticleType.RED_DUST, new DustSpellColor(new Color(8388608)), loc);
coloredParticle.display();
coloredParticle.setColor(new DustSpellColor(Color.GREEN));
coloredParticle.display();

View File

@ -1,9 +1,9 @@
package mineplex.core.particleeffects;
import java.awt.Color;
import java.util.ArrayList;
import java.util.List;
import org.bukkit.Color;
import org.bukkit.Location;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.util.Vector;

View File

@ -1,6 +1,7 @@
package mineplex.core.particleeffects;
import org.bukkit.Color;
import java.awt.Color;
import org.bukkit.Location;
import org.bukkit.entity.Entity;
import org.bukkit.plugin.java.JavaPlugin;

View File

@ -1,6 +1,7 @@
package mineplex.core.particleeffects;
import org.bukkit.Color;
import java.awt.Color;
import org.bukkit.FireworkEffect;
import org.bukkit.entity.Entity;
import org.bukkit.plugin.java.JavaPlugin;

View File

@ -1,6 +1,7 @@
package mineplex.core.particleeffects;
import org.bukkit.Color;
import java.awt.Color;
import org.bukkit.Location;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.util.Vector;

View File

@ -1,9 +1,9 @@
package mineplex.core.particleeffects;
import java.awt.Color;
import java.util.HashMap;
import java.util.HashSet;
import org.bukkit.Color;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.Sound;

View File

@ -3,7 +3,6 @@ package mineplex.core.particleeffects;
import java.awt.*;
import java.awt.image.BufferedImage;
import org.bukkit.Color;
import org.bukkit.Location;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.util.Vector;

View File

@ -1,29 +1,54 @@
package mineplex.core.treasure;
import java.util.*;
import java.awt.Color;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.Random;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import mineplex.core.blockrestore.BlockRestore;
import mineplex.core.common.Rank;
import mineplex.core.common.util.*;
import mineplex.core.common.util.UtilParticle.ViewDist;
import mineplex.core.common.util.particles.ColoredParticle;
import mineplex.core.common.util.particles.DustSpellColor;
import mineplex.core.hologram.HologramManager;
import mineplex.core.reward.*;
import mineplex.core.status.ServerStatusManager;
import mineplex.core.rankGiveaway.redis.TitanChestGiveawayMessage;
import mineplex.core.treasure.animation.*;
import net.minecraft.server.v1_8_R3.BlockPosition;
import net.minecraft.server.v1_8_R3.PacketPlayOutBlockAction;
import org.bukkit.Bukkit;
import org.bukkit.Color;
import org.bukkit.Effect;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.craftbukkit.v1_8_R3.util.CraftMagicNumbers;
import org.bukkit.entity.Player;
import mineplex.core.blockrestore.BlockRestore;
import mineplex.core.common.Rank;
import mineplex.core.common.util.C;
import mineplex.core.common.util.Callback;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilParticle.ViewDist;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.particles.ColoredParticle;
import mineplex.core.common.util.particles.DustSpellColor;
import mineplex.core.hologram.HologramManager;
import mineplex.core.rankGiveaway.redis.TitanChestGiveawayMessage;
import mineplex.core.reward.RankRewardData;
import mineplex.core.reward.Reward;
import mineplex.core.reward.RewardData;
import mineplex.core.reward.RewardRarity;
import mineplex.core.reward.RewardType;
import mineplex.core.status.ServerStatusManager;
import mineplex.core.treasure.animation.Animation;
import mineplex.core.treasure.animation.BlockChangeAnimation;
import mineplex.core.treasure.animation.ChestOpenAnimation;
import mineplex.core.treasure.animation.ChestSpawnAnimation;
import mineplex.core.treasure.animation.FreedomChestAnimation;
import mineplex.core.treasure.animation.LootLegendaryAnimation;
import mineplex.core.treasure.animation.LootMythicalAnimation;
import mineplex.core.treasure.animation.LootRareAnimation;
import mineplex.core.treasure.animation.LootUncommonAnimation;
import mineplex.core.treasure.animation.TreasureRemoveAnimation;
/**
* Created by Shaun on 8/27/2014.
*/

View File

@ -1,11 +1,11 @@
package mineplex.core.treasure.animation;
import java.awt.Color;
import java.util.List;
import net.minecraft.server.v1_8_R3.BlockPosition;
import net.minecraft.server.v1_8_R3.MathHelper;
import org.bukkit.Color;
import org.bukkit.Location;
import org.bukkit.block.Block;
import org.bukkit.craftbukkit.v1_8_R3.CraftWorld;