Reposition class output
This commit is contained in:
parent
cc993188fe
commit
38d9aaf229
@ -59,7 +59,7 @@ public class Chairs extends JavaPlugin {
|
|||||||
getHandle.setAccessible(true);
|
getHandle.setAccessible(true);
|
||||||
Class<?> entityarrow = getHandle.invoke(arrow).getClass();
|
Class<?> entityarrow = getHandle.invoke(arrow).getClass();
|
||||||
Class<?> craftserver = getServer().getClass();
|
Class<?> craftserver = getServer().getClass();
|
||||||
vehiclearrowclass = new GenVehicleArrowClass().genAndLoadClass(arrowclass, entityarrow, craftserver);
|
vehiclearrowclass = new GenVehicleArrowClass(this).genAndLoadClass(arrowclass, entityarrow, craftserver);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
log.severe("Failed to generate VehicleArrow class, exiting");
|
log.severe("Failed to generate VehicleArrow class, exiting");
|
||||||
|
@ -23,6 +23,11 @@ import org.apache.bcel.generic.Type;
|
|||||||
|
|
||||||
public class GenVehicleArrowClass {
|
public class GenVehicleArrowClass {
|
||||||
|
|
||||||
|
private File datafolder;
|
||||||
|
public GenVehicleArrowClass(Chairs plugin)
|
||||||
|
{
|
||||||
|
this.datafolder = plugin.getDataFolder();
|
||||||
|
}
|
||||||
|
|
||||||
public Class<?> genAndLoadClass(String arrowclass, Class<?> entityarrow, Class<?> craftserver) throws IOException, ClassNotFoundException {
|
public Class<?> genAndLoadClass(String arrowclass, Class<?> entityarrow, Class<?> craftserver) throws IOException, ClassNotFoundException {
|
||||||
ClassGen cg = new ClassGen(
|
ClassGen cg = new ClassGen(
|
||||||
@ -60,10 +65,10 @@ public class GenVehicleArrowClass {
|
|||||||
mg.setMaxStack();
|
mg.setMaxStack();
|
||||||
cg.addMethod(mg.getMethod());
|
cg.addMethod(mg.getMethod());
|
||||||
il.dispose();
|
il.dispose();
|
||||||
cg.getJavaClass().dump("VehicleArrow.class");
|
cg.getJavaClass().dump(datafolder+File.separator+"VehicleArrow.class");
|
||||||
File arrowfile = new File("VehicleArrow.class");
|
File arrowfile = new File(datafolder+File.separator+"VehicleArrow.class");
|
||||||
InputStream arrwoinputstrean = new FileInputStream(arrowfile);
|
InputStream arrwoinputstrean = new FileInputStream(arrowfile);
|
||||||
File jarfile = new File("VehicleArrow.jar");
|
File jarfile = new File(datafolder+File.separator+"VehicleArrow.jar");
|
||||||
jarfile.delete();
|
jarfile.delete();
|
||||||
final ZipOutputStream zipout = new ZipOutputStream(new FileOutputStream(jarfile));
|
final ZipOutputStream zipout = new ZipOutputStream(new FileOutputStream(jarfile));
|
||||||
ZipEntry entry = new ZipEntry(arrowfile.getName());
|
ZipEntry entry = new ZipEntry(arrowfile.getName());
|
||||||
|
Loading…
Reference in New Issue
Block a user