Merge remote-tracking branch 'remotes/origin/master' into virizion_speed_builder
This commit is contained in:
commit
c3a564faa7
@ -33,6 +33,7 @@ import org.bukkit.craftbukkit.v1_8_R3.CraftWorld;
|
|||||||
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftCreature;
|
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftCreature;
|
||||||
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity;
|
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity;
|
||||||
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftLivingEntity;
|
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftLivingEntity;
|
||||||
|
import org.bukkit.entity.ArmorStand;
|
||||||
import org.bukkit.entity.Creature;
|
import org.bukkit.entity.Creature;
|
||||||
import org.bukkit.entity.Entity;
|
import org.bukkit.entity.Entity;
|
||||||
import org.bukkit.entity.EntityType;
|
import org.bukkit.entity.EntityType;
|
||||||
@ -803,6 +804,20 @@ public class UtilEnt
|
|||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void setAI(LivingEntity entity, boolean ai)
|
||||||
|
{
|
||||||
|
if(entity instanceof ArmorStand)
|
||||||
|
{
|
||||||
|
((ArmorStand)entity).setGravity(ai);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
CraftEntity e = (CraftEntity)entity;
|
||||||
|
if(e.getHandle() instanceof EntityInsentient)
|
||||||
|
{
|
||||||
|
((EntityInsentient)e.getHandle()).k(!ai);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static boolean inWater(LivingEntity ent)
|
public static boolean inWater(LivingEntity ent)
|
||||||
{
|
{
|
||||||
|
@ -43,6 +43,14 @@ public class MountPage extends ShopPageBase<CosmeticManager, CosmeticShop>
|
|||||||
if (slot == 26)
|
if (slot == 26)
|
||||||
slot = 28;
|
slot = 28;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
addButton(4, new ShopItem(Material.BED, C.cGray + " \u21FD Go Back", new String[]{}, 1, false), new IButton()
|
||||||
|
{
|
||||||
|
public void onClick(Player player, ClickType clickType)
|
||||||
|
{
|
||||||
|
getShop().openPageForPlayer(getPlayer(), new Menu(getPlugin(), getShop(), getClientManager(), getDonationManager(), player));
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void addMount(Mount<?> mount, int slot)
|
protected void addMount(Mount<?> mount, int slot)
|
||||||
@ -76,12 +84,5 @@ public class MountPage extends ShopPageBase<CosmeticManager, CosmeticShop>
|
|||||||
setItem(slot, new ShopItem(mount.GetDisplayMaterial(), mount.GetDisplayData(), (mount.GetCost(CurrencyType.Coins) < 0 ? "" : "Purchase ") + mount.GetName(), itemLore.toArray(new String[itemLore.size()]), 1, true, false));
|
setItem(slot, new ShopItem(mount.GetDisplayMaterial(), mount.GetDisplayData(), (mount.GetCost(CurrencyType.Coins) < 0 ? "" : "Purchase ") + mount.GetName(), itemLore.toArray(new String[itemLore.size()]), 1, true, false));
|
||||||
}
|
}
|
||||||
|
|
||||||
addButton(4, new ShopItem(Material.BED, C.cGray + " \u21FD Go Back", new String[]{}, 1, false), new IButton()
|
|
||||||
{
|
|
||||||
public void onClick(Player player, ClickType clickType)
|
|
||||||
{
|
|
||||||
getShop().openPageForPlayer(getPlayer(), new Menu(getPlugin(), getShop(), getClientManager(), getDonationManager(), player));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,7 +1,7 @@
|
|||||||
package mineplex.core.mount;
|
package mineplex.core.mount;
|
||||||
|
|
||||||
import mineplex.core.common.util.UtilAlg;
|
import java.util.ArrayList;
|
||||||
import mineplex.core.common.util.UtilEnt;
|
import java.util.List;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
@ -13,12 +13,14 @@ import org.bukkit.entity.Entity;
|
|||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.util.Vector;
|
import org.bukkit.util.Vector;
|
||||||
|
|
||||||
public class DragonData
|
import mineplex.core.common.util.UtilAlg;
|
||||||
|
import mineplex.core.common.util.UtilEnt;
|
||||||
|
|
||||||
|
public class DragonData extends MountData
|
||||||
{
|
{
|
||||||
DragonMount Host;
|
DragonMount Host;
|
||||||
|
|
||||||
public EnderDragon Dragon;
|
public EnderDragon Dragon;
|
||||||
public Player Rider;
|
|
||||||
|
|
||||||
public Entity TargetEntity = null;
|
public Entity TargetEntity = null;
|
||||||
|
|
||||||
@ -31,9 +33,8 @@ public class DragonData
|
|||||||
|
|
||||||
public DragonData(DragonMount dragonMount, Player rider)
|
public DragonData(DragonMount dragonMount, Player rider)
|
||||||
{
|
{
|
||||||
Host = dragonMount;
|
super(rider);
|
||||||
|
Host = dragonMount;
|
||||||
Rider = rider;
|
|
||||||
|
|
||||||
Velocity = rider.getLocation().getDirection().setY(0).normalize();
|
Velocity = rider.getLocation().getDirection().setY(0).normalize();
|
||||||
Pitch = UtilAlg.GetPitch(rider.getLocation().getDirection());
|
Pitch = UtilAlg.GetPitch(rider.getLocation().getDirection());
|
||||||
@ -51,25 +52,34 @@ public class DragonData
|
|||||||
Chicken = rider.getWorld().spawn(rider.getLocation(), Chicken.class);
|
Chicken = rider.getWorld().spawn(rider.getLocation(), Chicken.class);
|
||||||
Dragon.setPassenger(Chicken);
|
Dragon.setPassenger(Chicken);
|
||||||
|
|
||||||
Chicken.setPassenger(Rider);
|
Chicken.setPassenger(getOwner());
|
||||||
|
|
||||||
Bukkit.getServer().getScheduler().runTaskLater(Host.Manager.getPlugin(), new Runnable()
|
Bukkit.getServer().getScheduler().runTaskLater(Host.Manager.getPlugin(), new Runnable()
|
||||||
{
|
{
|
||||||
public void run()
|
public void run()
|
||||||
{
|
{
|
||||||
Chicken.setPassenger(Rider);
|
Chicken.setPassenger(getOwner());
|
||||||
}
|
}
|
||||||
}, 10L);
|
}, 10L);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Move()
|
public void Move()
|
||||||
{
|
{
|
||||||
Rider.eject();
|
getOwner().eject();
|
||||||
((CraftEnderDragon)Dragon).getHandle().setTargetBlock(GetTarget().getBlockX(), GetTarget().getBlockY(), GetTarget().getBlockZ());
|
((CraftEnderDragon)Dragon).getHandle().setTargetBlock(GetTarget().getBlockX(), GetTarget().getBlockY(), GetTarget().getBlockZ());
|
||||||
}
|
}
|
||||||
|
|
||||||
public Location GetTarget()
|
public Location GetTarget()
|
||||||
{
|
{
|
||||||
return Rider.getLocation().add(Rider.getLocation().getDirection().multiply(40));
|
return getOwner().getLocation().add(getOwner().getLocation().getDirection().multiply(40));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<Entity> getEntityParts()
|
||||||
|
{
|
||||||
|
List<Entity> list = new ArrayList<Entity>();
|
||||||
|
list.add(Dragon);
|
||||||
|
list.add(Chicken);
|
||||||
|
return list;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,6 @@ import org.bukkit.entity.Player;
|
|||||||
|
|
||||||
import mineplex.core.common.util.F;
|
import mineplex.core.common.util.F;
|
||||||
import mineplex.core.common.util.UtilPlayer;
|
import mineplex.core.common.util.UtilPlayer;
|
||||||
import mineplex.core.disguise.disguises.DisguiseChicken;
|
|
||||||
|
|
||||||
public class DragonMount extends Mount<DragonData>
|
public class DragonMount extends Mount<DragonData>
|
||||||
{
|
{
|
||||||
|
@ -22,7 +22,7 @@ import org.bukkit.entity.Horse.Style;
|
|||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
public class HorseMount extends Mount<Horse>
|
public class HorseMount extends Mount<SingleEntityMountData<Horse>>
|
||||||
{
|
{
|
||||||
protected Color _color;
|
protected Color _color;
|
||||||
protected Style _style;
|
protected Style _style;
|
||||||
@ -53,7 +53,7 @@ public class HorseMount extends Mount<Horse>
|
|||||||
while (activeIterator.hasNext())
|
while (activeIterator.hasNext())
|
||||||
{
|
{
|
||||||
Player player = activeIterator.next();
|
Player player = activeIterator.next();
|
||||||
Horse horse = _active.get(player);
|
Horse horse = _active.get(player).getEntity();
|
||||||
|
|
||||||
//Invalid (dead)
|
//Invalid (dead)
|
||||||
if (!horse.isValid())
|
if (!horse.isValid())
|
||||||
@ -113,15 +113,16 @@ public class HorseMount extends Mount<Horse>
|
|||||||
UtilPlayer.message(player, F.main("Mount", "You spawned " + F.elem(GetName()) + "."));
|
UtilPlayer.message(player, F.main("Mount", "You spawned " + F.elem(GetName()) + "."));
|
||||||
|
|
||||||
//Store
|
//Store
|
||||||
_active.put(player, horse);
|
SingleEntityMountData<Horse> mount = new SingleEntityMountData<Horse>(player, horse);
|
||||||
|
_active.put(player, mount);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Disable(Player player)
|
public void Disable(Player player)
|
||||||
{
|
{
|
||||||
Horse horse = _active.remove(player);
|
SingleEntityMountData<Horse> mount = _active.remove(player);
|
||||||
if (horse != null)
|
if (mount != null)
|
||||||
{
|
{
|
||||||
horse.remove();
|
mount.remove();
|
||||||
|
|
||||||
//Inform
|
//Inform
|
||||||
UtilPlayer.message(player, F.main("Mount", "You despawned " + F.elem(GetName()) + "."));
|
UtilPlayer.message(player, F.main("Mount", "You despawned " + F.elem(GetName()) + "."));
|
||||||
|
@ -5,6 +5,7 @@ import java.util.HashSet;
|
|||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.entity.Entity;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
@ -18,7 +19,7 @@ import mineplex.core.common.util.UtilServer;
|
|||||||
import mineplex.core.mount.event.MountActivateEvent;
|
import mineplex.core.mount.event.MountActivateEvent;
|
||||||
import mineplex.core.shop.item.SalesPackageBase;
|
import mineplex.core.shop.item.SalesPackageBase;
|
||||||
|
|
||||||
public abstract class Mount<T> extends SalesPackageBase implements Listener
|
public abstract class Mount<T extends MountData> extends SalesPackageBase implements Listener
|
||||||
{
|
{
|
||||||
protected HashSet<Player> _owners = new HashSet<Player>();
|
protected HashSet<Player> _owners = new HashSet<Player>();
|
||||||
protected HashMap<Player, T> _active = new HashMap<Player, T>();
|
protected HashMap<Player, T> _active = new HashMap<Player, T>();
|
||||||
@ -51,8 +52,8 @@ public abstract class Mount<T> extends SalesPackageBase implements Listener
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Manager.setActive(player, this);
|
|
||||||
EnableCustom(player);
|
EnableCustom(player);
|
||||||
|
Manager.setActive(player, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public abstract void EnableCustom(Player player);
|
public abstract void EnableCustom(Player player);
|
||||||
@ -97,4 +98,13 @@ public abstract class Mount<T> extends SalesPackageBase implements Listener
|
|||||||
{
|
{
|
||||||
return _owners.contains(player);
|
return _owners.contains(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public T getMountData(Entity ent)
|
||||||
|
{
|
||||||
|
for(T data : GetActive().values())
|
||||||
|
{
|
||||||
|
if(data.isPartOfMount(ent)) return data;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
43
Plugins/Mineplex.Core/src/mineplex/core/mount/MountData.java
Normal file
43
Plugins/Mineplex.Core/src/mineplex/core/mount/MountData.java
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
package mineplex.core.mount;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.bukkit.entity.Entity;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
public abstract class MountData
|
||||||
|
{
|
||||||
|
|
||||||
|
protected Player _owner;
|
||||||
|
|
||||||
|
public MountData(Player player)
|
||||||
|
{
|
||||||
|
_owner = player;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isPartOfMount(Entity ent)
|
||||||
|
{
|
||||||
|
return getEntityParts().contains(ent);
|
||||||
|
}
|
||||||
|
|
||||||
|
public abstract List<Entity> getEntityParts();
|
||||||
|
|
||||||
|
public boolean ownsMount(Player p)
|
||||||
|
{
|
||||||
|
return _owner.equals(p);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Player getOwner()
|
||||||
|
{
|
||||||
|
return _owner;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void remove()
|
||||||
|
{
|
||||||
|
for(Entity e : getEntityParts())
|
||||||
|
{
|
||||||
|
e.remove();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -3,6 +3,17 @@ package mineplex.core.mount;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.entity.Entity;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.EventHandler;
|
||||||
|
import org.bukkit.event.entity.ItemSpawnEvent;
|
||||||
|
import org.bukkit.event.entity.PlayerDeathEvent;
|
||||||
|
import org.bukkit.event.player.PlayerInteractAtEntityEvent;
|
||||||
|
import org.bukkit.event.player.PlayerInteractEntityEvent;
|
||||||
|
import org.bukkit.event.player.PlayerQuitEvent;
|
||||||
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
|
||||||
import mineplex.core.MiniPlugin;
|
import mineplex.core.MiniPlugin;
|
||||||
import mineplex.core.account.CoreClientManager;
|
import mineplex.core.account.CoreClientManager;
|
||||||
import mineplex.core.blockrestore.BlockRestore;
|
import mineplex.core.blockrestore.BlockRestore;
|
||||||
@ -22,17 +33,6 @@ import mineplex.core.mount.types.MountTitan;
|
|||||||
import mineplex.core.mount.types.MountUndead;
|
import mineplex.core.mount.types.MountUndead;
|
||||||
import mineplex.core.mount.types.MountZombie;
|
import mineplex.core.mount.types.MountZombie;
|
||||||
|
|
||||||
import org.bukkit.Material;
|
|
||||||
import org.bukkit.entity.Entity;
|
|
||||||
import org.bukkit.entity.Horse;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.event.EventHandler;
|
|
||||||
import org.bukkit.event.entity.ItemSpawnEvent;
|
|
||||||
import org.bukkit.event.entity.PlayerDeathEvent;
|
|
||||||
import org.bukkit.event.player.PlayerInteractEntityEvent;
|
|
||||||
import org.bukkit.event.player.PlayerQuitEvent;
|
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
|
||||||
|
|
||||||
public class MountManager extends MiniPlugin
|
public class MountManager extends MiniPlugin
|
||||||
{
|
{
|
||||||
private CoreClientManager _clientManager;
|
private CoreClientManager _clientManager;
|
||||||
@ -84,32 +84,30 @@ public class MountManager extends MiniPlugin
|
|||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void HorseInteract(PlayerInteractEntityEvent event)
|
public void mountInteract(PlayerInteractAtEntityEvent event)
|
||||||
|
{
|
||||||
|
MountData mount = getMountData(event.getRightClicked());
|
||||||
|
|
||||||
|
if(mount == null) return;
|
||||||
|
|
||||||
|
if(mount.ownsMount(event.getPlayer())) return;
|
||||||
|
|
||||||
|
event.setCancelled(true);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void mountInteract(PlayerInteractEntityEvent event)
|
||||||
{
|
{
|
||||||
if (!(event.getRightClicked() instanceof Horse))
|
MountData mount = getMountData(event.getRightClicked());
|
||||||
return;
|
|
||||||
|
|
||||||
boolean found = false;
|
if(mount == null) return;
|
||||||
for (Mount mount : _playerActiveMountMap.values())
|
|
||||||
{
|
|
||||||
if (mount.GetActive().containsValue(event.getRightClicked()))
|
|
||||||
{
|
|
||||||
found = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!found)
|
if(mount.ownsMount(event.getPlayer())) return;
|
||||||
return;
|
|
||||||
|
UtilPlayer.message(event.getPlayer(), F.main("Mount", "This is not your Mount!"));
|
||||||
Player player = event.getPlayer();
|
event.setCancelled(true);
|
||||||
Horse horse = (Horse)event.getRightClicked();
|
|
||||||
|
|
||||||
if (horse.getOwner() == null || !horse.getOwner().equals(player))
|
|
||||||
{
|
|
||||||
UtilPlayer.message(player, F.main("Mount", "This is not your Mount!"));
|
|
||||||
event.setCancelled(true);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
@ -178,16 +176,28 @@ public class MountManager extends MiniPlugin
|
|||||||
{
|
{
|
||||||
return _disguiseManager;
|
return _disguiseManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isMount(Entity ent)
|
public MountData getMountData(Entity ent)
|
||||||
{
|
{
|
||||||
for (Mount<?> mount : _playerActiveMountMap.values())
|
for (Mount<?> mount : _playerActiveMountMap.values())
|
||||||
{
|
{
|
||||||
if (mount.GetActive().values().contains(ent))
|
MountData data = mount.getMountData(ent);
|
||||||
{
|
if(data != null) return data;
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return false;
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Mount<?> getMount(Entity ent)
|
||||||
|
{
|
||||||
|
for (Mount<?> mount : _playerActiveMountMap.values())
|
||||||
|
{
|
||||||
|
if(mount.getMountData(ent) != null) return mount;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isMount(Entity ent)
|
||||||
|
{
|
||||||
|
return getMount(ent) != null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,35 @@
|
|||||||
|
package mineplex.core.mount;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.bukkit.entity.Entity;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
public class SingleEntityMountData<T extends Entity> extends MountData
|
||||||
|
{
|
||||||
|
|
||||||
|
protected T Entity;
|
||||||
|
|
||||||
|
public SingleEntityMountData(Player player, T ent)
|
||||||
|
{
|
||||||
|
super(player);
|
||||||
|
Entity = ent;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<Entity> getEntityParts()
|
||||||
|
{
|
||||||
|
List<Entity> list = new ArrayList<Entity>();
|
||||||
|
list.add(Entity);
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
public T getEntity()
|
||||||
|
{
|
||||||
|
return Entity;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -1,5 +1,6 @@
|
|||||||
package mineplex.core.mount.types;
|
package mineplex.core.mount.types;
|
||||||
|
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.Sound;
|
import org.bukkit.Sound;
|
||||||
@ -18,23 +19,12 @@ import mineplex.core.common.util.UtilMath;
|
|||||||
import mineplex.core.common.util.UtilPlayer;
|
import mineplex.core.common.util.UtilPlayer;
|
||||||
import mineplex.core.mount.Mount;
|
import mineplex.core.mount.Mount;
|
||||||
import mineplex.core.mount.MountManager;
|
import mineplex.core.mount.MountManager;
|
||||||
|
import mineplex.core.mount.SingleEntityMountData;
|
||||||
import mineplex.core.recharge.Recharge;
|
import mineplex.core.recharge.Recharge;
|
||||||
import mineplex.core.updater.UpdateType;
|
import mineplex.core.updater.UpdateType;
|
||||||
import mineplex.core.updater.event.UpdateEvent;
|
import mineplex.core.updater.event.UpdateEvent;
|
||||||
|
|
||||||
|
public class MountCart extends Mount<SingleEntityMountData<Minecart>>
|
||||||
import org.bukkit.ChatColor;
|
|
||||||
import org.bukkit.Material;
|
|
||||||
import org.bukkit.Sound;
|
|
||||||
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftMinecart;
|
|
||||||
import org.bukkit.entity.Minecart;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.event.EventHandler;
|
|
||||||
import org.bukkit.event.entity.EntityTargetEvent;
|
|
||||||
import org.bukkit.event.player.PlayerInteractEntityEvent;
|
|
||||||
import org.bukkit.event.vehicle.VehicleDamageEvent;
|
|
||||||
|
|
||||||
public class MountCart extends Mount<Minecart>
|
|
||||||
{
|
{
|
||||||
public MountCart(MountManager manager)
|
public MountCart(MountManager manager)
|
||||||
{
|
{
|
||||||
@ -56,7 +46,7 @@ public class MountCart extends Mount<Minecart>
|
|||||||
//Remove other mounts
|
//Remove other mounts
|
||||||
Manager.DeregisterAll(player);
|
Manager.DeregisterAll(player);
|
||||||
|
|
||||||
Minecart mount = player.getWorld().spawn(player.getLocation().add(0, 2, 0), Minecart.class);
|
SingleEntityMountData<Minecart> mount = new SingleEntityMountData<Minecart>(player, player.getWorld().spawn(player.getLocation().add(0, 2, 0), Minecart.class));
|
||||||
|
|
||||||
//Inform
|
//Inform
|
||||||
UtilPlayer.message(player, F.main("Mount", "You spawned " + F.elem(GetName()) + "."));
|
UtilPlayer.message(player, F.main("Mount", "You spawned " + F.elem(GetName()) + "."));
|
||||||
@ -67,7 +57,7 @@ public class MountCart extends Mount<Minecart>
|
|||||||
|
|
||||||
public void Disable(Player player)
|
public void Disable(Player player)
|
||||||
{
|
{
|
||||||
Minecart mount = _active.remove(player);
|
SingleEntityMountData<Minecart> mount = _active.remove(player);
|
||||||
if (mount != null)
|
if (mount != null)
|
||||||
{
|
{
|
||||||
mount.remove();
|
mount.remove();
|
||||||
@ -85,14 +75,11 @@ public class MountCart extends Mount<Minecart>
|
|||||||
if (event.getRightClicked() == null)
|
if (event.getRightClicked() == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!GetActive().containsKey(event.getPlayer()))
|
SingleEntityMountData<Minecart> mount = GetActive().get(event.getPlayer());
|
||||||
return;
|
|
||||||
|
|
||||||
if (!GetActive().get(event.getPlayer()).equals(event.getRightClicked()))
|
if(mount == null) return;
|
||||||
{
|
|
||||||
UtilPlayer.message(event.getPlayer(), F.main("Mount", "This is not your Mount!"));
|
if(!mount.ownsMount(event.getPlayer())) return;
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
event.getPlayer().leaveVehicle();
|
event.getPlayer().leaveVehicle();
|
||||||
event.getPlayer().eject();
|
event.getPlayer().eject();
|
||||||
@ -117,8 +104,10 @@ public class MountCart extends Mount<Minecart>
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
//Bounce
|
//Bounce
|
||||||
for (Minecart cart : GetActive().values())
|
for (SingleEntityMountData<Minecart> cartData : GetActive().values())
|
||||||
{
|
{
|
||||||
|
Minecart cart = cartData.getEntity();
|
||||||
|
|
||||||
if (cart.getPassenger() == null)
|
if (cart.getPassenger() == null)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@ -137,8 +126,10 @@ public class MountCart extends Mount<Minecart>
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Collide
|
//Collide
|
||||||
for (Minecart cart : GetActive().values())
|
for (SingleEntityMountData<Minecart> cartData : GetActive().values())
|
||||||
{
|
{
|
||||||
|
Minecart cart = cartData.getEntity();
|
||||||
|
|
||||||
if (cart.getPassenger() == null)
|
if (cart.getPassenger() == null)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@ -150,8 +141,9 @@ public class MountCart extends Mount<Minecart>
|
|||||||
if (!Recharge.Instance.usable(player, GetName() + " Collide"))
|
if (!Recharge.Instance.usable(player, GetName() + " Collide"))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
for (Minecart other : GetActive().values())
|
for (SingleEntityMountData<Minecart> otherData : GetActive().values())
|
||||||
{
|
{
|
||||||
|
Minecart other = otherData.getEntity();
|
||||||
if (other.equals(cart))
|
if (other.equals(cart))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
@ -9,11 +9,11 @@ import org.bukkit.event.EventHandler;
|
|||||||
|
|
||||||
import mineplex.core.common.util.C;
|
import mineplex.core.common.util.C;
|
||||||
import mineplex.core.common.util.UtilParticle;
|
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.ParticleType;
|
||||||
import mineplex.core.common.util.UtilParticle.ViewDist;
|
import mineplex.core.common.util.UtilParticle.ViewDist;
|
||||||
import mineplex.core.mount.HorseMount;
|
import mineplex.core.mount.HorseMount;
|
||||||
import mineplex.core.mount.MountManager;
|
import mineplex.core.mount.MountManager;
|
||||||
|
import mineplex.core.mount.SingleEntityMountData;
|
||||||
import mineplex.core.updater.UpdateType;
|
import mineplex.core.updater.UpdateType;
|
||||||
import mineplex.core.updater.event.UpdateEvent;
|
import mineplex.core.updater.event.UpdateEvent;
|
||||||
|
|
||||||
@ -38,10 +38,12 @@ public class MountFrost extends HorseMount
|
|||||||
public void Trail(UpdateEvent event)
|
public void Trail(UpdateEvent event)
|
||||||
{
|
{
|
||||||
if (event.getType() == UpdateType.TICK)
|
if (event.getType() == UpdateType.TICK)
|
||||||
for (Horse horse : GetActive().values())
|
for (SingleEntityMountData<Horse> horseData : GetActive().values())
|
||||||
UtilParticle.PlayParticle(ParticleType.SNOW_SHOVEL, horse.getLocation().add(0, 1, 0),
|
{
|
||||||
0.25f, 0.25f, 0.25f, 0.1f, 4,
|
Horse horse = horseData.getEntity();
|
||||||
ViewDist.NORMAL, UtilServer.getPlayers());
|
UtilParticle.PlayParticleToAll(ParticleType.SNOW_SHOVEL, horse.getLocation().add(0, 1, 0),
|
||||||
|
0.25f, 0.25f, 0.25f, 0.1f, 4, ViewDist.NORMAL);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// @EventHandler
|
// @EventHandler
|
||||||
|
@ -5,19 +5,19 @@ import org.bukkit.DyeColor;
|
|||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.entity.Horse;
|
import org.bukkit.entity.Horse;
|
||||||
import org.bukkit.entity.Horse.Color;
|
import org.bukkit.entity.Horse.Color;
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.entity.Horse.Style;
|
import org.bukkit.entity.Horse.Style;
|
||||||
import org.bukkit.entity.Horse.Variant;
|
import org.bukkit.entity.Horse.Variant;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
import mineplex.core.common.util.F;
|
import mineplex.core.common.util.F;
|
||||||
import mineplex.core.common.util.UtilPlayer;
|
import mineplex.core.common.util.UtilPlayer;
|
||||||
import mineplex.core.disguise.disguises.DisguiseBase;
|
import mineplex.core.disguise.disguises.DisguiseBase;
|
||||||
import mineplex.core.disguise.disguises.DisguisePig;
|
|
||||||
import mineplex.core.disguise.disguises.DisguiseSheep;
|
import mineplex.core.disguise.disguises.DisguiseSheep;
|
||||||
import mineplex.core.mount.HorseMount;
|
import mineplex.core.mount.HorseMount;
|
||||||
import mineplex.core.mount.MountManager;
|
import mineplex.core.mount.MountManager;
|
||||||
|
import mineplex.core.mount.SingleEntityMountData;
|
||||||
import mineplex.core.updater.UpdateType;
|
import mineplex.core.updater.UpdateType;
|
||||||
import mineplex.core.updater.event.UpdateEvent;
|
import mineplex.core.updater.event.UpdateEvent;
|
||||||
|
|
||||||
@ -45,6 +45,7 @@ public class MountSheep extends HorseMount
|
|||||||
Manager.DeregisterAll(player);
|
Manager.DeregisterAll(player);
|
||||||
|
|
||||||
Horse horse = player.getWorld().spawn(player.getLocation(), Horse.class);
|
Horse horse = player.getWorld().spawn(player.getLocation(), Horse.class);
|
||||||
|
SingleEntityMountData<Horse> mount = new SingleEntityMountData<Horse>(player, horse);
|
||||||
|
|
||||||
horse.setOwner(player);
|
horse.setOwner(player);
|
||||||
horse.setMaxDomestication(1);
|
horse.setMaxDomestication(1);
|
||||||
@ -59,7 +60,7 @@ public class MountSheep extends HorseMount
|
|||||||
UtilPlayer.message(player, F.main("Mount", "You spawned " + F.elem(GetName()) + "."));
|
UtilPlayer.message(player, F.main("Mount", "You spawned " + F.elem(GetName()) + "."));
|
||||||
|
|
||||||
//Store
|
//Store
|
||||||
_active.put(player, horse);
|
_active.put(player, mount);
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
@ -68,8 +69,10 @@ public class MountSheep extends HorseMount
|
|||||||
if (event.getType() != UpdateType.TICK)
|
if (event.getType() != UpdateType.TICK)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for (Horse horse : GetActive().values())
|
for (SingleEntityMountData<Horse> horseData : GetActive().values())
|
||||||
{
|
{
|
||||||
|
Horse horse = horseData.getEntity();
|
||||||
|
|
||||||
DisguiseBase base = Manager.getDisguiseManager().getDisguise(horse);
|
DisguiseBase base = Manager.getDisguiseManager().getDisguise(horse);
|
||||||
if (base == null || !(base instanceof DisguiseSheep))
|
if (base == null || !(base instanceof DisguiseSheep))
|
||||||
continue;
|
continue;
|
||||||
|
@ -9,6 +9,7 @@ import org.bukkit.entity.Slime;
|
|||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.entity.EntityTargetEvent;
|
import org.bukkit.event.entity.EntityTargetEvent;
|
||||||
import org.bukkit.event.player.PlayerInteractEntityEvent;
|
import org.bukkit.event.player.PlayerInteractEntityEvent;
|
||||||
|
import org.bukkit.util.Vector;
|
||||||
|
|
||||||
import mineplex.core.common.util.F;
|
import mineplex.core.common.util.F;
|
||||||
import mineplex.core.common.util.UtilAction;
|
import mineplex.core.common.util.UtilAction;
|
||||||
@ -18,11 +19,12 @@ import mineplex.core.common.util.UtilMath;
|
|||||||
import mineplex.core.common.util.UtilPlayer;
|
import mineplex.core.common.util.UtilPlayer;
|
||||||
import mineplex.core.mount.Mount;
|
import mineplex.core.mount.Mount;
|
||||||
import mineplex.core.mount.MountManager;
|
import mineplex.core.mount.MountManager;
|
||||||
|
import mineplex.core.mount.SingleEntityMountData;
|
||||||
import mineplex.core.recharge.Recharge;
|
import mineplex.core.recharge.Recharge;
|
||||||
import mineplex.core.updater.UpdateType;
|
import mineplex.core.updater.UpdateType;
|
||||||
import mineplex.core.updater.event.UpdateEvent;
|
import mineplex.core.updater.event.UpdateEvent;
|
||||||
|
|
||||||
public class MountSlime extends Mount<Slime>
|
public class MountSlime extends Mount<SingleEntityMountData<Slime>>
|
||||||
{
|
{
|
||||||
public MountSlime(MountManager manager)
|
public MountSlime(MountManager manager)
|
||||||
{
|
{
|
||||||
@ -44,10 +46,10 @@ public class MountSlime extends Mount<Slime>
|
|||||||
//Remove other mounts
|
//Remove other mounts
|
||||||
Manager.DeregisterAll(player);
|
Manager.DeregisterAll(player);
|
||||||
|
|
||||||
Slime mount = player.getWorld().spawn(player.getLocation(), Slime.class);
|
SingleEntityMountData<Slime> mount = new SingleEntityMountData<Slime>(player, player.getWorld().spawn(player.getLocation(), Slime.class));
|
||||||
mount.setSize(2);
|
mount.getEntity().setSize(2);
|
||||||
|
|
||||||
mount.setCustomName(player.getName() + "'s " + GetName());
|
mount.getEntity().setCustomName(player.getName() + "'s " + GetName());
|
||||||
|
|
||||||
//Inform
|
//Inform
|
||||||
UtilPlayer.message(player, F.main("Mount", "You spawned " + F.elem(GetName()) + "."));
|
UtilPlayer.message(player, F.main("Mount", "You spawned " + F.elem(GetName()) + "."));
|
||||||
@ -58,7 +60,7 @@ public class MountSlime extends Mount<Slime>
|
|||||||
|
|
||||||
public void Disable(Player player)
|
public void Disable(Player player)
|
||||||
{
|
{
|
||||||
Slime mount = _active.remove(player);
|
SingleEntityMountData<Slime> mount = _active.remove(player);
|
||||||
if (mount != null)
|
if (mount != null)
|
||||||
{
|
{
|
||||||
mount.remove();
|
mount.remove();
|
||||||
@ -79,11 +81,8 @@ public class MountSlime extends Mount<Slime>
|
|||||||
if (!GetActive().containsKey(event.getPlayer()))
|
if (!GetActive().containsKey(event.getPlayer()))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!GetActive().get(event.getPlayer()).equals(event.getRightClicked()))
|
if(!GetActive().get(event.getPlayer()).ownsMount(event.getPlayer()))
|
||||||
{
|
|
||||||
UtilPlayer.message(event.getPlayer(), F.main("Mount", "This is not your Mount!"));
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
event.getPlayer().leaveVehicle();
|
event.getPlayer().leaveVehicle();
|
||||||
event.getPlayer().eject();
|
event.getPlayer().eject();
|
||||||
@ -108,10 +107,15 @@ public class MountSlime extends Mount<Slime>
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
//Bounce
|
//Bounce
|
||||||
for (Slime slime : GetActive().values())
|
for (SingleEntityMountData<Slime> slimeData : GetActive().values())
|
||||||
{
|
{
|
||||||
|
Slime slime = slimeData.getEntity();
|
||||||
|
|
||||||
if (slime.getPassenger() == null)
|
if (slime.getPassenger() == null)
|
||||||
|
{
|
||||||
|
UtilEnt.setFakeHead(slime, false);
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (!UtilEnt.isGrounded(slime))
|
if (!UtilEnt.isGrounded(slime))
|
||||||
continue;
|
continue;
|
||||||
@ -124,14 +128,19 @@ public class MountSlime extends Mount<Slime>
|
|||||||
if (!Recharge.Instance.use(player, GetName(), 200, false, false))
|
if (!Recharge.Instance.use(player, GetName(), 200, false, false))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
UtilAction.velocity(slime, slime.getPassenger().getLocation().getDirection(), 1, true, 0, 0.4, 1, true);
|
Vector dir = slime.getPassenger().getLocation().getDirection();
|
||||||
|
|
||||||
|
UtilAction.velocity(slime, dir, 1, true, 0, 0.4, 1, true);
|
||||||
|
|
||||||
|
UtilEnt.CreatureForceLook(slime, 0, UtilAlg.GetYaw(dir));
|
||||||
|
|
||||||
slime.getWorld().playSound(slime.getLocation(), Sound.SLIME_WALK, 1f, 0.75f);
|
slime.getWorld().playSound(slime.getLocation(), Sound.SLIME_WALK, 1f, 0.75f);
|
||||||
}
|
}
|
||||||
|
|
||||||
//Collide
|
//Collide
|
||||||
for (Slime slime : GetActive().values())
|
for (SingleEntityMountData<Slime> slimeData : GetActive().values())
|
||||||
{
|
{
|
||||||
|
Slime slime = slimeData.getEntity();
|
||||||
if (slime.getPassenger() == null)
|
if (slime.getPassenger() == null)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@ -143,8 +152,10 @@ public class MountSlime extends Mount<Slime>
|
|||||||
if (!Recharge.Instance.usable(player, GetName() + " Collide"))
|
if (!Recharge.Instance.usable(player, GetName() + " Collide"))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
for (Slime other : GetActive().values())
|
for (SingleEntityMountData<Slime> otherSlime : GetActive().values())
|
||||||
{
|
{
|
||||||
|
Slime other = otherSlime.getEntity();
|
||||||
|
|
||||||
if (other.equals(slime))
|
if (other.equals(slime))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
@ -4,21 +4,6 @@ import java.lang.reflect.Field;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
|
|
||||||
import mineplex.core.common.util.C;
|
|
||||||
import mineplex.core.common.util.F;
|
|
||||||
import mineplex.core.common.util.UtilAction;
|
|
||||||
import mineplex.core.common.util.UtilBlock;
|
|
||||||
import mineplex.core.common.util.UtilEnt;
|
|
||||||
import mineplex.core.common.util.UtilMath;
|
|
||||||
import mineplex.core.common.util.UtilPlayer;
|
|
||||||
import mineplex.core.disguise.disguises.DisguiseSpider;
|
|
||||||
import mineplex.core.mount.HorseMount;
|
|
||||||
import mineplex.core.mount.MountManager;
|
|
||||||
import mineplex.core.recharge.Recharge;
|
|
||||||
import mineplex.core.updater.UpdateType;
|
|
||||||
import mineplex.core.updater.event.UpdateEvent;
|
|
||||||
import net.minecraft.server.v1_8_R3.EntityLiving;
|
|
||||||
|
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.Sound;
|
import org.bukkit.Sound;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
@ -32,6 +17,22 @@ import org.bukkit.event.EventHandler;
|
|||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.bukkit.util.Vector;
|
import org.bukkit.util.Vector;
|
||||||
|
|
||||||
|
import mineplex.core.common.util.C;
|
||||||
|
import mineplex.core.common.util.F;
|
||||||
|
import mineplex.core.common.util.UtilAction;
|
||||||
|
import mineplex.core.common.util.UtilBlock;
|
||||||
|
import mineplex.core.common.util.UtilEnt;
|
||||||
|
import mineplex.core.common.util.UtilMath;
|
||||||
|
import mineplex.core.common.util.UtilPlayer;
|
||||||
|
import mineplex.core.disguise.disguises.DisguiseSpider;
|
||||||
|
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 net.minecraft.server.v1_8_R3.EntityLiving;
|
||||||
|
|
||||||
public class MountSpider extends HorseMount
|
public class MountSpider extends HorseMount
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
@ -87,7 +88,8 @@ public class MountSpider extends HorseMount
|
|||||||
UtilPlayer.message(player, F.main("Mount", "You spawned " + F.elem(GetName()) + "."));
|
UtilPlayer.message(player, F.main("Mount", "You spawned " + F.elem(GetName()) + "."));
|
||||||
|
|
||||||
//Store
|
//Store
|
||||||
_active.put(player, horse);
|
SingleEntityMountData<Horse> mount = new SingleEntityMountData<Horse>(player, horse);
|
||||||
|
_active.put(player, mount);
|
||||||
|
|
||||||
DisguiseSpider spider = new DisguiseSpider(horse);
|
DisguiseSpider spider = new DisguiseSpider(horse);
|
||||||
spider.setName(player.getName() + "'s Spider Mount");
|
spider.setName(player.getName() + "'s Spider Mount");
|
||||||
@ -105,7 +107,7 @@ public class MountSpider extends HorseMount
|
|||||||
ArrayList<Horse> used = new ArrayList<Horse>();
|
ArrayList<Horse> used = new ArrayList<Horse>();
|
||||||
for (Player player : GetActive().keySet())
|
for (Player player : GetActive().keySet())
|
||||||
{
|
{
|
||||||
Horse horse = GetActive().get(player);
|
Horse horse = GetActive().get(player).getEntity();
|
||||||
|
|
||||||
used.add(horse);
|
used.add(horse);
|
||||||
|
|
||||||
@ -126,21 +128,24 @@ public class MountSpider extends HorseMount
|
|||||||
if (event.getType() != UpdateType.TICK)
|
if (event.getType() != UpdateType.TICK)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for (Entry<Player, Horse> horse : GetActive().entrySet())
|
for (Entry<Player, SingleEntityMountData<Horse>> entry : GetActive().entrySet())
|
||||||
{
|
{
|
||||||
if (horse.getValue().getPassenger() != horse.getKey())
|
Player player = entry.getKey();
|
||||||
|
Horse horse = entry.getValue().getEntity();
|
||||||
|
|
||||||
|
if (horse.getPassenger() != player)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
//If player is looking up
|
//If player is looking up
|
||||||
if (horse.getKey().getEyeLocation().getPitch() > -45)
|
if (player.getEyeLocation().getPitch() > -45)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
for (Block block : UtilBlock.getSurrounding(horse.getValue().getLocation().getBlock(), true))
|
for (Block block : UtilBlock.getSurrounding(horse.getLocation().getBlock(), true))
|
||||||
{
|
{
|
||||||
if (UtilBlock.airFoliage(block) || block.isLiquid())
|
if (UtilBlock.airFoliage(block) || block.isLiquid())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
UtilAction.velocity(horse.getValue(), new Vector(horse.getValue().getVelocity().getX(), 0.2, horse.getValue().getVelocity().getZ()));
|
UtilAction.velocity(horse, new Vector(horse.getVelocity().getX(), 0.2, horse.getVelocity().getZ()));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -191,7 +196,7 @@ public class MountSpider extends HorseMount
|
|||||||
|
|
||||||
for (Player player : GetActive().keySet())
|
for (Player player : GetActive().keySet())
|
||||||
{
|
{
|
||||||
final Horse horse = GetActive().get(player);
|
final Horse horse = GetActive().get(player).getEntity();
|
||||||
|
|
||||||
if (horse.getPassenger() != player)
|
if (horse.getPassenger() != player)
|
||||||
continue;
|
continue;
|
||||||
|
@ -1,27 +1,19 @@
|
|||||||
package mineplex.core.mount.types;
|
package mineplex.core.mount.types;
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
|
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.entity.ArmorStand;
|
import org.bukkit.entity.EntityType;
|
||||||
import org.bukkit.entity.Slime;
|
|
||||||
import org.bukkit.entity.Horse.Color;
|
|
||||||
import org.bukkit.entity.Horse.Style;
|
|
||||||
import org.bukkit.entity.Horse.Variant;
|
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.EventPriority;
|
import org.bukkit.event.EventPriority;
|
||||||
import org.bukkit.event.entity.EntityDamageEvent;
|
import org.bukkit.event.entity.EntityDamageEvent;
|
||||||
import org.bukkit.event.entity.EntityTargetEvent;
|
import org.bukkit.event.entity.EntityTargetEvent;
|
||||||
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
|
import org.bukkit.event.player.PlayerInteractAtEntityEvent;
|
||||||
import org.bukkit.event.player.PlayerInteractEntityEvent;
|
|
||||||
import org.bukkit.event.player.PlayerJoinEvent;
|
import org.bukkit.event.player.PlayerJoinEvent;
|
||||||
|
|
||||||
import mineplex.core.common.Rank;
|
import mineplex.core.common.Rank;
|
||||||
import mineplex.core.common.util.C;
|
import mineplex.core.common.util.C;
|
||||||
import mineplex.core.common.util.F;
|
import mineplex.core.common.util.F;
|
||||||
import mineplex.core.common.util.UtilPlayer;
|
import mineplex.core.common.util.UtilPlayer;
|
||||||
import mineplex.core.mount.HorseMount;
|
|
||||||
import mineplex.core.mount.Mount;
|
import mineplex.core.mount.Mount;
|
||||||
import mineplex.core.mount.MountManager;
|
import mineplex.core.mount.MountManager;
|
||||||
import mineplex.core.updater.UpdateType;
|
import mineplex.core.updater.UpdateType;
|
||||||
@ -85,11 +77,20 @@ public class MountTitan extends Mount<MountTitanData>
|
|||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void interactMount(PlayerInteractEntityEvent event)
|
public void interactMount(PlayerInteractAtEntityEvent event)
|
||||||
{
|
{
|
||||||
if (event.getRightClicked() == null)
|
if (event.getRightClicked() == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
for(MountTitanData mount : GetActive().values())
|
||||||
|
{
|
||||||
|
if(mount.isPartOfMount(event.getRightClicked()))
|
||||||
|
{
|
||||||
|
event.setCancelled(true);
|
||||||
|
if(event.getRightClicked().getType() == EntityType.ARMOR_STAND) return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!GetActive().containsKey(event.getPlayer()))
|
if (!GetActive().containsKey(event.getPlayer()))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -123,7 +124,7 @@ public class MountTitan extends Mount<MountTitanData>
|
|||||||
{
|
{
|
||||||
for (MountTitanData data : _active.values())
|
for (MountTitanData data : _active.values())
|
||||||
{
|
{
|
||||||
if (data.ownsEntity(event.getEntity()))
|
if (data.isPartOfMount(event.getEntity()))
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,11 +3,7 @@
|
|||||||
package mineplex.core.mount.types;
|
package mineplex.core.mount.types;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
import mineplex.core.common.util.UtilAlg;
|
|
||||||
import mineplex.core.common.util.UtilEnt;
|
|
||||||
import mineplex.core.common.util.UtilMath;
|
|
||||||
import mineplex.core.common.util.UtilPlayer;
|
|
||||||
|
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
@ -20,9 +16,13 @@ import org.bukkit.inventory.ItemStack;
|
|||||||
import org.bukkit.util.EulerAngle;
|
import org.bukkit.util.EulerAngle;
|
||||||
import org.bukkit.util.Vector;
|
import org.bukkit.util.Vector;
|
||||||
|
|
||||||
public class MountTitanData
|
import mineplex.core.common.util.UtilAlg;
|
||||||
|
import mineplex.core.common.util.UtilEnt;
|
||||||
|
import mineplex.core.common.util.UtilMath;
|
||||||
|
import mineplex.core.mount.MountData;
|
||||||
|
|
||||||
|
public class MountTitanData extends MountData
|
||||||
{
|
{
|
||||||
private String _owner;
|
|
||||||
|
|
||||||
private Slime _head;
|
private Slime _head;
|
||||||
|
|
||||||
@ -30,7 +30,7 @@ public class MountTitanData
|
|||||||
|
|
||||||
public MountTitanData(Player player, String name)
|
public MountTitanData(Player player, String name)
|
||||||
{
|
{
|
||||||
_owner = player.getName();
|
super(player);
|
||||||
|
|
||||||
Location loc = player.getLocation();
|
Location loc = player.getLocation();
|
||||||
loc.setPitch(0);
|
loc.setPitch(0);
|
||||||
@ -72,7 +72,11 @@ public class MountTitanData
|
|||||||
{
|
{
|
||||||
//Head
|
//Head
|
||||||
if (_head.getPassenger() != null)
|
if (_head.getPassenger() != null)
|
||||||
_head.setVelocity(_head.getPassenger().getLocation().getDirection().multiply(0.8).add(new Vector(0,0.2,0)));
|
{
|
||||||
|
Vector dir = _head.getPassenger().getLocation().getDirection().multiply(0.8).add(new Vector(0,0.2,0));
|
||||||
|
_head.setVelocity(dir);
|
||||||
|
UtilEnt.CreatureLook(_head, dir);
|
||||||
|
}
|
||||||
|
|
||||||
Location infront = _head.getLocation().add(0, -1.5, 0);
|
Location infront = _head.getLocation().add(0, -1.5, 0);
|
||||||
|
|
||||||
@ -133,14 +137,13 @@ public class MountTitanData
|
|||||||
for (ArmorStand stand : _nodes)
|
for (ArmorStand stand : _nodes)
|
||||||
stand.remove();
|
stand.remove();
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean ownsMount(Player player)
|
|
||||||
{
|
|
||||||
return _owner.equals(player.getName());
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean ownsEntity(Entity ent)
|
@Override
|
||||||
|
public List<Entity> getEntityParts()
|
||||||
{
|
{
|
||||||
return (_head.equals(ent) || _nodes.contains(ent));
|
List<Entity> entities = new ArrayList<Entity>();
|
||||||
|
entities.addAll(_nodes);
|
||||||
|
entities.add(_head);
|
||||||
|
return entities;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,15 +1,5 @@
|
|||||||
package mineplex.core.mount.types;
|
package mineplex.core.mount.types;
|
||||||
|
|
||||||
import mineplex.core.common.util.C;
|
|
||||||
import mineplex.core.common.util.UtilParticle;
|
|
||||||
import mineplex.core.common.util.UtilParticle.ParticleType;
|
|
||||||
import mineplex.core.common.util.UtilParticle.ViewDist;
|
|
||||||
import mineplex.core.common.util.UtilServer;
|
|
||||||
import mineplex.core.mount.HorseMount;
|
|
||||||
import mineplex.core.mount.MountManager;
|
|
||||||
import mineplex.core.updater.UpdateType;
|
|
||||||
import mineplex.core.updater.event.UpdateEvent;
|
|
||||||
|
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.entity.Horse;
|
import org.bukkit.entity.Horse;
|
||||||
import org.bukkit.entity.Horse.Color;
|
import org.bukkit.entity.Horse.Color;
|
||||||
@ -17,6 +7,16 @@ import org.bukkit.entity.Horse.Style;
|
|||||||
import org.bukkit.entity.Horse.Variant;
|
import org.bukkit.entity.Horse.Variant;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
|
|
||||||
|
import mineplex.core.common.util.C;
|
||||||
|
import mineplex.core.common.util.UtilParticle;
|
||||||
|
import mineplex.core.common.util.UtilParticle.ParticleType;
|
||||||
|
import mineplex.core.common.util.UtilParticle.ViewDist;
|
||||||
|
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 MountUndead extends HorseMount
|
public class MountUndead extends HorseMount
|
||||||
{
|
{
|
||||||
public MountUndead(MountManager manager)
|
public MountUndead(MountManager manager)
|
||||||
@ -37,16 +37,20 @@ public class MountUndead extends HorseMount
|
|||||||
public void Trail(UpdateEvent event)
|
public void Trail(UpdateEvent event)
|
||||||
{
|
{
|
||||||
if (event.getType() == UpdateType.TICK)
|
if (event.getType() == UpdateType.TICK)
|
||||||
for (Horse horse : GetActive().values())
|
for (SingleEntityMountData<Horse> horseData : GetActive().values())
|
||||||
UtilParticle.PlayParticle(ParticleType.FLAME, horse.getLocation().add(0, 1, 0),
|
{
|
||||||
0.25f, 0.25f, 0.25f, 0, 2,
|
Horse horse = horseData.getEntity();
|
||||||
ViewDist.NORMAL, UtilServer.getPlayers());
|
UtilParticle.PlayParticleToAll(ParticleType.FLAME, horse.getLocation().add(0, 1, 0),
|
||||||
|
0.25f, 0.25f, 0.25f, 0, 2,ViewDist.NORMAL);
|
||||||
|
}
|
||||||
|
|
||||||
if (event.getType() == UpdateType.FAST)
|
if (event.getType() == UpdateType.FAST)
|
||||||
for (Horse horse : GetActive().values())
|
for (SingleEntityMountData<Horse> horseData : GetActive().values())
|
||||||
UtilParticle.PlayParticle(ParticleType.LAVA, horse.getLocation().add(0, 1, 0),
|
{
|
||||||
0.25f, 0.25f, 0.25f, 0, 1,
|
Horse horse = horseData.getEntity();
|
||||||
ViewDist.NORMAL, UtilServer.getPlayers());
|
UtilParticle.PlayParticleToAll(ParticleType.LAVA, horse.getLocation().add(0, 1, 0),
|
||||||
|
0.25f, 0.25f, 0.25f, 0, 1, ViewDist.NORMAL);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -14,7 +14,7 @@ import org.bukkit.entity.LivingEntity;
|
|||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.entity.Wither;
|
import org.bukkit.entity.Wither;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.player.PlayerInteractEntityEvent;
|
import org.bukkit.event.player.PlayerInteractAtEntityEvent;
|
||||||
import org.bukkit.event.player.PlayerInteractEvent;
|
import org.bukkit.event.player.PlayerInteractEvent;
|
||||||
import org.bukkit.util.Vector;
|
import org.bukkit.util.Vector;
|
||||||
|
|
||||||
@ -24,9 +24,9 @@ import mineplex.core.common.util.UtilAction;
|
|||||||
import mineplex.core.common.util.UtilAlg;
|
import mineplex.core.common.util.UtilAlg;
|
||||||
import mineplex.core.common.util.UtilEnt;
|
import mineplex.core.common.util.UtilEnt;
|
||||||
import mineplex.core.common.util.UtilEvent;
|
import mineplex.core.common.util.UtilEvent;
|
||||||
|
import mineplex.core.common.util.UtilEvent.ActionType;
|
||||||
import mineplex.core.common.util.UtilGear;
|
import mineplex.core.common.util.UtilGear;
|
||||||
import mineplex.core.common.util.UtilPlayer;
|
import mineplex.core.common.util.UtilPlayer;
|
||||||
import mineplex.core.common.util.UtilEvent.ActionType;
|
|
||||||
import mineplex.core.event.StackerEvent;
|
import mineplex.core.event.StackerEvent;
|
||||||
import mineplex.core.gadget.gadgets.MorphBlock;
|
import mineplex.core.gadget.gadgets.MorphBlock;
|
||||||
import mineplex.core.gadget.types.GadgetType;
|
import mineplex.core.gadget.types.GadgetType;
|
||||||
@ -54,7 +54,7 @@ public class StackerManager extends MiniPlugin implements IThrown
|
|||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void GrabEntity(PlayerInteractEntityEvent event)
|
public void GrabEntity(PlayerInteractAtEntityEvent event)
|
||||||
{
|
{
|
||||||
if (event.isCancelled())
|
if (event.isCancelled())
|
||||||
return;
|
return;
|
||||||
@ -62,7 +62,10 @@ public class StackerManager extends MiniPlugin implements IThrown
|
|||||||
Entity stackee = event.getRightClicked();
|
Entity stackee = event.getRightClicked();
|
||||||
if (stackee == null)
|
if (stackee == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if(Manager.GetMount().isMount(stackee))
|
||||||
|
return;
|
||||||
|
|
||||||
if (!(stackee instanceof LivingEntity))
|
if (!(stackee instanceof LivingEntity))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user