Use getter here

This commit is contained in:
Shevchik 2013-12-16 23:04:33 +04:00
parent 364d9dbaca
commit 9af92fa1e5
2 changed files with 6 additions and 2 deletions

View File

@ -45,7 +45,11 @@ public class Chairs extends JavaPlugin {
{ {
return psitdata; return psitdata;
} }
protected Class<?> vehiclearrowclass; private Class<?> vehiclearrowclass;
protected Class<?> getVehicleArrowClass()
{
return vehiclearrowclass;
}
@Override @Override
public void onEnable() { public void onEnable() {

View File

@ -98,7 +98,7 @@ public class PlayerSitData {
Object nmsarrow = getHandleMethod.invoke(arrow); Object nmsarrow = getHandleMethod.invoke(arrow);
Field bukkitEntityField = nmsarrow.getClass().getSuperclass().getDeclaredField("bukkitEntity"); Field bukkitEntityField = nmsarrow.getClass().getSuperclass().getDeclaredField("bukkitEntity");
bukkitEntityField.setAccessible(true); bukkitEntityField.setAccessible(true);
Constructor<?> ctor = plugin.vehiclearrowclass.getDeclaredConstructor(Bukkit.getServer().getClass(), nmsarrow.getClass()); Constructor<?> ctor = plugin.getVehicleArrowClass().getDeclaredConstructor(Bukkit.getServer().getClass(), nmsarrow.getClass());
ctor.setAccessible(true); ctor.setAccessible(true);
Object vehiclearrow = ctor.newInstance(Bukkit.getServer(), nmsarrow); Object vehiclearrow = ctor.newInstance(Bukkit.getServer(), nmsarrow);
bukkitEntityField.set(nmsarrow, vehiclearrow); bukkitEntityField.set(nmsarrow, vehiclearrow);