Fix for forest / bump version

This commit is contained in:
Jesse Boyd 2016-04-22 09:12:38 +10:00
parent e158b4d222
commit 70362d348f
10 changed files with 114 additions and 20 deletions

View File

@ -10,7 +10,7 @@ buildscript {
} }
group = 'com.boydti.fawe' group = 'com.boydti.fawe'
version = '3.3.20' version = '3.3.21'
description = """FastAsyncWorldEdit""" description = """FastAsyncWorldEdit"""
subprojects { subprojects {

View File

@ -1,6 +1,6 @@
name: FastAsyncWorldEdit name: FastAsyncWorldEdit
main: com.boydti.fawe.bukkit.FaweBukkit main: com.boydti.fawe.bukkit.FaweBukkit
version: 3.3.20 version: 3.3.21
description: Fast Async WorldEdit plugin description: Fast Async WorldEdit plugin
authors: [Empire92] authors: [Empire92]
loadbefore: [WorldEdit] loadbefore: [WorldEdit]

View File

@ -423,7 +423,9 @@ public class BukkitQueue_1_8 extends BukkitQueue_All {
}, 1); }, 1);
return true; return true;
} catch (final Exception e) { } catch (final Exception e) {
e.printStackTrace(); if (Thread.currentThread() == Fawe.get().getMainThread()) {
e.printStackTrace();
}
} }
return false; return false;
} }

View File

@ -212,7 +212,9 @@ public class BukkitQueue_1_9 extends BukkitQueue_All {
} }
return true; return true;
} catch (final Throwable e) { } catch (final Throwable e) {
e.printStackTrace(); if (Thread.currentThread() == Fawe.get().getMainThread()) {
e.printStackTrace();
}
} }
return false; return false;
} }

View File

@ -185,7 +185,9 @@ public class BukkitQueue_1_9_R1 extends BukkitQueue_All {
} }
return true; return true;
} catch (final Throwable e) { } catch (final Throwable e) {
e.printStackTrace(); if (Thread.currentThread() == Fawe.get().getMainThread()) {
e.printStackTrace();
}
} }
return false; return false;
} }

View File

@ -1,6 +1,6 @@
name: FastAsyncWorldEdit name: FastAsyncWorldEdit
main: com.boydti.fawe.bukkit.FaweBukkit main: com.boydti.fawe.bukkit.FaweBukkit
version: 3.3.20 version: 3.3.21
description: Fast Async WorldEdit plugin description: Fast Async WorldEdit plugin
authors: [Empire92] authors: [Empire92]
loadbefore: [WorldEdit] loadbefore: [WorldEdit]

View File

@ -56,4 +56,38 @@ public abstract class TaskManager {
} }
}); });
} }
public <T> T sync(final RunnableVal<T> function) {
if (Fawe.get().getMainThread() == Thread.currentThread()) {
function.run();
return function.value;
}
RunnableVal<RuntimeException> run = new RunnableVal<RuntimeException>() {
@Override
public void run(RuntimeException value) {
try {
function.run();
} catch (RuntimeException e) {
this.value = e;
} catch (Throwable neverHappens) {
neverHappens.printStackTrace();
}
synchronized (function) {
function.notifyAll();
}
}
};
TaskManager.IMP.task(run);
if (run.value != null) {
throw run.value;
}
try {
synchronized (function) {
function.wait(15000);
}
} catch (InterruptedException e) {
e.printStackTrace();
}
return function.value;
}
} }

View File

