3
0
Mirror von https://github.com/IntellectualSites/FastAsyncWorldEdit.git synchronisiert 2024-11-10 05:20:04 +01:00

Updated to use simplified method signature for commands. Also improved SimpleInjector.

Dieser Commit ist enthalten in:
zml2008 2011-12-17 23:45:12 -08:00
Ursprung 6fb8085692
Commit 4dc3c035c1
19 geänderte Dateien mit 366 neuen und 371 gelöschten Zeilen

Datei anzeigen

@ -3,22 +3,30 @@ package com.sk89q.minecraft.util.commands;
import java.lang.reflect.Constructor; import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException; import java.lang.reflect.InvocationTargetException;
public class SimpleInjector<T> implements Injector { public class SimpleInjector implements Injector {
private final T injectionObject; private Object[] args;
private Class<?>[] argClasses;
public SimpleInjector(T injectionObject) { public SimpleInjector(Object... args) {
this.injectionObject = injectionObject; this.args = args;
} argClasses = new Class[args.length];
for (int i = 0; i < args.length; ++i) {
public Object getInstance(Class<?> cls) throws InvocationTargetException, argClasses[i] = args[i].getClass();
IllegalAccessException, InstantiationException { }
try { }
Constructor<?> construct = cls.getConstructor(injectionObject.getClass());
return construct.newInstance(injectionObject);
} catch (NoSuchMethodException e) {
e.printStackTrace();
}
return null;
}
public Object getInstance(Class<?> clazz) {
try {
Constructor<?> ctr = clazz.getConstructor(argClasses);
return ctr.newInstance(args);
} catch (NoSuchMethodException e) {
return null;
} catch (InvocationTargetException e) {
return null;
} catch (InstantiationException e) {
return null;
} catch (IllegalAccessException e) {
return null;
}
}
} }

Datei anzeigen

