diff --git a/libs/craftbukkit194.jar b/libs/craftbukkit194.jar new file mode 100644 index 0000000..4bd3d43 Binary files /dev/null and b/libs/craftbukkit194.jar differ diff --git a/src/com/cnaude/chairs/vehiclearrow/v_1_9_R2/CraftChairsArrow.java b/src/com/cnaude/chairs/vehiclearrow/v_1_9_R2/CraftChairsArrow.java new file mode 100644 index 0000000..d49b511 --- /dev/null +++ b/src/com/cnaude/chairs/vehiclearrow/v_1_9_R2/CraftChairsArrow.java @@ -0,0 +1,30 @@ +package com.cnaude.chairs.vehiclearrow.v_1_9_R2; + +import net.minecraft.server.v1_9_R2.EntityArrow; + +import org.bukkit.craftbukkit.v1_9_R2.CraftServer; +import org.bukkit.craftbukkit.v1_9_R2.entity.CraftArrow; +import org.bukkit.entity.Entity; +import org.bukkit.entity.Player; +import org.bukkit.entity.Vehicle; + +import com.cnaude.chairs.api.ChairsAPI; + +public class CraftChairsArrow extends CraftArrow implements Vehicle { + + public CraftChairsArrow(CraftServer server, EntityArrow entity) { + super(server, entity); + } + + @Override + public void remove() { + Entity passenger = getPassenger(); + if (passenger != null && passenger instanceof Player) { + if (ChairsAPI.isSitting((Player) passenger)) { + return; + } + } + super.remove(); + } + +} diff --git a/src/com/cnaude/chairs/vehiclearrow/v_1_9_R2/NMSArrowFactory.java b/src/com/cnaude/chairs/vehiclearrow/v_1_9_R2/NMSArrowFactory.java new file mode 100644 index 0000000..dd2abea --- /dev/null +++ b/src/com/cnaude/chairs/vehiclearrow/v_1_9_R2/NMSArrowFactory.java @@ -0,0 +1,20 @@ +package com.cnaude.chairs.vehiclearrow.v_1_9_R2; + +import net.minecraft.server.v1_9_R2.EntityArrow; + +import org.bukkit.Location; +import org.bukkit.craftbukkit.v1_9_R2.CraftWorld; +import org.bukkit.entity.Arrow; + +import com.cnaude.chairs.vehiclearrow.NMSArrowFactoryInterface; + +public class NMSArrowFactory implements NMSArrowFactoryInterface { + + @Override + public Arrow spawnArrow(Location location) { + CraftWorld world = (CraftWorld) location.getWorld(); + EntityArrow arrow = new NMSChairsArrow(world, location); + return (Arrow) arrow.getBukkitEntity(); + } + +} diff --git a/src/com/cnaude/chairs/vehiclearrow/v_1_9_R2/NMSChairsArrow.java b/src/com/cnaude/chairs/vehiclearrow/v_1_9_R2/NMSChairsArrow.java new file mode 100644 index 0000000..37d61b1 --- /dev/null +++ b/src/com/cnaude/chairs/vehiclearrow/v_1_9_R2/NMSChairsArrow.java @@ -0,0 +1,23 @@ +package com.cnaude.chairs.vehiclearrow.v_1_9_R2; + +import net.minecraft.server.v1_9_R2.EntityTippedArrow; + +import org.bukkit.Bukkit; +import org.bukkit.Location; +import org.bukkit.craftbukkit.v1_9_R2.CraftServer; +import org.bukkit.craftbukkit.v1_9_R2.CraftWorld; + +public class NMSChairsArrow extends EntityTippedArrow { + + public NMSChairsArrow(CraftWorld cworld, Location location) { + super(cworld.getHandle()); + setPositionRotation(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch()); + world.addEntity(this); + bukkitEntity = new CraftChairsArrow((CraftServer) Bukkit.getServer(), this); + } + + @Override + public void m() { + } + +}