@ -90,28 +90,73 @@ public class WorldWrapper extends AbstractWorld {
} }
@Override @Override
public boolean generateTree(EditSession editSession, Vector pt) throws MaxChangedBlocksException { public boolean generateTree(final EditSession editSession, final Vector pt) throws MaxChangedBlocksException {
return parent.generateTree(editSession, pt); return TaskManager.IMP.sync(new RunnableVal<Boolean>() {
@Override
public void run(Boolean ignore) {
try {
this.value = parent.generateTree(editSession, pt);
} catch (MaxChangedBlocksException e) {
e.printStackTrace();
}
}
});
} }
@Override @Override
public boolean generateBigTree(EditSession editSession, Vector pt) throws MaxChangedBlocksException { public boolean generateBigTree(final EditSession editSession, final Vector pt) throws MaxChangedBlocksException {
return parent.generateBigTree(editSession, pt); return TaskManager.IMP.sync(new RunnableVal<Boolean>() {
@Override
public void run(Boolean ignore) {
try {
this.value = parent.generateBigTree(editSession, pt);
} catch (MaxChangedBlocksException e) {
e.printStackTrace();
}
}
});
} }
@Override @Override
public boolean generateBirchTree(EditSession editSession, Vector pt) throws MaxChangedBlocksException { public boolean generateBirchTree(final EditSession editSession, final Vector pt) throws MaxChangedBlocksException {
return parent.generateBirchTree(editSession, pt); return TaskManager.IMP.sync(new RunnableVal<Boolean>() {
@Override
public void run(Boolean ignore) {
try {
this.value = parent.generateBirchTree(editSession, pt);
} catch (MaxChangedBlocksException e) {
e.printStackTrace();
}
}
});
} }
@Override @Override
public boolean generateRedwoodTree(EditSession editSession, Vector pt) throws MaxChangedBlocksException { public boolean generateRedwoodTree(final EditSession editSession, final Vector pt) throws MaxChangedBlocksException {
return parent.generateRedwoodTree(editSession, pt); return TaskManager.IMP.sync(new RunnableVal<Boolean>() {
@Override
public void run(Boolean ignore) {
try {
this.value = parent.generateRedwoodTree(editSession, pt);
} catch (MaxChangedBlocksException e) {
e.printStackTrace();
}
}
});
} }
@Override @Override
public boolean generateTallRedwoodTree(EditSession editSession, Vector pt) throws MaxChangedBlocksException { public boolean generateTallRedwoodTree(final EditSession editSession, final Vector pt) throws MaxChangedBlocksException {
return parent.generateTallRedwoodTree(editSession, pt); return TaskManager.IMP.sync(new RunnableVal<Boolean>() {
@Override
public void run(Boolean ignore) {
try {
this.value = parent.generateTallRedwoodTree(editSession, pt);
} catch (MaxChangedBlocksException e) {
e.printStackTrace();
}
}
});
} }
@Override @Override
@ -293,8 +338,17 @@ public class WorldWrapper extends AbstractWorld {
} }
@Override @Override
public boolean generateTree(TreeGenerator.TreeType type, EditSession editSession, Vector position) throws MaxChangedBlocksException { public boolean generateTree(final TreeGenerator.TreeType type, final EditSession editSession, final Vector position) throws MaxChangedBlocksException {
return parent.generateTree(type, editSession, position); return TaskManager.IMP.sync(new RunnableVal<Boolean>() {
@Override
public void run(Boolean ignore) {
try {
this.value = parent.generateTree(editSession, position);
} catch (MaxChangedBlocksException e) {
e.printStackTrace();
}
}
});
} }
@Override @Override

View File

@ -18,7 +18,7 @@ import org.spongepowered.api.plugin.PluginContainer;
import org.spongepowered.api.profile.GameProfileManager; import org.spongepowered.api.profile.GameProfileManager;
import org.spongepowered.api.world.World; import org.spongepowered.api.world.World;
@Plugin(id = "com.boydti.fawe", name = "FastAsyncWorldEdit", description = "Lagless WorldEdit, Area restrictions, Memory mangement, Block logging", url = "https://github.com/boy0001/FastAsyncWorldedit", version = "3.3.20") @Plugin(id = "com.boydti.fawe", name = "FastAsyncWorldEdit", description = "Lagless WorldEdit, Area restrictions, Memory mangement, Block logging", url = "https://github.com/boy0001/FastAsyncWorldedit", version = "3.3.21")
public class SpongeMain { public class SpongeMain {
public PluginContainer plugin; public PluginContainer plugin;

View File

@ -8,7 +8,7 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties> </properties>
<artifactId>FastAsyncWorldEdit</artifactId> <artifactId>FastAsyncWorldEdit</artifactId>
<version>3.3.20</version> <version>3.3.21</version>
<name>FastAsyncWorldEdit</name> <name>FastAsyncWorldEdit</name>
<packaging>jar</packaging> <packaging>jar</packaging>
<build> <build>