mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2025-07-13 14:58:35 +00:00
Merge remote-tracking branch 'upstream/feature/translatable-text' into i18n-merge
This commit is contained in:
@ -61,19 +61,19 @@ import org.enginehub.piston.part.SubCommandPart;
|
||||
@CommandContainer(superTypes = CommandPermissionsConditionGenerator.Registration.class)
|
||||
public class ApplyBrushCommands {
|
||||
|
||||
private static final CommandArgument REGION_FACTORY = arg(TranslatableComponent.of("shape"), TextComponent.of("The shape of the region"))
|
||||
private static final CommandArgument REGION_FACTORY = arg(TranslatableComponent.of("shape"), TranslatableComponent.of("worldedit.brush.apply.shape"))
|
||||
.defaultsTo(ImmutableList.of())
|
||||
.ofTypes(ImmutableList.of(Key.of(RegionFactory.class)))
|
||||
.build();
|
||||
|
||||
private static final CommandArgument RADIUS = arg(TranslatableComponent.of("radius"), TextComponent.of("The size of the brush"))
|
||||
private static final CommandArgument RADIUS = arg(TranslatableComponent.of("radius"), TranslatableComponent.of("worldedit.brush.apply.radius"))
|
||||
.defaultsTo(ImmutableList.of("5"))
|
||||
.ofTypes(ImmutableList.of(Key.of(double.class)))
|
||||
.build();
|
||||
|
||||
public static void register(CommandManagerService service, CommandManager commandManager, CommandRegistrationHandler registration) {
|
||||
commandManager.register("apply", builder -> {
|
||||
builder.description(TextComponent.of("Apply brush, apply a function to every block"));
|
||||
builder.description(TranslatableComponent.of("worldedit.brush.apply.description"));
|
||||
builder.action(org.enginehub.piston.Command.Action.NULL_ACTION);
|
||||
|
||||
CommandManager manager = service.newCommandManager();
|
||||
@ -85,7 +85,7 @@ public class ApplyBrushCommands {
|
||||
|
||||
builder.condition(new PermissionCondition(ImmutableSet.of("worldedit.brush.apply")));
|
||||
builder.addParts(REGION_FACTORY, RADIUS);
|
||||
builder.addPart(SubCommandPart.builder(TranslatableComponent.of("type"), TextComponent.of("Type of brush to use"))
|
||||
builder.addPart(SubCommandPart.builder(TranslatableComponent.of("type"), TranslatableComponent.of("worldedit.brush.apply.type"))
|
||||
.withCommands(manager.getAllCommands().collect(Collectors.toList()))
|
||||
.required()
|
||||
.build());
|
||||
@ -125,8 +125,7 @@ public class ApplyBrushCommands {
|
||||
@Direction(includeDiagonals = true)
|
||||
com.sk89q.worldedit.util.Direction direction) throws WorldEditException {
|
||||
player.print(TextComponent.builder().append("WARNING: ", TextColor.RED, TextDecoration.BOLD)
|
||||
.append("This brush simulates item usages. Its effects may not work on all platforms, may not be undo-able," +
|
||||
" and may cause strange interactions with other mods/plugins. Use at your own risk.").build());
|
||||
.append(TranslatableComponent.of("worldedit.brush.apply.item.warning")).build());
|
||||
setApplyBrush(parameters, player, localSession, new ItemUseFactory(item, direction));
|
||||
}
|
||||
|
||||
|
@ -49,6 +49,11 @@ import com.sk89q.worldedit.regions.Region;
|
||||
import com.sk89q.worldedit.regions.Regions;
|
||||
import com.sk89q.worldedit.util.Location;
|
||||
import com.sk89q.worldedit.util.formatting.component.PaginationBox;
|
||||
import com.sk89q.worldedit.util.formatting.component.TextUtils;
|
||||
import com.sk89q.worldedit.util.formatting.text.Component;
|
||||
import com.sk89q.worldedit.util.formatting.text.TextComponent;
|
||||
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
|
||||
import com.sk89q.worldedit.util.formatting.text.event.HoverEvent;
|
||||
import com.sk89q.worldedit.world.World;
|
||||
import com.sk89q.worldedit.world.biome.BiomeData;
|
||||
import com.sk89q.worldedit.world.biome.BiomeType;
|
||||
@ -58,6 +63,7 @@ import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
import org.enginehub.piston.annotation.Command;
|
||||
import org.enginehub.piston.annotation.CommandContainer;
|
||||
import java.util.List;
|
||||
import org.enginehub.piston.annotation.param.Arg;
|
||||
import org.enginehub.piston.annotation.param.ArgFlag;
|
||||
import org.enginehub.piston.annotation.param.Switch;
|
||||
@ -101,7 +107,7 @@ public class BiomeCommands {
|
||||
})
|
||||
.collect(Collectors.toList()));
|
||||
return paginationBox.create(page);
|
||||
}, null);
|
||||
}, (Component) null);
|
||||
}
|
||||
|
||||
@Command(
|
||||
@ -118,24 +124,24 @@ public class BiomeCommands {
|
||||
BiomeRegistry biomeRegistry = WorldEdit.getInstance().getPlatformManager()
|
||||
.queryCapability(Capability.GAME_HOOKS).getRegistries().getBiomeRegistry();
|
||||
Set<BiomeType> biomes = new HashSet<>();
|
||||
String qualifier;
|
||||
String messageKey;
|
||||
|
||||
if (useLineOfSight) {
|
||||
Location blockPosition = player.getBlockTrace(300);
|
||||
if (blockPosition == null) {
|
||||
player.printError(BBC.NO_BLOCK.s());
|
||||
player.printError(TranslatableComponent.of("worldedit.raytrace.noblock"));
|
||||
return;
|
||||
}
|
||||
|
||||
BiomeType biome = player.getWorld().getBiome(blockPosition.toVector().toBlockPoint().toBlockVector2());
|
||||
biomes.add(biome);
|
||||
|
||||
qualifier = "at line of sight point";
|
||||
messageKey = "worldedit.biomeinfo.lineofsight";
|
||||
} else if (usePosition) {
|
||||
BiomeType biome = player.getWorld().getBiome(player.getLocation().toVector().toBlockPoint().toBlockVector2());
|
||||
biomes.add(biome);
|
||||
|
||||
qualifier = "at your position";
|
||||
messageKey = "worldedit.biomeinfo.position";
|
||||
} else {
|
||||
World world = player.getWorld();
|
||||
Region region = session.getSelection(world);
|
||||
@ -150,19 +156,18 @@ public class BiomeCommands {
|
||||
}
|
||||
}
|
||||
|
||||
qualifier = "in your selection";
|
||||
messageKey = "worldedit.biomeinfo.selection";
|
||||
}
|
||||
|
||||
BBC.BIOME_LIST_HEADER.send(player, 1, 1);
|
||||
player.print(biomes.size() != 1 ? "Biomes " + qualifier + ":" : "Biome " + qualifier + ":");
|
||||
for (BiomeType biome : biomes) {
|
||||
List<Component> components = biomes.stream().map(biome -> {
|
||||
BiomeData data = biomeRegistry.getData(biome);
|
||||
if (data != null) {
|
||||
player.print(" " + data.getName());
|
||||
return TextComponent.of(data.getName()).hoverEvent(HoverEvent.showText(TextComponent.of(biome.getId())));
|
||||
} else {
|
||||
player.print(" <unknown #" + biome.getId() + ">");
|
||||
return TextComponent.of(biome.getId());
|
||||
}
|
||||
}
|
||||
}).collect(Collectors.toList());
|
||||
player.printInfo(TranslatableComponent.of(messageKey, TextUtils.join(components, TextComponent.of(", "))));
|
||||
}
|
||||
|
||||
@Command(
|
||||
@ -195,7 +200,10 @@ public class BiomeCommands {
|
||||
FlatRegionVisitor visitor = new FlatRegionVisitor(Regions.asFlatRegion(region), replace);
|
||||
Operations.completeLegacy(visitor);
|
||||
|
||||
BBC.BIOME_CHANGED.send(player, visitor.getAffected());
|
||||
player.printInfo(TranslatableComponent.of(
|
||||
"worldedit.setbiome.changed",
|
||||
TextComponent.of(visitor.getAffected())
|
||||
));
|
||||
if (!player.hasPermission("fawe.tips")) {
|
||||
BBC.TIP_BIOME_PATTERN.or(BBC.TIP_BIOME_MASK).send(player);
|
||||
}
|
||||
|
@ -124,6 +124,8 @@ import java.net.URI;
|
||||
import java.nio.file.FileSystems;
|
||||
import java.util.List;
|
||||
import java.util.zip.GZIPInputStream;
|
||||
import com.sk89q.worldedit.util.formatting.text.TextComponent;
|
||||
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
|
||||
import org.enginehub.piston.annotation.Command;
|
||||
import com.sk89q.worldedit.function.factory.Apply;
|
||||
import org.enginehub.piston.annotation.CommandContainer;
|
||||
@ -1147,6 +1149,6 @@ public class BrushCommands {
|
||||
tool.setFill(null);
|
||||
tool.setBrush(new OperationFactoryBrush(factory, shape, session), permission);
|
||||
|
||||
player.print("Set brush to " + factory);
|
||||
player.printInfo(TranslatableComponent.of("worldedit.brush.operation.equip", TextComponent.of(factory.toString())));
|
||||
}
|
||||
}
|
||||
|
@ -40,6 +40,7 @@ import com.sk89q.worldedit.util.formatting.component.PaginationBox;
|
||||
import com.sk89q.worldedit.command.util.WorldEditAsyncCommandBuilder;
|
||||
import com.sk89q.worldedit.util.formatting.text.Component;
|
||||
import com.sk89q.worldedit.util.formatting.text.TextComponent;
|
||||
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
|
||||
import com.sk89q.worldedit.util.formatting.text.event.ClickEvent;
|
||||
import com.sk89q.worldedit.util.formatting.text.format.TextColor;
|
||||
import com.sk89q.worldedit.world.World;
|
||||
@ -85,9 +86,9 @@ public class ChunkCommands {
|
||||
int chunkZ = (int) Math.floor(pos.getBlockZ() / 16.0);
|
||||
|
||||
final BlockVector2 chunkPos = BlockVector2.at(chunkX, chunkZ);
|
||||
player.print("Chunk: " + chunkX + ", " + chunkZ);
|
||||
player.print("Old format: " + LegacyChunkStore.getFilename(chunkPos));
|
||||
player.print("McRegion: region/" + McRegionChunkStore.getFilename(chunkPos));
|
||||
player.printInfo(TranslatableComponent.of("worldedit.chunkinfo.chunk", TextComponent.of(chunkX), TextComponent.of(chunkZ)));
|
||||
player.printInfo(TranslatableComponent.of("worldedit.chunkinfo.old-filename", TextComponent.of(LegacyChunkStore.getFilename(chunkPos))));
|
||||
player.printInfo(TranslatableComponent.of("worldedit.chunkinfo.mcregion-filename", TextComponent.of(McRegionChunkStore.getFilename(chunkPos))));
|
||||
}
|
||||
|
||||
@Command(
|
||||
@ -99,7 +100,7 @@ public class ChunkCommands {
|
||||
@ArgFlag(name = 'p', desc = "Page number.", def = "1") int page) throws WorldEditException {
|
||||
final Region region = session.getSelection(world);
|
||||
|
||||
actor.print("Listing chunks for " + actor.getName());
|
||||
actor.print(TranslatableComponent.of("worldedit.listchunks.listfor", TextComponent.of(actor.getName())));
|
||||
actor.print(new ChunkListPaginationBox(region).create(page));
|
||||
}
|
||||
|
||||
|
@ -73,7 +73,10 @@ import com.sk89q.worldedit.regions.Region;
|
||||
import com.sk89q.worldedit.regions.RegionSelector;
|
||||
import com.sk89q.worldedit.regions.selector.CuboidRegionSelector;
|
||||
import com.sk89q.worldedit.session.ClipboardHolder;
|
||||
import com.sk89q.worldedit.util.formatting.text.Component;
|
||||
import com.sk89q.worldedit.world.World;
|
||||
import com.sk89q.worldedit.util.formatting.text.TextComponent;
|
||||
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
|
||||
import org.enginehub.piston.annotation.Command;
|
||||
import org.enginehub.piston.annotation.CommandContainer;
|
||||
import org.enginehub.piston.annotation.param.Arg;
|
||||
@ -149,10 +152,10 @@ public class ClipboardCommands {
|
||||
copy.setSourceMask(mask);
|
||||
}
|
||||
Operations.completeLegacy(copy);
|
||||
BBC.COMMAND_COPY.send(actor, region.getArea());
|
||||
if (!actor.hasPermission("fawe.tips")) {
|
||||
BBC.TIP_PASTE.or(BBC.TIP_DOWNLOAD, BBC.TIP_ROTATE, BBC.TIP_COPYPASTE, BBC.TIP_REPLACE_MARKER, BBC.TIP_COPY_PATTERN).send(actor);
|
||||
}
|
||||
copy.getStatusMessages().forEach(actor::print);
|
||||
}
|
||||
|
||||
@Command(
|
||||
@ -269,10 +272,10 @@ public class ClipboardCommands {
|
||||
Operations.completeLegacy(copy);
|
||||
session.setClipboard(new ClipboardHolder(clipboard));
|
||||
|
||||
BBC.COMMAND_CUT_SLOW.send(actor, region.getArea());
|
||||
if (!actor.hasPermission("fawe.tips")) {
|
||||
BBC.TIP_LAZYCUT.send(actor);
|
||||
}
|
||||
copy.getStatusMessages().forEach(actor::print);
|
||||
}
|
||||
|
||||
@Command(
|
||||
@ -443,7 +446,7 @@ public class ClipboardCommands {
|
||||
}
|
||||
Clipboard clipboard = holder.getClipboard();
|
||||
Region region = clipboard.getRegion();
|
||||
List<String> messages = Lists.newArrayList();
|
||||
List<Component> messages = Lists.newArrayList();
|
||||
|
||||
BlockVector3 to = atOrigin ? clipboard.getOrigin() : session.getPlacementPosition(actor);
|
||||
checkPaste(actor, editSession, to, holder, clipboard);
|
||||
@ -458,6 +461,7 @@ public class ClipboardCommands {
|
||||
.maskSource(sourceMask)
|
||||
.build();
|
||||
Operations.completeLegacy(operation);
|
||||
messages.addAll(Lists.newArrayList(operation.getStatusMessages()));
|
||||
}
|
||||
|
||||
if (selectPasted || onlySelect) {
|
||||
@ -469,9 +473,13 @@ public class ClipboardCommands {
|
||||
selector.learnChanges();
|
||||
selector.explainRegionAdjust(actor, session);
|
||||
}
|
||||
BBC.COMMAND_PASTE.send(actor, to);
|
||||
if (!actor.hasPermission("fawe.tips")) {
|
||||
BBC.TIP_COPYPASTE.or(BBC.TIP_SOURCE_MASK, BBC.TIP_REPLACE_MARKER).send(actor, to);
|
||||
}
|
||||
if (onlySelect) {
|
||||
actor.printInfo(TranslatableComponent.of("worldedit.paste.selected"));
|
||||
} else {
|
||||
actor.printInfo(TranslatableComponent.of("worldedit.paste.pasted", TextComponent.of(to.toString())));
|
||||
}
|
||||
}
|
||||
|
||||
@ -548,7 +556,7 @@ public class ClipboardCommands {
|
||||
transform = transform.rotateX(-xRotate);
|
||||
transform = transform.rotateZ(-zRotate);
|
||||
holder.setTransform(holder.getTransform().combine(transform));
|
||||
actor.print(BBC.COMMAND_ROTATE.s());
|
||||
actor.printInfo(TranslatableComponent.of("worldedit.rotate.rotated"));
|
||||
if (!actor.hasPermission("fawe.tips")) {
|
||||
BBC.TIP_FLIP.or(BBC.TIP_DEFORM, BBC.TIP_TRANSFORM).send(actor);
|
||||
}
|
||||
@ -567,7 +575,7 @@ public class ClipboardCommands {
|
||||
AffineTransform transform = new AffineTransform();
|
||||
transform = transform.scale(direction.abs().multiply(-2).add(1, 1, 1).toVector3());
|
||||
holder.setTransform(holder.getTransform().combine(transform));
|
||||
actor.print("The clipboard copy has been flipped.");
|
||||
actor.printInfo(TranslatableComponent.of("worldedit.flip.flipped"));
|
||||
}
|
||||
|
||||
@Command(
|
||||
@ -577,6 +585,6 @@ public class ClipboardCommands {
|
||||
@CommandPermissions("worldedit.clipboard.clear")
|
||||
public void clearClipboard(Actor actor, LocalSession session) throws WorldEditException {
|
||||
session.setClipboard(null);
|
||||
actor.print("Clipboard cleared.");
|
||||
actor.printInfo(TranslatableComponent.of("worldedit.clearclipboard.cleared"));
|
||||
}
|
||||
}
|
||||
|
@ -89,7 +89,7 @@ public class ExpandCommands {
|
||||
|
||||
private static Command createVertCommand(CommandManager commandManager) {
|
||||
return commandManager.newCommand("vert")
|
||||
.description(TextComponent.of("Vertically expand the selection to world limits."))
|
||||
.description(TranslatableComponent.of("worldedit.expand.description.vert"))
|
||||
.action(parameters -> {
|
||||
expandVert(
|
||||
requireIV(Key.of(LocalSession.class), "localSession", parameters),
|
||||
@ -110,10 +110,12 @@ public class ExpandCommands {
|
||||
session.getRegionSelector(player.getWorld()).learnChanges();
|
||||
int newSize = region.getArea();
|
||||
session.getRegionSelector(player.getWorld()).explainRegionAdjust(player, session);
|
||||
player.print("Region expanded " + (newSize - oldSize)
|
||||
+ " blocks [top-to-bottom].");
|
||||
int changeSize = newSize - oldSize;
|
||||
player.printInfo(
|
||||
TranslatableComponent.of("worldedit.expand.expanded.vert", TextComponent.of(changeSize))
|
||||
);
|
||||
} catch (RegionOperationException e) {
|
||||
player.printError(e.getMessage());
|
||||
player.printError(TextComponent.of(e.getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
@ -148,7 +150,8 @@ public class ExpandCommands {
|
||||
|
||||
session.getRegionSelector(world).explainRegionAdjust(actor, session);
|
||||
|
||||
actor.print("Region expanded " + (newSize - oldSize) + " block(s).");
|
||||
int changeSize = newSize - oldSize;
|
||||
actor.printInfo(TranslatableComponent.of("worldedit.expand.expanded", TextComponent.of(changeSize)));
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -19,6 +19,8 @@
|
||||
|
||||
package com.sk89q.worldedit.command;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import com.boydti.fawe.Fawe;
|
||||
import com.boydti.fawe.config.BBC;
|
||||
import com.boydti.fawe.object.extent.ResettableExtent;
|
||||
@ -48,6 +50,9 @@ import com.sk89q.worldedit.extent.clipboard.Clipboard;
|
||||
import com.sk89q.worldedit.extension.platform.Capability;
|
||||
import com.sk89q.worldedit.function.mask.Mask;
|
||||
import com.sk89q.worldedit.util.formatting.component.PaginationBox;
|
||||
import com.sk89q.worldedit.util.formatting.text.TextComponent;
|
||||
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
|
||||
import com.sk89q.worldedit.util.formatting.text.format.TextColor;
|
||||
import com.sk89q.worldedit.util.formatting.text.Component;
|
||||
import com.sk89q.worldedit.world.World;
|
||||
import com.sk89q.worldedit.world.item.ItemType;
|
||||
@ -63,8 +68,6 @@ import org.enginehub.piston.annotation.param.Arg;
|
||||
import org.enginehub.piston.annotation.param.ArgFlag;
|
||||
import org.enginehub.piston.annotation.param.Switch;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
/**
|
||||
* General WorldEdit commands.
|
||||
*/
|
||||
@ -98,14 +101,17 @@ public class GeneralCommands {
|
||||
limit = limit == null ? config.defaultChangeLimit : Math.max(-1, limit);
|
||||
if (!mayDisable && config.maxChangeLimit > -1) {
|
||||
if (limit > config.maxChangeLimit) {
|
||||
actor.printError("Your maximum allowable limit is " + config.maxChangeLimit + ".");
|
||||
actor.printError(TranslatableComponent.of("worldedit.limit.too-high", TextComponent.of(config.maxChangeLimit)));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
session.setBlockChangeLimit(limit);
|
||||
actor.print("Block change limit set to " + limit + "."
|
||||
+ (limit == config.defaultChangeLimit ? "" : " (Use //limit to go back to the default.)"));
|
||||
Component component = TextComponent.empty().append(TranslatableComponent.of("worldedit.limit.set", TextComponent.of(limit)));
|
||||
if (limit != config.defaultChangeLimit) {
|
||||
component.append(TextComponent.space()).append(TranslatableComponent.of("worldedit.limit.return-to-default", TextColor.GRAY));
|
||||
}
|
||||
actor.printInfo(component);
|
||||
}
|
||||
|
||||
@Command(
|
||||
@ -122,14 +128,17 @@ public class GeneralCommands {
|
||||
limit = limit == null ? config.calculationTimeout : Math.max(-1, limit);
|
||||
if (!mayDisable && config.maxCalculationTimeout > -1) {
|
||||
if (limit > config.maxCalculationTimeout) {
|
||||
actor.printError("Your maximum allowable timeout is " + config.maxCalculationTimeout + " ms.");
|
||||
actor.printError(TranslatableComponent.of("worldedit.timeout.too-high", TextComponent.of(config.maxCalculationTimeout)));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
session.setTimeout(limit);
|
||||
actor.print("Timeout time set to " + limit + " ms."
|
||||
+ (limit == config.calculationTimeout ? "" : " (Use //timeout to go back to the default.)"));
|
||||
Component component = TextComponent.empty().append(TranslatableComponent.of("worldedit.timeout.set", TextComponent.of(limit)));
|
||||
if (limit != config.calculationTimeout) {
|
||||
component.append(TranslatableComponent.of("worldedit.timeout.return-to-default", TextColor.GRAY));
|
||||
}
|
||||
actor.printInfo(component);
|
||||
}
|
||||
|
||||
@Command(
|
||||
@ -142,16 +151,16 @@ public class GeneralCommands {
|
||||
Boolean fastMode) {
|
||||
boolean hasFastMode = session.hasFastMode();
|
||||
if (fastMode != null && fastMode == hasFastMode) {
|
||||
actor.printError("Fast mode already " + (fastMode ? "enabled" : "disabled") + ".");
|
||||
actor.printError(TranslatableComponent.of(fastMode ? "worldedit.fast.enabled.already" : "worldedit.fast.disabled.already"));
|
||||
return;
|
||||
}
|
||||
|
||||
if (hasFastMode) {
|
||||
session.setFastMode(false);
|
||||
actor.print("Fast mode disabled.");
|
||||
actor.printInfo(TranslatableComponent.of("worldedit.fast.disabled"));
|
||||
} else {
|
||||
session.setFastMode(true);
|
||||
actor.print("Fast mode enabled. Lighting in the affected chunks may be wrong and/or you may need to rejoin to see changes.");
|
||||
actor.printInfo(TranslatableComponent.of("worldedit.fast.enabled"));
|
||||
}
|
||||
}
|
||||
|
||||
@ -164,10 +173,10 @@ public class GeneralCommands {
|
||||
@Arg(desc = "The reorder mode", def = "")
|
||||
EditSession.ReorderMode reorderMode) {
|
||||
if (reorderMode == null) {
|
||||
actor.print("The reorder mode is " + session.getReorderMode().getDisplayName());
|
||||
actor.printInfo(TranslatableComponent.of("worldedit.reorder.current", TextComponent.of(session.getReorderMode().getDisplayName())));
|
||||
} else {
|
||||
session.setReorderMode(reorderMode);
|
||||
actor.print("The reorder mode is now " + session.getReorderMode().getDisplayName());
|
||||
actor.printInfo(TranslatableComponent.of("worldedit.reorder.set", TextComponent.of(session.getReorderMode().getDisplayName())));
|
||||
}
|
||||
}
|
||||
|
||||
@ -184,17 +193,18 @@ public class GeneralCommands {
|
||||
}
|
||||
boolean useServerCui = session.shouldUseServerCUI();
|
||||
if (drawSelection != null && drawSelection == useServerCui) {
|
||||
player.printError("Server CUI already " + (useServerCui ? "enabled" : "disabled") + ".");
|
||||
player.printError(TranslatableComponent.of("worldedit.drawsel." + (useServerCui ? "enabled" : "disabled") + ".already"));
|
||||
|
||||
return;
|
||||
}
|
||||
if (useServerCui) {
|
||||
session.setUseServerCUI(false);
|
||||
session.updateServerCUI(player);
|
||||
player.print("Server CUI disabled.");
|
||||
player.printInfo(TranslatableComponent.of("worldedit.drawsel.disabled"));
|
||||
} else {
|
||||
session.setUseServerCUI(true);
|
||||
session.updateServerCUI(player);
|
||||
player.print("Server CUI enabled. This only supports cuboid regions, with a maximum size of 32x32x32.");
|
||||
player.printInfo(TranslatableComponent.of("worldedit.drawsel.enabled"));
|
||||
}
|
||||
}
|
||||
|
||||
@ -207,9 +217,9 @@ public class GeneralCommands {
|
||||
@Arg(desc = "The world override", def = "") World world) {
|
||||
session.setWorldOverride(world);
|
||||
if (world == null) {
|
||||
actor.print("Removed world override.");
|
||||
actor.printInfo(TranslatableComponent.of("worldedit.world.remove"));
|
||||
} else {
|
||||
actor.print("Set the world override to " + world.getId() + ". (Use //world to go back to default)");
|
||||
actor.printInfo(TranslatableComponent.of("worldedit.world.set", TextComponent.of(world.getId())));
|
||||
}
|
||||
}
|
||||
|
||||
@ -224,16 +234,16 @@ public class GeneralCommands {
|
||||
@Arg(desc = "The mode to set the watchdog hook to", def = "")
|
||||
HookMode hookMode) {
|
||||
if (WorldEdit.getInstance().getPlatformManager().queryCapability(Capability.GAME_HOOKS).getWatchdog() == null) {
|
||||
actor.printError("This platform has no watchdog hook.");
|
||||
actor.printError(TranslatableComponent.of("worldedit.watchdog.no-hook"));
|
||||
return;
|
||||
}
|
||||
boolean previousMode = session.isTickingWatchdog();
|
||||
if (hookMode != null && (hookMode == HookMode.ACTIVE) == previousMode) {
|
||||
actor.printError("Watchdog hook already " + (previousMode ? "active" : "inactive") + ".");
|
||||
actor.printError(TranslatableComponent.of(previousMode ? "worldedit.watchdog.active.already" : "worldedit.watchdog.inactive.already"));
|
||||
return;
|
||||
}
|
||||
session.setTickingWatchdog(!previousMode);
|
||||
actor.print("Watchdog hook now " + (previousMode ? "inactive" : "active") + ".");
|
||||
actor.printInfo(TranslatableComponent.of(previousMode ? "worldedit.watchdog.inactive" : "worldedit.watchdog.active"));
|
||||
}
|
||||
|
||||
@Command(
|
||||
@ -247,10 +257,10 @@ public class GeneralCommands {
|
||||
Mask mask) {
|
||||
if (mask == null) {
|
||||
session.setMask(null);
|
||||
actor.print("Global mask disabled.");
|
||||
actor.printInfo(TranslatableComponent.of("worldedit.gmask.disabled"));
|
||||
} else {
|
||||
session.setMask(mask);
|
||||
actor.print("Global mask set.");
|
||||
actor.printInfo(TranslatableComponent.of("worldedit.gmask.set"));
|
||||
}
|
||||
}
|
||||
|
||||
@ -261,9 +271,9 @@ public class GeneralCommands {
|
||||
)
|
||||
public void togglePlace(Player player, LocalSession session) {
|
||||
if (session.togglePlacementPosition()) {
|
||||
player.print(BBC.PLACE_ENABLED.s());
|
||||
player.printInfo(TranslatableComponent.of("worldedit.toggleplace.pos1"));
|
||||
} else {
|
||||
player.print(BBC.PLACE_DISABLED.s());
|
||||
player.printInfo(TranslatableComponent.of("worldedit.toggleplace.player"));
|
||||
}
|
||||
}
|
||||
|
||||
@ -284,11 +294,11 @@ public class GeneralCommands {
|
||||
List<String> query) throws Exception {
|
||||
String search = String.join(" ", query);
|
||||
if (search.length() <= 2) {
|
||||
actor.printError("Enter a longer search string (len > 2).");
|
||||
actor.printError(TranslatableComponent.of("worldedit.searchitem.too-short"));
|
||||
return;
|
||||
}
|
||||
if (blocksOnly && itemsOnly) {
|
||||
actor.printError("You cannot use both the 'b' and 'i' flags simultaneously.");
|
||||
actor.printError(TranslatableComponent.of("worldedit.searchitem.either-b-or-i"));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -53,10 +53,12 @@ import com.sk89q.worldedit.math.BlockVector2;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.math.Vector3;
|
||||
import com.sk89q.worldedit.regions.CuboidRegion;
|
||||
import com.sk89q.worldedit.util.formatting.text.TextComponent;
|
||||
import com.sk89q.worldedit.regions.Region;
|
||||
import com.sk89q.worldedit.util.TreeGenerator.TreeType;
|
||||
import com.sk89q.worldedit.world.biome.BiomeType;
|
||||
import com.sk89q.worldedit.world.block.BlockType;
|
||||
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
|
||||
import java.awt.RenderingHints;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.io.IOException;
|
||||
@ -211,7 +213,7 @@ public class GenerationCommands {
|
||||
worldEdit.checkMaxRadius(max);
|
||||
BlockVector3 pos = session.getPlacementPosition(actor);
|
||||
int affected = editSession.makeCylinder(pos, pattern, radius.getX(), radius.getZ(), Math.min(256, height), !hollow);
|
||||
BBC.VISITOR_BLOCK.send(actor, affected);
|
||||
actor.printInfo(TranslatableComponent.of("worldedit.cyl.created", TextComponent.of(affected)));
|
||||
}
|
||||
|
||||
@Command(
|
||||
@ -252,7 +254,7 @@ public class GenerationCommands {
|
||||
if (actor instanceof Player) {
|
||||
((Player) actor).findFreePosition();
|
||||
}
|
||||
BBC.VISITOR_BLOCK.send(actor, affected);
|
||||
actor.printInfo(TranslatableComponent.of("worldedit.sphere.created", TextComponent.of(affected)));
|
||||
}
|
||||
|
||||
@Command(
|
||||
@ -272,7 +274,7 @@ public class GenerationCommands {
|
||||
worldEdit.checkMaxRadius(size);
|
||||
density /= 100;
|
||||
int affected = editSession.makeForest(session.getPlacementPosition(actor), size, density, type);
|
||||
actor.print(affected + " trees created.");
|
||||
actor.printInfo(TranslatableComponent.of("worldedit.forestgen.created", TextComponent.of(affected)));
|
||||
return affected;
|
||||
}
|
||||
|
||||
@ -290,7 +292,7 @@ public class GenerationCommands {
|
||||
checkCommandArgument(0 <= density && density <= 100, "Density must be between 0 and 100");
|
||||
worldEdit.checkMaxRadius(size);
|
||||
int affected = editSession.makePumpkinPatches(session.getPlacementPosition(actor), size, density);
|
||||
actor.print(affected + " pumpkin patches created.");
|
||||
actor.printInfo(TranslatableComponent.of("worldedit.pumpkins.created", TextComponent.of(affected)));
|
||||
return affected;
|
||||
}
|
||||
|
||||
@ -327,7 +329,7 @@ public class GenerationCommands {
|
||||
if (actor instanceof Player) {
|
||||
((Player) actor).findFreePosition();
|
||||
}
|
||||
BBC.VISITOR_BLOCK.send(actor, affected);
|
||||
actor.printInfo(TranslatableComponent.of("worldedit.pyramid.created", TextComponent.of(affected)));
|
||||
}
|
||||
|
||||
@Command(
|
||||
@ -388,9 +390,9 @@ public class GenerationCommands {
|
||||
if (actor instanceof Player) {
|
||||
((Player) actor).findFreePosition();
|
||||
}
|
||||
BBC.VISITOR_BLOCK.send(actor, affected);
|
||||
actor.printInfo(TranslatableComponent.of("worldedit.generate.created", TextComponent.of(affected)));
|
||||
} catch (ExpressionException e) {
|
||||
actor.printError(e.getMessage());
|
||||
actor.printError(TextComponent.of(e.getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
@ -449,9 +451,9 @@ public class GenerationCommands {
|
||||
final Vector3 unit1 = unit;
|
||||
try {
|
||||
final int affected = editSession.makeBiomeShape(region, zero, unit1, target, String.join(" ", expression), hollow, session.getTimeout());
|
||||
BBC.VISITOR_FLAT.send(actor, affected);
|
||||
actor.printInfo(TranslatableComponent.of("worldedit.generatebiome.changed", TextComponent.of(affected)));
|
||||
} catch (ExpressionException e) {
|
||||
actor.printError(e.getMessage());
|
||||
actor.printError(TextComponent.of(e.getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -41,6 +41,7 @@ import com.sk89q.worldedit.command.util.CommandPermissionsConditionGenerator;
|
||||
import com.sk89q.worldedit.command.util.annotation.Confirm;
|
||||
import com.sk89q.worldedit.entity.Player;
|
||||
import com.sk89q.worldedit.extension.platform.Actor;
|
||||
import com.sk89q.worldedit.util.formatting.text.TextComponent;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.regions.Region;
|
||||
import com.sk89q.worldedit.util.Location;
|
||||
@ -49,6 +50,7 @@ import java.io.File;
|
||||
import java.util.Objects;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
|
||||
import org.enginehub.piston.annotation.Command;
|
||||
import org.enginehub.piston.annotation.CommandContainer;
|
||||
import org.enginehub.piston.annotation.param.Arg;
|
||||
@ -240,7 +242,7 @@ public class HistoryCommands {
|
||||
player.checkPermission("worldedit.history.undo.other");
|
||||
undoSession = worldEdit.getSessionManager().findByName(playerName);
|
||||
if (undoSession == null) {
|
||||
player.printError("Unable to find session for " + playerName);
|
||||
player.printError(TranslatableComponent.of("worldedit.session.cant-find-session", TextComponent.of(playerName)));
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -255,9 +257,9 @@ public class HistoryCommands {
|
||||
}
|
||||
}
|
||||
if (timesUndone > 0) {
|
||||
player.print("Undid " + timesUndone + " available edits.");
|
||||
player.printInfo(TranslatableComponent.of("worldedit.undo.undone", TextComponent.of(timesUndone)));
|
||||
} else {
|
||||
player.printError("Nothing left to undo.");
|
||||
player.printError(TranslatableComponent.of("worldedit.undo.none"));
|
||||
}
|
||||
}
|
||||
|
||||
@ -278,7 +280,7 @@ public class HistoryCommands {
|
||||
player.checkPermission("worldedit.history.redo.other");
|
||||
redoSession = worldEdit.getSessionManager().findByName(playerName);
|
||||
if (redoSession == null) {
|
||||
BBC.COMMAND_HISTORY_OTHER_ERROR.send(player, playerName);
|
||||
player.printError(TranslatableComponent.of("worldedit.session.cant-find-session", TextComponent.of(playerName)));
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -293,9 +295,9 @@ public class HistoryCommands {
|
||||
}
|
||||
}
|
||||
if (timesRedone > 0) {
|
||||
BBC.COMMAND_REDO_SUCCESS.send(player, timesRedone == 1 ? "" : " x" + timesRedone);
|
||||
player.printInfo(TranslatableComponent.of("worldedit.redo.redid", TextComponent.of(timesRedone)));
|
||||
} else {
|
||||
player.printError(BBC.COMMAND_REDO_ERROR.s());
|
||||
player.printError(TranslatableComponent.of("worldedit.redo.none"));
|
||||
}
|
||||
}
|
||||
|
||||
@ -307,7 +309,7 @@ public class HistoryCommands {
|
||||
@CommandPermissions("worldedit.history.clear")
|
||||
public void clearHistory(Actor actor, LocalSession session) {
|
||||
session.clearHistory();
|
||||
actor.print("History cleared.");
|
||||
actor.printInfo(TranslatableComponent.of("worldedit.clearhistory.cleared"));
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -29,6 +29,8 @@ import com.sk89q.worldedit.command.util.CommandPermissionsConditionGenerator;
|
||||
import com.sk89q.worldedit.command.util.Logging;
|
||||
import com.sk89q.worldedit.entity.Player;
|
||||
import com.sk89q.worldedit.util.Location;
|
||||
import com.sk89q.worldedit.util.formatting.text.TextComponent;
|
||||
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
|
||||
import org.enginehub.piston.annotation.Command;
|
||||
import org.enginehub.piston.annotation.CommandContainer;
|
||||
import org.enginehub.piston.annotation.param.Arg;
|
||||
@ -62,7 +64,7 @@ public class NavigationCommands {
|
||||
@CommandPermissions("worldedit.navigation.unstuck")
|
||||
public void unstuck(Player player) throws WorldEditException {
|
||||
player.findFreePosition();
|
||||
player.print("There you go!");
|
||||
player.printInfo(TranslatableComponent.of("worldedit.unstuck.moved"));
|
||||
}
|
||||
|
||||
@Command(
|
||||
@ -82,9 +84,9 @@ public class NavigationCommands {
|
||||
}
|
||||
}
|
||||
if (ascentLevels == 0) {
|
||||
player.printError(BBC.ASCEND_FAIL.s());
|
||||
player.printError(TranslatableComponent.of("worldedit.ascend.obstructed"));
|
||||
} else {
|
||||
player.print((ascentLevels != 1) ? "Ascended " + ascentLevels + " levels." : "Ascended a level.");
|
||||
player.printInfo(TranslatableComponent.of("worldedit.ascend.moved", TextComponent.of(ascentLevels)));
|
||||
}
|
||||
}
|
||||
|
||||
@ -105,11 +107,9 @@ public class NavigationCommands {
|
||||
}
|
||||
}
|
||||
if (descentLevels == 0) {
|
||||
player.printError(BBC.DESCEND_FAIL.s());
|
||||
} else if (descentLevels == 1) {
|
||||
player.print(BBC.DESCEND_SINGULAR.s());
|
||||
player.printError(TranslatableComponent.of("worldedit.descend.obstructed"));
|
||||
} else {
|
||||
player.print((descentLevels != 1) ? "Descended " + descentLevels + " levels." : "Descended a level.");
|
||||
player.printInfo(TranslatableComponent.of("worldedit.descend.moved", TextComponent.of(descentLevels)));
|
||||
}
|
||||
}
|
||||
|
||||
@ -130,9 +130,9 @@ public class NavigationCommands {
|
||||
|
||||
boolean alwaysGlass = getAlwaysGlass(forceFlight, forceGlass);
|
||||
if (player.ascendToCeiling(clearance, alwaysGlass)) {
|
||||
player.print(BBC.WHOOSH.s());
|
||||
player.printInfo(TranslatableComponent.of("worldedit.ceil.moved"));
|
||||
} else {
|
||||
player.printError(BBC.ASCEND_FAIL.s());
|
||||
player.printError(TranslatableComponent.of("worldedit.ceil.obstructed"));
|
||||
}
|
||||
}
|
||||
|
||||
@ -143,9 +143,9 @@ public class NavigationCommands {
|
||||
@CommandPermissions("worldedit.navigation.thru.command")
|
||||
public void thru(Player player) throws WorldEditException {
|
||||
if (player.passThroughForwardWall(6)) {
|
||||
player.print(BBC.WHOOSH.s());
|
||||
player.printInfo(TranslatableComponent.of("worldedit.thru.moved"));
|
||||
} else {
|
||||
player.printError(BBC.THRU_FAIL.s());
|
||||
player.printError(TranslatableComponent.of("worldedit.thru.obstructed"));
|
||||
}
|
||||
}
|
||||
|
||||
@ -165,14 +165,10 @@ public class NavigationCommands {
|
||||
pos = player.getSolidBlockTrace(300);
|
||||
}
|
||||
if (pos != null) {
|
||||
if (force) {
|
||||
player.setPosition(pos);
|
||||
} else {
|
||||
player.findFreePosition(pos);
|
||||
}
|
||||
player.print(BBC.POOF.s());
|
||||
player.findFreePosition(pos);
|
||||
player.printInfo(TranslatableComponent.of("worldedit.jumpto.moved"));
|
||||
} else {
|
||||
player.printError(BBC.NO_BLOCK.s());
|
||||
player.printError(TranslatableComponent.of("worldedit.jumpto.none"));
|
||||
}
|
||||
}
|
||||
|
||||
@ -191,9 +187,9 @@ public class NavigationCommands {
|
||||
boolean forceGlass) throws WorldEditException {
|
||||
boolean alwaysGlass = getAlwaysGlass(forceFlight, forceGlass);
|
||||
if (player.ascendUpwards(distance, alwaysGlass)) {
|
||||
player.print(BBC.WHOOSH.s());
|
||||
player.printInfo(TranslatableComponent.of("worldedit.up.moved"));
|
||||
} else {
|
||||
player.printError(BBC.UP_FAIL.s());
|
||||
player.printError(TranslatableComponent.of("worldedit.up.obstructed"));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -62,24 +62,24 @@ import static org.enginehub.piston.part.CommandParts.arg;
|
||||
@CommandContainer(superTypes = CommandPermissionsConditionGenerator.Registration.class)
|
||||
public class PaintBrushCommands {
|
||||
|
||||
private static final CommandArgument REGION_FACTORY = arg(TranslatableComponent.of("shape"), TextComponent.of("The shape of the region"))
|
||||
private static final CommandArgument REGION_FACTORY = arg(TranslatableComponent.of("shape"), TranslatableComponent.of("worldedit.brush.paint.shape"))
|
||||
.defaultsTo(ImmutableList.of())
|
||||
.ofTypes(ImmutableList.of(Key.of(RegionFactory.class)))
|
||||
.build();
|
||||
|
||||
private static final CommandArgument RADIUS = arg(TranslatableComponent.of("radius"), TextComponent.of("The size of the brush"))
|
||||
private static final CommandArgument RADIUS = arg(TranslatableComponent.of("radius"), TranslatableComponent.of("worldedit.brush.paint.size"))
|
||||
.defaultsTo(ImmutableList.of("5"))
|
||||
.ofTypes(ImmutableList.of(Key.of(double.class)))
|
||||
.build();
|
||||
|
||||
private static final CommandArgument DENSITY = arg(TranslatableComponent.of("density"), TextComponent.of("The density of the brush"))
|
||||
private static final CommandArgument DENSITY = arg(TranslatableComponent.of("density"), TranslatableComponent.of("worldedit.brush.paint.density"))
|
||||
.defaultsTo(ImmutableList.of("20"))
|
||||
.ofTypes(ImmutableList.of(Key.of(double.class)))
|
||||
.build();
|
||||
|
||||
public static void register(CommandManagerService service, CommandManager commandManager, CommandRegistrationHandler registration) {
|
||||
commandManager.register("paint", builder -> {
|
||||
builder.description(TextComponent.of("Paint brush, apply a function to a surface"));
|
||||
builder.description(TranslatableComponent.of("worldedit.brush.paint.description"));
|
||||
builder.action(org.enginehub.piston.Command.Action.NULL_ACTION);
|
||||
|
||||
CommandManager manager = service.newCommandManager();
|
||||
@ -92,7 +92,7 @@ public class PaintBrushCommands {
|
||||
builder.condition(new PermissionCondition(ImmutableSet.of("worldedit.brush.paint")));
|
||||
|
||||
builder.addParts(REGION_FACTORY, RADIUS, DENSITY);
|
||||
builder.addPart(SubCommandPart.builder(TranslatableComponent.of("type"), TextComponent.of("Type of brush to use"))
|
||||
builder.addPart(SubCommandPart.builder(TranslatableComponent.of("type"), TranslatableComponent.of("worldedit.brush.paint.type"))
|
||||
.withCommands(manager.getAllCommands().collect(Collectors.toList()))
|
||||
.required()
|
||||
.build());
|
||||
@ -125,15 +125,14 @@ public class PaintBrushCommands {
|
||||
)
|
||||
@CommandPermissions("worldedit.brush.item")
|
||||
public void item(CommandParameters parameters,
|
||||
Player player, LocalSession localSession,
|
||||
@Arg(desc = "The type of item to use")
|
||||
BaseItem item,
|
||||
@Arg(desc = "The direction in which the item will be applied", def = "up")
|
||||
@Direction(includeDiagonals = true)
|
||||
com.sk89q.worldedit.util.Direction direction) throws WorldEditException {
|
||||
Player player, LocalSession localSession,
|
||||
@Arg(desc = "The type of item to use")
|
||||
BaseItem item,
|
||||
@Arg(desc = "The direction in which the item will be applied", def = "up")
|
||||
@Direction(includeDiagonals = true)
|
||||
com.sk89q.worldedit.util.Direction direction) throws WorldEditException {
|
||||
player.print(TextComponent.builder().append("WARNING: ", TextColor.RED, TextDecoration.BOLD)
|
||||
.append("This brush simulates item usages. Its effects may not work on all platforms, may not be undo-able," +
|
||||
" and may cause strange interactions with other mods/plugins. Use at your own risk.").build());
|
||||
.append(TranslatableComponent.of("worldedit.brush.paint.item.warning")).build());
|
||||
setPaintBrush(parameters, player, localSession, new ItemUseFactory(item, direction));
|
||||
}
|
||||
|
||||
|
@ -65,8 +65,12 @@ import com.sk89q.worldedit.util.TreeGenerator.TreeType;
|
||||
import com.sk89q.worldedit.world.World;
|
||||
import com.sk89q.worldedit.world.biome.BiomeType;
|
||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||
import com.sk89q.worldedit.util.formatting.component.TextUtils;
|
||||
import com.sk89q.worldedit.util.formatting.text.Component;
|
||||
import com.sk89q.worldedit.util.formatting.text.TextComponent;
|
||||
import com.sk89q.worldedit.world.block.BlockTypes;
|
||||
import org.enginehub.piston.annotation.Command;
|
||||
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
|
||||
import org.enginehub.piston.annotation.CommandContainer;
|
||||
import org.enginehub.piston.annotation.param.Arg;
|
||||
import org.enginehub.piston.annotation.param.ArgFlag;
|
||||
@ -113,7 +117,7 @@ public class RegionCommands {
|
||||
Pattern pattern) {
|
||||
int affected = editSession.setBlocks(region, pattern);
|
||||
if (affected != 0) {
|
||||
BBC.OPERATION.send(actor, affected);
|
||||
actor.printInfo(TranslatableComponent.of("worldedit.set.done"));
|
||||
if (!actor.hasPermission("fawe.tips"))
|
||||
BBC.TIP_FAST.or(BBC.TIP_CANCEL, BBC.TIP_MASK, BBC.TIP_MASK_ANGLE, BBC.TIP_SET_LINEAR, BBC.TIP_SURFACE_SPREAD, BBC.TIP_SET_HAND).send(actor);
|
||||
}
|
||||
@ -245,7 +249,7 @@ public class RegionCommands {
|
||||
@Switch(name = 'h', desc = "Generate only a shell")
|
||||
boolean shell) throws WorldEditException {
|
||||
if (!(region instanceof CuboidRegion)) {
|
||||
actor.printError("//line only works with cuboid selections");
|
||||
actor.printError(TranslatableComponent.of("worldedit.line.cuboid-only"));
|
||||
return 0;
|
||||
}
|
||||
checkCommandArgument(thickness >= 0, "Thickness must be >= 0");
|
||||
@ -255,7 +259,7 @@ public class RegionCommands {
|
||||
BlockVector3 pos2 = cuboidregion.getPos2();
|
||||
int blocksChanged = editSession.drawLine(pattern, pos1, pos2, thickness, !shell);
|
||||
|
||||
actor.print(blocksChanged + " block(s) have been changed.");
|
||||
actor.printInfo(TranslatableComponent.of("worldedit.line.changed", TextComponent.of(blocksChanged)));
|
||||
return blocksChanged;
|
||||
}
|
||||
|
||||
@ -276,7 +280,7 @@ public class RegionCommands {
|
||||
@Switch(name = 'h', desc = "Generate only a shell")
|
||||
boolean shell) throws WorldEditException {
|
||||
if (!(region instanceof ConvexPolyhedralRegion)) {
|
||||
actor.printError("//curve only works with convex polyhedral selections");
|
||||
actor.printError(TranslatableComponent.of("worldedit.curve.convex-only"));
|
||||
return;
|
||||
}
|
||||
checkCommandArgument(thickness >= 0, "Thickness must be >= 0");
|
||||
@ -286,7 +290,7 @@ public class RegionCommands {
|
||||
|
||||
int blocksChanged = editSession.drawSpline(pattern, vectors, 0, 0, 0, 10, thickness, !shell);
|
||||
|
||||
actor.print(blocksChanged + " block(s) have been changed.");
|
||||
actor.printInfo(TranslatableComponent.of("worldedit.curve.changed", TextComponent.of(blocksChanged)));
|
||||
}
|
||||
|
||||
@Command(
|
||||
@ -305,9 +309,8 @@ public class RegionCommands {
|
||||
if (from == null) {
|
||||
from = new ExistingBlockMask(editSession);
|
||||
}
|
||||
Mask finalFrom = from;
|
||||
int affected = editSession.replaceBlocks(region, finalFrom, to);
|
||||
actor.print(affected + " block(s) have been replaced.");
|
||||
int affected = editSession.replaceBlocks(region, from, to);
|
||||
actor.printInfo(TranslatableComponent.of("worldedit.replace.replaced", TextComponent.of(affected)));
|
||||
}
|
||||
|
||||
@Command(
|
||||
@ -321,7 +324,7 @@ public class RegionCommands {
|
||||
@Arg(desc = "The pattern of blocks to overlay")
|
||||
Pattern pattern) throws WorldEditException {
|
||||
int affected = editSession.overlayCuboidBlocks(region, pattern);
|
||||
actor.print(affected + " block(s) have been overlaid.");
|
||||
actor.printInfo(TranslatableComponent.of("worldedit.overlay.overlaid", TextComponent.of(affected)));
|
||||
}
|
||||
|
||||
@Command(
|
||||
@ -360,7 +363,7 @@ public class RegionCommands {
|
||||
@Arg(desc = "The pattern of blocks to set")
|
||||
Pattern pattern) throws WorldEditException {
|
||||
int affected = editSession.center(region, pattern);
|
||||
actor.print("Center set (" + affected + " block(s) changed)");
|
||||
actor.printInfo(TranslatableComponent.of("worldedit.center.changed", TextComponent.of(affected)));
|
||||
return affected;
|
||||
}
|
||||
|
||||
@ -373,7 +376,7 @@ public class RegionCommands {
|
||||
@Confirm(Confirm.Processor.REGION)
|
||||
public void naturalize(Actor actor, EditSession editSession, @Selection Region region) throws WorldEditException {
|
||||
int affected = editSession.naturalizeCuboidBlocks(region);
|
||||
actor.print(affected + " block(s) have been made to look more natural.");
|
||||
actor.printInfo(TranslatableComponent.of("worldedit.naturalize.naturalized", TextComponent.of(affected)));
|
||||
}
|
||||
|
||||
@Command(
|
||||
@ -387,7 +390,7 @@ public class RegionCommands {
|
||||
@Arg(desc = "The pattern of blocks to set")
|
||||
Pattern pattern) throws WorldEditException {
|
||||
int affected = editSession.makeWalls(region, pattern);
|
||||
actor.print(affected + " block(s) have been changed.");
|
||||
actor.printInfo(TranslatableComponent.of("worldedit.walls.changed", TextComponent.of(affected)));
|
||||
}
|
||||
|
||||
@Command(
|
||||
@ -402,7 +405,7 @@ public class RegionCommands {
|
||||
@Arg(desc = "The pattern of blocks to set")
|
||||
Pattern pattern) throws WorldEditException {
|
||||
int affected = editSession.makeCuboidFaces(region, pattern);
|
||||
actor.print(affected + " block(s) have been changed.");
|
||||
actor.printInfo(TranslatableComponent.of("worldedit.faces.changed", TextComponent.of(affected)));
|
||||
}
|
||||
|
||||
@Command(
|
||||
@ -428,12 +431,12 @@ public class RegionCommands {
|
||||
}
|
||||
try {
|
||||
HeightMap heightMap = new HeightMap(editSession, region, mask, snow);
|
||||
HeightMapFilter filter = new HeightMapFilter(new GaussianKernel(5, 1.0));
|
||||
int affected = heightMap.applyFilter(filter, iterations);
|
||||
actor.print("Terrain's height map smoothed. " + affected + " block(s) changed.");
|
||||
HeightMapFilter filter = new HeightMapFilter(new GaussianKernel(5, 1.0));
|
||||
int affected = heightMap.applyFilter(filter, iterations);
|
||||
actor.printInfo(TranslatableComponent.of("worldedit.smooth.changed", TextComponent.of(affected)));
|
||||
} catch (Throwable e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Command(
|
||||
@ -518,11 +521,12 @@ public class RegionCommands {
|
||||
session.getRegionSelector(world).learnChanges();
|
||||
session.getRegionSelector(world).explainRegionAdjust(actor, session);
|
||||
} catch (RegionOperationException e) {
|
||||
actor.printError(e.getMessage());
|
||||
actor.printError(TextComponent.of(e.getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
BBC.VISITOR_BLOCK.send(actor, affected);
|
||||
actor.printInfo(TranslatableComponent.of("worldedit.move.moved", TextComponent.of(affected)));
|
||||
return affected;
|
||||
}
|
||||
|
||||
@Command(
|
||||
@ -589,11 +593,12 @@ public class RegionCommands {
|
||||
session.getRegionSelector(world).learnChanges();
|
||||
session.getRegionSelector(world).explainRegionAdjust(actor, session);
|
||||
} catch (RegionOperationException e) {
|
||||
actor.printError(e.getMessage());
|
||||
actor.printError(TextComponent.of(e.getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
BBC.VISITOR_BLOCK.send(actor, affected);
|
||||
actor.printInfo(TranslatableComponent.of("worldedit.stack.changed", TextComponent.of(affected)));
|
||||
return affected;
|
||||
}
|
||||
|
||||
@Command(
|
||||
@ -641,9 +646,9 @@ public class RegionCommands {
|
||||
if (actor instanceof Player) {
|
||||
((Player) actor).findFreePosition();
|
||||
}
|
||||
actor.print(affected + " block(s) have been deformed.");
|
||||
actor.printInfo(TranslatableComponent.of("worldedit.deform.deformed", TextComponent.of(affected)));
|
||||
} catch (ExpressionException e) {
|
||||
actor.printError(e.getMessage());
|
||||
actor.printError(TextComponent.of(e.getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
@ -667,17 +672,7 @@ public class RegionCommands {
|
||||
editSession.regenerate(region, biome, seed);
|
||||
session.setMask(mask);
|
||||
session.setSourceMask(mask);
|
||||
if (!player.hasPermission("fawe.tips")) {
|
||||
player.print(BBC.COMMAND_REGEN_2.s());
|
||||
} else if (biome == null) {
|
||||
BBC.COMMAND_REGEN_0.send(player);
|
||||
if (!player.hasPermission("fawe.tips")) player.print(BBC.TIP_REGEN_0.s());
|
||||
} else if (seed == null) {
|
||||
player.print(BBC.COMMAND_REGEN_1.s());
|
||||
if (!player.hasPermission("fawe.tips")) BBC.TIP_REGEN_1.send(player);
|
||||
} else {
|
||||
player.print(BBC.COMMAND_REGEN_2.s());
|
||||
}
|
||||
actor.printInfo(TranslatableComponent.of("worldedit.regen.regenerated"));
|
||||
}
|
||||
|
||||
@Command(
|
||||
@ -701,7 +696,7 @@ public class RegionCommands {
|
||||
checkCommandArgument(thickness >= 0, "Thickness must be >= 0");
|
||||
Mask finalMask = mask == null ? new SolidBlockMask(editSession) : mask;
|
||||
int affected = editSession.hollowOutRegion(region, thickness, pattern, finalMask);
|
||||
actor.print(affected + " block(s) have been changed.");
|
||||
actor.printInfo(TranslatableComponent.of("worldedit.hollow.changed", TextComponent.of(affected)));
|
||||
}
|
||||
|
||||
@Command(
|
||||
@ -718,7 +713,7 @@ public class RegionCommands {
|
||||
double density) throws WorldEditException {
|
||||
checkCommandArgument(0 <= density && density <= 100, "Density must be in [0, 100]");
|
||||
int affected = editSession.makeForest(region, density / 100, type);
|
||||
actor.print(affected + " trees created.");
|
||||
actor.printInfo(TranslatableComponent.of("worldedit.forest.created", TextComponent.of(affected)));
|
||||
return affected;
|
||||
}
|
||||
|
||||
@ -740,7 +735,7 @@ public class RegionCommands {
|
||||
Operations.completeLegacy(visitor);
|
||||
|
||||
int affected = ground.getAffected();
|
||||
actor.print(affected + " flora created.");
|
||||
actor.printInfo(TranslatableComponent.of("worldedit.flora.created", TextComponent.of(affected)));
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -59,6 +59,7 @@ import com.sk89q.worldedit.util.formatting.component.TextComponentProducer;
|
||||
import com.sk89q.worldedit.util.formatting.text.Component;
|
||||
import com.sk89q.worldedit.util.formatting.text.TextComponent;
|
||||
import com.sk89q.worldedit.util.formatting.text.event.ClickEvent;
|
||||
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
|
||||
import com.sk89q.worldedit.util.formatting.text.event.HoverEvent;
|
||||
import com.sk89q.worldedit.util.formatting.component.CodeFormat;
|
||||
import com.sk89q.worldedit.util.formatting.text.format.TextColor;
|
||||
@ -246,7 +247,7 @@ public class SchematicCommands {
|
||||
}
|
||||
file = actor.openFileOpenDialog(extensions);
|
||||
if (file == null || !file.exists()) {
|
||||
actor.printError("Schematic " + filename + " does not exist! (" + file + ")");
|
||||
actor.printError(TranslatableComponent.of("worldedit.schematic.load.does-not-exist", TextComponent.of(filename)));
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
@ -273,7 +274,7 @@ public class SchematicCommands {
|
||||
if (format == null) {
|
||||
format = ClipboardFormats.findByFile(file);
|
||||
if (format == null) {
|
||||
BBC.CLIPBOARD_INVALID_FORMAT.send(actor, file.getName());
|
||||
actor.printError(TranslatableComponent.of("worldedit.schematic.unknown-format", TextComponent.of(formatName)));
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -322,7 +323,7 @@ public class SchematicCommands {
|
||||
|
||||
ClipboardFormat format = ClipboardFormats.findByAlias(formatName);
|
||||
if (format == null) {
|
||||
actor.printError("Unknown schematic format: " + formatName);
|
||||
actor.printError(TranslatableComponent.of("worldedit.schematic.unknown-format", TextComponent.of(formatName)));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -353,7 +354,7 @@ public class SchematicCommands {
|
||||
}
|
||||
}
|
||||
if (!allowOverwrite) {
|
||||
actor.printError("That schematic already exists. Use the -f flag to overwrite it.");
|
||||
actor.printError(TranslatableComponent.of("worldedit.schematic.save.already-exists"));
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -362,8 +363,8 @@ public class SchematicCommands {
|
||||
File parent = f.getParentFile();
|
||||
if (parent != null && !parent.exists()) {
|
||||
if (!parent.mkdirs()) {
|
||||
throw new StopExecutionException(TextComponent.of(
|
||||
"Could not create folder for schematics!"));
|
||||
throw new StopExecutionException(TranslatableComponent.of(
|
||||
"worldedit.schematic.save.failed-directory"));
|
||||
}
|
||||
}
|
||||
|
||||
@ -372,7 +373,7 @@ public class SchematicCommands {
|
||||
SchematicSaveTask task = new SchematicSaveTask(actor, f, format, holder, overwrite);
|
||||
AsyncCommandBuilder.wrap(task, actor)
|
||||
.registerWithSupervisor(worldEdit.getSupervisor(), "Saving schematic " + filename)
|
||||
.sendMessageAfterDelay("(Please wait... saving schematic.)")
|
||||
.sendMessageAfterDelay(TranslatableComponent.of("worldedit.schematic.save.saving"))
|
||||
.onSuccess(filename + " saved" + (overwrite ? " (overwriting previous file)." : "."), null)
|
||||
.onFailure("Failed to load schematic", worldEdit.getPlatformManager().getPlatformCommandManager().getExceptionConverter())
|
||||
.buildAndExec(worldEdit.getExecutorService());
|
||||
@ -449,7 +450,7 @@ public class SchematicCommands {
|
||||
)
|
||||
@CommandPermissions("worldedit.schematic.formats")
|
||||
public void formats(Actor actor) {
|
||||
actor.print("Available clipboard formats (Name: Lookup names)");
|
||||
actor.printInfo(TranslatableComponent.of("worldedit.schematic.formats.title"));
|
||||
StringBuilder builder;
|
||||
boolean first = true;
|
||||
for (ClipboardFormat format : ClipboardFormats.getAll()) {
|
||||
@ -463,7 +464,7 @@ public class SchematicCommands {
|
||||
first = false;
|
||||
}
|
||||
first = true;
|
||||
actor.print(builder.toString());
|
||||
actor.printInfo(TextComponent.of(builder.toString()));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -28,6 +28,7 @@ import com.sk89q.worldedit.command.util.CommandPermissions;
|
||||
import com.sk89q.worldedit.command.util.CommandPermissionsConditionGenerator;
|
||||
import com.sk89q.worldedit.command.util.Logging;
|
||||
import com.sk89q.worldedit.entity.Player;
|
||||
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
|
||||
import com.sk89q.worldedit.extension.platform.PlatformCommandManager;
|
||||
import java.io.File;
|
||||
import java.util.List;
|
||||
@ -70,7 +71,7 @@ public class ScriptingCommands {
|
||||
@Arg(desc = "Arguments to the CraftScript", def = "", variable = true)
|
||||
List<String> args) throws WorldEditException {
|
||||
if (!player.hasPermission("worldedit.scripting.execute." + filename)) {
|
||||
player.printError("You don't have permission to use that script.");
|
||||
player.printError(TranslatableComponent.of("worldedit.execute.script-permissions"));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -96,12 +97,12 @@ public class ScriptingCommands {
|
||||
String lastScript = session.getLastScript();
|
||||
|
||||
if (!player.hasPermission("worldedit.scripting.execute." + lastScript)) {
|
||||
player.printError(BBC.SCRIPTING_NO_PERM.s());
|
||||
player.printError(TranslatableComponent.of("worldedit.execute.script-permissions"));
|
||||
return;
|
||||
}
|
||||
|
||||
if (lastScript == null) {
|
||||
player.printError(BBC.SCRIPTING_CS.s());
|
||||
player.printError(TranslatableComponent.of("worldedit.executelast.no-script"));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -71,6 +71,7 @@ import com.sk89q.worldedit.util.formatting.component.CommandListBox;
|
||||
import com.sk89q.worldedit.util.formatting.component.SubtleFormat;
|
||||
import com.sk89q.worldedit.util.formatting.component.TextComponentProducer;
|
||||
import com.sk89q.worldedit.util.formatting.text.TextComponent;
|
||||
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
|
||||
import com.sk89q.worldedit.util.formatting.text.event.ClickEvent;
|
||||
import com.sk89q.worldedit.util.formatting.text.format.TextColor;
|
||||
import com.sk89q.worldedit.world.World;
|
||||
@ -123,12 +124,12 @@ public class SelectionCommands {
|
||||
} else if (actor instanceof Locatable) {
|
||||
pos = ((Locatable) actor).getBlockLocation();
|
||||
} else {
|
||||
actor.printError("You must provide coordinates as console.");
|
||||
actor.printError(TranslatableComponent.of("worldedit.pos.console-require-coords"));
|
||||
return;
|
||||
}
|
||||
|
||||
if (!session.getRegionSelector(world).selectPrimary(pos.toVector().toBlockPoint(), ActorSelectorLimits.forActor(actor))) {
|
||||
actor.printError("Position already set.");
|
||||
actor.printError(TranslatableComponent.of("worldedit.pos.already-set"));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -152,12 +153,12 @@ public class SelectionCommands {
|
||||
} else if (actor instanceof Locatable) {
|
||||
pos = ((Locatable) actor).getBlockLocation();
|
||||
} else {
|
||||
actor.printError("You must provide coordinates as console.");
|
||||
actor.printError(TranslatableComponent.of("worldedit.pos.console-require-coords"));
|
||||
return;
|
||||
}
|
||||
|
||||
if (!session.getRegionSelector(world).selectSecondary(pos.toVector().toBlockPoint(), ActorSelectorLimits.forActor(actor))) {
|
||||
actor.printError("Position already set.");
|
||||
actor.printError(TranslatableComponent.of("worldedit.pos.already-set"));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -175,15 +176,15 @@ public class SelectionCommands {
|
||||
Location pos = player.getBlockTrace(300);
|
||||
|
||||
if (pos != null) {
|
||||
if (!session.getRegionSelector(player.getWorld()).selectPrimary(pos.toBlockPoint(), ActorSelectorLimits.forActor(player))) {
|
||||
player.printError(BBC.SELECTOR_ALREADY_SET.s());
|
||||
if (!session.getRegionSelector(player.getWorld()).selectPrimary(pos.toVector().toBlockPoint(), ActorSelectorLimits.forActor(player))) {
|
||||
player.printError(TranslatableComponent.of("worldedit.hpos.already-set"));
|
||||
return;
|
||||
}
|
||||
|
||||
session.getRegionSelector(player.getWorld())
|
||||
.explainPrimarySelection(player, session, pos.toBlockPoint());
|
||||
} else {
|
||||
player.printError(BBC.NO_BLOCK.s());
|
||||
player.printError(TranslatableComponent.of("worldedit.hpos.no-block"));
|
||||
}
|
||||
}
|
||||
|
||||
@ -197,15 +198,15 @@ public class SelectionCommands {
|
||||
Location pos = player.getBlockTrace(300);
|
||||
|
||||
if (pos != null) {
|
||||
if (!session.getRegionSelector(player.getWorld()).selectSecondary(pos.toBlockPoint(), ActorSelectorLimits.forActor(player))) {
|
||||
player.printError(BBC.SELECTOR_ALREADY_SET.s());
|
||||
if (!session.getRegionSelector(player.getWorld()).selectSecondary(pos.toVector().toBlockPoint(), ActorSelectorLimits.forActor(player))) {
|
||||
player.printError(TranslatableComponent.of("worldedit.hpos.already-set"));
|
||||
return;
|
||||
}
|
||||
|
||||
session.getRegionSelector(player.getWorld())
|
||||
.explainSecondarySelection(player, session, pos.toBlockPoint());
|
||||
} else {
|
||||
player.printError(BBC.NO_BLOCK.s());
|
||||
player.printError(TranslatableComponent.of("worldedit.hpos.no-block"));
|
||||
}
|
||||
}
|
||||
|
||||
@ -233,9 +234,13 @@ public class SelectionCommands {
|
||||
min = BlockVector3.at(min2D.getBlockX() * 16, 0, min2D.getBlockZ() * 16);
|
||||
max = BlockVector3.at(max2D.getBlockX() * 16 + 15, world.getMaxY(), max2D.getBlockZ() * 16 + 15);
|
||||
|
||||
actor.print("Chunks selected: ("
|
||||
+ min2D.getBlockX() + ", " + min2D.getBlockZ() + ") - ("
|
||||
+ max2D.getBlockX() + ", " + max2D.getBlockZ() + ")");
|
||||
actor.printInfo(TranslatableComponent.of(
|
||||
"worldedit.chunk.selected-multiple",
|
||||
TextComponent.of(min2D.getBlockX()),
|
||||
TextComponent.of(min2D.getBlockZ()),
|
||||
TextComponent.of(max2D.getBlockX()),
|
||||
TextComponent.of(max2D.getBlockZ())
|
||||
));
|
||||
} else {
|
||||
final BlockVector2 min2D;
|
||||
if (coordinates != null) {
|
||||
@ -255,8 +260,8 @@ public class SelectionCommands {
|
||||
min = BlockVector3.at(min2D.getBlockX() * 16, 0, min2D.getBlockZ() * 16);
|
||||
max = min.add(15, world.getMaxY(), 15);
|
||||
|
||||
actor.print("Chunk selected: "
|
||||
+ min2D.getBlockX() + ", " + min2D.getBlockZ());
|
||||
actor.printInfo(TranslatableComponent.of("worldedit.chunk.selected", TextComponent.of(min2D.getBlockX()),
|
||||
TextComponent.of(min2D.getBlockZ())));
|
||||
}
|
||||
|
||||
final CuboidRegionSelector selector;
|
||||
@ -287,16 +292,16 @@ public class SelectionCommands {
|
||||
}
|
||||
ItemType itemType = ItemTypes.parse(wandId);
|
||||
if (itemType == null) {
|
||||
player.printError("Wand item is mis-configured or disabled.");
|
||||
player.printError(TranslatableComponent.of("worldedit.wand.invalid"));
|
||||
return;
|
||||
}
|
||||
player.giveItem(new BaseItemStack(itemType, 1));
|
||||
if (navWand) {
|
||||
session.setTool(itemType, NavigationWand.INSTANCE);
|
||||
player.print("Left click: jump to location; Right click: pass through walls");
|
||||
player.printInfo(TranslatableComponent.of("worldedit.wand.navwand.info"));
|
||||
} else {
|
||||
session.setTool(itemType, SelectionWand.INSTANCE);
|
||||
player.print(BBC.SELECTION_WAND.s());
|
||||
session.setTool(itemType, new SelectionWand());
|
||||
player.printInfo(TranslatableComponent.of("worldedit.wand.selwand.info"));
|
||||
}
|
||||
if (!player.hasPermission("fawe.tips"))
|
||||
BBC.TIP_SEL_LIST.or(BBC.TIP_SELECT_CONNECTED, BBC.TIP_SET_POS1, BBC.TIP_FARWAND, BBC.TIP_DISCORD).send(player);
|
||||
@ -350,9 +355,9 @@ public class SelectionCommands {
|
||||
|
||||
session.getRegionSelector(world).explainRegionAdjust(actor, session);
|
||||
|
||||
actor.print("Region contracted " + (oldSize - newSize) + " blocks.");
|
||||
actor.printInfo(TranslatableComponent.of("worldedit.contract.contracted", TextComponent.of(oldSize - newSize)));
|
||||
} catch (RegionOperationException e) {
|
||||
actor.printError(e.getMessage());
|
||||
actor.printError(TextComponent.of(e.getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
@ -379,9 +384,9 @@ public class SelectionCommands {
|
||||
|
||||
session.getRegionSelector(world).explainRegionAdjust(actor, session);
|
||||
|
||||
actor.print("Region shifted.");
|
||||
actor.print(TranslatableComponent.of("worldedit.shift.shifted"));
|
||||
} catch (RegionOperationException e) {
|
||||
actor.printError(e.getMessage());
|
||||
actor.printError(TextComponent.of(e.getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
@ -402,7 +407,7 @@ public class SelectionCommands {
|
||||
region.expand(getChangesForEachDir(amount, onlyHorizontal, onlyVertical));
|
||||
session.getRegionSelector(world).learnChanges();
|
||||
session.getRegionSelector(world).explainRegionAdjust(actor, session);
|
||||
actor.print("Region outset.");
|
||||
actor.print(TranslatableComponent.of("worldedit.outset.outset"));
|
||||
}
|
||||
|
||||
@Command(
|
||||
@ -422,7 +427,7 @@ public class SelectionCommands {
|
||||
region.contract(getChangesForEachDir(amount, onlyHorizontal, onlyVertical));
|
||||
session.getRegionSelector(world).learnChanges();
|
||||
session.getRegionSelector(world).explainRegionAdjust(actor, session);
|
||||
actor.print("Region inset.");
|
||||
actor.print(TranslatableComponent.of("worldedit.inset.inset"));
|
||||
}
|
||||
|
||||
private BlockVector3[] getChangesForEachDir(int amount, boolean onlyHorizontal, boolean onlyVertical) {
|
||||
@ -480,20 +485,15 @@ public class SelectionCommands {
|
||||
|
||||
long numBlocks = ((long) size.getBlockX() * size.getBlockY() * size.getBlockZ());
|
||||
|
||||
String msg = String.format("%1$s: %2$s @ %3$s (%4$d blocks)", name, sizeStr, originStr, numBlocks);
|
||||
player.print(msg);
|
||||
|
||||
index++;
|
||||
}
|
||||
return;
|
||||
BlockVector3 origin = clipboard.getOrigin();
|
||||
actor.printInfo(TranslatableComponent.of("worldedit.size.offset", TextComponent.of(origin.toString())));
|
||||
} else {
|
||||
region = session.getSelection(world);
|
||||
|
||||
actor.printInfo(TranslatableComponent.of("worldedit.size.type", TextComponent.of(session.getRegionSelector(world).getTypeName())));
|
||||
|
||||
region = session.getSelection(player.getWorld());
|
||||
|
||||
player.print("Type: " + session.getRegionSelector(player.getWorld()).getTypeName());
|
||||
|
||||
for (String line : session.getRegionSelector(player.getWorld()).getInformationLines()) {
|
||||
player.print(line);
|
||||
for (Component line : session.getRegionSelector(world).getSelectionInfoLines()) {
|
||||
actor.print(line);
|
||||
}
|
||||
|
||||
}
|
||||
@ -501,22 +501,22 @@ public class SelectionCommands {
|
||||
.subtract(region.getMinimumPoint())
|
||||
.add(1, 1, 1);
|
||||
|
||||
player.print("Size: " + size);
|
||||
player.print("Cuboid distance: " + region.getMaximumPoint().distance(region.getMinimumPoint()));
|
||||
player.print("# of blocks: " + region.getArea());
|
||||
actor.printInfo(TranslatableComponent.of("worldedit.size.size", TextComponent.of(size.toString())));
|
||||
actor.printInfo(TranslatableComponent.of("worldedit.size.distance", TextComponent.of(region.getMaximumPoint().distance(region.getMinimumPoint()))));
|
||||
actor.printInfo(TranslatableComponent.of("worldedit.size.blocks", TextComponent.of(region.getArea())));
|
||||
}
|
||||
|
||||
|
||||
@Command(
|
||||
name = "/count",
|
||||
desc = "Counts the number of blocks matching a mask"
|
||||
)
|
||||
@CommandPermissions("worldedit.analysis.count")
|
||||
public void count(Actor actor, World world, LocalSession session, EditSession editSession,
|
||||
public int count(Actor actor, World world, LocalSession session, EditSession editSession,
|
||||
@Arg(desc = "The mask of blocks to match")
|
||||
Mask mask) throws WorldEditException {
|
||||
int count = editSession.countBlocks(session.getSelection(world), mask);
|
||||
actor.print("Counted: " + count);
|
||||
actor.printInfo(TranslatableComponent.of("worldedit.count.counted", TextComponent.of(count)));
|
||||
return count;
|
||||
}
|
||||
|
||||
@Command(
|
||||
@ -547,22 +547,13 @@ public class SelectionCommands {
|
||||
|
||||
|
||||
if (distribution.isEmpty()) { // *Should* always be false
|
||||
player.printError("No blocks counted.");
|
||||
actor.printError(TranslatableComponent.of("worldedit.distr.no-blocks"));
|
||||
return;
|
||||
}
|
||||
|
||||
// note: doing things like region.getArea is inaccurate for non-cuboids.
|
||||
int size = session.getSelection(player.getWorld()).getArea();
|
||||
BBC.SELECTION_DISTR.send(player, size);
|
||||
|
||||
for (Countable c : distribution) {
|
||||
String name = c.getID().toString();
|
||||
String str = String.format("%-7s (%.3f%%) %s",
|
||||
String.valueOf(c.getAmount()),
|
||||
c.getAmount() / (double) size * 100,
|
||||
name);
|
||||
player.print(str);
|
||||
}
|
||||
BlockDistributionResult res = new BlockDistributionResult(distribution, separateStates);
|
||||
if (!actor.isPlayer()) res.formatForConsole();
|
||||
return res.create(finalPage);
|
||||
}
|
||||
|
||||
private static class BlockDistributionResult extends PaginationBox {
|
||||
@ -618,7 +609,7 @@ public class SelectionCommands {
|
||||
|
||||
@Override
|
||||
public Component create(int page) throws InvalidComponentException {
|
||||
super.getContents().append(TextComponent.of("Total Block Count: " + totalBlocks, TextColor.GRAY))
|
||||
super.getContents().append(TranslatableComponent.of("worldedit.distr.total", TextColor.GRAY, TextComponent.of(totalBlocks)))
|
||||
.append(TextComponent.newline());
|
||||
return super.create(page);
|
||||
}
|
||||
@ -638,7 +629,7 @@ public class SelectionCommands {
|
||||
if (selector == null) {
|
||||
session.getRegionSelector(world).clear();
|
||||
session.dispatchCUISelection(actor);
|
||||
actor.print(BBC.SELECTION_CLEARED.s());
|
||||
actor.printInfo(TranslatableComponent.of("worldedit.select.cleared"));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -648,38 +639,38 @@ public class SelectionCommands {
|
||||
switch (selector) {
|
||||
case CUBOID:
|
||||
newSelector = new CuboidRegionSelector(oldSelector);
|
||||
actor.print(BBC.SEL_CUBOID.s());
|
||||
actor.printInfo(TranslatableComponent.of("worldedit.select.cuboid.message"));
|
||||
break;
|
||||
case EXTEND:
|
||||
newSelector = new ExtendingCuboidRegionSelector(oldSelector);
|
||||
actor.print(BBC.SEL_CUBOID_EXTEND.s());
|
||||
actor.printInfo(TranslatableComponent.of("worldedit.select.extend.message"));
|
||||
break;
|
||||
case POLY: {
|
||||
newSelector = new Polygonal2DRegionSelector(oldSelector);
|
||||
actor.print(BBC.SEL_2D_POLYGON.s());
|
||||
actor.printInfo(TranslatableComponent.of("worldedit.select.poly.message"));
|
||||
Optional<Integer> limit = ActorSelectorLimits.forActor(actor).getPolygonVertexLimit();
|
||||
limit.ifPresent(integer -> actor.print(BBC.SEL_MAX.format(integer)));
|
||||
limit.ifPresent(integer -> actor.printInfo(TranslatableComponent.of("worldedit.select.poly.limit-message", TextComponent.of(integer))));
|
||||
break;
|
||||
}
|
||||
case ELLIPSOID:
|
||||
newSelector = new EllipsoidRegionSelector(oldSelector);
|
||||
actor.print(BBC.SAL_ELLIPSOID.s());
|
||||
actor.printInfo(TranslatableComponent.of("worldedit.select.ellipsoid.message"));
|
||||
break;
|
||||
case SPHERE:
|
||||
newSelector = new SphereRegionSelector(oldSelector);
|
||||
actor.print(BBC.SEL_SPHERE.s());
|
||||
actor.printInfo(TranslatableComponent.of("worldedit.select.sphere.message"));
|
||||
break;
|
||||
case CYL:
|
||||
newSelector = new CylinderRegionSelector(oldSelector);
|
||||
actor.print(BBC.SEL_CYLINDRICAL.s());
|
||||
actor.printInfo(TranslatableComponent.of("worldedit.select.cyl.message"));
|
||||
break;
|
||||
case CONVEX:
|
||||
case HULL:
|
||||
case POLYHEDRON: {
|
||||
newSelector = new ConvexPolyhedralRegionSelector(oldSelector);
|
||||
actor.print(BBC.SEL_CONVEX_POLYHEDRAL.s());
|
||||
actor.printInfo(TranslatableComponent.of("worldedit.select.convex.message"));
|
||||
Optional<Integer> limit = ActorSelectorLimits.forActor(actor).getPolyhedronVertexLimit();
|
||||
limit.ifPresent(integer -> actor.print(BBC.SEL_MAX.format(integer)));
|
||||
limit.ifPresent(integer -> actor.printInfo(TranslatableComponent.of("worldedit.select.convex.limit-message", TextComponent.of(integer))));
|
||||
break;
|
||||
}
|
||||
case POLYHEDRAL:
|
||||
@ -706,14 +697,14 @@ public class SelectionCommands {
|
||||
TextComponentProducer contents = box.getContents();
|
||||
contents.append(SubtleFormat.wrap("Select one of the modes below:")).newline();
|
||||
|
||||
box.appendCommand("cuboid", "Select two corners of a cuboid", "//sel cuboid");
|
||||
box.appendCommand("extend", "Fast cuboid selection mode", "//sel extend");
|
||||
box.appendCommand("poly", "Select a 2D polygon with height", "//sel poly");
|
||||
box.appendCommand("ellipsoid", "Select an ellipsoid", "//sel ellipsoid");
|
||||
box.appendCommand("sphere", "Select a sphere", "//sel sphere");
|
||||
box.appendCommand("cyl", "Select a cylinder", "//sel cyl");
|
||||
box.appendCommand("convex", "Select a convex polyhedral", "//sel convex");
|
||||
box.appendCommand("polyhedral", "Select a hollow polyhedral", "//sel polyhedral");
|
||||
box.appendCommand("cuboid", TranslatableComponent.of("worldedit.select.cuboid.description"), "//sel cuboid");
|
||||
box.appendCommand("extend", TranslatableComponent.of("worldedit.select.extend.description"), "//sel extend");
|
||||
box.appendCommand("poly", TranslatableComponent.of("worldedit.select.poly.description"), "//sel poly");
|
||||
box.appendCommand("ellipsoid", TranslatableComponent.of("worldedit.select.ellipsoid.description"), "//sel ellipsoid");
|
||||
box.appendCommand("sphere", TranslatableComponent.of("worldedit.select.sphere.description"), "//sel sphere");
|
||||
box.appendCommand("cyl", TranslatableComponent.of("worldedit.select.cyl.description"), "//sel cyl");
|
||||
box.appendCommand("convex", TranslatableComponent.of("worldedit.select.convex.description"), "//sel convex");
|
||||
box.appendCommand("polyhedral", "Select a hollow polyhedral", "//sel polyhedral");
|
||||
box.appendCommand("fuzzy[=<mask>]", "Select all connected blocks (magic wand)", "//sel fuzzy[=<mask>]");
|
||||
|
||||
actor.print(box.create(1));
|
||||
@ -731,7 +722,7 @@ public class SelectionCommands {
|
||||
|
||||
if (found != null) {
|
||||
session.setDefaultRegionSelector(found);
|
||||
BBC.SELECTOR_SET_DEFAULT.send(actor, found.name());
|
||||
actor.printInfo(TranslatableComponent.of("worldedit.select.default-set", TextComponent.of(found.name())));
|
||||
} else {
|
||||
throw new RuntimeException("Something unexpected happened. Please report this.");
|
||||
}
|
||||
|
@ -28,11 +28,11 @@ import com.sk89q.worldedit.WorldEdit;
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
import com.sk89q.worldedit.command.util.CommandPermissions;
|
||||
import com.sk89q.worldedit.command.util.CommandPermissionsConditionGenerator;
|
||||
import com.sk89q.worldedit.entity.Player;
|
||||
import com.sk89q.worldedit.extension.platform.Actor;
|
||||
import com.sk89q.worldedit.util.formatting.component.PaginationBox;
|
||||
import com.sk89q.worldedit.util.formatting.text.Component;
|
||||
import com.sk89q.worldedit.util.formatting.text.TextComponent;
|
||||
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
|
||||
import com.sk89q.worldedit.util.formatting.text.event.ClickEvent;
|
||||
import com.sk89q.worldedit.util.formatting.text.event.HoverEvent;
|
||||
import com.sk89q.worldedit.util.formatting.text.format.TextColor;
|
||||
@ -76,7 +76,7 @@ public class SnapshotCommands {
|
||||
LocalConfiguration config = we.getConfiguration();
|
||||
|
||||
if (config.snapshotRepo == null) {
|
||||
actor.printError("Snapshot/backup restore is not configured.");
|
||||
actor.printError(TranslatableComponent.of("worldedit.restore.not-configured"));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -86,7 +86,7 @@ public class SnapshotCommands {
|
||||
if (!snapshots.isEmpty()) {
|
||||
actor.print(new SnapshotListBox(world.getName(), snapshots).create(page));
|
||||
} else {
|
||||
actor.printError("No snapshots are available. See console for details.");
|
||||
actor.printError(TranslatableComponent.of("worldedit.restore.none-found-console"));
|
||||
|
||||
// Okay, let's toss some debugging information!
|
||||
File dir = config.snapshotRepo.getDirectory();
|
||||
@ -101,7 +101,7 @@ public class SnapshotCommands {
|
||||
}
|
||||
}
|
||||
} catch (MissingWorldException ex) {
|
||||
actor.printError("No snapshots were found for this world.");
|
||||
actor.printError(TranslatableComponent.of("worldedit.restore.none-for-world"));
|
||||
}
|
||||
}
|
||||
|
||||
@ -117,7 +117,7 @@ public class SnapshotCommands {
|
||||
LocalConfiguration config = we.getConfiguration();
|
||||
|
||||
if (config.snapshotRepo == null) {
|
||||
actor.printError("Snapshot/backup restore is not configured.");
|
||||
actor.printError(TranslatableComponent.of("worldedit.restore.not-configured"));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -128,19 +128,19 @@ public class SnapshotCommands {
|
||||
|
||||
if (snapshot != null) {
|
||||
session.setSnapshot(null);
|
||||
actor.print("Now using newest snapshot.");
|
||||
actor.printInfo(TranslatableComponent.of("worldedit.snapshot.use.newest"));
|
||||
} else {
|
||||
actor.printError("No snapshots were found.");
|
||||
actor.printError(TranslatableComponent.of("worldedit.restore.none-found"));
|
||||
}
|
||||
} catch (MissingWorldException ex) {
|
||||
actor.printError("No snapshots were found for this world.");
|
||||
actor.printError(TranslatableComponent.of("worldedit.restore.none-for-world"));
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
session.setSnapshot(config.snapshotRepo.getSnapshot(name));
|
||||
actor.print("Snapshot set to: " + name);
|
||||
actor.printInfo(TranslatableComponent.of("worldedit.snapshot.use", TextComponent.of(name)));
|
||||
} catch (InvalidSnapshotException e) {
|
||||
actor.printError("That snapshot does not exist or is not available.");
|
||||
actor.printError(TranslatableComponent.of("worldedit.restore.not-available"));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -156,30 +156,30 @@ public class SnapshotCommands {
|
||||
LocalConfiguration config = we.getConfiguration();
|
||||
|
||||
if (config.snapshotRepo == null) {
|
||||
actor.printError("Snapshot/backup restore is not configured.");
|
||||
actor.printError(TranslatableComponent.of("worldedit.restore.not-configured"));
|
||||
return;
|
||||
}
|
||||
|
||||
if (index < 1) {
|
||||
actor.printError("Invalid index, must be equal or higher then 1.");
|
||||
actor.printError(TranslatableComponent.of("worldedit.snapshot.index-above-0"));
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
List<Snapshot> snapshots = config.snapshotRepo.getSnapshots(true, world.getName());
|
||||
if (snapshots.size() < index) {
|
||||
actor.printError("Invalid index, must be between 1 and " + snapshots.size() + ".");
|
||||
actor.printError(TranslatableComponent.of("worldedit.snapshot.index-oob", TextComponent.of(snapshots.size())));
|
||||
return;
|
||||
}
|
||||
Snapshot snapshot = snapshots.get(index - 1);
|
||||
if (snapshot == null) {
|
||||
actor.printError("That snapshot does not exist or is not available.");
|
||||
actor.printError(TranslatableComponent.of("worldedit.restore.not-available"));
|
||||
return;
|
||||
}
|
||||
session.setSnapshot(snapshot);
|
||||
actor.print("Snapshot set to: " + snapshot.getName());
|
||||
actor.printInfo(TranslatableComponent.of("worldedit.snapshot.use", TextComponent.of(snapshot.getName())));
|
||||
} catch (MissingWorldException e) {
|
||||
actor.printError("No snapshots were found for this world.");
|
||||
actor.printError(TranslatableComponent.of("worldedit.restore.none-for-world"));
|
||||
}
|
||||
}
|
||||
|
||||
@ -195,7 +195,7 @@ public class SnapshotCommands {
|
||||
LocalConfiguration config = we.getConfiguration();
|
||||
|
||||
if (config.snapshotRepo == null) {
|
||||
actor.printError("Snapshot/backup restore is not configured.");
|
||||
actor.printError(TranslatableComponent.of("worldedit.restore.not-configured"));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -203,14 +203,16 @@ public class SnapshotCommands {
|
||||
Snapshot snapshot = config.snapshotRepo.getSnapshotBefore(date, world.getName());
|
||||
|
||||
if (snapshot == null) {
|
||||
actor.printError("Couldn't find a snapshot before "
|
||||
+ dateFormat.withZone(session.getTimeZone()).format(date) + ".");
|
||||
actor.printError(TranslatableComponent.of(
|
||||
"worldedit.snapshot.none-before",
|
||||
TextComponent.of(dateFormat.withZone(session.getTimeZone()).format(date)))
|
||||
);
|
||||
} else {
|
||||
session.setSnapshot(snapshot);
|
||||
actor.print("Snapshot set to: " + snapshot.getName());
|
||||
actor.printInfo(TranslatableComponent.of("worldedit.snapshot.use", TextComponent.of(snapshot.getName())));
|
||||
}
|
||||
} catch (MissingWorldException ex) {
|
||||
actor.printError("No snapshots were found for this world.");
|
||||
actor.printError(TranslatableComponent.of("worldedit.restore.none-for-world"));
|
||||
}
|
||||
}
|
||||
|
||||
@ -226,21 +228,23 @@ public class SnapshotCommands {
|
||||
LocalConfiguration config = we.getConfiguration();
|
||||
|
||||
if (config.snapshotRepo == null) {
|
||||
actor.printError("Snapshot/backup restore is not configured.");
|
||||
actor.printError(TranslatableComponent.of("worldedit.restore.not-configured"));
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
Snapshot snapshot = config.snapshotRepo.getSnapshotAfter(date, world.getName());
|
||||
if (snapshot == null) {
|
||||
actor.printError("Couldn't find a snapshot after "
|
||||
+ dateFormat.withZone(session.getTimeZone()).format(date) + ".");
|
||||
actor.printError(TranslatableComponent.of(
|
||||
"worldedit.snapshot.none-after",
|
||||
TextComponent.of(dateFormat.withZone(session.getTimeZone()).format(date)))
|
||||
);
|
||||
} else {
|
||||
session.setSnapshot(snapshot);
|
||||
actor.print("Snapshot set to: " + snapshot.getName());
|
||||
actor.printInfo(TranslatableComponent.of("worldedit.snapshot.use", TextComponent.of(snapshot.getName())));
|
||||
}
|
||||
} catch (MissingWorldException ex) {
|
||||
actor.printError("No snapshots were found for this world.");
|
||||
actor.printError(TranslatableComponent.of("worldedit.restore.none-for-world"));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -29,6 +29,8 @@ import com.sk89q.worldedit.command.util.CommandPermissionsConditionGenerator;
|
||||
import com.sk89q.worldedit.command.util.Logging;
|
||||
import com.sk89q.worldedit.extension.platform.Actor;
|
||||
import com.sk89q.worldedit.regions.Region;
|
||||
import com.sk89q.worldedit.util.formatting.text.TextComponent;
|
||||
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
|
||||
import com.sk89q.worldedit.world.DataException;
|
||||
import com.sk89q.worldedit.world.World;
|
||||
import com.sk89q.worldedit.world.snapshot.InvalidSnapshotException;
|
||||
@ -55,20 +57,20 @@ public class SnapshotUtilCommands {
|
||||
}
|
||||
|
||||
@Command(
|
||||
name = "restore",
|
||||
aliases = { "/restore" },
|
||||
desc = "Restore the selection from a snapshot"
|
||||
name = "restore",
|
||||
aliases = { "/restore" },
|
||||
desc = "Restore the selection from a snapshot"
|
||||
)
|
||||
@Logging(REGION)
|
||||
@CommandPermissions("worldedit.snapshots.restore")
|
||||
public void restore(Actor actor, World world, LocalSession session, EditSession editSession,
|
||||
@Arg(name = "snapshot", desc = "The snapshot to restore", def = "")
|
||||
String snapshotName) throws WorldEditException {
|
||||
String snapshotName) throws WorldEditException {
|
||||
|
||||
LocalConfiguration config = we.getConfiguration();
|
||||
|
||||
if (config.snapshotRepo == null) {
|
||||
actor.printError("Snapshot/backup restore is not configured.");
|
||||
actor.printError(TranslatableComponent.of("worldedit.restore.not-configured"));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -79,7 +81,7 @@ public class SnapshotUtilCommands {
|
||||
try {
|
||||
snapshot = config.snapshotRepo.getSnapshot(snapshotName);
|
||||
} catch (InvalidSnapshotException e) {
|
||||
actor.printError("That snapshot does not exist or is not available.");
|
||||
actor.printError(TranslatableComponent.of("worldedit.restore.not-available"));
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
@ -92,7 +94,7 @@ public class SnapshotUtilCommands {
|
||||
snapshot = config.snapshotRepo.getDefaultSnapshot(world.getName());
|
||||
|
||||
if (snapshot == null) {
|
||||
actor.printError("No snapshots were found. See console for details.");
|
||||
actor.printError(TranslatableComponent.of("worldedit.restore.none-found-console"));
|
||||
|
||||
// Okay, let's toss some debugging information!
|
||||
File dir = config.snapshotRepo.getDirectory();
|
||||
@ -109,7 +111,7 @@ public class SnapshotUtilCommands {
|
||||
return;
|
||||
}
|
||||
} catch (MissingWorldException ex) {
|
||||
actor.printError("No snapshots were found for this world.");
|
||||
actor.printError(TranslatableComponent.of("worldedit.restore.none-for-world"));
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -119,9 +121,9 @@ public class SnapshotUtilCommands {
|
||||
// Load chunk store
|
||||
try {
|
||||
chunkStore = snapshot.getChunkStore();
|
||||
actor.print("Snapshot '" + snapshot.getName() + "' loaded; now restoring...");
|
||||
actor.printInfo(TranslatableComponent.of("worldedit.restore.loaded", TextComponent.of(snapshot.getName())));
|
||||
} catch (DataException | IOException e) {
|
||||
actor.printError("Failed to load snapshot: " + e.getMessage());
|
||||
actor.printError(TranslatableComponent.of("worldedit.restore.failed", TextComponent.of(e.getMessage())));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -135,18 +137,17 @@ public class SnapshotUtilCommands {
|
||||
if (restore.hadTotalFailure()) {
|
||||
String error = restore.getLastErrorMessage();
|
||||
if (!restore.getMissingChunks().isEmpty()) {
|
||||
actor.printError("Chunks were not present in snapshot.");
|
||||
actor.printError(TranslatableComponent.of("worldedit.restore.chunk-not-present"));
|
||||
} else if (error != null) {
|
||||
actor.printError("Errors prevented any blocks from being restored.");
|
||||
actor.printError("Last error: " + error);
|
||||
actor.printError(TranslatableComponent.of("worldedit.restore.block-place-failed"));
|
||||
actor.printError(TranslatableComponent.of("worldedit.restore.block-place-error", TextComponent.of(error)));
|
||||
} else {
|
||||
actor.printError("No chunks could be loaded. (Bad archive?)");
|
||||
actor.printError(TranslatableComponent.of("worldedit.restore.chunk-load-failed"));
|
||||
}
|
||||
} else {
|
||||
actor.print(String.format("Restored; %d "
|
||||
+ "missing chunks and %d other errors.",
|
||||
restore.getMissingChunks().size(),
|
||||
restore.getErrorChunks().size()));
|
||||
actor.printInfo(TranslatableComponent.of("worldedit.restore.restored",
|
||||
TextComponent.of(restore.getMissingChunks().size()),
|
||||
TextComponent.of(restore.getErrorChunks().size())));
|
||||
}
|
||||
} finally {
|
||||
try {
|
||||
|
@ -30,6 +30,8 @@ import com.sk89q.worldedit.command.tool.SinglePickaxe;
|
||||
import com.sk89q.worldedit.command.util.CommandPermissions;
|
||||
import com.sk89q.worldedit.command.util.CommandPermissionsConditionGenerator;
|
||||
import com.sk89q.worldedit.entity.Player;
|
||||
import com.sk89q.worldedit.util.formatting.text.TextComponent;
|
||||
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
|
||||
import org.enginehub.piston.annotation.Command;
|
||||
import org.enginehub.piston.annotation.CommandContainer;
|
||||
import org.enginehub.piston.annotation.param.Arg;
|
||||
@ -50,7 +52,7 @@ public class SuperPickaxeCommands {
|
||||
public void single(Player player, LocalSession session) throws WorldEditException {
|
||||
session.setSuperPickaxe(new SinglePickaxe());
|
||||
session.enableSuperPickAxe();
|
||||
player.print(BBC.SUPERPICKAXE_AREA_ENABLED.s());
|
||||
player.printInfo(TranslatableComponent.of("worldedit.tool.superpickaxe.mode.single"));
|
||||
}
|
||||
|
||||
@Command(
|
||||
@ -65,13 +67,13 @@ public class SuperPickaxeCommands {
|
||||
LocalConfiguration config = we.getConfiguration();
|
||||
|
||||
if (range > config.maxSuperPickaxeSize) {
|
||||
BBC.TOOL_RANGE_ERROR.send(player, config.maxSuperPickaxeSize);
|
||||
player.printError(TranslatableComponent.of("worldedit.superpickaxe.max-range", TextComponent.of(config.maxSuperPickaxeSize)));
|
||||
return;
|
||||
}
|
||||
|
||||
session.setSuperPickaxe(new AreaPickaxe(range));
|
||||
session.enableSuperPickAxe();
|
||||
player.print(BBC.SUPERPICKAXE_AREA_ENABLED.s());
|
||||
player.printInfo(TranslatableComponent.of("worldedit.tool.superpickaxe.mode.area"));
|
||||
}
|
||||
|
||||
@Command(
|
||||
@ -87,12 +89,12 @@ public class SuperPickaxeCommands {
|
||||
LocalConfiguration config = we.getConfiguration();
|
||||
|
||||
if (range > config.maxSuperPickaxeSize) {
|
||||
BBC.TOOL_RANGE_ERROR.send(player, config.maxSuperPickaxeSize);
|
||||
player.printError(TranslatableComponent.of("worldedit.superpickaxe.max-range", TextComponent.of(config.maxSuperPickaxeSize)));
|
||||
return;
|
||||
}
|
||||
|
||||
session.setSuperPickaxe(new RecursivePickaxe(range));
|
||||
session.enableSuperPickAxe();
|
||||
player.print(BBC.SUPERPICKAXE_AREA_ENABLED.s());
|
||||
player.printInfo(TranslatableComponent.of("worldedit.tool.superpickaxe.mode.recursive"));
|
||||
}
|
||||
}
|
||||
|
@ -27,7 +27,6 @@ import com.sk89q.worldedit.LocalConfiguration;
|
||||
import com.sk89q.worldedit.LocalSession;
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
import com.sk89q.worldedit.blocks.BaseItemStack;
|
||||
import com.sk89q.worldedit.command.tool.BlockDataCyler;
|
||||
import com.sk89q.worldedit.command.tool.BlockReplacer;
|
||||
import com.sk89q.worldedit.command.tool.InvalidToolBindException;
|
||||
@ -125,10 +124,10 @@ public class ToolCommands {
|
||||
return "/tool " + name;
|
||||
}
|
||||
|
||||
static void setToolNone(Player player, LocalSession session, String type)
|
||||
static void setToolNone(Player player, LocalSession session, boolean isBrush)
|
||||
throws InvalidToolBindException {
|
||||
session.setTool(player.getItemInHand(HandSide.MAIN_HAND).getType(), null);
|
||||
player.print(type + " unbound from your current item.");
|
||||
player.printInfo(TranslatableComponent.of(isBrush ? "worldedit.brush.none.equip" : "worldedit.tool.none.equip"));
|
||||
}
|
||||
private final WorldEdit we;
|
||||
|
||||
@ -146,7 +145,7 @@ public class ToolCommands {
|
||||
|
||||
final ItemType itemType = player.getItemInHand(HandSide.MAIN_HAND).getType();
|
||||
session.setTool(itemType, SelectionWand.INSTANCE);
|
||||
player.print("Selection wand bound to " + itemType.getName() + ".");
|
||||
player.printInfo(TranslatableComponent.of("worldedit.tool.selwand.equip", TextComponent.of(itemType.getName())));
|
||||
}
|
||||
|
||||
@Command(
|
||||
@ -159,7 +158,7 @@ public class ToolCommands {
|
||||
|
||||
BaseItemStack itemStack = player.getItemInHand(HandSide.MAIN_HAND);
|
||||
session.setTool(player, NavigationWand.INSTANCE);
|
||||
player.print("Navigation wand bound to " + itemStack.getType().getName() + ".");
|
||||
player.printInfo(TranslatableComponent.of("worldedit.tool.navWand.equip", TextComponent.of(itemType.getName())));
|
||||
}
|
||||
|
||||
@Command(
|
||||
@ -171,7 +170,7 @@ public class ToolCommands {
|
||||
|
||||
BaseItemStack itemStack = player.getItemInHand(HandSide.MAIN_HAND);
|
||||
session.setTool(player, new QueryTool());
|
||||
BBC.TOOL_INFO.send(player, itemStack.getType().getName());
|
||||
player.printInfo(TranslatableComponent.of("worldedit.tool.info.equip", TextComponent.of(itemType.getName())));
|
||||
}
|
||||
|
||||
@Command(
|
||||
@ -196,7 +195,7 @@ public class ToolCommands {
|
||||
|
||||
BaseItemStack itemStack = player.getItemInHand(HandSide.MAIN_HAND);
|
||||
session.setTool(player, new TreePlanter(type));
|
||||
BBC.TOOL_TREE.send(player, itemStack.getType().getName());
|
||||
player.printInfo(TranslatableComponent.of("worldedit.tool.tree.equip", TextComponent.of(itemType.getName())));
|
||||
}
|
||||
|
||||
@Command(
|
||||
@ -210,7 +209,7 @@ public class ToolCommands {
|
||||
|
||||
BaseItemStack itemStack = player.getItemInHand(HandSide.MAIN_HAND);
|
||||
session.setTool(player, new BlockReplacer(pattern));
|
||||
BBC.TOOL_REPL.send(player, itemStack.getType().getName());
|
||||
player.printInfo(TranslatableComponent.of("worldedit.tool.repl.equip", TextComponent.of(itemType.getName())));
|
||||
}
|
||||
|
||||
@Command(
|
||||
@ -222,7 +221,7 @@ public class ToolCommands {
|
||||
|
||||
BaseItemStack itemStack = player.getItemInHand(HandSide.MAIN_HAND);
|
||||
session.setTool(player, new BlockDataCyler());
|
||||
BBC.TOOL_CYCLER.send(player, itemStack.getType().getName());
|
||||
player.printInfo(TranslatableComponent.of("worldedit.tool.data-cycler.equip", TextComponent.of(itemType.getName())));
|
||||
}
|
||||
|
||||
@Command(
|
||||
@ -240,13 +239,13 @@ public class ToolCommands {
|
||||
LocalConfiguration config = we.getConfiguration();
|
||||
|
||||
if (range > config.maxSuperPickaxeSize) {
|
||||
BBC.TOOL_RANGE_ERROR.send(player, config.maxSuperPickaxeSize);
|
||||
player.printError(TranslatableComponent.of("worldedit.superpickaxe.max-range", TextComponent.of(config.maxSuperPickaxeSize)));
|
||||
return;
|
||||
}
|
||||
|
||||
BaseItemStack itemStack = player.getItemInHand(HandSide.MAIN_HAND);
|
||||
session.setTool(player, new FloodFillTool(range, pattern));
|
||||
BBC.TOOL_FLOOD_FILL.send(player, itemStack.getType().getName());
|
||||
player.printInfo(TranslatableComponent.of("worldedit.tool.floodfill.equip", TextComponent.of(itemType.getName())));
|
||||
}
|
||||
|
||||
@Command(
|
||||
@ -258,7 +257,7 @@ public class ToolCommands {
|
||||
|
||||
BaseItemStack itemStack = player.getItemInHand(HandSide.MAIN_HAND);
|
||||
session.setTool(player, new FloatingTreeRemover());
|
||||
BBC.TOOL_DELTREE.send(player, itemStack.getType().getName());
|
||||
player.printInfo(TranslatableComponent.of("worldedit.tool.deltree.equip", TextComponent.of(itemType.getName())));
|
||||
}
|
||||
|
||||
@Command(
|
||||
@ -270,7 +269,7 @@ public class ToolCommands {
|
||||
|
||||
BaseItemStack itemStack = player.getItemInHand(HandSide.MAIN_HAND);
|
||||
session.setTool(player, new DistanceWand());
|
||||
BBC.TOOL_FARWAND.send(player, itemStack.getType().getName());
|
||||
player.printInfo(TranslatableComponent.of("worldedit.tool.farwand.equip", TextComponent.of(itemType.getName())));
|
||||
}
|
||||
|
||||
@Command(
|
||||
@ -284,10 +283,10 @@ public class ToolCommands {
|
||||
Pattern primary,
|
||||
@Arg(desc = "Pattern to set on right-click")
|
||||
Pattern secondary) throws WorldEditException {
|
||||
BaseItemStack itemStack = player.getItemInHand(HandSide.MAIN_HAND);
|
||||
|
||||
session.setTool(itemStack.getType(), new LongRangeBuildTool(primary, secondary));
|
||||
player.print("Long-range building tool bound to " + itemStack.getType().getName() + ".");
|
||||
final ItemType itemType = player.getItemInHand(HandSide.MAIN_HAND).getType();
|
||||
session.setTool(itemType, new LongRangeBuildTool(primary, secondary));
|
||||
player.printInfo(TranslatableComponent.of("worldedit.tool.lrbuild.equip", TextComponent.of(itemType.getName())));
|
||||
String primaryName = "pattern";
|
||||
String secondaryName = "pattern";
|
||||
if (primary instanceof BlockStateHolder) {
|
||||
@ -296,7 +295,6 @@ public class ToolCommands {
|
||||
if (secondary instanceof BlockStateHolder) {
|
||||
secondaryName = ((BlockStateHolder<?>) secondary).getBlockType().getName();
|
||||
}
|
||||
player.print("Left-click set to " + primaryName + "; right-click set to "
|
||||
+ secondaryName + ".");
|
||||
player.printInfo(TranslatableComponent.of("worldedit.tool.lrbuild.set", TextComponent.of(primaryName), TextComponent.of(secondaryName)));
|
||||
}
|
||||
}
|
||||
|
@ -44,6 +44,7 @@ import com.sk89q.worldedit.function.mask.Mask;
|
||||
import com.sk89q.worldedit.function.pattern.Pattern;
|
||||
import com.sk89q.worldedit.internal.command.CommandArgParser;
|
||||
import com.sk89q.worldedit.util.HandSide;
|
||||
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
|
||||
import org.enginehub.piston.annotation.Command;
|
||||
import org.enginehub.piston.annotation.CommandContainer;
|
||||
import org.enginehub.piston.annotation.param.Arg;
|
||||
@ -82,7 +83,7 @@ public class ToolUtilCommands {
|
||||
return;
|
||||
}
|
||||
if (maskOpt == null) {
|
||||
player.print("Brush mask disabled.");
|
||||
player.print(TranslatableComponent.of("worldedit.tool.mask.disabled"));
|
||||
tool.setMask(null);
|
||||
return;
|
||||
}
|
||||
@ -91,7 +92,7 @@ public class ToolUtilCommands {
|
||||
settings.addSetting(BrushSettings.SettingType.MASK, lastArg);
|
||||
settings.setMask(maskOpt);
|
||||
tool.update();
|
||||
player.print("Brush mask set.");
|
||||
player.print(TranslatableComponent.of("worldedit.tool.mask.set"));
|
||||
}
|
||||
|
||||
@Command(
|
||||
@ -112,16 +113,15 @@ public class ToolUtilCommands {
|
||||
return;
|
||||
}
|
||||
if (pattern == null) {
|
||||
player.print(BBC.BRUSH_MATERIAL.s());
|
||||
tool.setFill(null);
|
||||
return;
|
||||
}
|
||||
BrushSettings settings = offHand ? tool.getOffHand() : tool.getContext();
|
||||
settings.setFill(pattern);
|
||||
String lastArg = Iterables.getLast(CommandArgParser.spaceSplit(arguments.get())).getSubstring();
|
||||
settings.addSetting(BrushSettings.SettingType.FILL, lastArg);
|
||||
tool.update();
|
||||
player.print(BBC.BRUSH_MATERIAL.s());
|
||||
} else {
|
||||
BrushSettings settings = offHand ? tool.getOffHand() : tool.getContext();
|
||||
settings.setFill(pattern);
|
||||
String lastArg = Iterables.getLast(CommandArgParser.spaceSplit(arguments.get())).getSubstring();
|
||||
settings.addSetting(BrushSettings.SettingType.FILL, lastArg);
|
||||
tool.update();
|
||||
}
|
||||
player.print(TranslatableComponent.of("worldedit.tool.material.set"));
|
||||
}
|
||||
|
||||
@Command(
|
||||
@ -133,7 +133,7 @@ public class ToolUtilCommands {
|
||||
@Arg(desc = "The range of the brush")
|
||||
int range) throws WorldEditException {
|
||||
session.getBrushTool(player, false).setRange(range);
|
||||
player.print("Brush range set.");
|
||||
player.printInfo(TranslatableComponent.of("worldedit.tool.range.set"));
|
||||
}
|
||||
|
||||
@Command(
|
||||
@ -147,7 +147,7 @@ public class ToolUtilCommands {
|
||||
we.checkMaxBrushRadius(size);
|
||||
|
||||
session.getBrushTool(player, false).setSize(size);
|
||||
player.print("Brush size set.");
|
||||
player.printInfo(TranslatableComponent.of("worldedit.tool.size.set"));
|
||||
}
|
||||
|
||||
//todo none should be moved to the same class where it is in upstream
|
||||
@ -172,9 +172,9 @@ public class ToolUtilCommands {
|
||||
Mask maskOpt) throws WorldEditException {
|
||||
session.getBrushTool(player, false).setTraceMask(maskOpt);
|
||||
if (maskOpt == null) {
|
||||
player.print("Trace mask disabled.");
|
||||
player.printInfo(TranslatableComponent.of("worldedit.tool.tracemask.disabled"));
|
||||
} else {
|
||||
player.print("Trace mask set.");
|
||||
player.printInfo(TranslatableComponent.of("worldedit.tool.tracemask.set"));
|
||||
}
|
||||
}
|
||||
|
||||
@ -189,15 +189,15 @@ public class ToolUtilCommands {
|
||||
Boolean superPickaxe) {
|
||||
boolean hasSuperPickAxe = session.hasSuperPickAxe();
|
||||
if (superPickaxe != null && superPickaxe == hasSuperPickAxe) {
|
||||
player.printError("Super pickaxe already " + (superPickaxe ? "enabled" : "disabled") + ".");
|
||||
player.printError(TranslatableComponent.of(superPickaxe ? "worldedit.tool.superpickaxe.enabled.already" : "worldedit.tool.superpickaxe.disabled.already"));
|
||||
return;
|
||||
}
|
||||
if (hasSuperPickAxe) {
|
||||
session.disableSuperPickAxe();
|
||||
player.print("Super pickaxe disabled.");
|
||||
player.printInfo(TranslatableComponent.of("worldedit.tool.superpickaxe.disabled"));
|
||||
} else {
|
||||
session.enableSuperPickAxe();
|
||||
player.print("Super pickaxe enabled.");
|
||||
player.printInfo(TranslatableComponent.of("worldedit.tool.superpickaxe.enabled"));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -72,6 +72,7 @@ import com.sk89q.worldedit.util.formatting.component.SubtleFormat;
|
||||
import com.sk89q.worldedit.util.formatting.text.Component;
|
||||
import com.sk89q.worldedit.util.formatting.text.TextComponent;
|
||||
import com.sk89q.worldedit.util.formatting.text.format.TextColor;
|
||||
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
|
||||
import com.sk89q.worldedit.world.World;
|
||||
import com.sk89q.worldedit.world.block.BlockTypes;
|
||||
import java.awt.RenderingHints;
|
||||
@ -214,7 +215,7 @@ public class UtilityCommands {
|
||||
|
||||
BlockVector3 pos = session.getPlacementPosition(actor);
|
||||
int affected = editSession.fillDirection(pos, pattern, radius, depth, direction);
|
||||
actor.print(affected + " block(s) have been created.");
|
||||
actor.printInfo(TranslatableComponent.of("worldedit.fill.created", TextComponent.of(affected)));
|
||||
return affected;
|
||||
}
|
||||
|
||||
@ -312,7 +313,7 @@ public class UtilityCommands {
|
||||
|
||||
BlockVector3 pos = session.getPlacementPosition(actor);
|
||||
int affected = editSession.fillXZ(pos, pattern, radius, depth, true);
|
||||
actor.print(affected + " block(s) have been created.");
|
||||
actor.printInfo(TranslatableComponent.of("worldedit.fillr.created", TextComponent.of(affected)));
|
||||
return affected;
|
||||
}
|
||||
|
||||
@ -330,9 +331,8 @@ public class UtilityCommands {
|
||||
double radius = radiusExp.evaluate();
|
||||
radius = Math.max(0, radius);
|
||||
we.checkMaxRadius(radius);
|
||||
int affected = editSession.drainArea(
|
||||
session.getPlacementPosition(actor), radius, waterlogged);
|
||||
actor.print(affected + " block(s) have been changed.");
|
||||
int affected = editSession.drainArea(session.getPlacementPosition(actor), radius, waterlogged);
|
||||
actor.printInfo(TranslatableComponent.of("worldedit.drain.drained", TextComponent.of(affected)));
|
||||
return affected;
|
||||
}
|
||||
|
||||
@ -349,7 +349,7 @@ public class UtilityCommands {
|
||||
radius = Math.max(0, radius);
|
||||
we.checkMaxRadius(radius);
|
||||
int affected = editSession.fixLiquid(session.getPlacementPosition(actor), radius, BlockTypes.LAVA);
|
||||
actor.print(affected + " block(s) have been changed.");
|
||||
actor.printInfo(TranslatableComponent.of("worldedit.fixlava.fixed", TextComponent.of(affected)));
|
||||
return affected;
|
||||
}
|
||||
|
||||
@ -366,7 +366,7 @@ public class UtilityCommands {
|
||||
radius = Math.max(0, radius);
|
||||
we.checkMaxRadius(radius);
|
||||
int affected = editSession.fixLiquid(session.getPlacementPosition(actor), radius, BlockTypes.WATER);
|
||||
actor.print(affected + " block(s) have been changed.");
|
||||
actor.printInfo(TranslatableComponent.of("worldedit.fixwater.fixed", TextComponent.of(affected)));
|
||||
return affected;
|
||||
}
|
||||
|
||||
@ -387,7 +387,7 @@ public class UtilityCommands {
|
||||
height = height != null ? Math.min((world.getMaxY() + 1), height + 1) : (world.getMaxY() + 1);
|
||||
|
||||
int affected = editSession.removeAbove(session.getPlacementPosition(actor), size, height);
|
||||
actor.print(affected + " block(s) have been removed.");
|
||||
actor.printInfo(TranslatableComponent.of("worldedit.removeabove.removed", TextComponent.of(affected)));
|
||||
return affected;
|
||||
}
|
||||
|
||||
@ -408,7 +408,7 @@ public class UtilityCommands {
|
||||
height = height != null ? Math.min((world.getMaxY() + 1), height + 1) : (world.getMaxY() + 1);
|
||||
|
||||
int affected = editSession.removeBelow(session.getPlacementPosition(actor), size, height);
|
||||
actor.print(affected + " block(s) have been removed.");
|
||||
actor.printInfo(TranslatableComponent.of("worldedit.removebelow.removed", TextComponent.of(affected)));
|
||||
return affected;
|
||||
}
|
||||
|
||||
@ -428,7 +428,7 @@ public class UtilityCommands {
|
||||
we.checkMaxRadius(radius);
|
||||
|
||||
int affected = editSession.removeNear(session.getPlacementPosition(actor), mask, radius);
|
||||
actor.print(affected + " block(s) have been removed.");
|
||||
actor.printInfo(TranslatableComponent.of("worldedit.removenear.removed", TextComponent.of(affected)));
|
||||
return affected;
|
||||
}
|
||||
|
||||
@ -459,7 +459,7 @@ public class UtilityCommands {
|
||||
}
|
||||
|
||||
int affected = editSession.replaceBlocks(region, from, to);
|
||||
actor.print(affected + " block(s) have been replaced.");
|
||||
actor.printInfo(TranslatableComponent.of("worldedit.replacenear.replaced", TextComponent.of(affected)));
|
||||
return affected;
|
||||
}
|
||||
|
||||
@ -477,7 +477,7 @@ public class UtilityCommands {
|
||||
we.checkMaxRadius(size);
|
||||
|
||||
int affected = editSession.simulateSnow(session.getPlacementPosition(actor), size);
|
||||
actor.print(affected + " surface(s) covered. Let it snow~");
|
||||
actor.printInfo(TranslatableComponent.of("worldedit.snow.created", TextComponent.of(affected)));
|
||||
return affected;
|
||||
}
|
||||
|
||||
@ -495,7 +495,7 @@ public class UtilityCommands {
|
||||
we.checkMaxRadius(size);
|
||||
|
||||
int affected = editSession.thaw(session.getPlacementPosition(actor), size);
|
||||
actor.print(affected + " surface(s) thawed.");
|
||||
actor.printInfo(TranslatableComponent.of("worldedit.thaw.removed", TextComponent.of(affected)));
|
||||
return affected;
|
||||
}
|
||||
|
||||
@ -516,7 +516,7 @@ public class UtilityCommands {
|
||||
final boolean onlyNormalDirt = !convertCoarse;
|
||||
|
||||
final int affected = editSession.green(session.getPlacementPosition(actor), size, onlyNormalDirt);
|
||||
actor.print(affected + " surface(s) greened.");
|
||||
actor.printInfo(TranslatableComponent.of("worldedit.green.changed", TextComponent.of(affected)));
|
||||
return affected;
|
||||
}
|
||||
|
||||
@ -554,7 +554,7 @@ public class UtilityCommands {
|
||||
)
|
||||
@CommandPermissions("worldedit.extinguish")
|
||||
@Logging(PLACEMENT)
|
||||
public void extinguish(Actor actor, LocalSession session, EditSession editSession,
|
||||
public int extinguish(Actor actor, LocalSession session, EditSession editSession,
|
||||
@Arg(desc = "The radius of the square to remove in", def = "")
|
||||
Integer radius) throws WorldEditException {
|
||||
|
||||
@ -566,7 +566,8 @@ public class UtilityCommands {
|
||||
|
||||
Mask mask = new BlockTypeMask(editSession, BlockTypes.FIRE);
|
||||
int affected = editSession.removeNear(session.getPlacementPosition(actor), mask, size);
|
||||
actor.print(affected + " block(s) have been removed.");
|
||||
actor.printInfo(TranslatableComponent.of("worldedit.extinguish.removed", TextComponent.of(affected)));
|
||||
return affected;
|
||||
}
|
||||
|
||||
@Command(
|
||||
@ -599,7 +600,7 @@ public class UtilityCommands {
|
||||
if (radius == null) {
|
||||
radius = config.butcherDefaultRadius;
|
||||
} else if (radius < -1) {
|
||||
actor.printError("Use -1 to remove all mobs in loaded chunks");
|
||||
actor.printError(TranslatableComponent.of("worldedit.butcher.explain-all"));
|
||||
return 0;
|
||||
} else if (radius == -1) {
|
||||
if (config.butcherMaxRadius != -1) {
|
||||
@ -622,7 +623,11 @@ public class UtilityCommands {
|
||||
|
||||
int killed = killMatchingEntities(radius, actor, flags::createFunction);
|
||||
|
||||
actor.print("Killed " + killed + (killed != 1 ? " mobs" : " mob") + (radius < 0 ? "" : " in a radius of " + radius) + ".");
|
||||
actor.printInfo(TranslatableComponent.of(
|
||||
"worldedit.butcher.killed",
|
||||
TextComponent.of(killed),
|
||||
TextComponent.of(radius)
|
||||
));
|
||||
|
||||
return killed;
|
||||
}
|
||||
@ -656,20 +661,19 @@ public class UtilityCommands {
|
||||
@Arg(desc = "The radius of the cuboid to remove from")
|
||||
int radius) throws WorldEditException {
|
||||
if (radius < -1) {
|
||||
actor.printError("Use -1 to remove all entities in loaded chunks");
|
||||
actor.printError(TranslatableComponent.of("worldedit.remove.explain-all"));
|
||||
return 0;
|
||||
}
|
||||
|
||||
int removed = killMatchingEntities(radius, actor, remover::createFunction);
|
||||
|
||||
actor.print("Marked " + removed + (removed != 1 ? " entities" : " entity") + " for removal.");
|
||||
actor.printInfo(TranslatableComponent.of("worldedit.remove.removed", TextComponent.of(removed)));
|
||||
return removed;
|
||||
}
|
||||
|
||||
// get the formatter with the system locale. in the future, if we can get a local from a player, we can use that
|
||||
private static final DecimalFormat formatter = (DecimalFormat) NumberFormat.getInstance(Locale.getDefault());
|
||||
static {
|
||||
formatter.applyPattern("#,##0.#####"); // pattern is locale-insensitive. this can translate to "1.234,56789"
|
||||
private DecimalFormat formatForLocale(Locale locale) {
|
||||
DecimalFormat format = (DecimalFormat) NumberFormat.getInstance(locale);
|
||||
format.applyPattern("#,##0.#####");
|
||||
return format;
|
||||
}
|
||||
|
||||
@Command(
|
||||
@ -685,16 +689,15 @@ public class UtilityCommands {
|
||||
try {
|
||||
expression = Expression.compile(String.join(" ", input));
|
||||
} catch (ExpressionException e) {
|
||||
actor.printError(String.format(
|
||||
"'%s' could not be parsed as a valid expression", input));
|
||||
actor.printError(TranslatableComponent.of("worldedit.calc.invalid", TextComponent.of(String.join(" ", input))));
|
||||
return;
|
||||
}
|
||||
WorldEditAsyncCommandBuilder.createAndSendMessage(actor, () -> {
|
||||
double result = expression.evaluate(
|
||||
new double[]{}, WorldEdit.getInstance().getSessionManager().get(actor).getTimeout());
|
||||
String formatted = Double.isNaN(result) ? "NaN" : formatter.format(result);
|
||||
String formatted = Double.isNaN(result) ? "NaN" : formatForLocale(actor.getLocale()).format(result);
|
||||
return SubtleFormat.wrap(input + " = ").append(TextComponent.of(formatted, TextColor.LIGHT_PURPLE));
|
||||
}, null);
|
||||
}, (Component) null);
|
||||
}
|
||||
|
||||
@Command(
|
||||
|
@ -36,9 +36,13 @@ import com.sk89q.worldedit.entity.Player;
|
||||
import com.sk89q.worldedit.event.platform.ConfigurationLoadEvent;
|
||||
import com.sk89q.worldedit.extension.platform.Actor;
|
||||
import com.sk89q.worldedit.extension.platform.Capability;
|
||||
import com.sk89q.worldedit.extension.platform.NoCapablePlatformException;
|
||||
import com.sk89q.worldedit.extension.platform.Platform;
|
||||
import com.sk89q.worldedit.extension.platform.PlatformManager;
|
||||
import com.sk89q.worldedit.util.formatting.text.format.TextColor;
|
||||
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
|
||||
import com.sk89q.worldedit.util.formatting.text.TextComponent;
|
||||
import com.sk89q.worldedit.util.formatting.component.TextComponentProducer;
|
||||
import com.sk89q.worldedit.util.formatting.component.MessageBox;
|
||||
import java.io.IOException;
|
||||
import java.time.ZoneId;
|
||||
import java.time.ZonedDateTime;
|
||||
@ -47,8 +51,8 @@ import java.time.format.TextStyle;
|
||||
import java.time.zone.ZoneRulesException;
|
||||
import java.util.Date;
|
||||
import java.util.GregorianCalendar;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import org.enginehub.piston.annotation.Command;
|
||||
import org.enginehub.piston.annotation.CommandContainer;
|
||||
@ -76,37 +80,45 @@ public class WorldEditCommands {
|
||||
FaweVersion fVer = Fawe.get().getVersion();
|
||||
String fVerStr = fVer == null ? "unknown" : "-" + fVer.build;
|
||||
actor.print("FastAsyncWorldEdit" + fVerStr + " created by Empire92");
|
||||
|
||||
|
||||
if (fVer != null) {
|
||||
actor.printDebug("----------- Platforms -----------");
|
||||
FaweVersion version = Fawe.get().getVersion();
|
||||
Date date = new GregorianCalendar(2000 + version.year, version.month - 1, version.day)
|
||||
.getTime();
|
||||
actor.printDebug(" - DATE: " + date.toLocaleString());
|
||||
actor.printDebug(" - COMMIT: " + Integer.toHexString(version.hash));
|
||||
actor.printDebug(" - BUILD: " + version.build);
|
||||
actor.printDebug(" - PLATFORM: " + Settings.IMP.PLATFORM);
|
||||
actor.printDebug("------------------------------------");
|
||||
|
||||
TextComponent dateArg = TextComponent.of(date.toLocaleString());
|
||||
TextComponent commitArg = TextComponent.of(Integer.toHexString(version.hash));
|
||||
TextComponent buildArg = TextComponent.of(version.build);
|
||||
TextComponent platformArg = TextComponent.of(Settings.IMP.PLATFORM);
|
||||
|
||||
actor.printInfo(TranslatableComponent.of("worldedit.version.version", dateArg, commitArg, buildArg, platformArg));
|
||||
}
|
||||
|
||||
actor.printInfo(TextComponent.of("Wiki: https://github.com/IntellectualSites/FastAsyncWorldEdit-1.13/wiki"));
|
||||
|
||||
PlatformManager pm = we.getPlatformManager();
|
||||
|
||||
actor.printDebug("----------- Platforms -----------");
|
||||
TextComponentProducer producer = new TextComponentProducer();
|
||||
for (Platform platform : pm.getPlatforms()) {
|
||||
actor.printDebug(String.format("* %s (%s)", platform.getPlatformName(), platform.getPlatformVersion()));
|
||||
producer.append(
|
||||
TextComponent.of("* ", TextColor.GRAY)
|
||||
.append(TextComponent.of(platform.getPlatformName()))
|
||||
.append(TextComponent.of("(" + platform.getPlatformVersion() + ")"))
|
||||
).newline();
|
||||
}
|
||||
|
||||
actor.printDebug("----------- Capabilities -----------");
|
||||
for (Capability capability : Capability.values()) {
|
||||
try {
|
||||
Platform platform = pm.queryCapability(capability);
|
||||
actor.printDebug(String.format("%s: %s", capability.name(),
|
||||
platform != null ? platform.getPlatformName() : "NONE"));
|
||||
} catch (NoCapablePlatformException e) {
|
||||
actor.printDebug(String.format("%s: %s", capability.name(), "NONE"));
|
||||
}
|
||||
actor.print(new MessageBox("Platforms", producer, TextColor.GRAY).create());
|
||||
|
||||
producer.reset();
|
||||
for (Capability capability : Capability.values()) {
|
||||
Platform platform = pm.queryCapability(capability);
|
||||
producer.append(
|
||||
TextComponent.of(capability.name(), TextColor.GRAY)
|
||||
.append(TextComponent.of(": ")
|
||||
.append(TextComponent.of(platform != null ? platform.getPlatformName() : "NONE")))
|
||||
).newline();
|
||||
}
|
||||
actor.printDebug("");
|
||||
actor.printDebug("Wiki: https://github.com/IntellectualSites/FastAsyncWorldEdit-1.13/wiki");
|
||||
actor.print(new MessageBox("Capabilities", producer, TextColor.GRAY).create());
|
||||
|
||||
}
|
||||
|
||||
@Command(
|
||||
@ -118,7 +130,7 @@ public class WorldEditCommands {
|
||||
we.getPlatformManager().queryCapability(Capability.CONFIGURATION).reload();
|
||||
we.getEventBus().post(new ConfigurationLoadEvent(we.getPlatformManager().queryCapability(Capability.CONFIGURATION).getConfiguration()));
|
||||
Fawe.get().setupConfigs();
|
||||
actor.print("Configuration and translations reloaded!");
|
||||
actor.printInfo(TranslatableComponent.of("worldedit.reload.config"));
|
||||
}
|
||||
|
||||
@Command(
|
||||
@ -129,7 +141,9 @@ public class WorldEditCommands {
|
||||
@SkipQueue
|
||||
@CommandPermissions({"worldedit.report", "worldedit.debugpaste"})
|
||||
public void report(Actor actor) throws WorldEditException, IOException {
|
||||
BBC.DOWNLOAD_LINK.send(actor, IncendoPaster.debugPaste());
|
||||
String dest = IncendoPaster.debugPaste();
|
||||
actor.printInfo(TranslatableComponent.of("worldedit.report.written", TextComponent.of(dest)));
|
||||
BBC.DOWNLOAD_LINK.send(actor, );
|
||||
}
|
||||
|
||||
@Command(
|
||||
@ -172,12 +186,13 @@ public class WorldEditCommands {
|
||||
try {
|
||||
ZoneId tz = ZoneId.of(timezone);
|
||||
session.setTimezone(tz);
|
||||
actor.print("Timezone set for this session to: " + tz.getDisplayName(
|
||||
TextStyle.FULL, Locale.ENGLISH
|
||||
));
|
||||
actor.print("The current time in that timezone is: " + dateFormat.format(ZonedDateTime.now(tz)));
|
||||
actor.printInfo(TranslatableComponent.of("worldedit.timezone.set", TextComponent.of(tz.getDisplayName(
|
||||
TextStyle.FULL, actor.getLocale()
|
||||
))));
|
||||
actor.print(TranslatableComponent.of("worldedit.timezone.current",
|
||||
TextComponent.of(dateFormat.withLocale(actor.getLocale()).format(ZonedDateTime.now(tz)))));
|
||||
} catch (ZoneRulesException e) {
|
||||
actor.printError("Invalid timezone");
|
||||
actor.printError(TranslatableComponent.of("worldedit.timezone.invalid"));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -27,6 +27,7 @@ import com.sk89q.worldedit.entity.Player;
|
||||
import com.sk89q.worldedit.extension.platform.Actor;
|
||||
import com.sk89q.worldedit.extension.platform.Platform;
|
||||
import com.sk89q.worldedit.util.Location;
|
||||
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
|
||||
import com.sk89q.worldedit.world.block.BlockType;
|
||||
import com.sk89q.worldedit.world.block.BlockTypes;
|
||||
|
||||
@ -79,7 +80,7 @@ public class AreaPickaxe implements BlockTool {
|
||||
}
|
||||
editSession.flushQueue();
|
||||
} catch (MaxChangedBlocksException e) {
|
||||
player.printError("Max blocks change limit reached.");
|
||||
player.printError(TranslatableComponent.of("worldedit.tool.max-block-changes"));
|
||||
} finally {
|
||||
session.remember(editSession);
|
||||
}
|
||||
|
@ -31,6 +31,8 @@ import com.sk89q.worldedit.extension.platform.Platform;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.registry.state.Property;
|
||||
import com.sk89q.worldedit.util.Location;
|
||||
import com.sk89q.worldedit.util.formatting.text.TextComponent;
|
||||
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
|
||||
import com.sk89q.worldedit.world.World;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
|
||||
@ -62,12 +64,12 @@ public class BlockDataCyler implements DoubleActionBlockTool {
|
||||
if (!config.allowedDataCycleBlocks.isEmpty()
|
||||
&& !player.hasPermission("worldedit.override.data-cycler")
|
||||
&& !config.allowedDataCycleBlocks.contains(block.getBlockType().getId())) {
|
||||
player.printError(BBC.BLOCK_CYCLER_NO_PERM.s());
|
||||
player.printError(TranslatableComponent.of("worldedit.tool.data-cycler.block-not-permitted"));
|
||||
return true;
|
||||
}
|
||||
|
||||
if (block.getStates().keySet().isEmpty()) {
|
||||
player.printError(BBC.BLOCK_CYCLER_CANNOT_CYCLE.s());
|
||||
player.printError(TranslatableComponent.of("worldedit.tool.data-cycler.cant-cycle"));
|
||||
} else {
|
||||
Property<?> currentProperty = selectedProperties.get(player.getUniqueId());
|
||||
|
||||
@ -89,9 +91,13 @@ public class BlockDataCyler implements DoubleActionBlockTool {
|
||||
|
||||
try {
|
||||
editSession.setBlock(blockPoint, newBlock);
|
||||
player.print("Value of " + currentProperty.getName() + " is now " + currentProperty.getValues().get(index));
|
||||
player.printInfo(TranslatableComponent.of(
|
||||
"worldedit.tool.data-cycler.new-value",
|
||||
TextComponent.of(currentProperty.getName()),
|
||||
TextComponent.of(String.valueOf(currentProperty.getValues().get(index)))
|
||||
));
|
||||
} catch (MaxChangedBlocksException e) {
|
||||
player.printError(BBC.BLOCK_CYCLER_LIMIT.s());
|
||||
player.printError(TranslatableComponent.of("worldedit.tool.max-block-changes"));
|
||||
} finally {
|
||||
session.remember(editSession);
|
||||
}
|
||||
@ -102,7 +108,7 @@ public class BlockDataCyler implements DoubleActionBlockTool {
|
||||
index = (index + 1) % properties.size();
|
||||
currentProperty = properties.get(index);
|
||||
selectedProperties.put(player.getUniqueId(), currentProperty);
|
||||
player.print("Now cycling " + currentProperty.getName());
|
||||
player.printInfo(TranslatableComponent.of("worldedit.tool.data-cycler.cycling", TextComponent.of(currentProperty.getName())));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -30,6 +30,8 @@ import com.sk89q.worldedit.extent.inventory.BlockBag;
|
||||
import com.sk89q.worldedit.function.pattern.Pattern;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.util.Location;
|
||||
import com.sk89q.worldedit.util.formatting.text.TextComponent;
|
||||
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
|
||||
import com.sk89q.worldedit.world.block.BaseBlock;
|
||||
|
||||
/**
|
||||
@ -76,7 +78,7 @@ public class BlockReplacer implements DoubleActionBlockTool {
|
||||
|
||||
if (targetBlock != null) {
|
||||
pattern = targetBlock;
|
||||
player.print("Replacer tool switched to: " + targetBlock.getBlockType().getName());
|
||||
player.printInfo(TranslatableComponent.of("worldedit.tool.repl.switched", TextComponent.of(targetBlock.getBlockType().getName())));
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -86,6 +86,7 @@ import java.util.concurrent.locks.Lock;
|
||||
import java.util.concurrent.locks.ReentrantLock;
|
||||
import java.util.function.Supplier;
|
||||
import java.util.stream.Stream;
|
||||
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
/**
|
||||
|
@ -29,6 +29,7 @@ import com.sk89q.worldedit.function.mask.Mask;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.regions.RegionSelector;
|
||||
import com.sk89q.worldedit.util.Location;
|
||||
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
|
||||
|
||||
/**
|
||||
* A wand that can be used at a distance.
|
||||
@ -75,7 +76,7 @@ public class DistanceWand extends BrushTool implements DoubleActionTraceTool {
|
||||
}
|
||||
|
||||
if (target == null) {
|
||||
player.printError(BBC.NO_BLOCK.s());
|
||||
player.printError(TranslatableComponent.of("worldedit.tool.no-block"));
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -32,6 +32,7 @@ import com.sk89q.worldedit.extension.platform.Platform;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.util.Direction;
|
||||
import com.sk89q.worldedit.util.Location;
|
||||
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
|
||||
import com.sk89q.worldedit.world.World;
|
||||
import com.sk89q.worldedit.world.block.BlockCategories;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
@ -74,7 +75,7 @@ public class FloatingTreeRemover implements BlockTool {
|
||||
final BlockState state = world.getBlock(clicked.toVector().toBlockPoint());
|
||||
|
||||
if (!isTreeBlock(state.getBlockType())) {
|
||||
player.printError(BBC.TOOL_DELTREE_ERROR.s());
|
||||
player.printError(TranslatableComponent.of("worldedit.tool.deltree.not-tree"));
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -82,7 +83,7 @@ public class FloatingTreeRemover implements BlockTool {
|
||||
try {
|
||||
final Set<BlockVector3> blockSet = bfs(world, clicked.toVector().toBlockPoint());
|
||||
if (blockSet == null) {
|
||||
player.printError(BBC.TOOL_DELTREE_FLOATING_ERROR.s());
|
||||
player.printError(TranslatableComponent.of("worldedit.tool.deltree.not-floating"));
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -93,7 +94,7 @@ public class FloatingTreeRemover implements BlockTool {
|
||||
}
|
||||
}
|
||||
} catch (MaxChangedBlocksException e) {
|
||||
player.printError("Max blocks change limit reached.");
|
||||
player.printError(TranslatableComponent.of("worldedit.tool.max-block-changes"));
|
||||
} finally {
|
||||
session.remember(editSession);
|
||||
}
|
||||
|
@ -33,6 +33,7 @@ import com.sk89q.worldedit.function.pattern.Pattern;
|
||||
import com.sk89q.worldedit.function.visitor.RecursiveVisitor;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.util.Location;
|
||||
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
|
||||
import com.sk89q.worldedit.world.World;
|
||||
import com.sk89q.worldedit.world.block.BlockType;
|
||||
import com.sk89q.worldedit.world.block.BlockTypes;
|
||||
@ -80,7 +81,7 @@ public class FloodFillTool implements BlockTool {
|
||||
visitor.visit(origin);
|
||||
Operations.completeLegacy(visitor);
|
||||
} catch (MaxChangedBlocksException e) {
|
||||
player.printError("Max blocks change limit reached.");
|
||||
player.printError(TranslatableComponent.of("worldedit.tool.max-block-changes"));
|
||||
} finally {
|
||||
session.remember(editSession);
|
||||
}
|
||||
|
@ -32,6 +32,7 @@ import com.sk89q.worldedit.function.mask.Mask;
|
||||
import com.sk89q.worldedit.function.pattern.Pattern;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.util.Location;
|
||||
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
|
||||
import com.sk89q.worldedit.world.block.BaseBlock;
|
||||
|
||||
/**
|
||||
@ -119,7 +120,7 @@ public class LongRangeBuildTool extends BrushTool implements DoubleActionTraceTo
|
||||
}
|
||||
|
||||
if (target == null) {
|
||||
player.printError(BBC.NO_BLOCK.s());
|
||||
player.printError(TranslatableComponent.of("worldedit.tool.no-block"));
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -25,6 +25,7 @@ import com.sk89q.worldedit.entity.Player;
|
||||
import com.sk89q.worldedit.extension.platform.Actor;
|
||||
import com.sk89q.worldedit.extension.platform.Platform;
|
||||
import com.sk89q.worldedit.util.Location;
|
||||
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
|
||||
|
||||
public enum NavigationWand implements DoubleActionTraceTool {
|
||||
INSTANCE;
|
||||
|
@ -29,6 +29,7 @@ import com.sk89q.worldedit.extension.platform.Platform;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.util.Location;
|
||||
import com.sk89q.worldedit.util.formatting.text.TextComponent;
|
||||
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
|
||||
import com.sk89q.worldedit.util.formatting.text.event.HoverEvent;
|
||||
import com.sk89q.worldedit.util.formatting.text.format.TextColor;
|
||||
import com.sk89q.worldedit.world.World;
|
||||
@ -58,15 +59,15 @@ public class QueryTool implements BlockTool {
|
||||
builder.append(TextComponent.of("@" + clicked.toVector().toBlockPoint() + ": ", TextColor.BLUE));
|
||||
builder.append(TextComponent.of(block.getBlockType().getName(), TextColor.YELLOW));
|
||||
builder.append(TextComponent.of(" (" + block + ") ", TextColor.GRAY)
|
||||
.hoverEvent(HoverEvent.of(HoverEvent.Action.SHOW_TEXT, TextComponent.of("Block state"))));
|
||||
.hoverEvent(HoverEvent.of(HoverEvent.Action.SHOW_TEXT, TranslatableComponent.of("worldedit.tool.info.blockstate.hover"))));
|
||||
final OptionalInt internalId = BlockStateIdAccess.getBlockStateId(block.toImmutableState());
|
||||
if (internalId.isPresent()) {
|
||||
builder.append(TextComponent.of(" (" + internalId.getAsInt() + ") ", TextColor.DARK_GRAY)
|
||||
.hoverEvent(HoverEvent.of(HoverEvent.Action.SHOW_TEXT, TextComponent.of("Internal ID"))));
|
||||
.hoverEvent(HoverEvent.of(HoverEvent.Action.SHOW_TEXT, TranslatableComponent.of("worldedit.tool.info.internalid.hover"))));
|
||||
}
|
||||
builder.append(TextComponent.of(" (" + world.getBlockLightLevel(blockPoint) + "/"
|
||||
+ world.getBlockLightLevel(blockPoint.add(0, 1, 0)) + ")", TextColor.WHITE)
|
||||
.hoverEvent(HoverEvent.of(HoverEvent.Action.SHOW_TEXT, TextComponent.of("Block Light/Light Above"))));
|
||||
.hoverEvent(HoverEvent.of(HoverEvent.Action.SHOW_TEXT, TranslatableComponent.of("worldedit.tool.info.light.hover"))));
|
||||
|
||||
player.print(builder.build());
|
||||
|
||||
|
@ -32,6 +32,7 @@ import com.sk89q.worldedit.function.operation.Operations;
|
||||
import com.sk89q.worldedit.function.visitor.RecursiveVisitor;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.util.Location;
|
||||
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
|
||||
import com.sk89q.worldedit.world.World;
|
||||
import com.sk89q.worldedit.world.block.BlockType;
|
||||
import com.sk89q.worldedit.world.block.BlockTypes;
|
||||
|
@ -28,6 +28,7 @@ import com.sk89q.worldedit.extension.platform.Actor;
|
||||
import com.sk89q.worldedit.extension.platform.Platform;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.util.Location;
|
||||
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
|
||||
import com.sk89q.worldedit.world.World;
|
||||
import com.sk89q.worldedit.world.block.BlockType;
|
||||
import com.sk89q.worldedit.world.block.BlockTypes;
|
||||
@ -56,7 +57,7 @@ public class SinglePickaxe implements BlockTool {
|
||||
editSession.setBlock(blockPoint, BlockTypes.AIR.getDefaultState());
|
||||
session.remember(editSession);
|
||||
} catch (MaxChangedBlocksException e) {
|
||||
player.printError("Max blocks change limit reached.");
|
||||
player.printError(TranslatableComponent.of("worldedit.tool.max-block-changes"));
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -31,6 +31,7 @@ import com.sk89q.worldedit.extension.platform.Platform;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.util.Location;
|
||||
import com.sk89q.worldedit.util.TreeGenerator;
|
||||
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
|
||||
|
||||
/**
|
||||
* Plants a tree.
|
||||
@ -64,10 +65,10 @@ public class TreePlanter implements BlockTool {
|
||||
}
|
||||
|
||||
if (!successful) {
|
||||
player.printError(BBC.TOOL_TREE_ERROR_BLOCK.s());
|
||||
player.printError(TranslatableComponent.of("worldedit.tool.tree.obstructed"));
|
||||
}
|
||||
} catch (MaxChangedBlocksException e) {
|
||||
player.printError(BBC.WORLDEDIT_CANCEL_REASON_MAX_CHANGES.s());
|
||||
player.printError(TranslatableComponent.of("worldedit.tool.max-block-changes"));
|
||||
} finally {
|
||||
session.remember(editSession);
|
||||
}
|
||||
|
@ -55,7 +55,7 @@ public final class AsyncCommandBuilder<T> {
|
||||
@Nullable
|
||||
private String description;
|
||||
@Nullable
|
||||
private String delayMessage;
|
||||
private Component delayMessage;
|
||||
|
||||
@Nullable
|
||||
private Component successMessage;
|
||||
@ -84,7 +84,12 @@ public final class AsyncCommandBuilder<T> {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public AsyncCommandBuilder<T> sendMessageAfterDelay(String message) {
|
||||
return sendMessageAfterDelay(TextComponent.of(checkNotNull(message)));
|
||||
}
|
||||
|
||||
public AsyncCommandBuilder<T> sendMessageAfterDelay(Component message) {
|
||||
this.delayMessage = checkNotNull(message);
|
||||
return this;
|
||||
}
|
||||
|
@ -24,6 +24,8 @@ import static com.google.common.base.Preconditions.checkNotNull;
|
||||
import com.google.common.util.concurrent.ListenableFuture;
|
||||
import com.google.common.util.concurrent.MoreExecutors;
|
||||
import com.sk89q.worldedit.extension.platform.Actor;
|
||||
import com.sk89q.worldedit.util.formatting.text.Component;
|
||||
import com.sk89q.worldedit.util.formatting.text.TextComponent;
|
||||
|
||||
import java.util.Timer;
|
||||
|
||||
@ -34,7 +36,12 @@ public class FutureProgressListener implements Runnable {
|
||||
|
||||
private final MessageTimerTask task;
|
||||
|
||||
@Deprecated
|
||||
public FutureProgressListener(Actor sender, String message) {
|
||||
this(sender, TextComponent.of(message));
|
||||
}
|
||||
|
||||
public FutureProgressListener(Actor sender, Component message) {
|
||||
checkNotNull(sender);
|
||||
checkNotNull(message);
|
||||
|
||||
@ -47,8 +54,13 @@ public class FutureProgressListener implements Runnable {
|
||||
task.cancel();
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public static void addProgressListener(ListenableFuture<?> future, Actor sender, String message) {
|
||||
future.addListener(new FutureProgressListener(sender, message), MoreExecutors.directExecutor());
|
||||
}
|
||||
|
||||
public static void addProgressListener(ListenableFuture<?> future, Actor sender, Component message) {
|
||||
future.addListener(new FutureProgressListener(sender, message), MoreExecutors.directExecutor());
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -22,15 +22,22 @@ package com.sk89q.worldedit.command.util;
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import com.sk89q.worldedit.extension.platform.Actor;
|
||||
import com.sk89q.worldedit.util.formatting.text.Component;
|
||||
import com.sk89q.worldedit.util.formatting.text.TextComponent;
|
||||
|
||||
import java.util.TimerTask;
|
||||
|
||||
public class MessageTimerTask extends TimerTask {
|
||||
|
||||
private final Actor sender;
|
||||
private final String message;
|
||||
private final Component message;
|
||||
|
||||
@Deprecated
|
||||
MessageTimerTask(Actor sender, String message) {
|
||||
this(sender, TextComponent.of(message));
|
||||
}
|
||||
|
||||
MessageTimerTask(Actor sender, Component message) {
|
||||
checkNotNull(sender);
|
||||
checkNotNull(message);
|
||||
|
||||
|
@ -30,6 +30,8 @@ import com.sk89q.worldedit.extension.platform.Actor;
|
||||
import com.sk89q.worldedit.util.formatting.component.CommandListBox;
|
||||
import com.sk89q.worldedit.util.formatting.component.CommandUsageBox;
|
||||
import com.sk89q.worldedit.util.formatting.component.InvalidComponentException;
|
||||
import com.sk89q.worldedit.util.formatting.text.TextComponent;
|
||||
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@ -76,7 +78,7 @@ public class PrintCommandHelp {
|
||||
List<Command> visited = new ArrayList<>();
|
||||
Command currentCommand = detectCommand(manager, commandPath.get(0));
|
||||
if (currentCommand == null) {
|
||||
actor.printError(String.format("The command '%s' could not be found.", commandPath.get(0)));
|
||||
actor.printError(TranslatableComponent.of("worldedit.help.command-not-found", TextComponent.of(commandPath.get(0))));
|
||||
return;
|
||||
}
|
||||
visited.add(currentCommand);
|
||||
@ -87,8 +89,8 @@ public class PrintCommandHelp {
|
||||
Map<String, Command> subCommands = getSubCommands(currentCommand);
|
||||
|
||||
if (subCommands.isEmpty()) {
|
||||
actor.printError(String.format("'%s' has no sub-commands. (Maybe '%s' is for a parameter?)",
|
||||
toCommandString(visited), subCommand));
|
||||
actor.printError(TranslatableComponent.of("worldedit.help.no-subcommands",
|
||||
TextComponent.of(toCommandString(visited)), TextComponent.of(subCommand)));
|
||||
// full help for single command
|
||||
CommandUsageBox box = new CommandUsageBox(visited, visited.stream()
|
||||
.map(Command::getName).collect(Collectors.joining(" ")), helpRootCommand);
|
||||
@ -100,8 +102,8 @@ public class PrintCommandHelp {
|
||||
currentCommand = subCommands.get(subCommand);
|
||||
visited.add(currentCommand);
|
||||
} else {
|
||||
actor.printError(String.format("The sub-command '%s' under '%s' could not be found.",
|
||||
subCommand, toCommandString(visited)));
|
||||
actor.printError(TranslatableComponent.of("worldedit.help.subcommand-not-found",
|
||||
TextComponent.of(subCommand), TextComponent.of(toCommandString(visited))));
|
||||
// list subcommands for currentCommand
|
||||
printCommands(page, getSubCommands(Iterables.getLast(visited)).values().stream(), actor, visited, helpRootCommand);
|
||||
return;
|
||||
|
@ -22,6 +22,7 @@ package com.sk89q.worldedit.command.util;
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
import com.sk89q.worldedit.extension.platform.Actor;
|
||||
import com.sk89q.worldedit.util.formatting.text.Component;
|
||||
import com.sk89q.worldedit.util.formatting.text.TextComponent;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.concurrent.Callable;
|
||||
@ -33,13 +34,18 @@ public final class WorldEditAsyncCommandBuilder {
|
||||
private WorldEditAsyncCommandBuilder() {
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public static void createAndSendMessage(Actor actor, Callable<Component> task, @Nullable String desc) {
|
||||
createAndSendMessage(actor, task, desc != null ? TextComponent.of(desc) : null);
|
||||
}
|
||||
|
||||
public static void createAndSendMessage(Actor actor, Callable<Component> task, @Nullable Component desc) {
|
||||
final AsyncCommandBuilder<Component> builder = AsyncCommandBuilder.wrap(task, actor);
|
||||
if (desc != null) {
|
||||
builder.sendMessageAfterDelay(desc);
|
||||
}
|
||||
builder
|
||||
.onSuccess((String) null, actor::print)
|
||||
.onSuccess((String) null, actor::printInfo)
|
||||
.onFailure((String) null, WorldEdit.getInstance().getPlatformManager().getPlatformCommandManager().getExceptionConverter())
|
||||
.buildAndExec(WorldEdit.getInstance().getExecutorService());
|
||||
}
|
||||
|
Reference in New Issue
Block a user