mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2025-06-15 13:33:54 +00:00
Don't allow edits on plots when owner is offline and player is only added (#1313)
This commit is contained in:
@ -134,52 +134,52 @@ public enum FaweCache implements Trimable {
|
||||
*/
|
||||
public static final FaweBlockBagException BLOCK_BAG = new FaweBlockBagException();
|
||||
public static final FaweException MANUAL = new FaweException(
|
||||
Caption.of("fawe.cancel.worldedit.cancel.reason.manual"),
|
||||
Caption.of("fawe.cancel.reason.manual"),
|
||||
Type.MANUAL
|
||||
);
|
||||
public static final FaweException NO_REGION = new FaweException(
|
||||
Caption.of("fawe.cancel.worldedit.cancel.reason.no.region"),
|
||||
Caption.of("fawe.cancel.reason.no.region"),
|
||||
Type.NO_REGION
|
||||
);
|
||||
public static final FaweException OUTSIDE_REGION = new FaweException(
|
||||
Caption.of(
|
||||
"fawe.cancel.worldedit.cancel.reason.outside.region"),
|
||||
"fawe.cancel.reason.outside.region"),
|
||||
Type.OUTSIDE_REGION
|
||||
);
|
||||
public static final FaweException MAX_CHECKS = new FaweException(
|
||||
Caption.of("fawe.cancel.worldedit.cancel.reason.max" + ".checks"),
|
||||
Caption.of("fawe.cancel.reason.max" + ".checks"),
|
||||
Type.MAX_CHECKS
|
||||
);
|
||||
public static final FaweException MAX_CHANGES = new FaweException(
|
||||
Caption.of("fawe.cancel.worldedit.cancel.reason.max" + ".changes"),
|
||||
Caption.of("fawe.cancel.reason.max" + ".changes"),
|
||||
Type.MAX_CHANGES
|
||||
);
|
||||
public static final FaweException LOW_MEMORY = new FaweException(
|
||||
Caption.of("fawe.cancel.worldedit.cancel.reason.low" + ".memory"),
|
||||
Caption.of("fawe.cancel.reason.low" + ".memory"),
|
||||
Type.LOW_MEMORY
|
||||
);
|
||||
public static final FaweException MAX_ENTITIES = new FaweException(
|
||||
Caption.of(
|
||||
"fawe.cancel.worldedit.cancel.reason.max.entities"),
|
||||
"fawe.cancel.reason.max.entities"),
|
||||
Type.MAX_ENTITIES
|
||||
);
|
||||
public static final FaweException MAX_TILES = new FaweException(Caption.of(
|
||||
"fawe.cancel.worldedit.cancel.reason.max.tiles",
|
||||
"fawe.cancel.reason.max.tiles",
|
||||
Type.MAX_TILES
|
||||
));
|
||||
public static final FaweException MAX_ITERATIONS = new FaweException(
|
||||
Caption.of(
|
||||
"fawe.cancel.worldedit.cancel.reason.max.iterations"),
|
||||
"fawe.cancel.reason.max.iterations"),
|
||||
Type.MAX_ITERATIONS
|
||||
);
|
||||
public static final FaweException PLAYER_ONLY = new FaweException(
|
||||
Caption.of(
|
||||
"fawe.cancel.worldedit.cancel.reason.player-only"),
|
||||
"fawe.cancel.reason.player-only"),
|
||||
Type.PLAYER_ONLY
|
||||
);
|
||||
public static final FaweException ACTOR_REQUIRED = new FaweException(
|
||||
Caption.of(
|
||||
"fawe.cancel.worldedit.cancel.reason.actor-required"),
|
||||
"fawe.cancel.reason.actor-required"),
|
||||
Type.ACTOR_REQUIRED
|
||||
);
|
||||
|
||||
|
@ -23,8 +23,8 @@ public class MemoryCheckingExtent extends PassthroughExtent {
|
||||
if (MemUtil.isMemoryLimited()) {
|
||||
if (this.actor != null) {
|
||||
actor.print(Caption.of(
|
||||
"fawe.cancel.worldedit.cancel.reason",
|
||||
Caption.of("fawe.cancel.worldedit.cancel.reason.low.memory")
|
||||
"fawe.cancel.reason",
|
||||
Caption.of("fawe.cancel.reason.low.memory")
|
||||
));
|
||||
if (Permission.hasPermission(this.actor, "worldedit.fast")) {
|
||||
this.actor.print(Caption.of("fawe.info.worldedit.oom.admin"));
|
||||
|
@ -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) {
|
||||
|
@ -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
|
||||
|
@ -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(
|
||||
|
@ -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);
|
||||
}
|
||||
};
|
||||
|
@ -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()) {
|
||||
|
@ -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()));
|
||||
|
Reference in New Issue
Block a user