Don't allow edits on plots when owner is offline and player is only added (#1313)

This commit is contained in:
dordsor21
2021-10-04 13:34:40 +01:00
committed by GitHub
parent d44f297068
commit 6895234815
11 changed files with 156 additions and 55 deletions

View File

@ -1337,9 +1337,9 @@ public class EditSession extends PassthroughExtent implements AutoCloseable {
if (used.MAX_CHANGES > 0 || used.MAX_ENTITIES > 0) {
actor.print(Caption.of("fawe.error.worldedit.some.fails", used.MAX_FAILS));
} else if (new ExtentTraverser<>(getExtent()).findAndGet(FaweRegionExtent.class) != null) {
actor.print(Caption.of("fawe.cancel.worldedit.cancel.reason.outside.region"));
actor.print(Caption.of("fawe.cancel.reason.outside.region"));
} else {
actor.print(Caption.of("fawe.cancel.worldedit.cancel.reason.outside.level"));
actor.print(Caption.of("fawe.cancel.reason.outside.level"));
}
}
if (wnaMode) {

View File

@ -944,7 +944,7 @@ public class SchematicCommands {
}
LOGGER.info(actor.getName() + " saved " + file.getCanonicalPath());
} else {
actor.print(Caption.of("fawe.cancel.worldedit.cancel.reason.manual"));
actor.print(Caption.of("fawe.cancel.reason.manual"));
}
}
//FAWE end

View File

@ -206,9 +206,9 @@ public class UtilityCommands {
desc = "Cancel your current command"
)
@CommandPermissions(value = "fawe.cancel", queued = false)
public void cancel(Actor actor) {
int cancelled = actor.cancel(false);
actor.print(Caption.of("fawe.cancel.worldedit.cancel.count", cancelled));
public void cancel(Player player) {
int cancelled = player.cancel(false);
player.print(Caption.of("fawe.cancel.count", cancelled));
}
@Command(

View File

@ -61,7 +61,7 @@ public @interface Confirm {
* (long) value;
long max = 2 << 18;
if (max != -1 && area > max) {
actor.print(Caption.of("fawe.cancel.worldedit.cancel.reason.confirm.region",
actor.print(Caption.of("fawe.cancel.reason.confirm.region",
pos1, pos2, getArgs(context), region.getHeight() * area
));
return confirm(actor, context);
@ -77,7 +77,7 @@ public @interface Confirm {
}
int max = WorldEdit.getInstance().getConfiguration().maxRadius;
if (max != -1 && value > max) {
actor.print(Caption.of("fawe.cancel.worldedit.cancel.reason.confirm.radius",
actor.print(Caption.of("fawe.cancel.reason.confirm.radius",
value, max, getArgs(context)
));
return confirm(actor, context);
@ -93,7 +93,7 @@ public @interface Confirm {
}
int max = 50; //TODO configurable, get Key.of(Method.class) @Limit
if (max != -1 && value > max) {
actor.print(Caption.of("fawe.cancel.worldedit.cancel.reason.confirm.limit",
actor.print(Caption.of("fawe.cancel.reason.confirm.limit",
value, max, getArgs(context)
));
return confirm(actor, context);
@ -107,7 +107,7 @@ public @interface Confirm {
if (checkExisting(context)) {
return true;
}
actor.print(Caption.of("fawe.cancel.worldedit.cancel.reason.confirm", Processor.getArgs(context)));
actor.print(Caption.of("fawe.cancel.reason.confirm", Processor.getArgs(context)));
return confirm(actor, context);
}
};

View File

@ -763,7 +763,7 @@ public final class PlatformCommandManager {
actor.print(e.getRichMessage());
}
} catch (FaweException e) {
actor.print(Caption.of("fawe.cancel.worldedit.cancel.reason", e.getComponent()));
actor.print(Caption.of("fawe.cancel.reason", e.getComponent()));
} catch (UsageException e) {
ImmutableList<Command> cmd = e.getCommands();
if (!cmd.isEmpty()) {
@ -777,7 +777,7 @@ public final class PlatformCommandManager {
handleUnknownException(actor, e.getCause());
} catch (CommandException e) {
if (e.getCause() instanceof FaweException) {
actor.print(Caption.of("fawe.cancel.worldedit.cancel.reason", ((FaweException) e.getCause()).getComponent()));
actor.print(Caption.of("fawe.cancel.reason", ((FaweException) e.getCause()).getComponent()));
} else {
Component msg = e.getRichMessage();
if (msg == TextComponent.empty()) {

View File

@ -445,7 +445,7 @@ public class PlatformManager {
public void handleThrowable(Throwable e, Actor actor) {
FaweException faweException = FaweException.get(e);
if (faweException != null) {
actor.print(Caption.of("fawe.cancel.worldedit.cancel.reason", faweException.getComponent()));
actor.print(Caption.of("fawe.cancel.reason", faweException.getComponent()));
} else {
actor.print(Caption.of("worldedit.command.error.report"));
actor.print(Caption.of(e.getClass().getName(), TextComponent.of(": "), TextComponent.of(e.getMessage())));
@ -499,7 +499,7 @@ public class PlatformManager {
} catch (Throwable e) {
FaweException faweException = FaweException.get(e);
if (faweException != null) {
player.print(Caption.of("fawe.cancel.worldedit.cancel.reason", faweException.getComponent()));
player.print(Caption.of("fawe.cancel.reason", faweException.getComponent()));
} else {
player.print(Caption.of("worldedit.command.error.report"));
player.print(Caption.of(e.getClass().getName() + ": " + e.getMessage()));