Recover from failed injector (of minor classes)
This commit is contained in:
parent
dc686c45d0
commit
d68740ecd1
@ -52,6 +52,7 @@ public class BukkitMain extends JavaPlugin {
|
||||
|
||||
@Override
|
||||
public void onEnable() {
|
||||
Plugin toLoad = null;
|
||||
if (Bukkit.getPluginManager().getPlugin("WorldEdit") == null) {
|
||||
try {
|
||||
File output = new File(this.getDataFolder().getParentFile(), "WorldEdit.jar");
|
||||
@ -59,7 +60,7 @@ public class BukkitMain extends JavaPlugin {
|
||||
try (FileOutputStream fos = new FileOutputStream(output)) {
|
||||
fos.write(weJar);
|
||||
}
|
||||
Bukkit.getPluginManager().loadPlugin(output);
|
||||
toLoad = Bukkit.getPluginManager().loadPlugin(output);
|
||||
} catch (Throwable e) {
|
||||
e.printStackTrace();
|
||||
Fawe.debug("====== INSTALL WORLDEDIT ======");
|
||||
@ -70,5 +71,8 @@ public class BukkitMain extends JavaPlugin {
|
||||
}
|
||||
}
|
||||
FaweBukkit imp = new FaweBukkit(this);
|
||||
if (toLoad != null) {
|
||||
Bukkit.getPluginManager().enablePlugin(toLoad);
|
||||
}
|
||||
}
|
||||
}
|
@ -79,10 +79,16 @@ public class FaweBukkit implements IFawe, Listener {
|
||||
try {
|
||||
Fawe.set(this);
|
||||
setupInjector();
|
||||
com.sk89q.worldedit.bukkit.BukkitPlayer.inject(); // Fixes
|
||||
BukkitWorld.inject(); // Fixes
|
||||
FallbackRegistrationListener.inject(); // Fixes
|
||||
BukkitPlayerBlockBag.inject(); // features
|
||||
try {
|
||||
com.sk89q.worldedit.bukkit.BukkitPlayer.inject(); // Fixes
|
||||
BukkitWorld.inject(); // Fixes
|
||||
BukkitPlayerBlockBag.inject(); // features
|
||||
FallbackRegistrationListener.inject(); // Fixes
|
||||
} catch (Throwable e) {
|
||||
debug("========= INJECTOR FAILED =========");
|
||||
e.printStackTrace();
|
||||
debug("===================================");
|
||||
}
|
||||
try {
|
||||
new BrushListener(plugin);
|
||||
} catch (Throwable e) {
|
||||
|
@ -35,19 +35,19 @@ public class BlobBrush implements Brush {
|
||||
double modY = 1d/radius.getY();
|
||||
double modZ = 1d/radius.getZ();
|
||||
|
||||
int radius = (int) size;
|
||||
int radiusSqr = (int) (size * size);
|
||||
int sizeInt = (int) size * 2;
|
||||
for (int x = -sizeInt; x <= sizeInt; x++) {
|
||||
double nx = seedX + x * distort;
|
||||
double d1 = Math.abs(x) * modX;
|
||||
double d1 = x * x * modX;
|
||||
for (int y = -sizeInt; y <= sizeInt; y++) {
|
||||
double d2 = d1 + Math.abs(y) * modY;
|
||||
double d2 = d1 + y * y * modY;
|
||||
double ny = seedY + y * distort;
|
||||
for (int z = -sizeInt; z <= sizeInt; z++) {
|
||||
double nz = seedZ + z * distort;
|
||||
double distance = d2 + Math.abs(z) * modZ;
|
||||
double distance = d2 + z * z * modZ;
|
||||
double noise = this.amplitude * SimplexNoise.noise(nx, ny, nz);
|
||||
if (distance + distance * noise < radius) {
|
||||
if (distance + distance * noise < radiusSqr) {
|
||||
editSession.setBlock(px + x, py + y, pz + z, pattern);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user