@ -174,6 +174,8 @@ public class WorldEdit {
} }
}; };
commands.setInjector(new SimpleInjector(this));
commands.register(ChunkCommands.class); commands.register(ChunkCommands.class);
commands.register(ClipboardCommands.class); commands.register(ClipboardCommands.class);
commands.register(GeneralCommands.class); commands.register(GeneralCommands.class);
@ -1256,7 +1258,7 @@ public class WorldEdit {
long start = System.currentTimeMillis(); long start = System.currentTimeMillis();
try { try {
commands.execute(split, player, this, session, player, editSession); commands.execute(split, player, session, player, editSession);
} catch (CommandPermissionsException e) { } catch (CommandPermissionsException e) {
player.printError("You don't have permission to do this."); player.printError("You don't have permission to do this.");
} catch (MissingNestedCommandException e) { } catch (MissingNestedCommandException e) {

Datei anzeigen

@ -49,6 +49,12 @@ import com.sk89q.worldedit.tools.brushes.SphereBrush;
* @author sk89q * @author sk89q
*/ */
public class BrushCommands { public class BrushCommands {
private final WorldEdit we;
public BrushCommands(WorldEdit we) {
this.we = we;
}
@Command( @Command(
aliases = { "sphere", "s" }, aliases = { "sphere", "s" },
usage = "<block> [radius]", usage = "<block> [radius]",
@ -61,9 +67,8 @@ public class BrushCommands {
max = 2 max = 2
) )
@CommandPermissions("worldedit.brush.sphere") @CommandPermissions("worldedit.brush.sphere")
public static void sphereBrush(CommandContext args, WorldEdit we, public void sphereBrush(CommandContext args, LocalSession session,
LocalSession session, LocalPlayer player, EditSession editSession) LocalPlayer player, EditSession editSession) throws WorldEditException {
throws WorldEditException {
LocalConfiguration config = we.getConfiguration(); LocalConfiguration config = we.getConfiguration();
@ -101,9 +106,8 @@ public class BrushCommands {
max = 3 max = 3
) )
@CommandPermissions("worldedit.brush.cylinder") @CommandPermissions("worldedit.brush.cylinder")
public static void cylinderBrush(CommandContext args, WorldEdit we, public void cylinderBrush(CommandContext args, LocalSession session,
LocalSession session, LocalPlayer player, EditSession editSession) LocalPlayer player, EditSession editSession) throws WorldEditException {
throws WorldEditException {
LocalConfiguration config = we.getConfiguration(); LocalConfiguration config = we.getConfiguration();
@ -148,9 +152,8 @@ public class BrushCommands {
max = 0 max = 0
) )
@CommandPermissions("worldedit.brush.clipboard") @CommandPermissions("worldedit.brush.clipboard")
public static void clipboardBrush(CommandContext args, WorldEdit we, public void clipboardBrush(CommandContext args, LocalSession session,
LocalSession session, LocalPlayer player, EditSession editSession) LocalPlayer player, EditSession editSession) throws WorldEditException {
throws WorldEditException {
LocalConfiguration config = we.getConfiguration(); LocalConfiguration config = we.getConfiguration();
@ -189,9 +192,8 @@ public class BrushCommands {
max = 2 max = 2
) )
@CommandPermissions("worldedit.brush.smooth") @CommandPermissions("worldedit.brush.smooth")
public static void smoothBrush(CommandContext args, WorldEdit we, public void smoothBrush(CommandContext args, LocalSession session,
LocalSession session, LocalPlayer player, EditSession editSession) LocalPlayer player, EditSession editSession) throws WorldEditException {
throws WorldEditException {
LocalConfiguration config = we.getConfiguration(); LocalConfiguration config = we.getConfiguration();
@ -220,9 +222,8 @@ public class BrushCommands {
max = 1 max = 1
) )
@CommandPermissions("worldedit.brush.ex") @CommandPermissions("worldedit.brush.ex")
public static void extinguishBrush(CommandContext args, WorldEdit we, public void extinguishBrush(CommandContext args, LocalSession session,
LocalSession session, LocalPlayer player, EditSession editSession) LocalPlayer player, EditSession editSession) throws WorldEditException {
throws WorldEditException {
LocalConfiguration config = we.getConfiguration(); LocalConfiguration config = we.getConfiguration();

Datei anzeigen

@ -36,6 +36,12 @@ import com.sk89q.worldedit.data.McRegionChunkStore;
* @author sk89q * @author sk89q
*/ */
public class ChunkCommands { public class ChunkCommands {
private final WorldEdit we;
public ChunkCommands(WorldEdit we) {
this.we = we;
}
@Command( @Command(
aliases = { "chunkinfo" }, aliases = { "chunkinfo" },
usage = "", usage = "",
@ -44,9 +50,8 @@ public class ChunkCommands {
max = 0 max = 0
) )
@CommandPermissions("worldedit.chunkinfo") @CommandPermissions("worldedit.chunkinfo")
public static void chunkInfo(CommandContext args, WorldEdit we, public void chunkInfo(CommandContext args, LocalSession session, LocalPlayer player,
LocalSession session, LocalPlayer player, EditSession editSession) EditSession editSession) throws WorldEditException {
throws WorldEditException {
Vector pos = player.getBlockIn(); Vector pos = player.getBlockIn();
int chunkX = (int) Math.floor(pos.getBlockX() / 16.0); int chunkX = (int) Math.floor(pos.getBlockX() / 16.0);
@ -71,9 +76,8 @@ public class ChunkCommands {
max = 0 max = 0
) )
@CommandPermissions("worldedit.listchunks") @CommandPermissions("worldedit.listchunks")
public static void listChunks(CommandContext args, WorldEdit we, public void listChunks(CommandContext args, LocalSession session, LocalPlayer player,
LocalSession session, LocalPlayer player, EditSession editSession) EditSession editSession) throws WorldEditException {
throws WorldEditException {
Set<Vector2D> chunks = session.getSelection(player.getWorld()).getChunks(); Set<Vector2D> chunks = session.getSelection(player.getWorld()).getChunks();
@ -91,9 +95,8 @@ public class ChunkCommands {
) )
@CommandPermissions("worldedit.delchunks") @CommandPermissions("worldedit.delchunks")
@Logging(REGION) @Logging(REGION)
public static void deleteChunks(CommandContext args, WorldEdit we, public void deleteChunks(CommandContext args, LocalSession session, LocalPlayer player,
LocalSession session, LocalPlayer player, EditSession editSession) EditSession editSession) throws WorldEditException {
throws WorldEditException {
player.print("Note that this command does not yet support the mcregion format."); player.print("Note that this command does not yet support the mcregion format.");
LocalConfiguration config = we.getConfiguration(); LocalConfiguration config = we.getConfiguration();

Datei anzeigen

@ -38,6 +38,12 @@ import com.sk89q.worldedit.regions.Region;
* @author sk89q * @author sk89q
*/ */
public class ClipboardCommands { public class ClipboardCommands {
private final WorldEdit we;
public ClipboardCommands(WorldEdit we) {
this.we = we;
}
@Command( @Command(
aliases = { "/copy" }, aliases = { "/copy" },
usage = "", usage = "",
@ -46,9 +52,8 @@ public class ClipboardCommands {
max = 0 max = 0
) )
@CommandPermissions("worldedit.clipboard.copy") @CommandPermissions("worldedit.clipboard.copy")
public static void copy(CommandContext args, WorldEdit we, public void copy(CommandContext args, LocalSession session, LocalPlayer player,
LocalSession session, LocalPlayer player, EditSession editSession) EditSession editSession) throws WorldEditException {
throws WorldEditException {
Region region = session.getSelection(player.getWorld()); Region region = session.getSelection(player.getWorld());
Vector min = region.getMinimumPoint(); Vector min = region.getMinimumPoint();
@ -73,9 +78,8 @@ public class ClipboardCommands {
) )
@CommandPermissions("worldedit.clipboard.cut") @CommandPermissions("worldedit.clipboard.cut")
@Logging(REGION) @Logging(REGION)
public static void cut(CommandContext args, WorldEdit we, public void cut(CommandContext args, LocalSession session, LocalPlayer player,
LocalSession session, LocalPlayer player, EditSession editSession) EditSession editSession) throws WorldEditException {
throws WorldEditException {
BaseBlock block = new BaseBlock(BlockID.AIR); BaseBlock block = new BaseBlock(BlockID.AIR);
@ -113,9 +117,8 @@ public class ClipboardCommands {
) )
@CommandPermissions("worldedit.clipboard.paste") @CommandPermissions("worldedit.clipboard.paste")
@Logging(PLACEMENT) @Logging(PLACEMENT)
public static void paste(CommandContext args, WorldEdit we, public void paste(CommandContext args, LocalSession session, LocalPlayer player,
LocalSession session, LocalPlayer player, EditSession editSession) EditSession editSession) throws WorldEditException {
throws WorldEditException {
boolean atOrigin = args.hasFlag('o'); boolean atOrigin = args.hasFlag('o');
boolean pasteNoAir = args.hasFlag('a'); boolean pasteNoAir = args.hasFlag('a');
@ -141,9 +144,8 @@ public class ClipboardCommands {
max = 1 max = 1
) )
@CommandPermissions("worldedit.clipboard.rotate") @CommandPermissions("worldedit.clipboard.rotate")
public static void rotate(CommandContext args, WorldEdit we, public void rotate(CommandContext args, LocalSession session, LocalPlayer player,
LocalSession session, LocalPlayer player, EditSession editSession) EditSession editSession) throws WorldEditException {
throws WorldEditException {
int angle = args.getInteger(0); int angle = args.getInteger(0);
@ -169,9 +171,8 @@ public class ClipboardCommands {
max = 1 max = 1
) )
@CommandPermissions("worldedit.clipboard.flip") @CommandPermissions("worldedit.clipboard.flip")
public static void flip(CommandContext args, WorldEdit we, public void flip(CommandContext args, LocalSession session, LocalPlayer player,
LocalSession session, LocalPlayer player, EditSession editSession) EditSession editSession) throws WorldEditException {
throws WorldEditException {
CuboidClipboard.FlipDirection dir = we.getFlipDirection(player, CuboidClipboard.FlipDirection dir = we.getFlipDirection(player,
args.argsLength() > 0 ? args.getString(0).toLowerCase() : "me"); args.argsLength() > 0 ? args.getString(0).toLowerCase() : "me");
@ -189,9 +190,8 @@ public class ClipboardCommands {
max = 1 max = 1
) )
@CommandPermissions("worldedit.clipboard.load") @CommandPermissions("worldedit.clipboard.load")
public static void load(CommandContext args, WorldEdit we, public void load(CommandContext args, LocalSession session, LocalPlayer player,
LocalSession session, LocalPlayer player, EditSession editSession) EditSession editSession) throws WorldEditException {
throws WorldEditException {
LocalConfiguration config = we.getConfiguration(); LocalConfiguration config = we.getConfiguration();
@ -225,9 +225,8 @@ public class ClipboardCommands {
max = 1 max = 1
) )
@CommandPermissions("worldedit.clipboard.save") @CommandPermissions("worldedit.clipboard.save")
public static void save(CommandContext args, WorldEdit we, public void save(CommandContext args, LocalSession session, LocalPlayer player,
LocalSession session, LocalPlayer player, EditSession editSession) EditSession editSession) throws WorldEditException {
throws WorldEditException {
LocalConfiguration config = we.getConfiguration(); LocalConfiguration config = we.getConfiguration();
@ -268,9 +267,8 @@ public class ClipboardCommands {
max = 0 max = 0
) )
@CommandPermissions("worldedit.clipboard.clear") @CommandPermissions("worldedit.clipboard.clear")
public static void clearClipboard(CommandContext args, WorldEdit we, public void clearClipboard(CommandContext args, LocalSession session, LocalPlayer player,
LocalSession session, LocalPlayer player, EditSession editSession) EditSession editSession) throws WorldEditException {
throws WorldEditException {
session.setClipboard(null); session.setClipboard(null);
player.print("Clipboard cleared."); player.print("Clipboard cleared.");

Datei anzeigen

@ -34,6 +34,12 @@ import com.sk89q.worldedit.masks.Mask;
* @author sk89q * @author sk89q
*/ */
public class GeneralCommands { public class GeneralCommands {
private final WorldEdit we;
public GeneralCommands(WorldEdit we) {
this.we = we;
}
@Command( @Command(
aliases = { "/limit" }, aliases = { "/limit" },
usage = "<limit>", usage = "<limit>",
@ -42,9 +48,8 @@ public class GeneralCommands {
max = 1 max = 1
) )
@CommandPermissions("worldedit.limit") @CommandPermissions("worldedit.limit")
public static void limit(CommandContext args, WorldEdit we, public void limit(CommandContext args, LocalSession session, LocalPlayer player,
LocalSession session, LocalPlayer player, EditSession editSession) EditSession editSession) throws WorldEditException {
throws WorldEditException {
LocalConfiguration config = we.getConfiguration(); LocalConfiguration config = we.getConfiguration();
@ -70,9 +75,8 @@ public class GeneralCommands {
max = 1 max = 1
) )
@CommandPermissions("worldedit.fast") @CommandPermissions("worldedit.fast")
public static void fast(CommandContext args, WorldEdit we, public void fast(CommandContext args, LocalSession session, LocalPlayer player,
LocalSession session, LocalPlayer player, EditSession editSession) EditSession editSession) throws WorldEditException {
throws WorldEditException {
String newState = args.getString(0, null); String newState = args.getString(0, null);
if (session.hasFastMode()) { if (session.hasFastMode()) {
@ -102,9 +106,8 @@ public class GeneralCommands {
max = -1 max = -1
) )
@CommandPermissions("worldedit.global-mask") @CommandPermissions("worldedit.global-mask")
public static void mask(CommandContext args, WorldEdit we, public void mask(CommandContext args, LocalSession session, LocalPlayer player,
LocalSession session, LocalPlayer player, EditSession editSession) EditSession editSession) throws WorldEditException {
throws WorldEditException {
if (args.argsLength() == 0) { if (args.argsLength() == 0) {
session.setMask(null); session.setMask(null);
player.print("Global mask disabled."); player.print("Global mask disabled.");
@ -122,9 +125,8 @@ public class GeneralCommands {
min = 0, min = 0,
max = 0 max = 0
) )
public static void togglePlace(CommandContext args, WorldEdit we, public void togglePlace(CommandContext args, LocalSession session, LocalPlayer player,
LocalSession session, LocalPlayer player, EditSession editSession) EditSession editSession) throws WorldEditException {
throws WorldEditException {
if (session.togglePlacementPosition()) { if (session.togglePlacementPosition()) {
player.print("Now placing at pos #1."); player.print("Now placing at pos #1.");
@ -147,9 +149,8 @@ public class GeneralCommands {
max = 1 max = 1
) )
@Console @Console
public static void searchItem(CommandContext args, WorldEdit we, public void searchItem(CommandContext args, LocalSession session, LocalPlayer player,
LocalSession session, LocalPlayer player, EditSession editSession) EditSession editSession) throws WorldEditException {
throws WorldEditException {
String query = args.getString(0).trim().toLowerCase(); String query = args.getString(0).trim().toLowerCase();
boolean blocksOnly = args.hasFlag('b'); boolean blocksOnly = args.hasFlag('b');
@ -222,8 +223,7 @@ public class GeneralCommands {
) )
@NestedCommand(WorldEditCommands.class) @NestedCommand(WorldEditCommands.class)
@Console @Console
public static void we(CommandContext args, WorldEdit we, public void we(CommandContext args, LocalSession session, LocalPlayer player,
LocalSession session, LocalPlayer player, EditSession editSession) EditSession editSession) throws WorldEditException {
throws WorldEditException {
} }
} }

Datei anzeigen

@ -36,6 +36,12 @@ import com.sk89q.worldedit.util.TreeGenerator;
* @author sk89q * @author sk89q
*/ */
public class GenerationCommands { public class GenerationCommands {
private final WorldEdit we;
public GenerationCommands(WorldEdit we) {
this.we = we;
}
@Command( @Command(
aliases = { "/hcyl" }, aliases = { "/hcyl" },
usage = "<block> <radius>[,<radius>] [height]", usage = "<block> <radius>[,<radius>] [height]",
@ -50,9 +56,8 @@ public class GenerationCommands {
) )
@CommandPermissions("worldedit.generation.cylinder") @CommandPermissions("worldedit.generation.cylinder")
@Logging(PLACEMENT) @Logging(PLACEMENT)
public static void hcyl(CommandContext args, WorldEdit we, public void hcyl(CommandContext args, LocalSession session, LocalPlayer player,
LocalSession session, LocalPlayer player, EditSession editSession) EditSession editSession) throws WorldEditException {
throws WorldEditException {
Pattern block = we.getBlockPattern(player, args.getString(0)); Pattern block = we.getBlockPattern(player, args.getString(0));
String[] radiuses = args.getString(1).split(","); String[] radiuses = args.getString(1).split(",");
@ -92,9 +97,8 @@ public class GenerationCommands {
) )
@CommandPermissions("worldedit.generation.cylinder") @CommandPermissions("worldedit.generation.cylinder")
@Logging(PLACEMENT) @Logging(PLACEMENT)
public static void cyl(CommandContext args, WorldEdit we, public void cyl(CommandContext args, LocalSession session, LocalPlayer player,
LocalSession session, LocalPlayer player, EditSession editSession) EditSession editSession) throws WorldEditException {
throws WorldEditException {
Pattern block = we.getBlockPattern(player, args.getString(0)); Pattern block = we.getBlockPattern(player, args.getString(0));
String[] radiuses = args.getString(1).split(","); String[] radiuses = args.getString(1).split(",");
@ -134,9 +138,8 @@ public class GenerationCommands {
) )
@CommandPermissions("worldedit.generation.sphere") @CommandPermissions("worldedit.generation.sphere")
@Logging(PLACEMENT) @Logging(PLACEMENT)
public static void hsphere(CommandContext args, WorldEdit we, public void hsphere(CommandContext args, LocalSession session, LocalPlayer player,
LocalSession session, LocalPlayer player, EditSession editSession) EditSession editSession) throws WorldEditException {
throws WorldEditException {
final Pattern block = we.getBlockPattern(player, args.getString(0)); final Pattern block = we.getBlockPattern(player, args.getString(0));
String[] radiuses = args.getString(1).split(","); String[] radiuses = args.getString(1).split(",");
@ -187,9 +190,8 @@ public class GenerationCommands {
) )
@CommandPermissions("worldedit.generation.sphere") @CommandPermissions("worldedit.generation.sphere")
@Logging(PLACEMENT) @Logging(PLACEMENT)
public static void sphere(CommandContext args, WorldEdit we, public void sphere(CommandContext args, LocalSession session, LocalPlayer player,
LocalSession session, LocalPlayer player, EditSession editSession) EditSession editSession) throws WorldEditException {
throws WorldEditException {
Pattern block = we.getBlockPattern(player, args.getString(0)); Pattern block = we.getBlockPattern(player, args.getString(0));
String[] radiuses = args.getString(1).split(","); String[] radiuses = args.getString(1).split(",");
@ -235,9 +237,8 @@ public class GenerationCommands {
) )
@CommandPermissions("worldedit.generation.forest") @CommandPermissions("worldedit.generation.forest")
@Logging(POSITION) @Logging(POSITION)
public static void forestGen(CommandContext args, WorldEdit we, public void forestGen(CommandContext args, LocalSession session, LocalPlayer player,
LocalSession session, LocalPlayer player, EditSession editSession) EditSession editSession) throws WorldEditException {
throws WorldEditException {
int size = args.argsLength() > 0 ? Math.max(1, args.getInteger(0)) : 10; int size = args.argsLength() > 0 ? Math.max(1, args.getInteger(0)) : 10;
TreeGenerator.TreeType type = args.argsLength() > 1 ? TreeGenerator.TreeType type = args.argsLength() > 1 ?
@ -264,9 +265,8 @@ public class GenerationCommands {
) )
@CommandPermissions("worldedit.generation.pumpkins") @CommandPermissions("worldedit.generation.pumpkins")
@Logging(POSITION) @Logging(POSITION)
public static void pumpkins(CommandContext args, WorldEdit we, public void pumpkins(CommandContext args, LocalSession session, LocalPlayer player,
LocalSession session, LocalPlayer player, EditSession editSession) EditSession editSession) throws WorldEditException {
throws WorldEditException {
int size = args.argsLength() > 0 ? Math.max(1, args.getInteger(0)) : 10; int size = args.argsLength() > 0 ? Math.max(1, args.getInteger(0)) : 10;
@ -283,9 +283,8 @@ public class GenerationCommands {
) )
@CommandPermissions("worldedit.generation.pyramid") @CommandPermissions("worldedit.generation.pyramid")
@Logging(PLACEMENT) @Logging(PLACEMENT)
public static void pyramid(CommandContext args, WorldEdit we, public void pyramid(CommandContext args, LocalSession session, LocalPlayer player,
LocalSession session, LocalPlayer player, EditSession editSession) EditSession editSession) throws WorldEditException {
throws WorldEditException {
Pattern block = we.getBlockPattern(player, args.getString(0)); Pattern block = we.getBlockPattern(player, args.getString(0));
int size = Math.max(1, args.getInteger(1)); int size = Math.max(1, args.getInteger(1));
@ -306,9 +305,8 @@ public class GenerationCommands {
) )
@CommandPermissions("worldedit.generation.pyramid") @CommandPermissions("worldedit.generation.pyramid")
@Logging(PLACEMENT) @Logging(PLACEMENT)
public static void hpyramid(CommandContext args, WorldEdit we, public void hpyramid(CommandContext args, LocalSession session, LocalPlayer player,
LocalSession session, LocalPlayer player, EditSession editSession) EditSession editSession) throws WorldEditException {
throws WorldEditException {
Pattern block = we.getBlockPattern(player, args.getString(0)); Pattern block = we.getBlockPattern(player, args.getString(0));
int size = Math.max(1, args.getInteger(1)); int size = Math.max(1, args.getInteger(1));
@ -340,9 +338,8 @@ public class GenerationCommands {
) )
@CommandPermissions("worldedit.generation.shape") @CommandPermissions("worldedit.generation.shape")
@Logging(ALL) @Logging(ALL)
public static void generate(CommandContext args, WorldEdit we, public void generate(CommandContext args, LocalSession session, LocalPlayer player,
LocalSession session, LocalPlayer player, EditSession editSession) EditSession editSession) throws WorldEditException {
throws WorldEditException {
final Pattern pattern = we.getBlockPattern(player, args.getString(0)); final Pattern pattern = we.getBlockPattern(player, args.getString(0));
final Region region = session.getSelection(player.getWorld()); final Region region = session.getSelection(player.getWorld());

Datei anzeigen

@ -30,6 +30,12 @@ import com.sk89q.worldedit.*;
* @author sk89q * @author sk89q
*/ */
public class HistoryCommands { public class HistoryCommands {
private final WorldEdit we;
public HistoryCommands(WorldEdit we) {
this.we = we;
}
@Command( @Command(
aliases = { "/undo", "undo" }, aliases = { "/undo", "undo" },
usage = "[times] [player]", usage = "[times] [player]",
@ -38,9 +44,8 @@ public class HistoryCommands {
max = 2 max = 2
) )
@CommandPermissions("worldedit.history.undo") @CommandPermissions("worldedit.history.undo")
public static void undo(CommandContext args, WorldEdit we, public void undo(CommandContext args, LocalSession session, LocalPlayer player,
LocalSession session, LocalPlayer player, EditSession editSession) EditSession editSession) throws WorldEditException {
throws WorldEditException {
int times = Math.max(1, args.getInteger(0, 1)); int times = Math.max(1, args.getInteger(0, 1));
for (int i = 0; i < times; ++i) { for (int i = 0; i < times; ++i) {
@ -74,9 +79,8 @@ public class HistoryCommands {
max = 2 max = 2
) )
@CommandPermissions("worldedit.history.redo") @CommandPermissions("worldedit.history.redo")
public static void redo(CommandContext args, WorldEdit we, public void redo(CommandContext args, LocalSession session, LocalPlayer player,
LocalSession session, LocalPlayer player, EditSession editSession) EditSession editSession) throws WorldEditException {
throws WorldEditException {
int times = Math.max(1, args.getInteger(0, 1)); int times = Math.max(1, args.getInteger(0, 1));
@ -110,9 +114,8 @@ public class HistoryCommands {
max = 0 max = 0
) )
@CommandPermissions("worldedit.history.clear") @CommandPermissions("worldedit.history.clear")
public static void clearHistory(CommandContext args, WorldEdit we, public void clearHistory(CommandContext args, LocalSession session, LocalPlayer player,
LocalSession session, LocalPlayer player, EditSession editSession) EditSession editSession) throws WorldEditException {
throws WorldEditException {
session.clearHistory(); session.clearHistory();
player.print("History cleared."); player.print("History cleared.");

Datei anzeigen

@ -32,6 +32,12 @@ import com.sk89q.worldedit.*;
* @author sk89q * @author sk89q
*/ */
public class NavigationCommands { public class NavigationCommands {
private final WorldEdit we;
public NavigationCommands(WorldEdit we) {
this.we = we;
}
@Command( @Command(
aliases = { "unstuck", "!" }, aliases = { "unstuck", "!" },
usage = "", usage = "",
@ -40,9 +46,8 @@ public class NavigationCommands {
max = 0 max = 0
) )
@CommandPermissions("worldedit.navigation.unstuck") @CommandPermissions("worldedit.navigation.unstuck")
public static void unstuck(CommandContext args, WorldEdit we, public void unstuck(CommandContext args, LocalSession session, LocalPlayer player,
LocalSession session, LocalPlayer player, EditSession editSession) EditSession editSession) throws WorldEditException {
throws WorldEditException {
player.print("There you go!"); player.print("There you go!");
player.findFreePosition(); player.findFreePosition();
@ -56,9 +61,8 @@ public class NavigationCommands {
max = 1 max = 1
) )
@CommandPermissions("worldedit.navigation.ascend") @CommandPermissions("worldedit.navigation.ascend")
public static void ascend(CommandContext args, WorldEdit we, public void ascend(CommandContext args, LocalSession session, LocalPlayer player,
LocalSession session, LocalPlayer player, EditSession editSession) EditSession editSession) throws WorldEditException {
throws WorldEditException {
int levelsToAscend = 0; int levelsToAscend = 0;
if (args.argsLength() == 0) { if (args.argsLength() == 0) {
levelsToAscend = 1; levelsToAscend = 1;
@ -84,9 +88,8 @@ public class NavigationCommands {
max = 1 max = 1
) )
@CommandPermissions("worldedit.navigation.descend") @CommandPermissions("worldedit.navigation.descend")
public static void descend(CommandContext args, WorldEdit we, public void descend(CommandContext args, LocalSession session, LocalPlayer player,
LocalSession session, LocalPlayer player, EditSession editSession) EditSession editSession) throws WorldEditException {
throws WorldEditException {
int levelsToDescend = 0; int levelsToDescend = 0;
if (args.argsLength() == 0) { if (args.argsLength() == 0) {
levelsToDescend = 1; levelsToDescend = 1;
@ -113,9 +116,8 @@ public class NavigationCommands {
) )
@CommandPermissions("worldedit.navigation.ceiling") @CommandPermissions("worldedit.navigation.ceiling")
@Logging(POSITION) @Logging(POSITION)
public static void ceiling(CommandContext args, WorldEdit we, public void ceiling(CommandContext args, LocalSession session, LocalPlayer player,
LocalSession session, LocalPlayer player, EditSession editSession) EditSession editSession) throws WorldEditException {
throws WorldEditException {
int clearence = args.argsLength() > 0 ? int clearence = args.argsLength() > 0 ?
Math.max(0, args.getInteger(0)) : 0; Math.max(0, args.getInteger(0)) : 0;
@ -135,9 +137,8 @@ public class NavigationCommands {
max = 0 max = 0
) )
// @CommandPermissions("worldedit.navigation.thru.command") // TODO: Remove old permission // @CommandPermissions("worldedit.navigation.thru.command") // TODO: Remove old permission
public static void thru(CommandContext args, WorldEdit we, public void thru(CommandContext args, LocalSession session, LocalPlayer player,
LocalSession session, LocalPlayer player, EditSession editSession) EditSession editSession) throws WorldEditException {
throws WorldEditException {
if (!(player.hasPermission("worldedit.navigation.thru") || if (!(player.hasPermission("worldedit.navigation.thru") ||
player.hasPermission("worldedit.navigation.thru.command"))) { player.hasPermission("worldedit.navigation.thru.command"))) {
throw new WorldEditPermissionException(); throw new WorldEditPermissionException();
@ -158,9 +159,8 @@ public class NavigationCommands {
max = 0 max = 0
) )
// @CommandPermissions("worldedit.navigation.jumpto.command") //TODO: Remove old permission // @CommandPermissions("worldedit.navigation.jumpto.command") //TODO: Remove old permission
public static void jumpTo(CommandContext args, WorldEdit we, public void jumpTo(CommandContext args, LocalSession session, LocalPlayer player,
LocalSession session, LocalPlayer player, EditSession editSession) EditSession editSession) throws WorldEditException {
throws WorldEditException {
if (!(player.hasPermission("worldedit.navigation.jumpto") || if (!(player.hasPermission("worldedit.navigation.jumpto") ||
player.hasPermission("worldedit.navigation.jumpto.command"))) { player.hasPermission("worldedit.navigation.jumpto.command"))) {
@ -185,9 +185,8 @@ public class NavigationCommands {
) )
@CommandPermissions("worldedit.navigation.up") @CommandPermissions("worldedit.navigation.up")
@Logging(POSITION) @Logging(POSITION)
public static void up(CommandContext args, WorldEdit we, public void up(CommandContext args, LocalSession session, LocalPlayer player,
LocalSession session, LocalPlayer player, EditSession editSession) EditSession editSession) throws WorldEditException {
throws WorldEditException {
int distance = args.getInteger(0); int distance = args.getInteger(0);

Datei anzeigen

@ -42,6 +42,12 @@ import com.sk89q.worldedit.regions.RegionOperationException;
* @author sk89q * @author sk89q
*/ */
public class RegionCommands { public class RegionCommands {
private final WorldEdit we;
public RegionCommands(WorldEdit we) {
this.we = we;
}
@Command( @Command(
aliases = { "/set" }, aliases = { "/set" },
usage = "<block>", usage = "<block>",
@ -51,9 +57,8 @@ public class RegionCommands {
) )
@CommandPermissions("worldedit.region.set") @CommandPermissions("worldedit.region.set")
@Logging(REGION) @Logging(REGION)
public static void set(CommandContext args, WorldEdit we, public void set(CommandContext args, LocalSession session, LocalPlayer player,
LocalSession session, LocalPlayer player, EditSession editSession) EditSession editSession) throws WorldEditException {
throws WorldEditException {
Pattern pattern = we.getBlockPattern(player, args.getString(0)); Pattern pattern = we.getBlockPattern(player, args.getString(0));
@ -79,9 +84,8 @@ public class RegionCommands {
) )
@CommandPermissions("worldedit.region.replace") @CommandPermissions("worldedit.region.replace")
@Logging(REGION) @Logging(REGION)
public static void replace(CommandContext args, WorldEdit we, public void replace(CommandContext args, LocalSession session, LocalPlayer player,
LocalSession session, LocalPlayer player, EditSession editSession) EditSession editSession) throws WorldEditException {
throws WorldEditException {
Set<BaseBlock> from; Set<BaseBlock> from;
Pattern to; Pattern to;
@ -113,9 +117,8 @@ public class RegionCommands {
) )
@CommandPermissions("worldedit.region.overlay") @CommandPermissions("worldedit.region.overlay")
@Logging(REGION) @Logging(REGION)
public static void overlay(CommandContext args, WorldEdit we, public void overlay(CommandContext args, LocalSession session, LocalPlayer player,
LocalSession session, LocalPlayer player, EditSession editSession) EditSession editSession) throws WorldEditException {
throws WorldEditException {
Pattern pat = we.getBlockPattern(player, args.getString(0)); Pattern pat = we.getBlockPattern(player, args.getString(0));
@ -139,9 +142,8 @@ public class RegionCommands {
) )
@CommandPermissions("worldedit.region.naturalize") @CommandPermissions("worldedit.region.naturalize")
@Logging(REGION) @Logging(REGION)
public static void naturalize(CommandContext args, WorldEdit we, public void naturalize(CommandContext args, LocalSession session, LocalPlayer player,
LocalSession session, LocalPlayer player, EditSession editSession) EditSession editSession) throws WorldEditException {
throws WorldEditException {
Region region = session.getSelection(player.getWorld()); Region region = session.getSelection(player.getWorld());
int affected = editSession.naturalizeCuboidBlocks(region); int affected = editSession.naturalizeCuboidBlocks(region);
@ -157,9 +159,8 @@ public class RegionCommands {
) )
@CommandPermissions("worldedit.region.walls") @CommandPermissions("worldedit.region.walls")
@Logging(REGION) @Logging(REGION)
public static void walls(CommandContext args, WorldEdit we, public void walls(CommandContext args, LocalSession session, LocalPlayer player,
LocalSession session, LocalPlayer player, EditSession editSession) EditSession editSession) throws WorldEditException {
throws WorldEditException {
Pattern pattern = we.getBlockPattern(player, args.getString(0)); Pattern pattern = we.getBlockPattern(player, args.getString(0));
int affected; int affected;
@ -181,9 +182,8 @@ public class RegionCommands {
) )
@CommandPermissions("worldedit.region.faces") @CommandPermissions("worldedit.region.faces")
@Logging(REGION) @Logging(REGION)
public static void faces(CommandContext args, WorldEdit we, public void faces(CommandContext args, LocalSession session, LocalPlayer player,
LocalSession session, LocalPlayer player, EditSession editSession) EditSession editSession) throws WorldEditException {
throws WorldEditException {
Pattern pattern = we.getBlockPattern(player, args.getString(0)); Pattern pattern = we.getBlockPattern(player, args.getString(0));
int affected; int affected;
@ -209,9 +209,8 @@ public class RegionCommands {
) )
@CommandPermissions("worldedit.region.smooth") @CommandPermissions("worldedit.region.smooth")
@Logging(REGION) @Logging(REGION)
public static void smooth(CommandContext args, WorldEdit we, public void smooth(CommandContext args, LocalSession session, LocalPlayer player,
LocalSession session, LocalPlayer player, EditSession editSession) EditSession editSession) throws WorldEditException {
throws WorldEditException {
int iterations = 1; int iterations = 1;
if (args.argsLength() > 0) { if (args.argsLength() > 0) {
@ -239,9 +238,8 @@ public class RegionCommands {
) )
@CommandPermissions("worldedit.region.move") @CommandPermissions("worldedit.region.move")
@Logging(ORIENTATION_REGION) @Logging(ORIENTATION_REGION)
public static void move(CommandContext args, WorldEdit we, public void move(CommandContext args, LocalSession session, LocalPlayer player,
LocalSession session, LocalPlayer player, EditSession editSession) EditSession editSession) throws WorldEditException {
throws WorldEditException {
int count = args.argsLength() > 0 ? Math.max(1, args.getInteger(0)) : 1; int count = args.argsLength() > 0 ? Math.max(1, args.getInteger(0)) : 1;
Vector dir = we.getDirection(player, Vector dir = we.getDirection(player,
@ -289,9 +287,8 @@ public class RegionCommands {
) )
@CommandPermissions("worldedit.region.stack") @CommandPermissions("worldedit.region.stack")
@Logging(ORIENTATION_REGION) @Logging(ORIENTATION_REGION)
public static void stack(CommandContext args, WorldEdit we, public void stack(CommandContext args, LocalSession session, LocalPlayer player,
LocalSession session, LocalPlayer player, EditSession editSession) EditSession editSession) throws WorldEditException {
throws WorldEditException {
int count = args.argsLength() > 0 ? Math.max(1, args.getInteger(0)) : 1; int count = args.argsLength() > 0 ? Math.max(1, args.getInteger(0)) : 1;
Vector dir = we.getDiagonalDirection(player, Vector dir = we.getDiagonalDirection(player,
@ -332,9 +329,8 @@ public class RegionCommands {
) )
@CommandPermissions("worldedit.regen") @CommandPermissions("worldedit.regen")
@Logging(REGION) @Logging(REGION)
public static void regenerateChunk(CommandContext args, WorldEdit we, public void regenerateChunk(CommandContext args, LocalSession session, LocalPlayer player,
LocalSession session, LocalPlayer player, EditSession editSession) EditSession editSession) throws WorldEditException {
throws WorldEditException {
Region region = session.getSelection(player.getWorld()); Region region = session.getSelection(player.getWorld());
Mask mask = session.getMask(); Mask mask = session.getMask();
@ -359,9 +355,8 @@ public class RegionCommands {
) )
@CommandPermissions("worldedit.region.deform") @CommandPermissions("worldedit.region.deform")
@Logging(ALL) @Logging(ALL)
public static void deform(CommandContext args, WorldEdit we, public void deform(CommandContext args, LocalSession session, LocalPlayer player,
LocalSession session, LocalPlayer player, EditSession editSession) EditSession editSession) throws WorldEditException {
throws WorldEditException {
final Region region = session.getSelection(player.getWorld()); final Region region = session.getSelection(player.getWorld());
@ -406,9 +401,8 @@ public class RegionCommands {
) )
@CommandPermissions("worldedit.region.hollow") @CommandPermissions("worldedit.region.hollow")
@Logging(REGION) @Logging(REGION)
public static void hollow(CommandContext args, WorldEdit we, public void hollow(CommandContext args, LocalSession session, LocalPlayer player,
LocalSession session, LocalPlayer player, EditSession editSession) EditSession editSession) throws WorldEditException {
throws WorldEditException {
int affected = editSession.hollowOutRegion(session.getSelection(player.getWorld())); int affected = editSession.hollowOutRegion(session.getSelection(player.getWorld()));

Datei anzeigen

@ -33,6 +33,12 @@ import com.sk89q.worldedit.*;
* @author sk89q * @author sk89q
*/ */
public class ScriptingCommands { public class ScriptingCommands {
private final WorldEdit we;
public ScriptingCommands(WorldEdit we) {
this.we = we;
}
@Command( @Command(
aliases = { "cs" }, aliases = { "cs" },
usage = "<filename> [args...]", usage = "<filename> [args...]",
@ -42,9 +48,8 @@ public class ScriptingCommands {
) )
@CommandPermissions("worldedit.scripting.execute") @CommandPermissions("worldedit.scripting.execute")
@Logging(ALL) @Logging(ALL)
public static void execute(CommandContext args, WorldEdit we, public void execute(CommandContext args, LocalSession session, LocalPlayer player,
LocalSession session, LocalPlayer player, EditSession editSession) EditSession editSession) throws WorldEditException {
throws WorldEditException {
String[] scriptArgs = args.getSlice(1); String[] scriptArgs = args.getSlice(1);
String name = args.getString(0); String name = args.getString(0);
@ -71,9 +76,8 @@ public class ScriptingCommands {
) )
@CommandPermissions("worldedit.scripting.execute") @CommandPermissions("worldedit.scripting.execute")
@Logging(ALL) @Logging(ALL)
public static void executeLast(CommandContext args, WorldEdit we, public void executeLast(CommandContext args, LocalSession session, LocalPlayer player,
LocalSession session, LocalPlayer player, EditSession editSession) EditSession editSession) throws WorldEditException {
throws WorldEditException {
String lastScript = session.getLastScript(); String lastScript = session.getLastScript();

Datei anzeigen

@ -41,6 +41,12 @@ import com.sk89q.worldedit.blocks.*;
* @author sk89q * @author sk89q
*/ */
public class SelectionCommands { public class SelectionCommands {
private final WorldEdit we;
public SelectionCommands(WorldEdit we) {
this.we = we;
}
@Command( @Command(
aliases = { "/pos1" }, aliases = { "/pos1" },
usage = "[coordinates]", usage = "[coordinates]",
@ -49,9 +55,8 @@ public class SelectionCommands {
max = 1 max = 1
) )
@CommandPermissions("worldedit.selection.pos") @CommandPermissions("worldedit.selection.pos")
public static void pos1(CommandContext args, WorldEdit we, public void pos1(CommandContext args, LocalSession session, LocalPlayer player,
LocalSession session, LocalPlayer player, EditSession editSession) EditSession editSession) throws WorldEditException {
throws WorldEditException {
Vector pos; Vector pos;
@ -84,9 +89,8 @@ public class SelectionCommands {
max = 1 max = 1
) )
@CommandPermissions("worldedit.selection.pos") @CommandPermissions("worldedit.selection.pos")
public static void pos2(CommandContext args, WorldEdit we, public void pos2(CommandContext args, LocalSession session, LocalPlayer player,
LocalSession session, LocalPlayer player, EditSession editSession) EditSession editSession) throws WorldEditException {
throws WorldEditException {
Vector pos; Vector pos;
if (args.argsLength() == 1) { if (args.argsLength() == 1) {
@ -120,9 +124,8 @@ public class SelectionCommands {
max = 0 max = 0
) )
@CommandPermissions("worldedit.selection.hpos") @CommandPermissions("worldedit.selection.hpos")
public static void hpos1(CommandContext args, WorldEdit we, public void hpos1(CommandContext args, LocalSession session, LocalPlayer player,
LocalSession session, LocalPlayer player, EditSession editSession) EditSession editSession) throws WorldEditException {
throws WorldEditException {
Vector pos = player.getBlockTrace(300); Vector pos = player.getBlockTrace(300);
@ -148,9 +151,8 @@ public class SelectionCommands {
max = 0 max = 0
) )
@CommandPermissions("worldedit.selection.hpos") @CommandPermissions("worldedit.selection.hpos")
public static void hpos2(CommandContext args, WorldEdit we, public void hpos2(CommandContext args, LocalSession session, LocalPlayer player,
LocalSession session, LocalPlayer player, EditSession editSession) EditSession editSession) throws WorldEditException {
throws WorldEditException {
Vector pos = player.getBlockTrace(300); Vector pos = player.getBlockTrace(300);
@ -181,9 +183,8 @@ public class SelectionCommands {
max = 0 max = 0
) )
@CommandPermissions("worldedit.selection.chunk") @CommandPermissions("worldedit.selection.chunk")
public static void chunk(CommandContext args, WorldEdit we, public void chunk(CommandContext args, LocalSession session, LocalPlayer player,
LocalSession session, LocalPlayer player, EditSession editSession) EditSession editSession) throws WorldEditException {
throws WorldEditException {
final Vector min; final Vector min;
final Vector max; final Vector max;
@ -226,9 +227,8 @@ public class SelectionCommands {
max = 0 max = 0
) )
@CommandPermissions("worldedit.wand") @CommandPermissions("worldedit.wand")
public static void wand(CommandContext args, WorldEdit we, public void wand(CommandContext args, LocalSession session, LocalPlayer player,
LocalSession session, LocalPlayer player, EditSession editSession) EditSession editSession) throws WorldEditException {
throws WorldEditException {
player.giveItem(we.getConfiguration().wandItem, 1); player.giveItem(we.getConfiguration().wandItem, 1);
player.print("Left click: select pos #1; Right click: select pos #2"); player.print("Left click: select pos #1; Right click: select pos #2");
@ -242,9 +242,8 @@ public class SelectionCommands {
max = 0 max = 0
) )
@CommandPermissions("worldedit.wand.toggle") @CommandPermissions("worldedit.wand.toggle")
public static void toggleWand(CommandContext args, WorldEdit we, public void toggleWand(CommandContext args, LocalSession session, LocalPlayer player,
LocalSession session, LocalPlayer player, EditSession editSession) EditSession editSession) throws WorldEditException {
throws WorldEditException {
session.setToolControl(!session.isToolControlEnabled()); session.setToolControl(!session.isToolControlEnabled());
@ -263,9 +262,8 @@ public class SelectionCommands {
max = 3 max = 3
) )
@CommandPermissions("worldedit.selection.expand") @CommandPermissions("worldedit.selection.expand")
public static void expand(CommandContext args, WorldEdit we, public void expand(CommandContext args, LocalSession session, LocalPlayer player,
LocalSession session, LocalPlayer player, EditSession editSession) EditSession editSession) throws WorldEditException {
throws WorldEditException {
Vector dir; Vector dir;
@ -339,9 +337,8 @@ public class SelectionCommands {
max = 3 max = 3
) )
@CommandPermissions("worldedit.selection.contract") @CommandPermissions("worldedit.selection.contract")
public static void contract(CommandContext args, WorldEdit we, public void contract(CommandContext args, LocalSession session, LocalPlayer player,
LocalSession session, LocalPlayer player, EditSession editSession) EditSession editSession) throws WorldEditException {
throws WorldEditException {
Vector dir; Vector dir;
int change = args.getInteger(0); int change = args.getInteger(0);
@ -394,9 +391,8 @@ public class SelectionCommands {
max = 2 max = 2
) )
@CommandPermissions("worldedit.selection.shift") @CommandPermissions("worldedit.selection.shift")
public static void shift(CommandContext args, WorldEdit we, public void shift(CommandContext args, LocalSession session, LocalPlayer player,
LocalSession session, LocalPlayer player, EditSession editSession) EditSession editSession) throws WorldEditException {
throws WorldEditException {
Vector dir; Vector dir;
int change = args.getInteger(0); int change = args.getInteger(0);
@ -434,9 +430,8 @@ public class SelectionCommands {
max = 1 max = 1
) )
@CommandPermissions("worldedit.selection.outset") @CommandPermissions("worldedit.selection.outset")
public static void outset(CommandContext args, WorldEdit we, public void outset(CommandContext args, LocalSession session, LocalPlayer player,
LocalSession session, LocalPlayer player, EditSession editSession) EditSession editSession) throws WorldEditException {
throws WorldEditException {
int change = args.getInteger(0); int change = args.getInteger(0);
Region region = session.getSelection(player.getWorld()); Region region = session.getSelection(player.getWorld());
@ -478,9 +473,8 @@ public class SelectionCommands {
max = 1 max = 1
) )
@CommandPermissions("worldedit.selection.inset") @CommandPermissions("worldedit.selection.inset")
public static void inset(CommandContext args, WorldEdit we, public void inset(CommandContext args, LocalSession session, LocalPlayer player,
LocalSession session, LocalPlayer player, EditSession editSession) EditSession editSession) throws WorldEditException {
throws WorldEditException {
int change = args.getInteger(0); int change = args.getInteger(0);
Region region = session.getSelection(player.getWorld()); Region region = session.getSelection(player.getWorld());
@ -512,8 +506,7 @@ public class SelectionCommands {
max = 0 max = 0
) )
@CommandPermissions("worldedit.selection.size") @CommandPermissions("worldedit.selection.size")
public static void size(CommandContext args, WorldEdit we, public void size(CommandContext args, LocalSession session, LocalPlayer player, EditSession editSession)
LocalSession session, LocalPlayer player, EditSession editSession)
throws WorldEditException { throws WorldEditException {
Region region = session.getSelection(player.getWorld()); Region region = session.getSelection(player.getWorld());
@ -540,9 +533,8 @@ public class SelectionCommands {
max = 1 max = 1
) )
@CommandPermissions("worldedit.analysis.count") @CommandPermissions("worldedit.analysis.count")
public static void count(CommandContext args, WorldEdit we, public void count(CommandContext args, LocalSession session, LocalPlayer player,
LocalSession session, LocalPlayer player, EditSession editSession) EditSession editSession) throws WorldEditException {
throws WorldEditException {
Set<Integer> searchIDs = we.getBlockIDs(player, Set<Integer> searchIDs = we.getBlockIDs(player,
args.getString(0), true); args.getString(0), true);
@ -562,9 +554,8 @@ public class SelectionCommands {
max = 0 max = 0
) )
@CommandPermissions("worldedit.analysis.distr") @CommandPermissions("worldedit.analysis.distr")
public static void distr(CommandContext args, WorldEdit we, public void distr(CommandContext args, LocalSession session, LocalPlayer player,
LocalSession session, LocalPlayer player, EditSession editSession) EditSession editSession) throws WorldEditException {
throws WorldEditException {
List<Countable<Integer>> distribution = List<Countable<Integer>> distribution =
editSession.getBlockDistribution(session.getSelection(player.getWorld())); editSession.getBlockDistribution(session.getSelection(player.getWorld()));
@ -605,9 +596,8 @@ public class SelectionCommands {
min = 0, min = 0,
max = 1 max = 1
) )
public static void select(CommandContext args, WorldEdit we, public void select(CommandContext args, LocalSession session, LocalPlayer player,
LocalSession session, LocalPlayer player, EditSession editSession) EditSession editSession) throws WorldEditException {
throws WorldEditException {
final LocalWorld world = player.getWorld(); final LocalWorld world = player.getWorld();
if (args.argsLength() == 0) { if (args.argsLength() == 0) {

Datei anzeigen

@ -39,8 +39,14 @@ import com.sk89q.worldedit.snapshots.Snapshot;
* @author sk89q * @author sk89q
*/ */
public class SnapshotCommands { public class SnapshotCommands {
private static Logger logger = Logger.getLogger("Minecraft.WorldEdit"); private static final Logger logger = Logger.getLogger("Minecraft.WorldEdit");
private static DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss z"); private static final DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss z");
private final WorldEdit we;
public SnapshotCommands(WorldEdit we) {
this.we = we;
}
@Command( @Command(
aliases = { "list" }, aliases = { "list" },
@ -50,9 +56,8 @@ public class SnapshotCommands {
max = 1 max = 1
) )
@CommandPermissions("worldedit.snapshots.list") @CommandPermissions("worldedit.snapshots.list")
public static void list(CommandContext args, WorldEdit we, public void list(CommandContext args, LocalSession session, LocalPlayer player,
LocalSession session, LocalPlayer player, EditSession editSession) EditSession editSession) throws WorldEditException {
throws WorldEditException {
LocalConfiguration config = we.getConfiguration(); LocalConfiguration config = we.getConfiguration();
@ -102,9 +107,8 @@ public class SnapshotCommands {
max = 1 max = 1
) )
@CommandPermissions("worldedit.snapshots.restore") @CommandPermissions("worldedit.snapshots.restore")
public static void use(CommandContext args, WorldEdit we, public void use(CommandContext args, LocalSession session, LocalPlayer player,
LocalSession session, LocalPlayer player, EditSession editSession) EditSession editSession) throws WorldEditException {
throws WorldEditException {
LocalConfiguration config = we.getConfiguration(); LocalConfiguration config = we.getConfiguration();
@ -147,9 +151,8 @@ public class SnapshotCommands {
max = 1 max = 1
) )
@CommandPermissions("worldedit.snapshots.restore") @CommandPermissions("worldedit.snapshots.restore")
public static void sel(CommandContext args, WorldEdit we, public void sel(CommandContext args, LocalSession session, LocalPlayer player,
LocalSession session, LocalPlayer player, EditSession editSession) EditSession editSession) throws WorldEditException {
throws WorldEditException {
LocalConfiguration config = we.getConfiguration(); LocalConfiguration config = we.getConfiguration();
if (config.snapshotRepo == null) { if (config.snapshotRepo == null) {
@ -196,9 +199,8 @@ public class SnapshotCommands {
max = -1 max = -1
) )
@CommandPermissions("worldedit.snapshots.restore") @CommandPermissions("worldedit.snapshots.restore")
public static void before(CommandContext args, WorldEdit we, public void before(CommandContext args, LocalSession session, LocalPlayer player,
LocalSession session, LocalPlayer player, EditSession editSession) EditSession editSession) throws WorldEditException {
throws WorldEditException {
LocalConfiguration config = we.getConfiguration(); LocalConfiguration config = we.getConfiguration();
@ -237,9 +239,8 @@ public class SnapshotCommands {
max = -1 max = -1
) )
@CommandPermissions("worldedit.snapshots.restore") @CommandPermissions("worldedit.snapshots.restore")
public static void after(CommandContext args, WorldEdit we, public void after(CommandContext args, LocalSession session, LocalPlayer player,
LocalSession session, LocalPlayer player, EditSession editSession) EditSession editSession) throws WorldEditException {
throws WorldEditException {
LocalConfiguration config = we.getConfiguration(); LocalConfiguration config = we.getConfiguration();

Datei anzeigen

@ -42,16 +42,21 @@ import com.sk89q.worldedit.snapshots.SnapshotRestore;
public class SnapshotUtilCommands { public class SnapshotUtilCommands {
private static Logger logger = Logger.getLogger("Minecraft.WorldEdit"); private static final Logger logger = Logger.getLogger("Minecraft.WorldEdit");
private final WorldEdit we;
public SnapshotUtilCommands(WorldEdit we) {
this.we = we;
}
@Command( @Command(
aliases = { "snapshot", "snap" }, aliases = { "snapshot", "snap" },
desc = "Snapshot commands" desc = "Snapshot commands"
) )
@NestedCommand(SnapshotCommands.class) @NestedCommand(SnapshotCommands.class)
public static void snapshot(CommandContext args, WorldEdit we, public void snapshot(CommandContext args, LocalSession session, LocalPlayer player,
LocalSession session, LocalPlayer player, EditSession editSession) EditSession editSession) throws WorldEditException {
throws WorldEditException {
} }
@Command( @Command(
@ -62,9 +67,8 @@ public class SnapshotUtilCommands {
max = 1 max = 1
) )
@CommandPermissions("worldedit.snapshots.restore") @CommandPermissions("worldedit.snapshots.restore")
public static void restore(CommandContext args, WorldEdit we, public void restore(CommandContext args, LocalSession session, LocalPlayer player,
LocalSession session, LocalPlayer player, EditSession editSession) EditSession editSession) throws WorldEditException {
throws WorldEditException {
LocalConfiguration config = we.getConfiguration(); LocalConfiguration config = we.getConfiguration();

Datei anzeigen

@ -33,6 +33,12 @@ import com.sk89q.worldedit.tools.RecursivePickaxe;
import com.sk89q.worldedit.tools.SinglePickaxe; import com.sk89q.worldedit.tools.SinglePickaxe;
public class SuperPickaxeCommands { public class SuperPickaxeCommands {
private final WorldEdit we;
public SuperPickaxeCommands(WorldEdit we) {
this.we = we;
}
@Command( @Command(
aliases = { "single" }, aliases = { "single" },
usage = "", usage = "",
@ -41,9 +47,8 @@ public class SuperPickaxeCommands {
max = 0 max = 0
) )
@CommandPermissions("worldedit.superpickaxe") @CommandPermissions("worldedit.superpickaxe")
public static void single(CommandContext args, WorldEdit we, public void single(CommandContext args, LocalSession session, LocalPlayer player,
LocalSession session, LocalPlayer player, EditSession editSession) EditSession editSession) throws WorldEditException {
throws WorldEditException {
session.setSuperPickaxe(new SinglePickaxe()); session.setSuperPickaxe(new SinglePickaxe());
session.enableSuperPickAxe(); session.enableSuperPickAxe();
@ -58,9 +63,8 @@ public class SuperPickaxeCommands {
max = 1 max = 1
) )
@CommandPermissions("worldedit.superpickaxe.area") @CommandPermissions("worldedit.superpickaxe.area")
public static void area(CommandContext args, WorldEdit we, public void area(CommandContext args, LocalSession session, LocalPlayer player,
LocalSession session, LocalPlayer player, EditSession editSession) EditSession editSession) throws WorldEditException {
throws WorldEditException {
LocalConfiguration config = we.getConfiguration(); LocalConfiguration config = we.getConfiguration();
int range = args.getInteger(0); int range = args.getInteger(0);
@ -83,9 +87,8 @@ public class SuperPickaxeCommands {
max = 1 max = 1
) )
@CommandPermissions("worldedit.superpickaxe.recursive") @CommandPermissions("worldedit.superpickaxe.recursive")
public static void recursive(CommandContext args, WorldEdit we, public void recursive(CommandContext args, LocalSession session, LocalPlayer player,
LocalSession session, LocalPlayer player, EditSession editSession) EditSession editSession) throws WorldEditException {
throws WorldEditException {
LocalConfiguration config = we.getConfiguration(); LocalConfiguration config = we.getConfiguration();
double range = args.getDouble(0); double range = args.getDouble(0);

Datei anzeigen

@ -31,6 +31,12 @@ import com.sk89q.worldedit.tools.*;
import com.sk89q.worldedit.util.TreeGenerator; import com.sk89q.worldedit.util.TreeGenerator;
public class ToolCommands { public class ToolCommands {
private final WorldEdit we;
public ToolCommands(WorldEdit we) {
this.we = we;
}
@Command( @Command(
aliases = { "none" }, aliases = { "none" },
usage = "", usage = "",
@ -38,9 +44,8 @@ public class ToolCommands {
min = 0, min = 0,
max = 0 max = 0
) )
public static void none(CommandContext args, WorldEdit we, public void none(CommandContext args, LocalSession session, LocalPlayer player,
LocalSession session, LocalPlayer player, EditSession editSession) EditSession editSession) throws WorldEditException {
throws WorldEditException {
session.setTool(player.getItemInHand(), null); session.setTool(player.getItemInHand(), null);
player.print("Tool unbound from your current item."); player.print("Tool unbound from your current item.");
@ -54,9 +59,8 @@ public class ToolCommands {
max = 0 max = 0
) )
@CommandPermissions("worldedit.tool.info") @CommandPermissions("worldedit.tool.info")
public static void info(CommandContext args, WorldEdit we, public void info(CommandContext args, LocalSession session, LocalPlayer player,
LocalSession session, LocalPlayer player, EditSession editSession) EditSession editSession) throws WorldEditException {
throws WorldEditException {
session.setTool(player.getItemInHand(), new QueryTool()); session.setTool(player.getItemInHand(), new QueryTool());
player.print("Info tool bound to " player.print("Info tool bound to "
@ -71,9 +75,8 @@ public class ToolCommands {
max = 1 max = 1
) )
@CommandPermissions("worldedit.tool.tree") @CommandPermissions("worldedit.tool.tree")
public static void tree(CommandContext args, WorldEdit we, public void tree(CommandContext args, LocalSession session, LocalPlayer player,
LocalSession session, LocalPlayer player, EditSession editSession) EditSession editSession) throws WorldEditException {
throws WorldEditException {
TreeGenerator.TreeType type = args.argsLength() > 0 ? TreeGenerator.TreeType type = args.argsLength() > 0 ?
type = TreeGenerator.lookup(args.getString(0)) type = TreeGenerator.lookup(args.getString(0))
@ -97,9 +100,8 @@ public class ToolCommands {
max = 1 max = 1
) )
@CommandPermissions("worldedit.tool.replacer") @CommandPermissions("worldedit.tool.replacer")
public static void repl(CommandContext args, WorldEdit we, public void repl(CommandContext args, LocalSession session, LocalPlayer player,
LocalSession session, LocalPlayer player, EditSession editSession) EditSession editSession) throws WorldEditException {
throws WorldEditException {
BaseBlock targetBlock = we.getBlock(player, args.getString(0)); BaseBlock targetBlock = we.getBlock(player, args.getString(0));
session.setTool(player.getItemInHand(), new BlockReplacer(targetBlock)); session.setTool(player.getItemInHand(), new BlockReplacer(targetBlock));
@ -115,9 +117,8 @@ public class ToolCommands {
max = 0 max = 0
) )
@CommandPermissions("worldedit.tool.data-cycler") @CommandPermissions("worldedit.tool.data-cycler")
public static void cycler(CommandContext args, WorldEdit we, public void cycler(CommandContext args, LocalSession session, LocalPlayer player,
LocalSession session, LocalPlayer player, EditSession editSession) EditSession editSession) throws WorldEditException {
throws WorldEditException {
session.setTool(player.getItemInHand(), new BlockDataCyler()); session.setTool(player.getItemInHand(), new BlockDataCyler());
player.print("Block data cycler tool bound to " player.print("Block data cycler tool bound to "
@ -132,9 +133,8 @@ public class ToolCommands {
max = 2 max = 2
) )
@CommandPermissions("worldedit.tool.flood-fill") @CommandPermissions("worldedit.tool.flood-fill")
public static void floodFill(CommandContext args, WorldEdit we, public void floodFill(CommandContext args, LocalSession session, LocalPlayer player,
LocalSession session, LocalPlayer player, EditSession editSession) EditSession editSession) throws WorldEditException {
throws WorldEditException {
LocalConfiguration config = we.getConfiguration(); LocalConfiguration config = we.getConfiguration();
int range = args.getInteger(1); int range = args.getInteger(1);
@ -155,9 +155,8 @@ public class ToolCommands {
desc = "Brush tool" desc = "Brush tool"
) )
@NestedCommand(BrushCommands.class) @NestedCommand(BrushCommands.class)
public static void brush(CommandContext args, WorldEdit we, public void brush(CommandContext args, LocalSession session, LocalPlayer player,
LocalSession session, LocalPlayer player, EditSession editSession) EditSession editSession) throws WorldEditException {
throws WorldEditException {
} }
@Command( @Command(
@ -168,9 +167,8 @@ public class ToolCommands {
max = 0 max = 0
) )
@CommandPermissions("worldedit.tool.deltree") @CommandPermissions("worldedit.tool.deltree")
public static void deltree(CommandContext args, WorldEdit we, public void deltree(CommandContext args, LocalSession session, LocalPlayer player,
LocalSession session, LocalPlayer player, EditSession editSession) EditSession editSession) throws WorldEditException {
throws WorldEditException {
session.setTool(player.getItemInHand(), new FloatingTreeRemover()); session.setTool(player.getItemInHand(), new FloatingTreeRemover());
player.print("Floating tree remover tool bound to " player.print("Floating tree remover tool bound to "
@ -185,9 +183,8 @@ public class ToolCommands {
max = 0 max = 0
) )
@CommandPermissions("worldedit.tool.farwand") @CommandPermissions("worldedit.tool.farwand")
public static void farwand(CommandContext args, WorldEdit we, public void farwand(CommandContext args, LocalSession session, LocalPlayer player,
LocalSession session, LocalPlayer player, EditSession editSession) EditSession editSession) throws WorldEditException {
throws WorldEditException {
session.setTool(player.getItemInHand(), new DistanceWand()); session.setTool(player.getItemInHand(), new DistanceWand());
player.print("Far wand tool bound to " + ItemType.toHeldName(player.getItemInHand()) + "."); player.print("Far wand tool bound to " + ItemType.toHeldName(player.getItemInHand()) + ".");
@ -201,9 +198,8 @@ public class ToolCommands {
max = 2 max = 2
) )
@CommandPermissions("worldedit.tool.lrbuild") @CommandPermissions("worldedit.tool.lrbuild")
public static void longrangebuildtool(CommandContext args, WorldEdit we, public void longrangebuildtool(CommandContext args, LocalSession session, LocalPlayer player,
LocalSession session, LocalPlayer player, EditSession editSession) EditSession editSession) throws WorldEditException {
throws WorldEditException {
BaseBlock secondary = we.getBlock(player, args.getString(0)); BaseBlock secondary = we.getBlock(player, args.getString(0));
BaseBlock primary = we.getBlock(player, args.getString(1)); BaseBlock primary = we.getBlock(player, args.getString(1));

Datei anzeigen

@ -33,6 +33,12 @@ import com.sk89q.worldedit.patterns.Pattern;
* @author sk89q * @author sk89q
*/ */
public class ToolUtilCommands { public class ToolUtilCommands {
private final WorldEdit we;
public ToolUtilCommands(WorldEdit we) {
this.we = we;
}
@Command( @Command(
aliases = { "/", "," }, aliases = { "/", "," },
usage = "[on|off]", usage = "[on|off]",
@ -41,9 +47,8 @@ public class ToolUtilCommands {
max = 1 max = 1
) )
@CommandPermissions("worldedit.superpickaxe") @CommandPermissions("worldedit.superpickaxe")
public static void togglePickaxe(CommandContext args, WorldEdit we, public void togglePickaxe(CommandContext args, LocalSession session, LocalPlayer player,
LocalSession session, LocalPlayer player, EditSession editSession) EditSession editSession) throws WorldEditException {
throws WorldEditException {
String newState = args.getString(0, null); String newState = args.getString(0, null);
if (session.hasSuperPickAxe()) { if (session.hasSuperPickAxe()) {
@ -70,9 +75,8 @@ public class ToolUtilCommands {
desc = "Select super pickaxe mode" desc = "Select super pickaxe mode"
) )
@NestedCommand(SuperPickaxeCommands.class) @NestedCommand(SuperPickaxeCommands.class)
public static void pickaxe(CommandContext args, WorldEdit we, public void pickaxe(CommandContext args, LocalSession session, LocalPlayer player,
LocalSession session, LocalPlayer player, EditSession editSession) EditSession editSession) throws WorldEditException {
throws WorldEditException {
} }
@Command( @Command(
@ -80,9 +84,8 @@ public class ToolUtilCommands {
desc = "Select a tool to bind" desc = "Select a tool to bind"
) )
@NestedCommand(ToolCommands.class) @NestedCommand(ToolCommands.class)
public static void tool(CommandContext args, WorldEdit we, public void tool(CommandContext args, LocalSession session, LocalPlayer player,
LocalSession session, LocalPlayer player, EditSession editSession) EditSession editSession) throws WorldEditException {
throws WorldEditException {
} }
@Command( @Command(
@ -93,9 +96,8 @@ public class ToolUtilCommands {
max = -1 max = -1
) )
@CommandPermissions("worldedit.brush.options.mask") @CommandPermissions("worldedit.brush.options.mask")
public static void mask(CommandContext args, WorldEdit we, public void mask(CommandContext args, LocalSession session, LocalPlayer player,
LocalSession session, LocalPlayer player, EditSession editSession) EditSession editSession) throws WorldEditException {
throws WorldEditException {
if (args.argsLength() == 0) { if (args.argsLength() == 0) {
session.getBrushTool(player.getItemInHand()).setMask(null); session.getBrushTool(player.getItemInHand()).setMask(null);
player.print("Brush mask disabled."); player.print("Brush mask disabled.");
@ -114,9 +116,8 @@ public class ToolUtilCommands {
max = 1 max = 1
) )
@CommandPermissions("worldedit.brush.options.material") @CommandPermissions("worldedit.brush.options.material")
public static void material(CommandContext args, WorldEdit we, public void material(CommandContext args, LocalSession session, LocalPlayer player,
LocalSession session, LocalPlayer player, EditSession editSession) EditSession editSession) throws WorldEditException {
throws WorldEditException {
Pattern pattern = we.getBlockPattern(player, args.getString(0)); Pattern pattern = we.getBlockPattern(player, args.getString(0));
session.getBrushTool(player.getItemInHand()).setFill(pattern); session.getBrushTool(player.getItemInHand()).setFill(pattern);
player.print("Brush material set."); player.print("Brush material set.");
@ -130,9 +131,8 @@ public class ToolUtilCommands {
max = 1 max = 1
) )
@CommandPermissions("worldedit.brush.options.range") @CommandPermissions("worldedit.brush.options.range")
public static void range(CommandContext args, WorldEdit we, public void range(CommandContext args, LocalSession session, LocalPlayer player,
LocalSession session, LocalPlayer player, EditSession editSession) EditSession editSession) throws WorldEditException {
throws WorldEditException {
int range = args.getInteger(0); int range = args.getInteger(0);
session.getBrushTool(player.getItemInHand()).setRange(range); session.getBrushTool(player.getItemInHand()).setRange(range);
player.print("Brush range set."); player.print("Brush range set.");
@ -146,9 +146,8 @@ public class ToolUtilCommands {
max = 1 max = 1
) )
@CommandPermissions("worldedit.brush.options.size") @CommandPermissions("worldedit.brush.options.size")
public static void size(CommandContext args, WorldEdit we, public void size(CommandContext args, LocalSession session, LocalPlayer player,
LocalSession session, LocalPlayer player, EditSession editSession) EditSession editSession) throws WorldEditException {
throws WorldEditException {
LocalConfiguration config = we.getConfiguration(); LocalConfiguration config = we.getConfiguration();

Datei anzeigen

@ -44,6 +44,12 @@ import com.sk89q.worldedit.regions.Region;
* @author sk89q * @author sk89q
*/ */
public class UtilityCommands { public class UtilityCommands {
private final WorldEdit we;
public UtilityCommands(WorldEdit we) {
this.we = we;
}
@Command( @Command(
aliases = { "/fill" }, aliases = { "/fill" },
usage = "<block> <radius> [depth]", usage = "<block> <radius> [depth]",
@ -53,9 +59,8 @@ public class UtilityCommands {
) )
@CommandPermissions("worldedit.fill") @CommandPermissions("worldedit.fill")
@Logging(PLACEMENT) @Logging(PLACEMENT)
public static void fill(CommandContext args, WorldEdit we, public void fill(CommandContext args, LocalSession session, LocalPlayer player,
LocalSession session, LocalPlayer player, EditSession editSession) EditSession editSession) throws WorldEditException {
throws WorldEditException {
Pattern pattern = we.getBlockPattern(player, args.getString(0)); Pattern pattern = we.getBlockPattern(player, args.getString(0));
double radius = Math.max(1, args.getDouble(1)); double radius = Math.max(1, args.getDouble(1));
@ -83,9 +88,8 @@ public class UtilityCommands {
) )
@CommandPermissions("worldedit.fill.recursive") @CommandPermissions("worldedit.fill.recursive")
@Logging(PLACEMENT) @Logging(PLACEMENT)
public static void fillr(CommandContext args, WorldEdit we, public void fillr(CommandContext args, LocalSession session, LocalPlayer player,
LocalSession session, LocalPlayer player, EditSession editSession) EditSession editSession) throws WorldEditException {
throws WorldEditException {
Pattern pattern = we.getBlockPattern(player, args.getString(0)); Pattern pattern = we.getBlockPattern(player, args.getString(0));
double radius = Math.max(1, args.getDouble(1)); double radius = Math.max(1, args.getDouble(1));
@ -113,9 +117,8 @@ public class UtilityCommands {
) )
@CommandPermissions("worldedit.drain") @CommandPermissions("worldedit.drain")
@Logging(PLACEMENT) @Logging(PLACEMENT)
public static void drain(CommandContext args, WorldEdit we, public void drain(CommandContext args, LocalSession session, LocalPlayer player,
LocalSession session, LocalPlayer player, EditSession editSession) EditSession editSession) throws WorldEditException {
throws WorldEditException {
double radius = Math.max(0, args.getDouble(0)); double radius = Math.max(0, args.getDouble(0));
we.checkMaxRadius(radius); we.checkMaxRadius(radius);
@ -133,9 +136,8 @@ public class UtilityCommands {
) )
@CommandPermissions("worldedit.fixlava") @CommandPermissions("worldedit.fixlava")
@Logging(PLACEMENT) @Logging(PLACEMENT)
public static void fixLava(CommandContext args, WorldEdit we, public void fixLava(CommandContext args, LocalSession session, LocalPlayer player,
LocalSession session, LocalPlayer player, EditSession editSession) EditSession editSession) throws WorldEditException {
throws WorldEditException {
double radius = Math.max(0, args.getDouble(0)); double radius = Math.max(0, args.getDouble(0));
we.checkMaxRadius(radius); we.checkMaxRadius(radius);
@ -153,9 +155,8 @@ public class UtilityCommands {
) )
@CommandPermissions("worldedit.fixwater") @CommandPermissions("worldedit.fixwater")
@Logging(PLACEMENT) @Logging(PLACEMENT)
public static void fixWater(CommandContext args, WorldEdit we, public void fixWater(CommandContext args, LocalSession session, LocalPlayer player,
LocalSession session, LocalPlayer player, EditSession editSession) EditSession editSession) throws WorldEditException {
throws WorldEditException {
double radius = Math.max(0, args.getDouble(0)); double radius = Math.max(0, args.getDouble(0));
we.checkMaxRadius(radius); we.checkMaxRadius(radius);
@ -173,9 +174,8 @@ public class UtilityCommands {
) )
@CommandPermissions("worldedit.removeabove") @CommandPermissions("worldedit.removeabove")
@Logging(PLACEMENT) @Logging(PLACEMENT)
public static void removeAbove(CommandContext args, WorldEdit we, public void removeAbove(CommandContext args, LocalSession session, LocalPlayer player,
LocalSession session, LocalPlayer player, EditSession editSession) EditSession editSession) throws WorldEditException {
throws WorldEditException {
int size = args.argsLength() > 0 ? Math.max(1, args.getInteger(0)) : 1; int size = args.argsLength() > 0 ? Math.max(1, args.getInteger(0)) : 1;
we.checkMaxRadius(size); we.checkMaxRadius(size);
@ -196,9 +196,8 @@ public class UtilityCommands {
) )
@CommandPermissions("worldedit.removebelow") @CommandPermissions("worldedit.removebelow")
@Logging(PLACEMENT) @Logging(PLACEMENT)
public static void removeBelow(CommandContext args, WorldEdit we, public void removeBelow(CommandContext args, LocalSession session, LocalPlayer player,
LocalSession session, LocalPlayer player, EditSession editSession) EditSession editSession) throws WorldEditException {
throws WorldEditException {
int size = args.argsLength() > 0 ? Math.max(1, args.getInteger(0)) : 1; int size = args.argsLength() > 0 ? Math.max(1, args.getInteger(0)) : 1;
we.checkMaxRadius(size); we.checkMaxRadius(size);
@ -218,9 +217,8 @@ public class UtilityCommands {
) )
@CommandPermissions("worldedit.removenear") @CommandPermissions("worldedit.removenear")
@Logging(PLACEMENT) @Logging(PLACEMENT)
public static void removeNear(CommandContext args, WorldEdit we, public void removeNear(CommandContext args, LocalSession session, LocalPlayer player,
LocalSession session, LocalPlayer player, EditSession editSession) EditSession editSession) throws WorldEditException {
throws WorldEditException {
BaseBlock block = we.getBlock(player, args.getString(0), true); BaseBlock block = we.getBlock(player, args.getString(0), true);
int size = Math.max(1, args.getInteger(1, 50)); int size = Math.max(1, args.getInteger(1, 50));
@ -240,9 +238,8 @@ public class UtilityCommands {
) )
@CommandPermissions("worldedit.replacenear") @CommandPermissions("worldedit.replacenear")
@Logging(PLACEMENT) @Logging(PLACEMENT)
public static void replaceNear(CommandContext args, WorldEdit we, public void replaceNear(CommandContext args, LocalSession session, LocalPlayer player,
LocalSession session, LocalPlayer player, EditSession editSession) EditSession editSession) throws WorldEditException {
throws WorldEditException {
int size = Math.max(1, args.getInteger(0)); int size = Math.max(1, args.getInteger(0));
int affected; int affected;
@ -278,9 +275,8 @@ public class UtilityCommands {
) )
@CommandPermissions("worldedit.snow") @CommandPermissions("worldedit.snow")
@Logging(PLACEMENT) @Logging(PLACEMENT)
public static void snow(CommandContext args, WorldEdit we, public void snow(CommandContext args, LocalSession session, LocalPlayer player,
LocalSession session, LocalPlayer player, EditSession editSession) EditSession editSession) throws WorldEditException {
throws WorldEditException {
double size = args.argsLength() > 0 ? Math.max(1, args.getDouble(0)) : 10; double size = args.argsLength() > 0 ? Math.max(1, args.getDouble(0)) : 10;
@ -297,9 +293,8 @@ public class UtilityCommands {
) )
@CommandPermissions("worldedit.thaw") @CommandPermissions("worldedit.thaw")
@Logging(PLACEMENT) @Logging(PLACEMENT)
public static void thaw(CommandContext args, WorldEdit we, public void thaw(CommandContext args, LocalSession session, LocalPlayer player,
LocalSession session, LocalPlayer player, EditSession editSession) EditSession editSession) throws WorldEditException {
throws WorldEditException {
double size = args.argsLength() > 0 ? Math.max(1, args.getDouble(0)) : 10; double size = args.argsLength() > 0 ? Math.max(1, args.getDouble(0)) : 10;
@ -316,9 +311,8 @@ public class UtilityCommands {
) )
@CommandPermissions("worldedit.green") @CommandPermissions("worldedit.green")
@Logging(PLACEMENT) @Logging(PLACEMENT)
public static void green(CommandContext args, WorldEdit we, public void green(CommandContext args, LocalSession session, LocalPlayer player,
LocalSession session, LocalPlayer player, EditSession editSession) EditSession editSession) throws WorldEditException {
throws WorldEditException {
double size = args.argsLength() > 0 ? Math.max(1, args.getDouble(0)) : 10; double size = args.argsLength() > 0 ? Math.max(1, args.getDouble(0)) : 10;
@ -335,9 +329,8 @@ public class UtilityCommands {
) )
@CommandPermissions("worldedit.extinguish") @CommandPermissions("worldedit.extinguish")
@Logging(PLACEMENT) @Logging(PLACEMENT)
public static void extinguish(CommandContext args, WorldEdit we, public void extinguish(CommandContext args, LocalSession session, LocalPlayer player,
LocalSession session, LocalPlayer player, EditSession editSession) EditSession editSession) throws WorldEditException {
throws WorldEditException {
LocalConfiguration config = we.getConfiguration(); LocalConfiguration config = we.getConfiguration();
@ -367,9 +360,8 @@ public class UtilityCommands {
@CommandPermissions("worldedit.butcher") @CommandPermissions("worldedit.butcher")
@Logging(PLACEMENT) @Logging(PLACEMENT)
@Console @Console
public static void butcher(CommandContext args, WorldEdit we, public void butcher(CommandContext args, LocalSession session, LocalPlayer player,
LocalSession session, LocalPlayer player, EditSession editSession) EditSession editSession) throws WorldEditException {
throws WorldEditException {
int radius = args.argsLength() > 0 ? Math.max(1, args.getInteger(0)) : -1; int radius = args.argsLength() > 0 ? Math.max(1, args.getInteger(0)) : -1;
@ -400,9 +392,8 @@ public class UtilityCommands {
) )
@CommandPermissions("worldedit.remove") @CommandPermissions("worldedit.remove")
@Logging(PLACEMENT) @Logging(PLACEMENT)
public static void remove(CommandContext args, WorldEdit we, public void remove(CommandContext args, LocalSession session, LocalPlayer player,
LocalSession session, LocalPlayer player, EditSession editSession) EditSession editSession) throws WorldEditException {
throws WorldEditException {
String typeStr = args.getString(0); String typeStr = args.getString(0);
int radius = args.getInteger(1); int radius = args.getInteger(1);

Datei anzeigen

@ -34,7 +34,13 @@ import com.sk89q.worldedit.WorldEdit;
import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.WorldEditException;
public class WorldEditCommands { public class WorldEditCommands {
private static DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss z"); private static final DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss z");
private final WorldEdit we;
public WorldEditCommands(WorldEdit we) {
this.we = we;
}
@Command( @Command(
aliases = { "version", "ver" }, aliases = { "version", "ver" },
@ -44,9 +50,8 @@ public class WorldEditCommands {
max = 0 max = 0
) )
@Console @Console
public static void version(CommandContext args, WorldEdit we, public void version(CommandContext args, LocalSession session, LocalPlayer player,
LocalSession session, LocalPlayer player, EditSession editSession) EditSession editSession) throws WorldEditException {
throws WorldEditException {
player.print("WorldEdit version " + WorldEdit.getVersion()); player.print("WorldEdit version " + WorldEdit.getVersion());
player.print("http://www.sk89q.com/projects/worldedit/"); player.print("http://www.sk89q.com/projects/worldedit/");
@ -61,9 +66,8 @@ public class WorldEditCommands {
) )
@CommandPermissions("worldedit.reload") @CommandPermissions("worldedit.reload")
@Console @Console
public static void reload(CommandContext args, WorldEdit we, public void reload(CommandContext args, LocalSession session, LocalPlayer player,
LocalSession session, LocalPlayer player, EditSession editSession) EditSession editSession) throws WorldEditException {
throws WorldEditException {
we.getServer().reload(); we.getServer().reload();
player.print("Configuration reloaded!"); player.print("Configuration reloaded!");
@ -76,9 +80,8 @@ public class WorldEditCommands {
min = 0, min = 0,
max = 0 max = 0
) )
public static void cui(CommandContext args, WorldEdit we, public void cui(CommandContext args, LocalSession session, LocalPlayer player,
LocalSession session, LocalPlayer player, EditSession editSession) EditSession editSession) throws WorldEditException {
throws WorldEditException {
session.setCUISupport(true); session.setCUISupport(true);
session.dispatchCUISetup(player); session.dispatchCUISetup(player);
} }
@ -91,9 +94,8 @@ public class WorldEditCommands {
max = 1 max = 1
) )
@Console @Console
public static void tz(CommandContext args, WorldEdit we, public void tz(CommandContext args, LocalSession session, LocalPlayer player,
LocalSession session, LocalPlayer player, EditSession editSession) EditSession editSession) throws WorldEditException {
throws WorldEditException {
TimeZone tz = TimeZone.getTimeZone(args.getString(0)); TimeZone tz = TimeZone.getTimeZone(args.getString(0));
session.setTimezone(tz); session.setTimezone(tz);
player.print("Timezone set for this session to: " + tz.getDisplayName()); player.print("Timezone set for this session to: " + tz.getDisplayName());