Clean up
This commit is contained in:
@@ -12,24 +12,24 @@ import org.bukkit.entity.Arrow;
|
||||
public class NMSAccess {
|
||||
|
||||
private Class<?> nmsArrowClass;
|
||||
|
||||
|
||||
public void setupVehicleArrow() throws Exception {
|
||||
String pkgname = getClass().getPackage().getName();
|
||||
String packageName = Bukkit.getServer().getClass().getPackage().getName();
|
||||
String nmspackageversion = packageName.substring(packageName.lastIndexOf('.') + 1);
|
||||
switch (nmspackageversion) {
|
||||
case "v1_7_R1": {
|
||||
nmsArrowClass = Class.forName(pkgname+"."+"nms172"+".NMSChairsArrow");
|
||||
return;
|
||||
}
|
||||
case "v1_6_R3": {
|
||||
nmsArrowClass = Class.forName(pkgname+"."+"nms164"+".NMSChairsArrow");
|
||||
return;
|
||||
}
|
||||
}
|
||||
throw new Exception("ChairsReloaded is not compatible with your server version");
|
||||
String pkgname = getClass().getPackage().getName();
|
||||
String packageName = Bukkit.getServer().getClass().getPackage().getName();
|
||||
String nmspackageversion = packageName.substring(packageName.lastIndexOf('.') + 1);
|
||||
switch (nmspackageversion) {
|
||||
case "v1_7_R1": {
|
||||
nmsArrowClass = Class.forName(pkgname+"."+"nms172"+".NMSChairsArrow");
|
||||
return;
|
||||
}
|
||||
case "v1_6_R3": {
|
||||
nmsArrowClass = Class.forName(pkgname+"."+"nms164"+".NMSChairsArrow");
|
||||
return;
|
||||
}
|
||||
}
|
||||
throw new Exception("ChairsReloaded is not compatible with your server version");
|
||||
}
|
||||
|
||||
|
||||
public Arrow spawnArrow(Location location) throws NoSuchMethodException, SecurityException, IllegalAccessException, IllegalArgumentException, InvocationTargetException, InstantiationException {
|
||||
World world = location.getWorld();
|
||||
Method getHandle = world.getClass().getDeclaredMethod("getHandle");
|
||||
|
@@ -7,11 +7,11 @@ import org.bukkit.entity.Arrow;
|
||||
public interface NMSChairsArrowInterface {
|
||||
|
||||
public void setBukkitEntity(Server server);
|
||||
|
||||
|
||||
public Arrow getBukkitArrow();
|
||||
|
||||
|
||||
public void setArrowLocation(Location location);
|
||||
|
||||
|
||||
public void addToWorld();
|
||||
|
||||
}
|
||||
|
@@ -1,5 +1,8 @@
|
||||
package com.cnaude.chairs.vehiclearrow.nms172;
|
||||
|
||||
import net.minecraft.server.v1_7_R1.EntityArrow;
|
||||
import net.minecraft.server.v1_7_R1.World;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Server;
|
||||
import org.bukkit.craftbukkit.v1_7_R1.CraftServer;
|
||||
@@ -7,19 +10,17 @@ import org.bukkit.entity.Arrow;
|
||||
|
||||
import com.cnaude.chairs.vehiclearrow.NMSChairsArrowInterface;
|
||||
|
||||
import net.minecraft.server.v1_7_R1.EntityArrow;
|
||||
import net.minecraft.server.v1_7_R1.World;
|
||||
|
||||
public class NMSChairsArrow extends EntityArrow implements NMSChairsArrowInterface {
|
||||
|
||||
|
||||
public NMSChairsArrow(World world) {
|
||||
super(world);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void h() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBukkitEntity(Server server) {
|
||||
bukkitEntity = new CraftChairsArrow((CraftServer) server, this);
|
||||
}
|
||||
|
Reference in New Issue
Block a user