mirror of
https://github.com/boy0001/FastAsyncWorldedit.git
synced 2024-11-28 13:45:36 +01:00
Fix calc 1.7.10
This commit is contained in:
parent
42d0317d6c
commit
590b620d9d
@ -25,7 +25,6 @@ import com.boydti.fawe.object.FawePlayer;
|
|||||||
import com.boydti.fawe.util.MathMan;
|
import com.boydti.fawe.util.MathMan;
|
||||||
import com.boydti.fawe.util.StringMan;
|
import com.boydti.fawe.util.StringMan;
|
||||||
import com.google.common.base.Joiner;
|
import com.google.common.base.Joiner;
|
||||||
import com.google.common.util.concurrent.AtomicDouble;
|
|
||||||
import com.sk89q.minecraft.util.commands.Command;
|
import com.sk89q.minecraft.util.commands.Command;
|
||||||
import com.sk89q.minecraft.util.commands.CommandContext;
|
import com.sk89q.minecraft.util.commands.CommandContext;
|
||||||
import com.sk89q.minecraft.util.commands.CommandException;
|
import com.sk89q.minecraft.util.commands.CommandException;
|
||||||
@ -491,13 +490,13 @@ public class UtilityCommands extends MethodCommands {
|
|||||||
try {
|
try {
|
||||||
FaweLimit limit = FawePlayer.wrap(actor).getLimit();
|
FaweLimit limit = FawePlayer.wrap(actor).getLimit();
|
||||||
final Expression expression = Expression.compile(input);
|
final Expression expression = Expression.compile(input);
|
||||||
final AtomicDouble result = new AtomicDouble(Double.NaN);
|
double[] result = new double[] { Double.NaN };
|
||||||
ExecutorService executor = Executors.newSingleThreadExecutor();
|
ExecutorService executor = Executors.newSingleThreadExecutor();
|
||||||
try {
|
try {
|
||||||
executor.invokeAll(Arrays.asList(new Callable<Object>() {
|
executor.invokeAll(Arrays.asList(new Callable<Object>() {
|
||||||
@Override
|
@Override
|
||||||
public Object call() throws Exception {
|
public Object call() throws Exception {
|
||||||
result.set(expression.evaluate());
|
result[0] = expression.evaluate();
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}), limit.MAX_EXPRESSION_MS, TimeUnit.MILLISECONDS); // Default timeout of 50 milliseconds to prevent abuse.
|
}), limit.MAX_EXPRESSION_MS, TimeUnit.MILLISECONDS); // Default timeout of 50 milliseconds to prevent abuse.
|
||||||
@ -505,7 +504,7 @@ public class UtilityCommands extends MethodCommands {
|
|||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
executor.shutdown();
|
executor.shutdown();
|
||||||
actor.print(BBC.getPrefix() + "= " + result);
|
actor.print(BBC.getPrefix() + "= " + result[0]);
|
||||||
} catch (EvaluationException e) {
|
} catch (EvaluationException e) {
|
||||||
actor.printError(String.format(
|
actor.printError(String.format(
|
||||||
"'%s' could not be parsed as a valid expression", input));
|
"'%s' could not be parsed as a valid expression", input));
|
||||||
|
Loading…
Reference in New Issue
Block a user