mirror of
https://github.com/boy0001/FastAsyncWorldedit.git
synced 2024-11-24 19:46:34 +01:00
Load without throwing errors without WorldEdit
It's just functional enough to print a message saying it won't function without WorldEdit
This commit is contained in:
parent
1a3aff28dc
commit
90e0ab574d
@ -61,6 +61,7 @@ public class FaweBukkit implements IFawe, Listener {
|
|||||||
this.plugin = plugin;
|
this.plugin = plugin;
|
||||||
try {
|
try {
|
||||||
Fawe.set(this);
|
Fawe.set(this);
|
||||||
|
setupInjector();
|
||||||
if (Bukkit.getVersion().contains("git-Spigot")) {
|
if (Bukkit.getVersion().contains("git-Spigot")) {
|
||||||
debug("====== USE PAPER SPIGOT ======");
|
debug("====== USE PAPER SPIGOT ======");
|
||||||
debug("DOWNLOAD: https://ci.destroystokyo.com/job/PaperSpigot/");
|
debug("DOWNLOAD: https://ci.destroystokyo.com/job/PaperSpigot/");
|
||||||
@ -79,8 +80,19 @@ public class FaweBukkit implements IFawe, Listener {
|
|||||||
new ChunkListener();
|
new ChunkListener();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setupInjector() {
|
||||||
|
if (Bukkit.getPluginManager().getPlugin("WorldEdit") != null) {
|
||||||
|
Fawe.get().setupInjector();
|
||||||
// Inject
|
// Inject
|
||||||
EditSessionBlockChangeDelegate.inject();
|
EditSessionBlockChangeDelegate.inject();
|
||||||
|
} else {
|
||||||
|
Fawe.debug("====== INSTALL WORLDEDIT ======");
|
||||||
|
Fawe.debug("FAWE requires WorldEdit to function correctly");
|
||||||
|
Fawe.debug("Info: https://github.com/boy0001/FastAsyncWorldedit/releases/");
|
||||||
|
Fawe.debug("===============================");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -223,30 +223,21 @@ public class Fawe {
|
|||||||
this.IMP.startMetrics();
|
this.IMP.startMetrics();
|
||||||
}
|
}
|
||||||
this.setupCommands();
|
this.setupCommands();
|
||||||
|
/*
|
||||||
|
* Instance independent stuff
|
||||||
|
*/
|
||||||
|
this.setupMemoryListener();
|
||||||
|
|
||||||
// Delayed setup
|
// Delayed event setup
|
||||||
TaskManager.IMP.later(new Runnable() {
|
TaskManager.IMP.later(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
try {
|
|
||||||
WEManager.IMP.managers.addAll(Fawe.this.IMP.getMaskManagers());
|
|
||||||
WEManager.IMP.managers.add(new PlotSquaredFeature());
|
|
||||||
Fawe.debug("Plugin 'PlotSquared' found. Using it now.");
|
|
||||||
} catch (Throwable e) {}
|
|
||||||
Fawe.this.worldedit = WorldEdit.getInstance();
|
|
||||||
// Events
|
// Events
|
||||||
Fawe.this.setupEvents();
|
|
||||||
Fawe.this.IMP.setupVault();
|
Fawe.this.IMP.setupVault();
|
||||||
}
|
}
|
||||||
}, 0);
|
}, 0);
|
||||||
|
|
||||||
/*
|
// Delayed updating
|
||||||
* Instance independent stuff
|
|
||||||
*/
|
|
||||||
this.setupInjector();
|
|
||||||
this.setupMemoryListener();
|
|
||||||
|
|
||||||
// Update
|
|
||||||
TaskManager.IMP.async(new Runnable() {
|
TaskManager.IMP.async(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
@ -311,23 +302,6 @@ public class Fawe {
|
|||||||
Settings.save(file);
|
Settings.save(file);
|
||||||
// Setting up message.yml
|
// Setting up message.yml
|
||||||
BBC.load(new File(this.IMP.getDirectory(), "message.yml"));
|
BBC.load(new File(this.IMP.getDirectory(), "message.yml"));
|
||||||
// Setting up commands.yml
|
|
||||||
Commands.load(new File(this.IMP.getDirectory(), "commands.yml"));
|
|
||||||
// Block rotation
|
|
||||||
try {
|
|
||||||
BundledBlockData.getInstance().loadFromResource();
|
|
||||||
} catch (IOException e) {
|
|
||||||
MainUtil.handleError(e);
|
|
||||||
}
|
|
||||||
File jar = MainUtil.getJarFile();
|
|
||||||
File extraBlocks = MainUtil.copyFile(jar, "extrablocks.json", null);
|
|
||||||
if (extraBlocks != null && extraBlocks.exists()) {
|
|
||||||
try {
|
|
||||||
BundledBlockData.getInstance().add(extraBlocks.toURI().toURL(), true);
|
|
||||||
} catch (Throwable ignore) {
|
|
||||||
Fawe.debug("Invalid format: extrablocks.json");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private WorldEdit worldedit;
|
private WorldEdit worldedit;
|
||||||
@ -339,13 +313,28 @@ public class Fawe {
|
|||||||
return this.worldedit;
|
return this.worldedit;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setupInjector() {
|
public void setupInjector() {
|
||||||
/*
|
/*
|
||||||
* Modify the sessions
|
* Modify the sessions
|
||||||
* - EditSession supports custom queue and a lot of optimizations
|
* - EditSession supports custom queue and a lot of optimizations
|
||||||
* - LocalSession supports VirtualPlayers and undo on disk
|
* - LocalSession supports VirtualPlayers and undo on disk
|
||||||
*/
|
*/
|
||||||
try {
|
try {
|
||||||
|
// Delayed worldedit setup
|
||||||
|
TaskManager.IMP.later(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
try {
|
||||||
|
WEManager.IMP.managers.addAll(Fawe.this.IMP.getMaskManagers());
|
||||||
|
WEManager.IMP.managers.add(new PlotSquaredFeature());
|
||||||
|
Fawe.debug("Plugin 'PlotSquared' found. Using it now.");
|
||||||
|
} catch (Throwable e) {}
|
||||||
|
Fawe.this.worldedit = WorldEdit.getInstance();
|
||||||
|
Fawe.this.setupEvents();
|
||||||
|
}
|
||||||
|
}, 0);
|
||||||
|
// Setting up commands.yml
|
||||||
|
Commands.load(new File(this.IMP.getDirectory(), "commands.yml"));
|
||||||
EditSession.inject(); // Custom block placer + optimizations
|
EditSession.inject(); // Custom block placer + optimizations
|
||||||
EditSessionEvent.inject(); // Add EditSession to event (API)
|
EditSessionEvent.inject(); // Add EditSession to event (API)
|
||||||
LocalSession.inject(); // Add remember order / queue flushing / Optimizations for disk
|
LocalSession.inject(); // Add remember order / queue flushing / Optimizations for disk
|
||||||
@ -422,6 +411,20 @@ public class Fawe {
|
|||||||
// BlockData
|
// BlockData
|
||||||
BlockData.inject(); // Temporary fix for 1.9.4
|
BlockData.inject(); // Temporary fix for 1.9.4
|
||||||
BundledBlockData.inject(); // Add custom rotation
|
BundledBlockData.inject(); // Add custom rotation
|
||||||
|
try {
|
||||||
|
BundledBlockData.getInstance().loadFromResource();
|
||||||
|
} catch (IOException e) {
|
||||||
|
MainUtil.handleError(e);
|
||||||
|
}
|
||||||
|
File jar = MainUtil.getJarFile();
|
||||||
|
File extraBlocks = MainUtil.copyFile(jar, "extrablocks.json", null);
|
||||||
|
if (extraBlocks != null && extraBlocks.exists()) {
|
||||||
|
try {
|
||||||
|
BundledBlockData.getInstance().add(extraBlocks.toURI().toURL(), true);
|
||||||
|
} catch (Throwable ignore) {
|
||||||
|
Fawe.debug("Invalid format: extrablocks.json");
|
||||||
|
}
|
||||||
|
}
|
||||||
// NBT
|
// NBT
|
||||||
NBTInputStream.inject(); // Add actual streaming + Optimizations + New methods
|
NBTInputStream.inject(); // Add actual streaming + Optimizations + New methods
|
||||||
NBTOutputStream.inject(); // New methods
|
NBTOutputStream.inject(); // New methods
|
||||||
|
@ -69,7 +69,7 @@ public class AnvilCommands {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
BBC.VISITOR_BLOCK.send(player, count.longValue());
|
player.print(BBC.VISITOR_BLOCK.format(count.longValue()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Command(
|
@Command(
|
||||||
@ -114,7 +114,7 @@ public class AnvilCommands {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
BBC.VISITOR_BLOCK.send(player, count.longValue());
|
player.print(BBC.VISITOR_BLOCK.format(count.longValue()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Command(
|
@Command(
|
||||||
@ -189,7 +189,7 @@ public class AnvilCommands {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
queue.filterWorld(filter);
|
queue.filterWorld(filter);
|
||||||
BBC.SELECTION_COUNT.send(player, count.longValue());
|
player.print(BBC.SELECTION_COUNT.format(count.longValue()));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -7,8 +7,9 @@ import com.boydti.fawe.object.FawePlayer;
|
|||||||
import com.boydti.fawe.object.RunnableVal3;
|
import com.boydti.fawe.object.RunnableVal3;
|
||||||
import com.boydti.fawe.util.MainUtil;
|
import com.boydti.fawe.util.MainUtil;
|
||||||
import com.boydti.fawe.util.StringMan;
|
import com.boydti.fawe.util.StringMan;
|
||||||
import com.sk89q.worldedit.extension.platform.Actor;
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
import java.lang.reflect.InvocationTargetException;
|
||||||
|
import java.lang.reflect.Method;
|
||||||
import java.util.EnumSet;
|
import java.util.EnumSet;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
@ -102,6 +103,7 @@ public enum BBC {
|
|||||||
BRUSH_SPLINE_SECONDARY("Created spline", "WorldEdit.Brush"),
|
BRUSH_SPLINE_SECONDARY("Created spline", "WorldEdit.Brush"),
|
||||||
BRUSH_BLEND_BALL("Blend ball brush equipped (%s0).", "WorldEdit.Brush"),
|
BRUSH_BLEND_BALL("Blend ball brush equipped (%s0).", "WorldEdit.Brush"),
|
||||||
BRUSH_ERODE("Erode brush equipped (%s0).", "WorldEdit.Brush"),
|
BRUSH_ERODE("Erode brush equipped (%s0).", "WorldEdit.Brush"),
|
||||||
|
BRUSH_RECURSIVE("Recursive brush equipped (%s0).", "WorldEdit.Brush"),
|
||||||
BRUSH_PASTE_NONE("Nothing to paste", "WorldEdit.Brush"),
|
BRUSH_PASTE_NONE("Nothing to paste", "WorldEdit.Brush"),
|
||||||
BRUSH_SIZE("Brush size set", "WorldEdit.Brush"),
|
BRUSH_SIZE("Brush size set", "WorldEdit.Brush"),
|
||||||
BRUSH_RANGE("Brush size set", "WorldEdit.Brush"),
|
BRUSH_RANGE("Brush size set", "WorldEdit.Brush"),
|
||||||
@ -276,6 +278,10 @@ public enum BBC {
|
|||||||
this(d, true, cat.toLowerCase());
|
this(d, true, cat.toLowerCase());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String f(final Object... args) {
|
||||||
|
return format(args);
|
||||||
|
}
|
||||||
|
|
||||||
public String format(final Object... args) {
|
public String format(final Object... args) {
|
||||||
String m = this.s;
|
String m = this.s;
|
||||||
for (int i = args.length - 1; i >= 0; i--) {
|
for (int i = args.length - 1; i >= 0; i--) {
|
||||||
@ -387,14 +393,23 @@ public enum BBC {
|
|||||||
return this.cat;
|
return this.cat;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void send(Actor actor, final Object... args) {
|
public void send(Object actor, final Object... args) {
|
||||||
if (isEmpty()) {
|
if (isEmpty()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (actor == null) {
|
if (actor == null) {
|
||||||
Fawe.debug(this.format(args));
|
Fawe.debug(this.format(args));
|
||||||
} else {
|
} else {
|
||||||
actor.print((PREFIX.isEmpty() ? "" : PREFIX.s() + " ") + this.format(args));
|
try {
|
||||||
|
Method method = actor.getClass().getDeclaredMethod("print", String.class);
|
||||||
|
method.invoke(actor, (PREFIX.isEmpty() ? "" : PREFIX.s() + " ") + this.format(args));
|
||||||
|
} catch (NoSuchMethodException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
} catch (InvocationTargetException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
} catch (IllegalAccessException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -74,7 +74,7 @@ public class CopyPastaBrush implements DoubleActionBrush {
|
|||||||
ClipboardHolder holder = new ClipboardHolder(clipboard, editSession.getWorld().getWorldData());
|
ClipboardHolder holder = new ClipboardHolder(clipboard, editSession.getWorld().getWorldData());
|
||||||
session.setClipboard(holder);
|
session.setClipboard(holder);
|
||||||
int blocks = builder.size();
|
int blocks = builder.size();
|
||||||
BBC.COMMAND_COPY.send(player, blocks);
|
player.print(BBC.COMMAND_COPY.format(blocks));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
case PRIMARY: {
|
case PRIMARY: {
|
||||||
@ -90,7 +90,7 @@ public class CopyPastaBrush implements DoubleActionBrush {
|
|||||||
.build();
|
.build();
|
||||||
Operations.completeLegacy(operation);
|
Operations.completeLegacy(operation);
|
||||||
} catch (EmptyClipboardException e) {
|
} catch (EmptyClipboardException e) {
|
||||||
BBC.BRUSH_PASTE_NONE.send(player);
|
player.print(BBC.BRUSH_PASTE_NONE.s());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -59,11 +59,11 @@ public class InspectBrush extends BrushTool implements DoubleActionTraceTool {
|
|||||||
|
|
||||||
public boolean perform(final Player player, LocalSession session, boolean rightClick) {
|
public boolean perform(final Player player, LocalSession session, boolean rightClick) {
|
||||||
if (!session.isToolControlEnabled() || !player.hasPermission("worldedit.tool.inspect")) {
|
if (!session.isToolControlEnabled() || !player.hasPermission("worldedit.tool.inspect")) {
|
||||||
BBC.NO_PERM.send(player, "worldedit.tool.inspect");
|
player.print(BBC.NO_PERM.f("worldedit.tool.inspect"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!Settings.HISTORY.USE_DATABASE) {
|
if (!Settings.HISTORY.USE_DATABASE) {
|
||||||
BBC.SETTING_DISABLE.send(player, "history.use-database");
|
player.print(BBC.SETTING_DISABLE.f("history.use-database"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
WorldVector target = getTarget(player, rightClick);
|
WorldVector target = getTarget(player, rightClick);
|
||||||
|
@ -68,12 +68,12 @@ public class SplineBrush implements DoubleActionBrush {
|
|||||||
numSplines = points.size();
|
numSplines = points.size();
|
||||||
}
|
}
|
||||||
this.positionSets.add(points);
|
this.positionSets.add(points);
|
||||||
BBC.BRUSH_SPLINE_PRIMARY.send(player);
|
player.print(BBC.BRUSH_SPLINE_PRIMARY.s());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case SECONDARY: {
|
case SECONDARY: {
|
||||||
if (positionSets.size() < 2) {
|
if (positionSets.size() < 2) {
|
||||||
BBC.BRUSH_SPLINE_SECONDARY_ERROR.send(player);
|
player.print(BBC.BRUSH_SPLINE_SECONDARY_ERROR.s());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
List<Vector> centroids = new ArrayList<>();
|
List<Vector> centroids = new ArrayList<>();
|
||||||
@ -112,7 +112,7 @@ public class SplineBrush implements DoubleActionBrush {
|
|||||||
}
|
}
|
||||||
editSession.drawSpline(Patterns.wrap(pattern), currentSpline, 0, 0, 0, 10, 0, true);
|
editSession.drawSpline(Patterns.wrap(pattern), currentSpline, 0, 0, 0, 10, 0, true);
|
||||||
}
|
}
|
||||||
BBC.BRUSH_SPLINE_SECONDARY.send(player);
|
player.print(BBC.BRUSH_SPLINE_SECONDARY.s());
|
||||||
positionSets.clear();
|
positionSets.clear();
|
||||||
numSplines = 0;
|
numSplines = 0;
|
||||||
break;
|
break;
|
||||||
|
@ -100,7 +100,7 @@ public class BrushCommands {
|
|||||||
BrushTool tool = session.getBrushTool(player.getItemInHand());
|
BrushTool tool = session.getBrushTool(player.getItemInHand());
|
||||||
tool.setSize(radius);
|
tool.setSize(radius);
|
||||||
tool.setBrush(new BlendBall(), "worldedit.brush.blendball");
|
tool.setBrush(new BlendBall(), "worldedit.brush.blendball");
|
||||||
BBC.BRUSH_SPHERE.send(player, radius);
|
player.print(BBC.BRUSH_BLEND_BALL.f(radius));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Command(
|
@Command(
|
||||||
@ -117,7 +117,7 @@ public class BrushCommands {
|
|||||||
DoubleActionBrushTool tool = session.getDoubleActionBrushTool(player.getItemInHand());
|
DoubleActionBrushTool tool = session.getDoubleActionBrushTool(player.getItemInHand());
|
||||||
tool.setSize(radius);
|
tool.setSize(radius);
|
||||||
tool.setBrush(new ErodeBrush(), "worldedit.brush.erode");
|
tool.setBrush(new ErodeBrush(), "worldedit.brush.erode");
|
||||||
BBC.BRUSH_SPHERE.send(player, radius);
|
player.print(BBC.BRUSH_ERODE.f(radius));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Command(
|
@Command(
|
||||||
@ -137,7 +137,7 @@ public class BrushCommands {
|
|||||||
tool.setBrush(new RecurseBrush(tool, depthFirst), "worldedit.brush.recursive");
|
tool.setBrush(new RecurseBrush(tool, depthFirst), "worldedit.brush.recursive");
|
||||||
tool.setMask(new IdMask(editSession));
|
tool.setMask(new IdMask(editSession));
|
||||||
tool.setFill(fill);
|
tool.setFill(fill);
|
||||||
BBC.BRUSH_SPHERE.send(player, radius);
|
player.print(BBC.BRUSH_RECURSIVE.f(radius));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Command(
|
@Command(
|
||||||
@ -160,7 +160,7 @@ public class BrushCommands {
|
|||||||
tool.setFill(fill);
|
tool.setFill(fill);
|
||||||
tool.setSize(radius);
|
tool.setSize(radius);
|
||||||
tool.setBrush(new LineBrush(shell, select, flat), "worldedit.brush.line");
|
tool.setBrush(new LineBrush(shell, select, flat), "worldedit.brush.line");
|
||||||
BBC.BRUSH_LINE.send(player, radius);
|
player.print(BBC.BRUSH_LINE.f(radius));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Command(
|
@Command(
|
||||||
@ -178,7 +178,7 @@ public class BrushCommands {
|
|||||||
tool.setFill(fill);
|
tool.setFill(fill);
|
||||||
tool.setSize(radius);
|
tool.setSize(radius);
|
||||||
tool.setBrush(new SplineBrush(player, session, tool), "worldedit.brush.spline");
|
tool.setBrush(new SplineBrush(player, session, tool), "worldedit.brush.spline");
|
||||||
BBC.BRUSH_SPLINE.send(player, radius);
|
player.print(BBC.BRUSH_SPLINE.f(radius));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Command(
|
@Command(
|
||||||
@ -205,7 +205,7 @@ public class BrushCommands {
|
|||||||
} else {
|
} else {
|
||||||
tool.setBrush(new SphereBrush(), "worldedit.brush.sphere");
|
tool.setBrush(new SphereBrush(), "worldedit.brush.sphere");
|
||||||
}
|
}
|
||||||
BBC.BRUSH_SPHERE.send(player, radius);
|
player.print(BBC.BRUSH_SPHERE.f(radius));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Command(
|
@Command(
|
||||||
@ -234,7 +234,7 @@ public class BrushCommands {
|
|||||||
} else {
|
} else {
|
||||||
tool.setBrush(new CylinderBrush(height), "worldedit.brush.cylinder");
|
tool.setBrush(new CylinderBrush(height), "worldedit.brush.cylinder");
|
||||||
}
|
}
|
||||||
BBC.BRUSH_CYLINDER.send(player, radius, height);
|
player.print(BBC.BRUSH_SPHERE.f(radius, height));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Command(
|
@Command(
|
||||||
@ -261,7 +261,7 @@ public class BrushCommands {
|
|||||||
|
|
||||||
BrushTool tool = session.getBrushTool(player.getItemInHand());
|
BrushTool tool = session.getBrushTool(player.getItemInHand());
|
||||||
tool.setBrush(new ClipboardBrush(holder, ignoreAir, usingOrigin), "worldedit.brush.clipboard");
|
tool.setBrush(new ClipboardBrush(holder, ignoreAir, usingOrigin), "worldedit.brush.clipboard");
|
||||||
BBC.BRUSH_CLIPBOARD.send(player);
|
player.print(BBC.BRUSH_CLIPBOARD.s());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Command(
|
@Command(
|
||||||
@ -289,7 +289,7 @@ public class BrushCommands {
|
|||||||
tool.setSize(radius);
|
tool.setSize(radius);
|
||||||
tool.setBrush(new SmoothBrush(iterations, naturalBlocksOnly), "worldedit.brush.smooth");
|
tool.setBrush(new SmoothBrush(iterations, naturalBlocksOnly), "worldedit.brush.smooth");
|
||||||
|
|
||||||
BBC.BRUSH_SMOOTH.send(player, radius, iterations, (naturalBlocksOnly ? "natural blocks only" : "any block"));
|
player.print(BBC.BRUSH_SMOOTH.f(radius, iterations, (naturalBlocksOnly ? "natural blocks only" : "any block")));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Command(
|
@Command(
|
||||||
@ -310,6 +310,7 @@ public class BrushCommands {
|
|||||||
tool.setMask(new BlockMask(editSession, new BaseBlock(BlockID.FIRE)));
|
tool.setMask(new BlockMask(editSession, new BaseBlock(BlockID.FIRE)));
|
||||||
tool.setBrush(new SphereBrush(), "worldedit.brush.ex");
|
tool.setBrush(new SphereBrush(), "worldedit.brush.ex");
|
||||||
BBC.BRUSH_EXTINGUISHER.send(player, radius);
|
BBC.BRUSH_EXTINGUISHER.send(player, radius);
|
||||||
|
player.print(BBC.BRUSH_EXTINGUISHER.f(radius));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Command(
|
@Command(
|
||||||
@ -331,7 +332,7 @@ public class BrushCommands {
|
|||||||
BrushTool tool = session.getBrushTool(player.getItemInHand());
|
BrushTool tool = session.getBrushTool(player.getItemInHand());
|
||||||
tool.setSize(radius);
|
tool.setSize(radius);
|
||||||
tool.setBrush(new GravityBrush(fromMaxY, tool), "worldedit.brush.gravity");
|
tool.setBrush(new GravityBrush(fromMaxY, tool), "worldedit.brush.gravity");
|
||||||
BBC.BRUSH_GRAVITY.send(player, radius);
|
player.print(BBC.BRUSH_GRAVITY.f(radius));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Command(
|
@Command(
|
||||||
@ -355,7 +356,7 @@ public class BrushCommands {
|
|||||||
} catch (EmptyClipboardException ignore) {
|
} catch (EmptyClipboardException ignore) {
|
||||||
tool.setBrush(new HeightBrush(file, rotation, yscale, tool, null), "worldedit.brush.height");
|
tool.setBrush(new HeightBrush(file, rotation, yscale, tool, null), "worldedit.brush.height");
|
||||||
}
|
}
|
||||||
BBC.BRUSH_HEIGHT.send(player, radius);
|
player.print(BBC.BRUSH_HEIGHT.f(radius));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Command(
|
@Command(
|
||||||
@ -374,7 +375,7 @@ public class BrushCommands {
|
|||||||
DoubleActionBrushTool tool = session.getDoubleActionBrushTool(player.getItemInHand());
|
DoubleActionBrushTool tool = session.getDoubleActionBrushTool(player.getItemInHand());
|
||||||
tool.setSize(radius);
|
tool.setSize(radius);
|
||||||
tool.setBrush(new CopyPastaBrush(player, session, tool), "worldedit.brush.copy");
|
tool.setBrush(new CopyPastaBrush(player, session, tool), "worldedit.brush.copy");
|
||||||
BBC.BRUSH_COPY.send(player, radius);
|
player.print(BBC.BRUSH_COPY.f(radius));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Command(
|
@Command(
|
||||||
@ -391,7 +392,7 @@ public class BrushCommands {
|
|||||||
BrushTool tool = session.getBrushTool(player.getItemInHand());
|
BrushTool tool = session.getBrushTool(player.getItemInHand());
|
||||||
String cmd = args.getJoinedStrings(1);
|
String cmd = args.getJoinedStrings(1);
|
||||||
tool.setBrush(new CommandBrush(player, tool, cmd, radius), "worldedit.brush.copy");
|
tool.setBrush(new CommandBrush(player, tool, cmd, radius), "worldedit.brush.copy");
|
||||||
BBC.BRUSH_COMMAND.send(player, cmd);
|
player.print(BBC.BRUSH_COMMAND.f(cmd));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Command(
|
@Command(
|
||||||
@ -436,7 +437,7 @@ public class BrushCommands {
|
|||||||
BrushTool tool = session.getBrushTool(player.getItemInHand());
|
BrushTool tool = session.getBrushTool(player.getItemInHand());
|
||||||
tool.setSize(radius);
|
tool.setSize(radius);
|
||||||
tool.setBrush(new ButcherBrush(flags), "worldedit.brush.butcher");
|
tool.setBrush(new ButcherBrush(flags), "worldedit.brush.butcher");
|
||||||
BBC.BRUSH_BUTCHER.send(player, radius);
|
player.print(BBC.BRUSH_BUTCHER.f(radius));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Class<?> inject() {
|
public static Class<?> inject() {
|
||||||
|
@ -6,7 +6,11 @@ import com.boydti.fawe.object.extent.TransformExtent;
|
|||||||
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.CommandPermissions;
|
import com.sk89q.minecraft.util.commands.CommandPermissions;
|
||||||
import com.sk89q.worldedit.*;
|
import com.sk89q.worldedit.EditSession;
|
||||||
|
import com.sk89q.worldedit.LocalConfiguration;
|
||||||
|
import com.sk89q.worldedit.LocalSession;
|
||||||
|
import com.sk89q.worldedit.WorldEdit;
|
||||||
|
import com.sk89q.worldedit.WorldEditException;
|
||||||
import com.sk89q.worldedit.blocks.ItemType;
|
import com.sk89q.worldedit.blocks.ItemType;
|
||||||
import com.sk89q.worldedit.entity.Player;
|
import com.sk89q.worldedit.entity.Player;
|
||||||
import com.sk89q.worldedit.extension.input.ParserContext;
|
import com.sk89q.worldedit.extension.input.ParserContext;
|
||||||
@ -14,6 +18,7 @@ import com.sk89q.worldedit.extension.platform.Actor;
|
|||||||
import com.sk89q.worldedit.function.mask.Mask;
|
import com.sk89q.worldedit.function.mask.Mask;
|
||||||
import com.sk89q.worldedit.util.command.parametric.Optional;
|
import com.sk89q.worldedit.util.command.parametric.Optional;
|
||||||
|
|
||||||
|
|
||||||
import static com.google.common.base.Preconditions.checkNotNull;
|
import static com.google.common.base.Preconditions.checkNotNull;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -43,21 +43,18 @@ public class ToolUtilCommands {
|
|||||||
String newState = args.getString(0, null);
|
String newState = args.getString(0, null);
|
||||||
if (session.hasSuperPickAxe()) {
|
if (session.hasSuperPickAxe()) {
|
||||||
if ("on".equals(newState)) {
|
if ("on".equals(newState)) {
|
||||||
player.printError("Super pick axe already enabled.");
|
|
||||||
BBC.SUPERPICKAXE_ENABLED.send(player);
|
BBC.SUPERPICKAXE_ENABLED.send(player);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
session.disableSuperPickAxe();
|
session.disableSuperPickAxe();
|
||||||
player.print("Super pick axe disabled.");
|
BBC.SUPERPICKAXE_DISABLED.send(player);
|
||||||
} else {
|
} else {
|
||||||
if ("off".equals(newState)) {
|
if ("off".equals(newState)) {
|
||||||
player.printError("Super pick axe already disabled.");
|
|
||||||
BBC.SUPERPICKAXE_DISABLED.send(player);
|
BBC.SUPERPICKAXE_DISABLED.send(player);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
session.enableSuperPickAxe();
|
session.enableSuperPickAxe();
|
||||||
player.print("Super pick axe enabled.");
|
|
||||||
BBC.SUPERPICKAXE_ENABLED.send(player);
|
BBC.SUPERPICKAXE_ENABLED.send(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
package com.sk89q.worldedit.command.tool;
|
package com.sk89q.worldedit.command.tool;
|
||||||
|
|
||||||
import com.sk89q.worldedit.*;
|
import com.sk89q.worldedit.EditSession;
|
||||||
|
import com.sk89q.worldedit.LocalConfiguration;
|
||||||
|
import com.sk89q.worldedit.LocalSession;
|
||||||
import com.sk89q.worldedit.blocks.BaseBlock;
|
import com.sk89q.worldedit.blocks.BaseBlock;
|
||||||
import com.sk89q.worldedit.blocks.BlockID;
|
import com.sk89q.worldedit.blocks.BlockID;
|
||||||
import com.sk89q.worldedit.entity.Player;
|
import com.sk89q.worldedit.entity.Player;
|
||||||
|
@ -19,7 +19,10 @@
|
|||||||
|
|
||||||
package com.sk89q.worldedit.command.tool;
|
package com.sk89q.worldedit.command.tool;
|
||||||
|
|
||||||
import com.sk89q.worldedit.*;
|
import com.sk89q.worldedit.EditSession;
|
||||||
|
import com.sk89q.worldedit.LocalConfiguration;
|
||||||
|
import com.sk89q.worldedit.LocalSession;
|
||||||
|
import com.sk89q.worldedit.WorldVectorFace;
|
||||||
import com.sk89q.worldedit.blocks.BaseBlock;
|
import com.sk89q.worldedit.blocks.BaseBlock;
|
||||||
import com.sk89q.worldedit.blocks.BlockID;
|
import com.sk89q.worldedit.blocks.BlockID;
|
||||||
import com.sk89q.worldedit.entity.Player;
|
import com.sk89q.worldedit.entity.Player;
|
||||||
|
@ -26,9 +26,9 @@ import com.sk89q.worldedit.event.Event;
|
|||||||
import com.sk89q.worldedit.extension.platform.Actor;
|
import com.sk89q.worldedit.extension.platform.Actor;
|
||||||
import com.sk89q.worldedit.extent.Extent;
|
import com.sk89q.worldedit.extent.Extent;
|
||||||
import com.sk89q.worldedit.world.World;
|
import com.sk89q.worldedit.world.World;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
|
|
||||||
import static com.google.common.base.Preconditions.checkNotNull;
|
import static com.google.common.base.Preconditions.checkNotNull;
|
||||||
import static com.sk89q.worldedit.EditSession.Stage;
|
import static com.sk89q.worldedit.EditSession.Stage;
|
||||||
|
|
||||||
|
@ -43,11 +43,21 @@ public class FaweForge implements IFawe {
|
|||||||
this.mod = mod;
|
this.mod = mod;
|
||||||
try {
|
try {
|
||||||
Fawe.set(this);
|
Fawe.set(this);
|
||||||
|
setupInjector();
|
||||||
} catch (InstanceAlreadyExistsException e) {
|
} catch (InstanceAlreadyExistsException e) {
|
||||||
MainUtil.handleError(e);
|
MainUtil.handleError(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setupInjector() {
|
||||||
|
try {
|
||||||
|
Fawe.get().setupInjector();
|
||||||
|
com.sk89q.worldedit.forge.ForgePlayer.inject();
|
||||||
|
} catch (Throwable e) {
|
||||||
|
Fawe.debug("Failed to inject WorldEdit classes.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void debug(String s) {
|
public void debug(String s) {
|
||||||
logger.debug(s);
|
logger.debug(s);
|
||||||
|
@ -30,8 +30,6 @@ public class ForgeMain {
|
|||||||
MinecraftForge.EVENT_BUS.register(this);
|
MinecraftForge.EVENT_BUS.register(this);
|
||||||
FMLCommonHandler.instance().bus().register(this);
|
FMLCommonHandler.instance().bus().register(this);
|
||||||
this.IMP = new FaweForge(this, event.getModLog(), event.getModMetadata(), directory);
|
this.IMP = new FaweForge(this, event.getModLog(), event.getModMetadata(), directory);
|
||||||
|
|
||||||
com.sk89q.worldedit.forge.ForgePlayer.inject();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Mod.EventHandler
|
@Mod.EventHandler
|
||||||
|
@ -43,11 +43,21 @@ public class FaweForge implements IFawe {
|
|||||||
this.mod = mod;
|
this.mod = mod;
|
||||||
try {
|
try {
|
||||||
Fawe.set(this);
|
Fawe.set(this);
|
||||||
|
setupInjector();
|
||||||
} catch (InstanceAlreadyExistsException e) {
|
} catch (InstanceAlreadyExistsException e) {
|
||||||
MainUtil.handleError(e);
|
MainUtil.handleError(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setupInjector() {
|
||||||
|
try {
|
||||||
|
Fawe.get().setupInjector();
|
||||||
|
com.sk89q.worldedit.forge.ForgePlayer.inject();
|
||||||
|
} catch (Throwable e) {
|
||||||
|
Fawe.debug("Failed to inject WorldEdit classes.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void debug(String s) {
|
public void debug(String s) {
|
||||||
logger.debug(s);
|
logger.debug(s);
|
||||||
|
@ -29,8 +29,6 @@ public class ForgeMain {
|
|||||||
MinecraftForge.EVENT_BUS.register(this);
|
MinecraftForge.EVENT_BUS.register(this);
|
||||||
FMLCommonHandler.instance().bus().register(this);
|
FMLCommonHandler.instance().bus().register(this);
|
||||||
this.IMP = new FaweForge(this, event.getModLog(), event.getModMetadata(), directory);
|
this.IMP = new FaweForge(this, event.getModLog(), event.getModMetadata(), directory);
|
||||||
|
|
||||||
com.sk89q.worldedit.forge.ForgePlayer.inject();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Mod.EventHandler
|
@Mod.EventHandler
|
||||||
|
@ -43,11 +43,21 @@ public class FaweForge implements IFawe {
|
|||||||
this.mod = mod;
|
this.mod = mod;
|
||||||
try {
|
try {
|
||||||
Fawe.set(this);
|
Fawe.set(this);
|
||||||
|
setupInjector();
|
||||||
} catch (InstanceAlreadyExistsException e) {
|
} catch (InstanceAlreadyExistsException e) {
|
||||||
MainUtil.handleError(e);
|
MainUtil.handleError(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setupInjector() {
|
||||||
|
try {
|
||||||
|
Fawe.get().setupInjector();
|
||||||
|
com.sk89q.worldedit.forge.ForgePlayer.inject();
|
||||||
|
} catch (Throwable e) {
|
||||||
|
Fawe.debug("Failed to inject WorldEdit classes.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void debug(String s) {
|
public void debug(String s) {
|
||||||
logger.error(s);
|
logger.error(s);
|
||||||
|
@ -31,8 +31,6 @@ public class ForgeMain {
|
|||||||
MinecraftForge.EVENT_BUS.register(this);
|
MinecraftForge.EVENT_BUS.register(this);
|
||||||
FMLCommonHandler.instance().bus().register(this);
|
FMLCommonHandler.instance().bus().register(this);
|
||||||
this.IMP = new FaweForge(this, event.getModLog(), event.getModMetadata(), directory);
|
this.IMP = new FaweForge(this, event.getModLog(), event.getModMetadata(), directory);
|
||||||
|
|
||||||
com.sk89q.worldedit.forge.ForgePlayer.inject();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Mod.EventHandler
|
@Mod.EventHandler
|
||||||
|
@ -43,11 +43,21 @@ public class FaweForge implements IFawe {
|
|||||||
this.mod = mod;
|
this.mod = mod;
|
||||||
try {
|
try {
|
||||||
Fawe.set(this);
|
Fawe.set(this);
|
||||||
|
setupInjector();
|
||||||
} catch (InstanceAlreadyExistsException e) {
|
} catch (InstanceAlreadyExistsException e) {
|
||||||
MainUtil.handleError(e);
|
MainUtil.handleError(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setupInjector() {
|
||||||
|
try {
|
||||||
|
Fawe.get().setupInjector();
|
||||||
|
com.sk89q.worldedit.forge.ForgePlayer.inject();
|
||||||
|
} catch (Throwable e) {
|
||||||
|
Fawe.debug("Failed to inject WorldEdit classes.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void debug(String s) {
|
public void debug(String s) {
|
||||||
logger.debug(s);
|
logger.debug(s);
|
||||||
|
@ -31,8 +31,6 @@ public class ForgeMain {
|
|||||||
MinecraftForge.EVENT_BUS.register(this);
|
MinecraftForge.EVENT_BUS.register(this);
|
||||||
FMLCommonHandler.instance().bus().register(this);
|
FMLCommonHandler.instance().bus().register(this);
|
||||||
this.IMP = new FaweForge(this, event.getModLog(), event.getModMetadata(), directory);
|
this.IMP = new FaweForge(this, event.getModLog(), event.getModMetadata(), directory);
|
||||||
|
|
||||||
com.sk89q.worldedit.forge.ForgePlayer.inject();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Mod.EventHandler
|
@Mod.EventHandler
|
||||||
|
@ -43,11 +43,21 @@ public class FaweForge implements IFawe {
|
|||||||
this.mod = mod;
|
this.mod = mod;
|
||||||
try {
|
try {
|
||||||
Fawe.set(this);
|
Fawe.set(this);
|
||||||
|
setupInjector();
|
||||||
} catch (InstanceAlreadyExistsException e) {
|
} catch (InstanceAlreadyExistsException e) {
|
||||||
MainUtil.handleError(e);
|
MainUtil.handleError(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setupInjector() {
|
||||||
|
try {
|
||||||
|
Fawe.get().setupInjector();
|
||||||
|
com.sk89q.worldedit.forge.ForgePlayer.inject();
|
||||||
|
} catch (Throwable e) {
|
||||||
|
Fawe.debug("Failed to inject WorldEdit classes.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void debug(String s) {
|
public void debug(String s) {
|
||||||
logger.debug(s);
|
logger.debug(s);
|
||||||
|
@ -30,8 +30,6 @@ public class ForgeMain {
|
|||||||
MinecraftForge.EVENT_BUS.register(this);
|
MinecraftForge.EVENT_BUS.register(this);
|
||||||
FMLCommonHandler.instance().bus().register(this);
|
FMLCommonHandler.instance().bus().register(this);
|
||||||
this.IMP = new FaweForge(this, event.getModLog(), event.getModMetadata(), directory);
|
this.IMP = new FaweForge(this, event.getModLog(), event.getModMetadata(), directory);
|
||||||
|
|
||||||
com.sk89q.worldedit.forge.ForgePlayer.inject();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Mod.EventHandler
|
@Mod.EventHandler
|
||||||
|
@ -75,6 +75,7 @@ public class NukkitWorldEdit extends PluginBase {
|
|||||||
public void onEnable() {
|
public void onEnable() {
|
||||||
try {
|
try {
|
||||||
Fawe.set(new FaweNukkit(this));
|
Fawe.set(new FaweNukkit(this));
|
||||||
|
Fawe.get().setupInjector();
|
||||||
Settings.HISTORY.COMBINE_STAGES = false;
|
Settings.HISTORY.COMBINE_STAGES = false;
|
||||||
logger = Logger.getLogger(NukkitWorldEdit.class.getCanonicalName());
|
logger = Logger.getLogger(NukkitWorldEdit.class.getCanonicalName());
|
||||||
createDefaultConfiguration("config-basic.yml");
|
createDefaultConfiguration("config-basic.yml");
|
||||||
|
Loading…
Reference in New Issue
Block a user