geforkt von Mirrors/FastAsyncWorldEdit
Allow console to execute commands now that editsessions etc. accept actors
- Fixes #724 - Fixes #1044
Dieser Commit ist enthalten in:
Ursprung
fa2f50dea8
Commit
0ed98729f8
@ -46,15 +46,15 @@ public class ProvideBindings extends Bindings {
|
||||
}
|
||||
|
||||
@Binding
|
||||
public LocalSession getLocalSession(Player player) {
|
||||
return getWorldEdit().getSessionManager().get(player);
|
||||
public LocalSession getLocalSession(Actor actor) {
|
||||
return getWorldEdit().getSessionManager().get(actor);
|
||||
}
|
||||
|
||||
@Binding
|
||||
public EditSession editSession(LocalSession localSession, Player player, InjectedValueAccess context) {
|
||||
public EditSession editSession(LocalSession localSession, Actor actor, InjectedValueAccess context) {
|
||||
Arguments arguments = context.injectedValue(Key.of(Arguments.class)).orElse(null);
|
||||
String command = arguments == null ? null : arguments.get();
|
||||
EditSession editSession = localSession.createEditSession(player, command);
|
||||
EditSession editSession = localSession.createEditSession(actor, command);
|
||||
editSession.enableStandardMode();
|
||||
Request.request().setEditSession(editSession);
|
||||
return editSession;
|
||||
@ -62,8 +62,8 @@ public class ProvideBindings extends Bindings {
|
||||
|
||||
@Selection
|
||||
@Binding
|
||||
public Region selection(LocalSession localSession, Player player) {
|
||||
return localSession.getSelection(player.getWorld());
|
||||
public Region selection(LocalSession localSession) {
|
||||
return localSession.getSelection();
|
||||
}
|
||||
|
||||
@Binding
|
||||
@ -124,8 +124,7 @@ public class ProvideBindings extends Bindings {
|
||||
if (extent != null) {
|
||||
return extent;
|
||||
}
|
||||
Player plr = getPlayer(actor);
|
||||
EditSession editSession = editSession(getLocalSession(plr), plr, access);
|
||||
EditSession editSession = editSession(getLocalSession(actor), actor, access);
|
||||
if (access instanceof InjectedValueStore) {
|
||||
InjectedValueStore store = (InjectedValueStore) access;
|
||||
store.injectValue(Key.of(EditSession.class), ValueProvider.constant(editSession));
|
||||
|
@ -6,27 +6,28 @@ import com.fastasyncworldedit.core.util.MemUtil;
|
||||
import com.fastasyncworldedit.core.util.Permission;
|
||||
import com.fastasyncworldedit.core.util.WEManager;
|
||||
import com.sk89q.worldedit.entity.Player;
|
||||
import com.sk89q.worldedit.extension.platform.Actor;
|
||||
import com.sk89q.worldedit.extent.Extent;
|
||||
|
||||
public class MemoryCheckingExtent extends PassthroughExtent {
|
||||
|
||||
private final Player player;
|
||||
private final Actor actor;
|
||||
|
||||
public MemoryCheckingExtent(Player player, Extent extent) {
|
||||
public MemoryCheckingExtent(Actor actor, Extent extent) {
|
||||
super(extent);
|
||||
this.player = player;
|
||||
this.actor = actor;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Extent getExtent() {
|
||||
if (MemUtil.isMemoryLimited()) {
|
||||
if (this.player != null) {
|
||||
player.print(Caption.of(
|
||||
if (this.actor != null) {
|
||||
actor.print(Caption.of(
|
||||
"fawe.cancel.worldedit.cancel.reason",
|
||||
Caption.of("fawe.cancel.worldedit.cancel.reason.low.memory")
|
||||
));
|
||||
if (Permission.hasPermission(this.player, "worldedit.fast")) {
|
||||
this.player.print(Caption.of("fawe.info.worldedit.oom.admin"));
|
||||
if (Permission.hasPermission(this.actor, "worldedit.fast")) {
|
||||
this.actor.print(Caption.of("fawe.info.worldedit.oom.admin"));
|
||||
}
|
||||
}
|
||||
WEManager.IMP.cancelEdit(this, FaweCache.LOW_MEMORY);
|
||||
|
@ -13,7 +13,7 @@ import com.fastasyncworldedit.core.util.MainUtil;
|
||||
import com.sk89q.jnbt.NBTInputStream;
|
||||
import com.sk89q.jnbt.NBTOutputStream;
|
||||
import com.sk89q.worldedit.EditSession;
|
||||
import com.sk89q.worldedit.entity.Player;
|
||||
import com.sk89q.worldedit.extension.platform.Actor;
|
||||
import com.sk89q.worldedit.function.operation.ChangeSetExecutor;
|
||||
import com.sk89q.worldedit.regions.Region;
|
||||
import com.sk89q.worldedit.world.World;
|
||||
@ -134,35 +134,35 @@ public class DiskStorageHistory extends FaweStreamChangeSet {
|
||||
enttFile.delete();
|
||||
}
|
||||
|
||||
public void undo(Player player, Region[] regions) {
|
||||
public void undo(Actor actor, Region[] regions) {
|
||||
try {
|
||||
close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
return;
|
||||
}
|
||||
EditSession session = toEditSession(player, regions);
|
||||
EditSession session = toEditSession(actor, regions);
|
||||
session.setBlocks(this, ChangeSetExecutor.Type.UNDO);
|
||||
deleteFiles();
|
||||
}
|
||||
|
||||
public void undo(Player player) {
|
||||
undo(player, null);
|
||||
public void undo(Actor actor) {
|
||||
undo(actor, null);
|
||||
}
|
||||
|
||||
public void redo(Player player, Region[] regions) {
|
||||
public void redo(Actor actor, Region[] regions) {
|
||||
try {
|
||||
close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
return;
|
||||
}
|
||||
EditSession session = toEditSession(player, regions);
|
||||
EditSession session = toEditSession(actor, regions);
|
||||
session.setBlocks(this, ChangeSetExecutor.Type.REDO);
|
||||
}
|
||||
|
||||
public void redo(Player player) {
|
||||
redo(player, null);
|
||||
public void redo(Actor actor) {
|
||||
redo(actor, null);
|
||||
}
|
||||
|
||||
public UUID getUUID() {
|
||||
|
@ -16,7 +16,7 @@ import com.sk89q.jnbt.CompoundTag;
|
||||
import com.sk89q.worldedit.EditSession;
|
||||
import com.sk89q.worldedit.EditSessionBuilder;
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
import com.sk89q.worldedit.entity.Player;
|
||||
import com.sk89q.worldedit.extension.platform.Actor;
|
||||
import com.sk89q.worldedit.extent.Extent;
|
||||
import com.sk89q.worldedit.extent.inventory.BlockBag;
|
||||
import com.sk89q.worldedit.history.change.BlockChange;
|
||||
@ -251,12 +251,12 @@ public abstract class AbstractChangeSet implements ChangeSet, IBatchProcessor {
|
||||
|
||||
public abstract Iterator<Change> getIterator(boolean redo);
|
||||
|
||||
public EditSession toEditSession(Player player) {
|
||||
return toEditSession(player, null);
|
||||
public EditSession toEditSession(Actor actor) {
|
||||
return toEditSession(actor, null);
|
||||
}
|
||||
|
||||
public EditSession toEditSession(Player player, Region[] regions) {
|
||||
EditSessionBuilder builder = WorldEdit.getInstance().newEditSessionBuilder().world(getWorld()).actor(player).
|
||||
public EditSession toEditSession(Actor actor, Region[] regions) {
|
||||
EditSessionBuilder builder = WorldEdit.getInstance().newEditSessionBuilder().world(getWorld()).actor(actor).
|
||||
fastMode(false).checkMemory(false).changeSet(this).limitUnlimited();
|
||||
if (regions != null) {
|
||||
builder.allowedRegions(regions);
|
||||
|
@ -3,6 +3,7 @@ package com.fastasyncworldedit.core.history.changeset;
|
||||
import com.sk89q.jnbt.CompoundTag;
|
||||
import com.sk89q.worldedit.EditSession;
|
||||
import com.sk89q.worldedit.entity.Player;
|
||||
import com.sk89q.worldedit.extension.platform.Actor;
|
||||
import com.sk89q.worldedit.extent.inventory.BlockBag;
|
||||
import com.sk89q.worldedit.history.change.BlockChange;
|
||||
import com.sk89q.worldedit.history.change.Change;
|
||||
@ -84,13 +85,13 @@ public class AbstractDelegateChangeSet extends AbstractChangeSet {
|
||||
}
|
||||
|
||||
@Override
|
||||
public EditSession toEditSession(Player player) {
|
||||
return parent.toEditSession(player);
|
||||
public EditSession toEditSession(Actor actor) {
|
||||
return parent.toEditSession(actor);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EditSession toEditSession(Player player, Region[] regions) {
|
||||
return parent.toEditSession(player, regions);
|
||||
public EditSession toEditSession(Actor actor, Region[] regions) {
|
||||
return parent.toEditSession(actor, regions);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -328,17 +328,17 @@ public class ClipboardCommands {
|
||||
@Deprecated
|
||||
@CommandPermissions({"worldedit.clipboard.download"})
|
||||
public void download(
|
||||
final Player player,
|
||||
final Actor actor,
|
||||
final LocalSession session,
|
||||
@Arg(name = "format", desc = "String", def = "fast") final String formatName
|
||||
) throws WorldEditException {
|
||||
final ClipboardFormat format = ClipboardFormats.findByAlias(formatName);
|
||||
if (format == null) {
|
||||
player.print(Caption.of("fawe.worldedit.clipboard.clipboard.invalid.format", formatName));
|
||||
actor.print(Caption.of("fawe.worldedit.clipboard.clipboard.invalid.format", formatName));
|
||||
return;
|
||||
}
|
||||
|
||||
player.print(Caption.of("fawe.web.generating.link", formatName));
|
||||
actor.print(Caption.of("fawe.web.generating.link", formatName));
|
||||
ClipboardHolder holder = session.getClipboard();
|
||||
|
||||
URL url;
|
||||
@ -388,7 +388,7 @@ public class ClipboardCommands {
|
||||
// If we have a transform, bake it into the copy
|
||||
if (!transform.isIdentity()) {
|
||||
final FlattenedClipboardTransform result = FlattenedClipboardTransform.transform(clipboard, transform);
|
||||
target = new BlockArrayClipboard(result.getTransformedRegion(), player.getUniqueId());
|
||||
target = new BlockArrayClipboard(result.getTransformedRegion(), actor.getUniqueId());
|
||||
target.setOrigin(clipboard.getOrigin());
|
||||
Operations.completeLegacy(result.copyTo(target));
|
||||
} else {
|
||||
@ -407,17 +407,17 @@ public class ClipboardCommands {
|
||||
}
|
||||
} else {
|
||||
if (Settings.IMP.WEB.URL.isEmpty()) {
|
||||
player.print(Caption.of("fawe.error.setting.disable", "web.url"));
|
||||
actor.print(Caption.of("fawe.error.setting.disable", "web.url"));
|
||||
return;
|
||||
}
|
||||
url = FaweAPI.upload(target, format);
|
||||
}
|
||||
}
|
||||
if (url == null) {
|
||||
player.print(Caption.of("fawe.web.generating.link.failed"));
|
||||
actor.print(Caption.of("fawe.web.generating.link.failed"));
|
||||
} else {
|
||||
String urlText = url.toString();
|
||||
player.print(Caption.of("fawe.web.download.link", urlText).clickEvent(ClickEvent.openUrl(urlText)));
|
||||
actor.print(Caption.of("fawe.web.download.link", urlText).clickEvent(ClickEvent.openUrl(urlText)));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -460,7 +460,7 @@ public class GeneralCommands {
|
||||
)
|
||||
@CommandPermissions("worldedit.global-texture")
|
||||
public void gtexture(
|
||||
Player player,
|
||||
Actor actor,
|
||||
World worldArg,
|
||||
LocalSession session,
|
||||
EditSession editSession,
|
||||
@ -470,7 +470,7 @@ public class GeneralCommands {
|
||||
// TODO NOT IMPLEMENTED convert this to an ArgumentConverter
|
||||
if (arguments.isEmpty()) {
|
||||
session.setTextureUtil(null);
|
||||
player.print(Caption.of("fawe.worldedit.general.texture.disabled"));
|
||||
actor.print(Caption.of("fawe.worldedit.general.texture.disabled"));
|
||||
} else {
|
||||
String arg = arguments.get(0);
|
||||
String argLower = arg.toLowerCase(Locale.ROOT);
|
||||
@ -503,7 +503,7 @@ public class GeneralCommands {
|
||||
util = Fawe.get().getTextureUtil();
|
||||
} else {
|
||||
ParserContext parserContext = new ParserContext();
|
||||
parserContext.setActor(player);
|
||||
parserContext.setActor(actor);
|
||||
parserContext.setWorld(worldArg);
|
||||
parserContext.setSession(session);
|
||||
parserContext.setExtent(editSession);
|
||||
@ -523,7 +523,7 @@ public class GeneralCommands {
|
||||
util = new CachedTextureUtil(util);
|
||||
}
|
||||
session.setTextureUtil(util);
|
||||
player.print(Caption.of("fawe.worldedit.general.texture.set", StringMan.join(arguments, " ")));
|
||||
actor.print(Caption.of("fawe.worldedit.general.texture.set", StringMan.join(arguments, " ")));
|
||||
}
|
||||
}
|
||||
|
||||
@ -535,16 +535,16 @@ public class GeneralCommands {
|
||||
)
|
||||
@CommandPermissions({"worldedit.global-mask", "worldedit.mask.global"})
|
||||
public void gsmask(
|
||||
Player player,
|
||||
Actor actor,
|
||||
LocalSession session,
|
||||
EditSession editSession,
|
||||
@Arg(desc = "The mask to set", def = "") Mask maskOpt
|
||||
) throws WorldEditException {
|
||||
session.setSourceMask(maskOpt);
|
||||
if (maskOpt == null) {
|
||||
player.print(Caption.of("fawe.worldedit.general.source.mask.disabled"));
|
||||
actor.print(Caption.of("fawe.worldedit.general.source.mask.disabled"));
|
||||
} else {
|
||||
player.print(Caption.of("fawe.worldedit.general.source.mask"));
|
||||
actor.print(Caption.of("fawe.worldedit.general.source.mask"));
|
||||
}
|
||||
}
|
||||
|
||||
@ -555,16 +555,16 @@ public class GeneralCommands {
|
||||
)
|
||||
@CommandPermissions({"worldedit.global-transform", "worldedit.transform.global"})
|
||||
public void gtransform(
|
||||
Player player,
|
||||
Actor actor,
|
||||
EditSession editSession,
|
||||
LocalSession session,
|
||||
@Arg(desc = "The transform to set", def = "") ResettableExtent transform
|
||||
) throws WorldEditException {
|
||||
session.setTransform(transform);
|
||||
if (transform == null) {
|
||||
player.print(Caption.of("fawe.worldedit.general.transform.disabled"));
|
||||
actor.print(Caption.of("fawe.worldedit.general.transform.disabled"));
|
||||
} else {
|
||||
player.print(Caption.of("fawe.worldedit.general.transform"));
|
||||
actor.print(Caption.of("fawe.worldedit.general.transform"));
|
||||
}
|
||||
}
|
||||
|
||||
@ -574,11 +574,11 @@ public class GeneralCommands {
|
||||
desc = "Toggle FAWE tips"
|
||||
)
|
||||
@CommandPermissions("fawe.tips")
|
||||
public void tips(Player player, LocalSession session) throws WorldEditException {
|
||||
if (player.togglePermission("fawe.tips")) {
|
||||
player.print(Caption.of("fawe.info.worldedit.toggle.tips.on"));
|
||||
public void tips(Actor actor, LocalSession session) throws WorldEditException {
|
||||
if (actor.togglePermission("fawe.tips")) {
|
||||
actor.print(Caption.of("fawe.info.worldedit.toggle.tips.on"));
|
||||
} else {
|
||||
player.print(Caption.of("fawe.info.worldedit.toggle.tips.off"));
|
||||
actor.print(Caption.of("fawe.info.worldedit.toggle.tips.off"));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -140,10 +140,10 @@ public class RegionCommands {
|
||||
@CommandPermissions("worldedit.region.test")
|
||||
@Logging(REGION)
|
||||
public void test(
|
||||
Player player, EditSession editSession,
|
||||
Actor actor, EditSession editSession,
|
||||
@Arg(desc = "test") double testValue
|
||||
) throws WorldEditException {
|
||||
player.print(TextComponent.of(testValue));
|
||||
actor.print(TextComponent.of(testValue));
|
||||
}
|
||||
|
||||
@Command(
|
||||
@ -151,19 +151,9 @@ public class RegionCommands {
|
||||
desc = "Get the light at a position"
|
||||
)
|
||||
@CommandPermissions("worldedit.light.fix")
|
||||
public void fixLighting(Player player) throws WorldEditException {
|
||||
final Location loc = player.getLocation();
|
||||
Region selection = player.getSelection();
|
||||
if (selection == null) {
|
||||
final int cx = loc.getBlockX() >> 4;
|
||||
final int cz = loc.getBlockZ() >> 4;
|
||||
selection = new CuboidRegion(
|
||||
BlockVector3.at(cx - 8, 0, cz - 8).multiply(16),
|
||||
BlockVector3.at(cx + 8, 0, cz + 8).multiply(16)
|
||||
);
|
||||
}
|
||||
int count = FaweAPI.fixLighting(player.getWorld(), selection, null, RelightMode.ALL);
|
||||
player.print(Caption.of("fawe.info.lighting.propagate.selection", count));
|
||||
public void fixLighting(Actor actor, LocalSession session, @Selection Region selection) throws WorldEditException {
|
||||
int count = FaweAPI.fixLighting(session.getSelectionWorld(), selection, null, RelightMode.ALL);
|
||||
actor.print(Caption.of("fawe.info.lighting.propagate.selection", count));
|
||||
}
|
||||
|
||||
// @Command(
|
||||
@ -184,18 +174,9 @@ public class RegionCommands {
|
||||
desc = "Removing lighting in a selection"
|
||||
)
|
||||
@CommandPermissions("worldedit.light.remove")
|
||||
public void removeLighting(Player player) {
|
||||
Region selection = player.getSelection();
|
||||
if (selection == null) {
|
||||
final int cx = player.getLocation().getBlockX() >> 4;
|
||||
final int cz = player.getLocation().getBlockZ() >> 4;
|
||||
selection = new CuboidRegion(
|
||||
BlockVector3.at(cx - 8, 0, cz - 8).multiply(16),
|
||||
BlockVector3.at(cx + 8, 0, cz + 8).multiply(16)
|
||||
);
|
||||
}
|
||||
int count = FaweAPI.fixLighting(player.getWorld(), selection, null, RelightMode.NONE);
|
||||
player.print(Caption.of("fawe.info.updated.lighting.selection", count));
|
||||
public void removeLighting(Actor actor, LocalSession session, @Selection Region selection) {
|
||||
int count = FaweAPI.fixLighting(session.getSelectionWorld(), selection, null, RelightMode.NONE);
|
||||
actor.print(Caption.of("fawe.info.updated.lighting.selection", count));
|
||||
}
|
||||
|
||||
@Command(
|
||||
@ -224,8 +205,8 @@ public class RegionCommands {
|
||||
desc = "Set block lighting in a selection"
|
||||
)
|
||||
@CommandPermissions("worldedit.light.set")
|
||||
public void setlighting(Player player, EditSession editSession, @Selection Region region) {
|
||||
player.print(Caption.of("fawe.info.temporarily-not-working"));
|
||||
public void setlighting(Actor actor, EditSession editSession, @Selection Region region) {
|
||||
actor.print(Caption.of("fawe.info.temporarily-not-working"));
|
||||
}
|
||||
|
||||
@Command(
|
||||
@ -233,8 +214,8 @@ public class RegionCommands {
|
||||
desc = "Set sky lighting in a selection"
|
||||
)
|
||||
@CommandPermissions("worldedit.light.set")
|
||||
public void setskylighting(Player player, @Selection Region region) {
|
||||
player.print(Caption.of("fawe.info.temporarily-not-working"));
|
||||
public void setskylighting(Actor actor, @Selection Region region) {
|
||||
actor.print(Caption.of("fawe.info.temporarily-not-working"));
|
||||
}
|
||||
|
||||
@Command(
|
||||
@ -355,7 +336,7 @@ public class RegionCommands {
|
||||
@Preload(Preload.PreloadCheck.PRELOAD)
|
||||
@Confirm(Confirm.Processor.REGION)
|
||||
public void lay(
|
||||
Player player,
|
||||
Actor actor,
|
||||
EditSession editSession,
|
||||
@Selection Region region,
|
||||
@Arg(name = "pattern", desc = "The pattern of blocks to lay") Pattern patternArg
|
||||
@ -380,7 +361,7 @@ public class RegionCommands {
|
||||
editSession.setBlock(x, y, z, patternArg);
|
||||
affected++;
|
||||
}
|
||||
player.print(Caption.of("fawe.worldedit.visitor.visitor.block", affected));
|
||||
actor.print(Caption.of("fawe.worldedit.visitor.visitor.block", affected));
|
||||
}
|
||||
|
||||
@Command(
|
||||
@ -619,7 +600,7 @@ public class RegionCommands {
|
||||
@Preload(Preload.PreloadCheck.PRELOAD)
|
||||
@Confirm(Confirm.Processor.REGION)
|
||||
public void fall(
|
||||
Player player, EditSession editSession, LocalSession session,
|
||||
Actor actor, EditSession editSession,
|
||||
@Selection Region region,
|
||||
@Arg(desc = "BlockStateHolder", def = "air")
|
||||
BlockStateHolder replace,
|
||||
@ -627,7 +608,7 @@ public class RegionCommands {
|
||||
boolean notFullHeight
|
||||
) throws WorldEditException {
|
||||
int affected = editSession.fall(region, !notFullHeight, replace);
|
||||
player.print(Caption.of("fawe.worldedit.visitor.visitor.block", affected));
|
||||
actor.print(Caption.of("fawe.worldedit.visitor.visitor.block", affected));
|
||||
}
|
||||
|
||||
@Command(
|
||||
|
@ -148,7 +148,7 @@ public class SchematicCommands {
|
||||
@Deprecated
|
||||
@CommandPermissions({"worldedit.clipboard.load", "worldedit.schematic.load", "worldedit.schematic.load.web", "worldedit.schematic.load.asset"})
|
||||
public void loadall(
|
||||
Player player, LocalSession session,
|
||||
Actor actor, LocalSession session,
|
||||
@Arg(desc = "Format name.", def = "fast")
|
||||
String formatName,
|
||||
@Arg(desc = "File name.")
|
||||
@ -160,18 +160,18 @@ public class SchematicCommands {
|
||||
) throws FilenameException {
|
||||
final ClipboardFormat format = ClipboardFormats.findByAlias(formatName);
|
||||
if (format == null) {
|
||||
player.print(Caption.of("fawe.worldedit.clipboard.clipboard.invalid.format", formatName));
|
||||
actor.print(Caption.of("fawe.worldedit.clipboard.clipboard.invalid.format", formatName));
|
||||
return;
|
||||
}
|
||||
try {
|
||||
MultiClipboardHolder all = ClipboardFormats.loadAllFromInput(player, filename, null, true);
|
||||
MultiClipboardHolder all = ClipboardFormats.loadAllFromInput(actor, filename, null, true);
|
||||
if (all != null) {
|
||||
if (overwrite) {
|
||||
session.setClipboard(all);
|
||||
} else {
|
||||
session.addClipboard(all);
|
||||
}
|
||||
player.print(Caption.of("fawe.worldedit.schematic.schematic.loaded", filename));
|
||||
actor.print(Caption.of("fawe.worldedit.schematic.schematic.loaded", filename));
|
||||
}
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
@ -183,9 +183,9 @@ public class SchematicCommands {
|
||||
desc = "Clear your clipboard"
|
||||
)
|
||||
@CommandPermissions({"worldedit.clipboard.clear", "worldedit.schematic.clear"})
|
||||
public void clear(Player player, LocalSession session) throws WorldEditException {
|
||||
public void clear(Actor actor, LocalSession session) throws WorldEditException {
|
||||
session.setClipboard(null);
|
||||
player.print(Caption.of("fawe.worldedit.clipboard.clipboard.cleared"));
|
||||
actor.print(Caption.of("fawe.worldedit.clipboard.clipboard.cleared"));
|
||||
}
|
||||
|
||||
@Command(
|
||||
@ -194,7 +194,7 @@ public class SchematicCommands {
|
||||
)
|
||||
@CommandPermissions({"worldedit.clipboard.clear", "worldedit.schematic.clear"})
|
||||
public void unload(
|
||||
Player player, LocalSession session,
|
||||
Actor actor, LocalSession session,
|
||||
@Arg(desc = "File name, requires extension.")
|
||||
String fileName
|
||||
) throws WorldEditException {
|
||||
@ -204,7 +204,7 @@ public class SchematicCommands {
|
||||
} else {
|
||||
final LocalConfiguration config = this.worldEdit.getConfiguration();
|
||||
File working = this.worldEdit.getWorkingDirectoryPath(config.saveDir).toFile();
|
||||
File root = Settings.IMP.PATHS.PER_PLAYER_SCHEMATICS ? new File(working, player.getUniqueId().toString()) : working;
|
||||
File root = Settings.IMP.PATHS.PER_PLAYER_SCHEMATICS ? new File(working, actor.getUniqueId().toString()) : working;
|
||||
uri = new File(root, fileName).toURI();
|
||||
}
|
||||
|
||||
@ -221,11 +221,11 @@ public class SchematicCommands {
|
||||
} else {
|
||||
session.setClipboard(null);
|
||||
}
|
||||
player.print(Caption.of("fawe.worldedit.clipboard.clipboard.cleared"));
|
||||
actor.print(Caption.of("fawe.worldedit.clipboard.clipboard.cleared"));
|
||||
return;
|
||||
}
|
||||
}
|
||||
player.print(Caption.of("fawe.worldedit.clipboard.clipboard.uri.not.found", fileName));
|
||||
actor.print(Caption.of("fawe.worldedit.clipboard.clipboard.uri.not.found", fileName));
|
||||
}
|
||||
|
||||
//FAWE start
|
||||
@ -235,42 +235,42 @@ public class SchematicCommands {
|
||||
desc = "Move your loaded schematic"
|
||||
)
|
||||
@CommandPermissions({"worldedit.schematic.move", "worldedit.schematic.move.other"})
|
||||
public void move(Player player, LocalSession session, @Arg(desc = "Directory.") String directory) throws WorldEditException,
|
||||
public void move(Actor actor, LocalSession session, @Arg(desc = "Directory.") String directory) throws WorldEditException,
|
||||
IOException {
|
||||
LocalConfiguration config = worldEdit.getConfiguration();
|
||||
File working = worldEdit.getWorkingDirectoryPath(config.saveDir).toFile();
|
||||
File dir = Settings.IMP.PATHS.PER_PLAYER_SCHEMATICS ? new File(working, player.getUniqueId().toString()) : working;
|
||||
File dir = Settings.IMP.PATHS.PER_PLAYER_SCHEMATICS ? new File(working, actor.getUniqueId().toString()) : working;
|
||||
File destDir = new File(dir, directory);
|
||||
if (!MainUtil.isInSubDirectory(working, destDir)) {
|
||||
player.print(Caption.of("worldedit.schematic.directory-does-not-exist", TextComponent.of(String.valueOf(destDir))));
|
||||
actor.print(Caption.of("worldedit.schematic.directory-does-not-exist", TextComponent.of(String.valueOf(destDir))));
|
||||
return;
|
||||
}
|
||||
if (Settings.IMP.PATHS.PER_PLAYER_SCHEMATICS && !MainUtil.isInSubDirectory(dir, destDir) && !player.hasPermission(
|
||||
if (Settings.IMP.PATHS.PER_PLAYER_SCHEMATICS && !MainUtil.isInSubDirectory(dir, destDir) && !actor.hasPermission(
|
||||
"worldedit.schematic.move.other")) {
|
||||
player.print(Caption.of("fawe.error.no-perm", "worldedit.schematic.move.other"));
|
||||
actor.print(Caption.of("fawe.error.no-perm", "worldedit.schematic.move.other"));
|
||||
return;
|
||||
}
|
||||
ClipboardHolder clipboard = session.getClipboard();
|
||||
List<File> sources = getFiles(clipboard);
|
||||
if (sources.isEmpty()) {
|
||||
player.print(Caption.of("fawe.worldedit.schematic.schematic.none"));
|
||||
actor.print(Caption.of("fawe.worldedit.schematic.schematic.none"));
|
||||
return;
|
||||
}
|
||||
if (!destDir.exists() && !destDir.mkdirs()) {
|
||||
player.print(Caption.of("worldedit.schematic.file-perm-fail", TextComponent.of(String.valueOf(destDir))));
|
||||
actor.print(Caption.of("worldedit.schematic.file-perm-fail", TextComponent.of(String.valueOf(destDir))));
|
||||
return;
|
||||
}
|
||||
for (File source : sources) {
|
||||
File destFile = new File(destDir, source.getName());
|
||||
if (destFile.exists()) {
|
||||
player.print(Caption.of("fawe.worldedit.schematic.schematic.move.exists", destFile));
|
||||
actor.print(Caption.of("fawe.worldedit.schematic.schematic.move.exists", destFile));
|
||||
continue;
|
||||
}
|
||||
if (Settings.IMP.PATHS.PER_PLAYER_SCHEMATICS && (!MainUtil.isInSubDirectory(
|
||||
dir,
|
||||
destFile
|
||||
) || !MainUtil.isInSubDirectory(dir, source)) && !player.hasPermission("worldedit.schematic.delete.other")) {
|
||||
player.print(Caption.of("fawe.worldedit.schematic.schematic.move.failed", destFile,
|
||||
) || !MainUtil.isInSubDirectory(dir, source)) && !actor.hasPermission("worldedit.schematic.delete.other")) {
|
||||
actor.print(Caption.of("fawe.worldedit.schematic.schematic.move.failed", destFile,
|
||||
Caption.of("fawe.error.no-perm", ("worldedit.schematic.move.other"))
|
||||
));
|
||||
continue;
|
||||
@ -281,7 +281,7 @@ public class SchematicCommands {
|
||||
if (cached.exists()) {
|
||||
Files.move(cached.toPath(), destFile.toPath());
|
||||
}
|
||||
player.print(Caption.of("fawe.worldedit.schematic.schematic.move.success", source, destFile));
|
||||
actor.print(Caption.of("fawe.worldedit.schematic.schematic.move.success", source, destFile));
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
@ -119,7 +119,7 @@ public class UtilityCommands {
|
||||
desc = "Generate or run a macro"
|
||||
)
|
||||
@CommandPermissions("worldedit.macro")
|
||||
public void macro(Player player, LocalSession session, String name, String argument) throws IOException {
|
||||
public void macro(Actor actor, LocalSession session, String name, String argument) throws IOException {
|
||||
|
||||
}
|
||||
|
||||
@ -130,11 +130,11 @@ public class UtilityCommands {
|
||||
)
|
||||
@CommandPermissions("fawe.admin")
|
||||
public void heightmapInterface(
|
||||
Player player,
|
||||
Actor actor,
|
||||
@Arg(name = "min", desc = "int", def = "100") int min,
|
||||
@Arg(name = "max", desc = "int", def = "200") int max
|
||||
) throws IOException {
|
||||
player.print(TextComponent.of("Please wait while we generate the minified heightmaps."));
|
||||
actor.print(TextComponent.of("Please wait while we generate the minified heightmaps."));
|
||||
File srcFolder = MainUtil.getFile(Fawe.imp().getDirectory(), Settings.IMP.PATHS.HEIGHTMAP);
|
||||
|
||||
File webSrc = new File(Fawe.imp().getDirectory(), "web" + File.separator + "heightmap");
|
||||
@ -170,7 +170,7 @@ public class UtilityCommands {
|
||||
RenderingHints.VALUE_INTERPOLATION_BILINEAR,
|
||||
true
|
||||
);
|
||||
player.print(TextComponent.of(String.format("Writing %s", name)));
|
||||
actor.print(TextComponent.of(String.format("Writing %s", name)));
|
||||
File minFile = new File(minImages, name);
|
||||
File maxFile = new File(maxImages, name);
|
||||
minFile.getParentFile().mkdirs();
|
||||
@ -195,9 +195,9 @@ public class UtilityCommands {
|
||||
config.append("// The local source for the image (used in commands)\n");
|
||||
config.append("var src_local = \"file://\";\n");
|
||||
File configFile = new File(webSrc, "config.js");
|
||||
player.print(TextComponent.of(String.format("Writing %s", configFile)));
|
||||
actor.print(TextComponent.of(String.format("Writing %s", configFile)));
|
||||
Files.write(configFile.toPath(), config.toString().getBytes());
|
||||
player.print(TextComponent.of("Done! See: `FastAsyncWorldEdit/web/heightmap`"));
|
||||
actor.print(TextComponent.of("Done! See: `FastAsyncWorldEdit/web/heightmap`"));
|
||||
}
|
||||
|
||||
@Command(
|
||||
@ -206,9 +206,9 @@ public class UtilityCommands {
|
||||
desc = "Cancel your current command"
|
||||
)
|
||||
@CommandPermissions(value = "fawe.cancel", queued = false)
|
||||
public void cancel(Player player) {
|
||||
int cancelled = player.cancel(false);
|
||||
player.print(Caption.of("fawe.cancel.worldedit.cancel.count", cancelled));
|
||||
public void cancel(Actor actor) {
|
||||
int cancelled = actor.cancel(false);
|
||||
actor.print(Caption.of("fawe.cancel.worldedit.cancel.count", cancelled));
|
||||
}
|
||||
|
||||
@Command(
|
||||
@ -825,9 +825,9 @@ public class UtilityCommands {
|
||||
desc = "Confirm a command"
|
||||
)
|
||||
@CommandPermissions(value = "fawe.confirm", queued = false)
|
||||
public void confirm(Player player) throws WorldEditException {
|
||||
if (!player.confirm()) {
|
||||
player.print(Caption.of("fawe.worldedit.utility.nothing.confirmed"));
|
||||
public void confirm(Actor actor) throws WorldEditException {
|
||||
if (!actor.confirm()) {
|
||||
actor.print(Caption.of("fawe.worldedit.utility.nothing.confirmed"));
|
||||
}
|
||||
}
|
||||
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren