Fix set compatibility with SKCompat

This commit is contained in:
Jesse Boyd 2017-08-28 21:29:07 +10:00
parent ee0a09e132
commit 9a430f3232
No known key found for this signature in database
GPG Key ID: 59F1DE6293AF6E1F
4 changed files with 12 additions and 5 deletions

View File

@ -134,7 +134,7 @@ public abstract class FawePlayer<T> extends Metadatable {
} }
public void checkConfirmationRadius(String command, int radius) throws RegionOperationException { public void checkConfirmationRadius(String command, int radius) throws RegionOperationException {
if (getMeta("cmdConfirmRunning", false)) { if (command == null || getMeta("cmdConfirmRunning", false)) {
return; return;
} }
if (radius > 0) { if (radius > 0) {
@ -146,7 +146,7 @@ public abstract class FawePlayer<T> extends Metadatable {
} }
public void checkConfirmationStack(String command, Region region, int times) throws RegionOperationException { public void checkConfirmationStack(String command, Region region, int times) throws RegionOperationException {
if (getMeta("cmdConfirmRunning", false)) { if (command == null || getMeta("cmdConfirmRunning", false)) {
return; return;
} }
if (region != null) { if (region != null) {
@ -161,7 +161,7 @@ public abstract class FawePlayer<T> extends Metadatable {
} }
public void checkConfirmationRegion(String command, Region region) throws RegionOperationException { public void checkConfirmationRegion(String command, Region region) throws RegionOperationException {
if (getMeta("cmdConfirmRunning", false)) { if (command == null || getMeta("cmdConfirmRunning", false)) {
return; return;
} }
if (region != null) { if (region != null) {

View File

@ -72,6 +72,7 @@ public class MethodCommands {
} }
public String getArguments(CommandContext context) { public String getArguments(CommandContext context) {
if (context == null) return null;
CommandLocals locals = context.getLocals(); CommandLocals locals = context.getLocals();
if (locals != null) { if (locals != null) {
return (String) locals.get("arguments"); return (String) locals.get("arguments");

View File

@ -322,6 +322,12 @@ public class RegionCommands extends MethodCommands {
BBC.TIP_REPLACE_ID.or(BBC.TIP_REPLACE_LIGHT, BBC.TIP_REPLACE_MARKER, BBC.TIP_TAB_COMPLETE).send(player); BBC.TIP_REPLACE_ID.or(BBC.TIP_REPLACE_LIGHT, BBC.TIP_REPLACE_MARKER, BBC.TIP_TAB_COMPLETE).send(player);
} }
// Compatibility for SKCompat
@Deprecated
public void set(Player player, LocalSession session, EditSession editSession, Pattern pattern) throws WorldEditException {
set(FawePlayer.wrap(player), session, editSession, session.getSelection(player.getWorld()), pattern, null);
}
@Command( @Command(
aliases = {"/set", "/s"}, aliases = {"/set", "/s"},
usage = "[pattern]", usage = "[pattern]",

View File

@ -69,7 +69,7 @@ public class ScriptingCommands {
final File dir = this.worldEdit.getWorkingDirectoryFile(this.worldEdit.getConfiguration().scriptsDir); final File dir = this.worldEdit.getWorkingDirectoryFile(this.worldEdit.getConfiguration().scriptsDir);
final File f = this.worldEdit.getSafeOpenFile(player, dir, name, "js", "js"); final File f = this.worldEdit.getSafeOpenFile(player, dir, name, "js", "js");
try { try {
ScriptingCommands.this.worldEdit.runScript(LocationMaskedPlayerWrapper.unwrap(player), f, scriptArgs); this.worldEdit.runScript(LocationMaskedPlayerWrapper.unwrap(player), f, scriptArgs);
} catch (final WorldEditException ex) { } catch (final WorldEditException ex) {
player.printError("Error while executing CraftScript."); player.printError("Error while executing CraftScript.");
} }
@ -97,7 +97,7 @@ public class ScriptingCommands {
final File f = this.worldEdit.getSafeOpenFile(player, dir, lastScript, "js", "js"); final File f = this.worldEdit.getSafeOpenFile(player, dir, lastScript, "js", "js");
try { try {
ScriptingCommands.this.worldEdit.runScript(LocationMaskedPlayerWrapper.unwrap(player), f, scriptArgs); this.worldEdit.runScript(LocationMaskedPlayerWrapper.unwrap(player), f, scriptArgs);
} catch (final WorldEditException ex) { } catch (final WorldEditException ex) {
player.printError("Error while executing CraftScript."); player.printError("Error while executing CraftScript.");
} }