Permalink
Browse files

Revert "Some command fixes" aka "Some command breaks"

This reverts commit 4a8bba7.
Fixes WORLDEDIT-3574.
  • Loading branch information...
wizjany committed Jun 9, 2017
1 parent 9cf8847 commit b557b2b71d81ef67f3d9fa878470442ac6c287b1
@@ -80,7 +80,7 @@ public BrushCommands(WorldEdit worldEdit) {
max = 2
)
@CommandPermissions("worldedit.brush.sphere")
public void sphereBrush(Player player, LocalSession session, Pattern fill,
public void sphereBrush(Player player, LocalSession session, EditSession editSession, Pattern fill,
@Optional("2") double radius, @Switch('h') boolean hollow) throws WorldEditException {
worldEdit.checkMaxBrushRadius(radius);
@@ -109,7 +109,7 @@ public void sphereBrush(Player player, LocalSession session, Pattern fill,
max = 3
)
@CommandPermissions("worldedit.brush.cylinder")
public void cylinderBrush(Player player, LocalSession session, Pattern fill,
public void cylinderBrush(Player player, LocalSession session, EditSession editSession, Pattern fill,
@Optional("2") double radius, @Optional("1") int height, @Switch('h') boolean hollow) throws WorldEditException {
worldEdit.checkMaxBrushRadius(radius);
worldEdit.checkMaxBrushRadius(height);
@@ -139,7 +139,7 @@ public void cylinderBrush(Player player, LocalSession session, Pattern fill,
"stood relative to the copied area when you copied it."
)
@CommandPermissions("worldedit.brush.clipboard")
public void clipboardBrush(Player player, LocalSession session, @Switch('a') boolean ignoreAir, @Switch('p') boolean usingOrigin) throws WorldEditException {
public void clipboardBrush(Player player, LocalSession session, EditSession editSession, @Switch('a') boolean ignoreAir, @Switch('p') boolean usingOrigin) throws WorldEditException {
ClipboardHolder holder = session.getClipboard();
Clipboard clipboard = holder.getClipboard();
@@ -167,7 +167,7 @@ public void clipboardBrush(Player player, LocalSession session, @Switch('a') boo
max = 2
)
@CommandPermissions("worldedit.brush.smooth")
public void smoothBrush(Player player, LocalSession session,
public void smoothBrush(Player player, LocalSession session, EditSession editSession,
@Optional("2") double radius, @Optional("4") int iterations, @Switch('n')
boolean naturalBlocksOnly) throws WorldEditException {
@@ -215,7 +215,7 @@ public void extinguishBrush(Player player, LocalSession session, EditSession edi
max = 1
)
@CommandPermissions("worldedit.brush.gravity")
public void gravityBrush(Player player, LocalSession session, @Optional("5") double radius, @Switch('h') boolean fromMaxY) throws WorldEditException {
public void gravityBrush(Player player, LocalSession session, EditSession editSession, @Optional("5") double radius, @Switch('h') boolean fromMaxY) throws WorldEditException {
worldEdit.checkMaxBrushRadius(radius);
BrushTool tool = session.getBrushTool(player.getItemInHand());
@@ -246,7 +246,7 @@ public void gravityBrush(Player player, LocalSession session, @Optional("5") dou
max = 1
)
@CommandPermissions("worldedit.brush.butcher")
public void butcherBrush(Player player, LocalSession session, CommandContext args) throws WorldEditException {
public void butcherBrush(Player player, LocalSession session, EditSession editSession, CommandContext args) throws WorldEditException {
LocalConfiguration config = worldEdit.getConfiguration();
double radius = args.argsLength() > 0 ? args.getDouble(0) : 5;
@@ -57,7 +57,7 @@ public ChunkCommands(WorldEdit worldEdit) {
max = 0
)
@CommandPermissions("worldedit.chunkinfo")
public void chunkInfo(Player player, LocalSession session, CommandContext args) throws WorldEditException {
public void chunkInfo(Player player, LocalSession session, EditSession editSession, CommandContext args) throws WorldEditException {
Vector pos = player.getBlockIn();
int chunkX = (int) Math.floor(pos.getBlockX() / 16.0);
int chunkZ = (int) Math.floor(pos.getBlockZ() / 16.0);
@@ -81,7 +81,7 @@ public void chunkInfo(Player player, LocalSession session, CommandContext args)
max = 0
)
@CommandPermissions("worldedit.listchunks")
public void listChunks(Player player, LocalSession session, CommandContext args) throws WorldEditException {
public void listChunks(Player player, LocalSession session, EditSession editSession, CommandContext args) throws WorldEditException {
Set<Vector2D> chunks = session.getSelection(player.getWorld()).getChunks();
for (Vector2D chunk : chunks) {
@@ -98,7 +98,7 @@ public void listChunks(Player player, LocalSession session, CommandContext args)
)
@CommandPermissions("worldedit.delchunks")
@Logging(REGION)
public void deleteChunks(Player player, LocalSession session, CommandContext args) throws WorldEditException {
public void deleteChunks(Player player, LocalSession session, EditSession editSession, CommandContext args) throws WorldEditException {
player.print("Note that this command does not yet support the mcregion format.");
LocalConfiguration config = worldEdit.getConfiguration();
@@ -207,7 +207,7 @@ public void rotate(Player player, LocalSession session, Double yRotate, @Optiona
max = 1
)
@CommandPermissions("worldedit.clipboard.flip")
public void flip(Player player, LocalSession session,
public void flip(Player player, LocalSession session, EditSession editSession,
@Optional(Direction.AIM) @Direction Vector direction) throws WorldEditException {
ClipboardHolder holder = session.getClipboard();
Clipboard clipboard = holder.getClipboard();
@@ -251,7 +251,7 @@ public void save(Actor actor) {
max = 0
)
@CommandPermissions("worldedit.clipboard.clear")
public void clearClipboard(Player player, LocalSession session) throws WorldEditException {
public void clearClipboard(Player player, LocalSession session, EditSession editSession) throws WorldEditException {
session.setClipboard(null);
player.print("Clipboard cleared.");
}
@@ -56,7 +56,7 @@ public GeneralCommands(WorldEdit worldEdit) {
max = 1
)
@CommandPermissions("worldedit.limit")
public void limit(Player player, LocalSession session, CommandContext args) throws WorldEditException {
public void limit(Player player, LocalSession session, EditSession editSession, CommandContext args) throws WorldEditException {
LocalConfiguration config = worldEdit.getConfiguration();
boolean mayDisable = player.hasPermission("worldedit.limit.unrestricted");
@@ -86,7 +86,7 @@ public void limit(Player player, LocalSession session, CommandContext args) thro
max = 1
)
@CommandPermissions("worldedit.fast")
public void fast(Player player, LocalSession session, CommandContext args) throws WorldEditException {
public void fast(Player player, LocalSession session, EditSession editSession, CommandContext args) throws WorldEditException {
String newState = args.getString(0, null);
if (session.hasFastMode()) {
@@ -116,7 +116,7 @@ public void fast(Player player, LocalSession session, CommandContext args) throw
max = -1
)
@CommandPermissions("worldedit.global-mask")
public void gmask(Player player, LocalSession session, @Optional Mask mask) throws WorldEditException {
public void gmask(Player player, LocalSession session, EditSession editSession, @Optional Mask mask) throws WorldEditException {
if (mask == null) {
session.setMask((Mask) null);
player.print("Global mask disabled.");
@@ -133,7 +133,7 @@ public void gmask(Player player, LocalSession session, @Optional Mask mask) thro
min = 0,
max = 0
)
public void togglePlace(Player player, LocalSession session, CommandContext args) throws WorldEditException {
public void togglePlace(Player player, LocalSession session, EditSession editSession, CommandContext args) throws WorldEditException {
if (session.togglePlacementPosition()) {
player.print("Now placing at pos #1.");
@@ -52,7 +52,7 @@ public HistoryCommands(WorldEdit worldEdit) {
max = 2
)
@CommandPermissions("worldedit.history.undo")
public void undo(Player player, LocalSession session, CommandContext args) throws WorldEditException {
public void undo(Player player, LocalSession session, EditSession editSession, CommandContext args) throws WorldEditException {
int times = Math.max(1, args.getInteger(0, 1));
for (int i = 0; i < times; ++i) {
EditSession undone;
@@ -85,7 +85,7 @@ public void undo(Player player, LocalSession session, CommandContext args) throw
max = 2
)
@CommandPermissions("worldedit.history.redo")
public void redo(Player player, LocalSession session, CommandContext args) throws WorldEditException {
public void redo(Player player, LocalSession session, EditSession editSession, CommandContext args) throws WorldEditException {
int times = Math.max(1, args.getInteger(0, 1));
@@ -119,7 +119,7 @@ public void redo(Player player, LocalSession session, CommandContext args) throw
max = 0
)
@CommandPermissions("worldedit.history.clear")
public void clearHistory(Player player, LocalSession session) throws WorldEditException {
public void clearHistory(Player player, LocalSession session, EditSession editSession) throws WorldEditException {
session.clearHistory();
player.print("History cleared.");
}
@@ -23,6 +23,7 @@
import com.sk89q.minecraft.util.commands.CommandContext;
import com.sk89q.minecraft.util.commands.CommandPermissions;
import com.sk89q.minecraft.util.commands.Logging;
import com.sk89q.worldedit.EditSession;
import com.sk89q.worldedit.LocalConfiguration;
import com.sk89q.worldedit.LocalSession;
import com.sk89q.worldedit.WorldEdit;
@@ -115,7 +116,7 @@ public void descend(Player player, @Optional("1") int levelsToDescend) throws Wo
)
@CommandPermissions("worldedit.navigation.ceiling")
@Logging(POSITION)
public void ceiling(Player player, LocalSession session, CommandContext args) throws WorldEditException {
public void ceiling(Player player, LocalSession session, EditSession editSession, CommandContext args) throws WorldEditException {
final int clearance = args.argsLength() > 0 ?
Math.max(0, args.getInteger(0)) : 0;
@@ -136,7 +137,7 @@ public void ceiling(Player player, LocalSession session, CommandContext args) th
max = 0
)
@CommandPermissions("worldedit.navigation.thru.command")
public void thru(Player player, LocalSession session, CommandContext args) throws WorldEditException {
public void thru(Player player, LocalSession session, EditSession editSession, CommandContext args) throws WorldEditException {
if (player.passThroughForwardWall(6)) {
player.print("Whoosh!");
} else {
@@ -152,7 +153,7 @@ public void thru(Player player, LocalSession session, CommandContext args) throw
max = 0
)
@CommandPermissions("worldedit.navigation.jumpto.command")
public void jumpTo(Player player, LocalSession session, CommandContext args) throws WorldEditException {
public void jumpTo(Player player, LocalSession session, EditSession editSession, CommandContext args) throws WorldEditException {
WorldVector pos = player.getSolidBlockTrace(300);
if (pos != null) {
@@ -173,7 +174,7 @@ public void jumpTo(Player player, LocalSession session, CommandContext args) thr
)
@CommandPermissions("worldedit.navigation.up")
@Logging(POSITION)
public void up(Player player, LocalSession session, CommandContext args) throws WorldEditException {
public void up(Player player, LocalSession session, EditSession editSession, CommandContext args) throws WorldEditException {
final int distance = args.getInteger(0);
final boolean alwaysGlass = getAlwaysGlass(args);
@@ -23,6 +23,7 @@
import com.sk89q.minecraft.util.commands.CommandContext;
import com.sk89q.minecraft.util.commands.CommandException;
import com.sk89q.minecraft.util.commands.CommandPermissions;
import com.sk89q.worldedit.EditSession;
import com.sk89q.worldedit.LocalConfiguration;
import com.sk89q.worldedit.LocalSession;
import com.sk89q.worldedit.WorldEdit;
@@ -200,7 +201,7 @@ public void save(Player player, LocalSession session, @Optional("schematic") Str
max = 1
)
@CommandPermissions("worldedit.schematic.delete")
public void delete(Player player, LocalSession session, CommandContext args) throws WorldEditException {
public void delete(Player player, LocalSession session, EditSession editSession, CommandContext args) throws WorldEditException {
LocalConfiguration config = worldEdit.getConfiguration();
String filename = args.getString(0);
@@ -335,7 +336,6 @@ public int compare(File f1, File f2) {
}
private List<String> listFiles(String prefix, File[] files) {
File dir = worldEdit.getWorkingDirectoryFile(prefix);
if (prefix == null) prefix = "";
List<String> result = new ArrayList<String>();
for (File file : files) {
@@ -344,13 +344,8 @@ public int compare(File f1, File f2) {
build.append("\u00a72");
ClipboardFormat format = ClipboardFormat.findByFile(file);
boolean inRoot = file.getParentFile().getName().equals(prefix);
if (inRoot) {
build.append(file.getName());
} else {
String relative = dir.toURI().relativize(file.toURI()).getPath();
build.append(relative);
}
build.append(": ").append(format == null ? "Unknown" : format.name());
build.append(inRoot ? file.getName() : file.getPath().split(Pattern.quote(prefix + File.separator))[1])
.append(": ").append(format == null ? "Unknown" : format.name());
result.add(build.toString());
}
return result;
@@ -23,6 +23,7 @@
import com.sk89q.minecraft.util.commands.CommandContext;
import com.sk89q.minecraft.util.commands.CommandPermissions;
import com.sk89q.minecraft.util.commands.Logging;
import com.sk89q.worldedit.EditSession;
import com.sk89q.worldedit.LocalSession;
import com.sk89q.worldedit.WorldEdit;
import com.sk89q.worldedit.WorldEditException;
@@ -59,7 +60,7 @@ public ScriptingCommands(WorldEdit worldEdit) {
)
@CommandPermissions("worldedit.scripting.execute")
@Logging(ALL)
public void execute(Player player, LocalSession session, CommandContext args) throws WorldEditException {
public void execute(Player player, LocalSession session, EditSession editSession, CommandContext args) throws WorldEditException {
String[] scriptArgs = args.getSlice(1);
String name = args.getString(0);
@@ -86,7 +87,7 @@ public void execute(Player player, LocalSession session, CommandContext args) th
)
@CommandPermissions("worldedit.scripting.execute")
@Logging(ALL)
public void executeLast(Player player, LocalSession session, CommandContext args) throws WorldEditException {
public void executeLast(Player player, LocalSession session, EditSession editSession, CommandContext args) throws WorldEditException {
String lastScript = session.getLastScript();
Oops, something went wrong.

0 comments on commit b557b2b

Please sign in to comment.