Finalize Captions

Follow up to a9d1202ce1
This commit is contained in:
NotMyFault 2021-04-05 19:54:49 +02:00
parent a9d1202ce1
commit 5e534ff9e2
No known key found for this signature in database
GPG Key ID: 158F5701A6AAD00C
135 changed files with 671 additions and 622 deletions

View File

@ -2,7 +2,6 @@ package com.boydti.fawe.bukkit.adapter;
import com.boydti.fawe.FAWEPlatformAdapterImpl;
import com.boydti.fawe.beta.IChunkGet;
import com.boydti.fawe.beta.implementation.chunk.ChunkHolder;
import com.boydti.fawe.config.Settings;
import com.sk89q.worldedit.bukkit.WorldEditPlugin;
import com.sk89q.worldedit.math.BlockVector3;

View File

@ -1,6 +1,5 @@
package com.boydti.fawe.bukkit.filter;
import com.boydti.fawe.object.RunnableVal;
import com.boydti.fawe.regions.general.CuboidRegionFilter;
import com.boydti.fawe.util.TaskManager;
import com.sk89q.worldedit.math.BlockVector2;

View File

@ -3,7 +3,6 @@ package com.boydti.fawe.bukkit.preloader;
import com.boydti.fawe.Fawe;
import com.sk89q.worldedit.bukkit.BukkitAdapter;
import com.sk89q.worldedit.math.BlockVector2;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.regions.Region;
import org.bukkit.Server;
import org.bukkit.World;
@ -19,7 +18,6 @@ import org.jetbrains.annotations.Nullable;
import java.io.File;
import java.io.InputStream;
import java.lang.ref.PhantomReference;
import java.util.Iterator;
import java.util.List;
import java.util.Set;

View File

@ -1,7 +1,6 @@
package com.boydti.fawe.bukkit.regions;
import com.boydti.fawe.regions.FaweMaskManager;
import org.bukkit.entity.Player;
import org.bukkit.permissions.Permissible;
public abstract class BukkitMaskManager extends FaweMaskManager {

View File

@ -7,7 +7,6 @@ import com.sk89q.jnbt.CompoundTag;
import com.sk89q.worldedit.blocks.BaseItemStack;
import com.sk89q.worldedit.world.item.ItemType;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
import javax.annotation.Nullable;

View File

@ -21,8 +21,6 @@ package com.sk89q.worldedit.bukkit;
import com.sk89q.worldedit.EditSession;
import com.sk89q.worldedit.MaxChangedBlocksException;
import com.sk89q.worldedit.math.BlockVector3;
import org.bukkit.BlockChangeDelegate;
import org.bukkit.block.data.BlockData;

View File

@ -82,7 +82,6 @@ import java.nio.file.Paths;
import java.util.List;
import java.util.Locale;
import java.util.Optional;
import java.util.logging.Level;
import static com.boydti.fawe.bukkit.util.JavaVersionCheck.checkJvm;
import static com.google.common.base.Preconditions.checkNotNull;

View File

@ -19,8 +19,8 @@
package com.sk89q.worldedit.bukkit;
import com.boydti.fawe.config.Caption;
import com.sk89q.worldedit.WorldEditException;
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
/**
* Thrown if the world has been unloaded.
@ -31,6 +31,6 @@ class WorldUnloadedException extends WorldEditException {
* Create a new instance.
*/
WorldUnloadedException() {
super(TranslatableComponent.of("worldedit.error.world-unloaded"));
super(Caption.of("worldedit.error.world-unloaded"));
}
}

View File

@ -12,7 +12,6 @@ import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.math.Vector3;
import com.sk89q.worldedit.registry.state.Property;
import com.sk89q.worldedit.util.Direction;
import com.sk89q.worldedit.util.SideEffectSet;
import com.sk89q.worldedit.world.DataFixer;
import com.sk89q.worldedit.world.biome.BiomeType;
import com.sk89q.worldedit.world.block.BaseBlock;

View File

@ -19,6 +19,7 @@
package com.sk89q.worldedit.cli;
import com.boydti.fawe.config.Caption;
import com.sk89q.worldedit.WorldEdit;
import com.sk89q.worldedit.cli.data.FileRegistries;
import com.sk89q.worldedit.cli.schematic.ClipboardWorld;
@ -33,7 +34,6 @@ import com.sk89q.worldedit.extent.clipboard.io.ClipboardFormats;
import com.sk89q.worldedit.extent.clipboard.io.ClipboardReader;
import com.sk89q.worldedit.internal.util.LogManagerCompat;
import com.sk89q.worldedit.registry.state.Property;
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
import com.sk89q.worldedit.world.biome.BiomeType;
import com.sk89q.worldedit.world.block.BlockCategory;
import com.sk89q.worldedit.world.block.BlockState;
@ -238,13 +238,13 @@ public class CLIWorldEdit {
while (scanner.hasNextLine()) {
String line = scanner.nextLine();
if (line.equals("stop")) {
commandSender.printInfo(TranslatableComponent.of("worldedit.cli.stopping"));
commandSender.print(Caption.of("worldedit.cli.stopping"));
break;
}
CommandEvent event = new CommandEvent(commandSender, line);
WorldEdit.getInstance().getEventBus().post(event);
if (!event.isCancelled()) {
commandSender.printError(TranslatableComponent.of("worldedit.cli.unknown-command"));
commandSender.print(Caption.of("worldedit.cli.unknown-command"));
} else {
saveAllWorlds(false);
}

View File

@ -4,6 +4,7 @@ import com.boydti.fawe.beta.IChunkSet;
import com.boydti.fawe.beta.Trimable;
import com.boydti.fawe.beta.implementation.queue.Pool;
import com.boydti.fawe.beta.implementation.queue.QueuePool;
import com.boydti.fawe.config.Caption;
import com.boydti.fawe.config.Settings;
import com.boydti.fawe.object.collection.BitArray;
import com.boydti.fawe.object.collection.BitArrayUnstretched;
@ -143,15 +144,15 @@ public enum FaweCache implements Trimable {
*/
public static final FaweChunkLoadException CHUNK = new FaweChunkLoadException();
public static final FaweBlockBagException BLOCK_BAG = new FaweBlockBagException();
public static final FaweException MANUAL = new FaweException(TranslatableComponent.of("fawe.cancel.worldedit.cancel.reason.manual"));
public static final FaweException NO_REGION = new FaweException(TranslatableComponent.of("fawe.cancel.worldedit.cancel.reason.no.region"));
public static final FaweException OUTSIDE_REGION = new FaweException(TranslatableComponent.of("fawe.cancel.worldedit.cancel.reason.outside.region"));
public static final FaweException MAX_CHECKS = new FaweException(TranslatableComponent.of("fawe.cancel.worldedit.cancel.reason.max.checks"));
public static final FaweException MAX_CHANGES = new FaweException(TranslatableComponent.of("fawe.cancel.worldedit.cancel.reason.max.changes"));
public static final FaweException LOW_MEMORY = new FaweException(TranslatableComponent.of("fawe.cancel.worldedit.cancel.reason.low.memory"));
public static final FaweException MAX_ENTITIES = new FaweException(TranslatableComponent.of("fawe.cancel.worldedit.cancel.reason.max.entities"));
public static final FaweException MAX_TILES = new FaweException(TranslatableComponent.of("fawe.cancel.worldedit.cancel.reason.max.tiles"));
public static final FaweException MAX_ITERATIONS = new FaweException(TranslatableComponent.of("fawe.cancel.worldedit.cancel.reason.max.iterations"));
public static final FaweException MANUAL = new FaweException(Caption.of("fawe.cancel.worldedit.cancel.reason.manual"));
public static final FaweException NO_REGION = new FaweException(Caption.of("fawe.cancel.worldedit.cancel.reason.no.region"));
public static final FaweException OUTSIDE_REGION = new FaweException(Caption.of("fawe.cancel.worldedit.cancel.reason.outside.region"));
public static final FaweException MAX_CHECKS = new FaweException(Caption.of("fawe.cancel.worldedit.cancel.reason.max.checks"));
public static final FaweException MAX_CHANGES = new FaweException(Caption.of("fawe.cancel.worldedit.cancel.reason.max.changes"));
public static final FaweException LOW_MEMORY = new FaweException(Caption.of("fawe.cancel.worldedit.cancel.reason.low.memory"));
public static final FaweException MAX_ENTITIES = new FaweException(Caption.of("fawe.cancel.worldedit.cancel.reason.max.entities"));
public static final FaweException MAX_TILES = new FaweException(Caption.of("fawe.cancel.worldedit.cancel.reason.max.tiles"));
public static final FaweException MAX_ITERATIONS = new FaweException(Caption.of("fawe.cancel.worldedit.cancel.reason.max.iterations"));
/*
thread cache

View File

@ -69,7 +69,7 @@ public class CatenaryBrush implements Brush, ResettableTool {
e.printStackTrace();
}
if (!visual) {
player.print(TranslatableComponent.of("fawe.worldedit.brush.brush.line.secondary"));
player.print(Caption.of("fawe.worldedit.brush.brush.line.secondary"));
if (!select) {
pos1 = null;
return;

View File

@ -45,7 +45,7 @@ public class CopyPastaBrush implements Brush, ResettableTool {
@Override
public boolean reset() {
session.setClipboard(null);
player.print(TranslatableComponent.of("fawe.worldedit.brush.brush.reset"));
player.print(Caption.of("fawe.worldedit.brush.brush.reset"));
return true;
}

View File

@ -1,5 +1,6 @@
package com.boydti.fawe.object.brush;
import com.boydti.fawe.config.Caption;
import com.boydti.fawe.object.brush.heightmap.HeightMap;
import com.boydti.fawe.object.brush.heightmap.RotatableHeightMap;
import com.boydti.fawe.object.brush.heightmap.ScalableHeightMap;
@ -44,7 +45,7 @@ public class HeightBrush implements Brush {
try {
heightMap = ScalableHeightMap.fromPNG(stream);
} catch (IOException e) {
throw new FaweException(TranslatableComponent.of("fawe.worldedit.brush.brush.height.invalid"));
throw new FaweException(Caption.of("fawe.worldedit.brush.brush.height.invalid"));
}
} else if (clipboard != null) {
heightMap = ScalableHeightMap.fromClipboard(clipboard);

View File

@ -34,7 +34,7 @@ public class LineBrush implements Brush, ResettableTool {
}
editSession.drawLine(pattern, pos1, position, size, !shell, flat);
if (!visual) {
editSession.getPlayer().print(TranslatableComponent.of("fawe.worldedit.brush.brush.line.secondary"));
editSession.getPlayer().print(Caption.of("fawe.worldedit.brush.brush.line.secondary"));
if (!select) {
pos1 = null;
} else {

View File

@ -1,6 +1,7 @@
package com.boydti.fawe.object.brush;
import com.boydti.fawe.FaweCache;
import com.boydti.fawe.config.Caption;
import com.boydti.fawe.object.brush.visualization.VisualExtent;
import com.boydti.fawe.object.mask.IdMask;
import com.boydti.fawe.object.visitor.DFSRecursiveVisitor;
@ -16,7 +17,6 @@ import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.math.MutableVector3;
import com.sk89q.worldedit.math.Vector3;
import com.sk89q.worldedit.math.interpolation.Node;
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
import java.util.ArrayList;
import java.util.Collection;
@ -93,13 +93,13 @@ public class SplineBrush implements Brush, ResettableTool {
points.add(position);
}
this.positionSets.add(points);
player.print(TranslatableComponent.of("fawe.worldedit.brush.spline.primary.2"));
player.print(Caption.of("fawe.worldedit.brush.spline.primary.2"));
if (!visualization) {
return;
}
}
if (positionSets.size() < 2) {
player.print(TranslatableComponent.of("fawe.worldedit.brush.brush.spline.secondary.error"));
player.print(Caption.of("fawe.worldedit.brush.brush.spline.secondary.error"));
return;
}
List<Vector3> centroids = new ArrayList<>();
@ -131,7 +131,7 @@ public class SplineBrush implements Brush, ResettableTool {
}
editSession.drawSpline(pattern, currentSpline, 0, 0, 0, 10, 0, true);
}
player.print(TranslatableComponent.of("fawe.worldedit.brush.spline.secondary"));
player.print(Caption.of("fawe.worldedit.brush.spline.secondary"));
if (visualization) {
numSplines = originalSize;
positionSets.remove(positionSets.size() - 1);

View File

@ -1,5 +1,6 @@
package com.boydti.fawe.object.brush;
import com.boydti.fawe.config.Caption;
import com.boydti.fawe.object.brush.visualization.VisualExtent;
import com.boydti.fawe.object.collection.LocalBlockVectorSet;
import com.boydti.fawe.util.MathMan;
@ -43,7 +44,7 @@ public class SurfaceSpline implements Brush {
return;
}
path.add(BlockVector3.at(pos.getBlockX(), max, pos.getBlockZ()));
editSession.getPlayer().printInfo(TranslatableComponent.of("fawe.worldedit.brush.spline.primary.2"));
editSession.getPlayer().print(Caption.of("fawe.worldedit.brush.spline.primary.2"));
if (!vis) {
return;
}
@ -107,6 +108,6 @@ public class SurfaceSpline implements Brush {
path.clear();
}
}
editSession.getPlayer().printInfo(TranslatableComponent.of("fawe.worldedit.brush.spline.secondary"));
editSession.getPlayer().print(Caption.of("fawe.worldedit.brush.spline.secondary"));
}
}

View File

@ -1,5 +1,6 @@
package com.boydti.fawe.object.brush.sweep;
import com.boydti.fawe.config.Caption;
import com.boydti.fawe.object.brush.ResettableTool;
import com.boydti.fawe.object.brush.visualization.VisualExtent;
import com.sk89q.worldedit.EditSession;
@ -18,7 +19,6 @@ import com.sk89q.worldedit.math.interpolation.Node;
import com.sk89q.worldedit.math.interpolation.ReparametrisingInterpolation;
import com.sk89q.worldedit.math.transform.AffineTransform;
import com.sk89q.worldedit.session.ClipboardHolder;
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
import java.util.ArrayList;
import java.util.List;
@ -53,13 +53,13 @@ public class SweepBrush implements Brush, ResettableTool {
return;
}
if (newPos) {
player.print(TranslatableComponent.of("fawe.worldedit.brush.spline.primary.2"));
player.print(Caption.of("fawe.worldedit.brush.spline.primary.2"));
positions.add(position);
return;
}
if (positions.size() < 2) {
player.printError(TranslatableComponent.of("fawe.worldedit.brush.brush.spline.secondary.error"));
player.print(Caption.of("fawe.worldedit.brush.brush.spline.secondary.error"));
return;
}
@ -111,7 +111,7 @@ public class SweepBrush implements Brush, ResettableTool {
break;
}
}
player.print(TranslatableComponent.of("fawe.worldedit.brush.spline.secondary"));
player.print(Caption.of("fawe.worldedit.brush.spline.secondary"));
reset();
}

View File

@ -1,9 +1,9 @@
package com.boydti.fawe.object.exception;
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
import com.boydti.fawe.config.Caption;
public class FaweBlockBagException extends FaweException {
public FaweBlockBagException() {
super(TranslatableComponent.of("fawe.error.worldedit.some.fails.blockbag"));
super(Caption.of("fawe.error.worldedit.some.fails.blockbag"));
}
}

View File

@ -1,9 +1,9 @@
package com.boydti.fawe.object.exception;
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
import com.boydti.fawe.config.Caption;
public class FaweChunkLoadException extends FaweException {
public FaweChunkLoadException() {
super(TranslatableComponent.of("fawe.cancel.worldedit.failed.load.chunk"));
super(Caption.of("fawe.cancel.worldedit.failed.load.chunk"));
}
}

View File

@ -1,13 +1,13 @@
package com.boydti.fawe.object.extent;
import com.boydti.fawe.FaweCache;
import com.boydti.fawe.config.Caption;
import com.boydti.fawe.util.MemUtil;
import com.boydti.fawe.util.Permission;
import com.boydti.fawe.util.WEManager;
import com.sk89q.worldedit.entity.Player;
import com.sk89q.worldedit.extent.Extent;
import com.sk89q.worldedit.extent.PassthroughExtent;
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
public class MemoryCheckingExtent extends PassthroughExtent {
@ -22,10 +22,10 @@ public class MemoryCheckingExtent extends PassthroughExtent {
public Extent getExtent() {
if (MemUtil.isMemoryLimited()) {
if (this.player != null) {
player.print(TranslatableComponent.of("fawe.cancel.worldedit.cancel.reason",
TranslatableComponent.of("fawe.cancel.worldedit.cancel.reason.low.memory")));
player.print(Caption.of("fawe.cancel.worldedit.cancel.reason",
Caption.of("fawe.cancel.worldedit.cancel.reason.low.memory")));
if (Permission.hasPermission(this.player, "worldedit.fast")) {
this.player.print(TranslatableComponent.of("fawe.info.worldedit.oom.admin"));
this.player.print(Caption.of("fawe.info.worldedit.oom.admin"));
}
}
WEManager.IMP.cancelEdit(this, FaweCache.LOW_MEMORY);

View File

@ -7,7 +7,6 @@ import com.boydti.fawe.util.TaskManager;
import com.sk89q.worldedit.entity.Player;
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 java.util.function.BiConsumer;
@ -104,7 +103,7 @@ public class DefaultProgressTracker implements BiConsumer<DefaultProgressTracker
}
public void doneTask() {
sendTile(TextComponent.empty(), TranslatableComponent.of("fawe.progress.progress.finished"));
sendTile(TextComponent.empty(), Caption.of("fawe.progress.progress.finished"));
}
public void sendTask() {

View File

@ -1,5 +1,6 @@
package com.boydti.fawe.object.regions;
import com.boydti.fawe.config.Caption;
import com.boydti.fawe.object.collection.BlockVectorSet;
import com.sk89q.worldedit.EditSession;
import com.sk89q.worldedit.extent.Extent;
@ -9,7 +10,6 @@ import com.sk89q.worldedit.function.visitor.RecursiveVisitor;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.regions.AbstractRegion;
import com.sk89q.worldedit.regions.RegionOperationException;
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
import com.sk89q.worldedit.world.World;
import org.jetbrains.annotations.NotNull;
@ -106,12 +106,12 @@ public class FuzzyRegion extends AbstractRegion {
@Override
public void expand(BlockVector3... changes) throws RegionOperationException {
throw new RegionOperationException(TranslatableComponent.of("fawe.error.selection-expand"));
throw new RegionOperationException(Caption.of("fawe.error.selection-expand"));
}
@Override
public void contract(BlockVector3... changes) throws RegionOperationException {
throw new RegionOperationException(TranslatableComponent.of("fawe.error.selection-contract"));
throw new RegionOperationException(Caption.of("fawe.error.selection-contract"));
}
@Override
@ -121,7 +121,7 @@ public class FuzzyRegion extends AbstractRegion {
@Override
public void shift(BlockVector3 change) throws RegionOperationException {
throw new RegionOperationException(TranslatableComponent.of("fawe.error.selection-shift"));
throw new RegionOperationException(Caption.of("fawe.error.selection-shift"));
}
public void setExtent(EditSession extent) {

View File

@ -1,5 +1,6 @@
package com.boydti.fawe.object.visitor;
import com.boydti.fawe.config.Caption;
import com.boydti.fawe.object.IntTriple;
import com.google.common.collect.Lists;
import com.sk89q.worldedit.WorldEditException;
@ -9,8 +10,6 @@ import com.sk89q.worldedit.function.operation.RunContext;
import com.sk89q.worldedit.math.BlockVector3;
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.format.TextColor;
import java.util.ArrayDeque;
import java.util.ArrayList;
@ -144,10 +143,10 @@ public abstract class DFSVisitor implements Operation {
}
public Iterable<Component> getStatusMessages() {
return Lists.newArrayList(TranslatableComponent.of(
return Lists.newArrayList(Caption.of(
"fawe.worldedit.visitor.visitor.block",
TextComponent.of(getAffected())
).color(TextColor.GRAY));
));
}
public int getAffected() {

View File

@ -10,6 +10,7 @@ import com.boydti.fawe.beta.implementation.lighting.RelightProcessor;
import com.boydti.fawe.beta.implementation.lighting.Relighter;
import com.boydti.fawe.beta.implementation.processors.LimitExtent;
import com.boydti.fawe.beta.implementation.queue.ParallelQueueExtent;
import com.boydti.fawe.config.Caption;
import com.boydti.fawe.config.Settings;
import com.boydti.fawe.logging.rollback.RollbackOptimizedHistory;
import com.boydti.fawe.object.FaweLimit;
@ -40,6 +41,7 @@ import com.sk89q.worldedit.internal.util.LogManagerCompat;
import com.sk89q.worldedit.regions.Region;
import com.sk89q.worldedit.util.Identifiable;
import com.sk89q.worldedit.util.eventbus.EventBus;
import com.sk89q.worldedit.util.formatting.text.TextComponent;
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
import com.sk89q.worldedit.world.World;
import org.apache.logging.log4j.Logger;
@ -240,11 +242,11 @@ public class EditSessionBuilder {
}
if (Settings.IMP.EXTENT.DEBUG) {
if (event.getActor() != null) {
event.getActor().printDebug(TranslatableComponent.of("Potentially unsafe extent blocked: " + toReturn.getClass().getName()));
event.getActor().printDebug(TranslatableComponent.of(" - For area restrictions, it is recommended to use the FaweAPI"));
event.getActor().printDebug(TranslatableComponent.of(" - For block logging, it is recommended to use BlocksHub"));
event.getActor().printDebug(TranslatableComponent.of(" - To allow this plugin add it to the FAWE `allowed-plugins` list"));
event.getActor().printDebug(TranslatableComponent.of(" - To hide this message set `debug` to false in the FAWE config.yml"));
event.getActor().printDebug(TextComponent.of("Potentially unsafe extent blocked: " + toReturn.getClass().getName()));
event.getActor().printDebug(TextComponent.of(" - For area restrictions, it is recommended to use the FaweAPI"));
event.getActor().printDebug(TextComponent.of(" - For block logging, it is recommended to use BlocksHub"));
event.getActor().printDebug(TextComponent.of(" - To allow this plugin add it to the FAWE `allowed-plugins` list"));
event.getActor().printDebug(TextComponent.of(" - To hide this message set `debug` to false in the FAWE config.yml"));
} else {
LOGGER.debug("Potentially unsafe extent blocked: " + toReturn.getClass().getName());
LOGGER.debug(" - For area restrictions, it is recommended to use the FaweAPI");
@ -300,7 +302,7 @@ public class EditSessionBuilder {
if (checkMemory) {
if (MemUtil.isMemoryLimitedSlow()) {
if (Permission.hasPermission(player, "worldedit.fast")) {
player.print(TranslatableComponent.of("fawe.info.worldedit.oom.admin"));
player.print(Caption.of("fawe.info.worldedit.oom.admin"));
}
throw FaweCache.LOW_MEMORY;
}

View File

@ -1,6 +1,7 @@
package com.boydti.fawe.util;
import com.boydti.fawe.Fawe;
import com.boydti.fawe.config.Caption;
import com.boydti.fawe.config.Settings;
import com.boydti.fawe.object.FaweInputStream;
import com.boydti.fawe.object.FaweOutputStream;
@ -880,7 +881,7 @@ public class MainUtil {
long age = now - file.lastModified();
if (age > timeDiff) {
pool.submit(file::delete);
Component msg = TranslatableComponent.of("worldedit.schematic.delete.deleted");
Component msg = Caption.of("worldedit.schematic.delete.deleted");
if (printDebug) {
LOGGER.debug(msg.toString());
}

View File

@ -1,5 +1,6 @@
package com.boydti.fawe.util;
import com.boydti.fawe.config.Caption;
import com.boydti.fawe.config.Settings;
import com.boydti.fawe.object.RegionWrapper;
import com.boydti.fawe.object.exception.FaweException;
@ -89,7 +90,7 @@ public class WEManager {
backupRegions.add(region);
}
} else {
player.printDebug(TextComponent.of("Invalid Mask"));
player.print(Caption.of("Invalid Mask"));
removed = true;
iterator.remove();
}

View File

@ -1,6 +1,7 @@
package com.boydti.fawe.util.image;
import com.boydti.fawe.Fawe;
import com.boydti.fawe.config.Caption;
import com.boydti.fawe.config.Settings;
import com.boydti.fawe.util.MainUtil;
import com.boydti.fawe.util.MathMan;
@ -175,7 +176,7 @@ public class ImageUtil {
try {
return MainUtil.readImage(getInputStream(uri));
} catch (IOException e) {
throw new InputParseException(TranslatableComponent.of(e.getMessage()));
throw new InputParseException(Caption.of(e.getMessage()));
}
}
@ -188,7 +189,7 @@ public class ImageUtil {
}
return new URL(uriStr).openStream();
} catch (IOException e) {
throw new InputParseException(TranslatableComponent.of(e.getMessage()));
throw new InputParseException(Caption.of(e.getMessage()));
}
}
@ -211,9 +212,9 @@ public class ImageUtil {
Settings.IMP.PATHS.HEIGHTMAP), arg);
return MainUtil.readImage(file);
}
throw new InputParseException(TranslatableComponent.of("fawe.error.invalid-image", TextComponent.of(arg)));
throw new InputParseException(Caption.of("fawe.error.invalid-image", TextComponent.of(arg)));
} catch (IOException e) {
throw new InputParseException(TranslatableComponent.of(e.getMessage()));
throw new InputParseException(Caption.of(e.getMessage()));
}
}
@ -230,16 +231,16 @@ public class ImageUtil {
File file = MainUtil.getFile(MainUtil.getFile(Fawe.imp().getDirectory(),
Settings.IMP.PATHS.HEIGHTMAP), arg);
if (!file.exists()) {
throw new InputParseException(TranslatableComponent.of("fawe.error.file-not-found", TextComponent.of(String.valueOf(file))));
throw new InputParseException(Caption.of("fawe.error.file-not-found", TextComponent.of(String.valueOf(file))));
}
if (file.isDirectory()) {
throw new InputParseException(TranslatableComponent.of("fawe.error.file-is-invalid-directory", TextComponent.of(String.valueOf(file))));
throw new InputParseException(Caption.of("fawe.error.file-is-invalid-directory", TextComponent.of(String.valueOf(file))));
}
return file.toURI();
}
throw new InputParseException(TranslatableComponent.of("fawe.error.invalid-image", TextComponent.of(arg)));
throw new InputParseException(Caption.of("fawe.error.invalid-image", TextComponent.of(arg)));
} catch (IOException | URISyntaxException e) {
throw new InputParseException(TranslatableComponent.of(e.getMessage()));
throw new InputParseException(Caption.of(e.getMessage()));
}
}
}

View File

@ -1086,9 +1086,9 @@ public class EditSession extends PassthroughExtent implements AutoCloseable {
if (used.MAX_CHANGES > 0 || used.MAX_ENTITIES > 0) {
player.print(Caption.of("fawe.error.worldedit.some.fails", used.MAX_FAILS));
} else if (new ExtentTraverser<>(getExtent()).findAndGet(FaweRegionExtent.class) != null) {
player.printError(TranslatableComponent.of("fawe.cancel.worldedit.cancel.reason.outside.region"));
player.print(Caption.of("fawe.cancel.worldedit.cancel.reason.outside.region"));
} else {
player.printError(TranslatableComponent.of("fawe.cancel.worldedit.cancel.reason.outside.level"));
player.print(Caption.of("fawe.cancel.worldedit.cancel.reason.outside.level"));
}
}
if (wnaMode) {
@ -1112,7 +1112,7 @@ public class EditSession extends PassthroughExtent implements AutoCloseable {
}
}
} catch (Throwable e) {
player.printError(TranslatableComponent.of("fawe.error.lighting"));
player.print(Caption.of("fawe.error.lighting"));
e.printStackTrace();
}
// Enqueue it

View File

@ -19,7 +19,7 @@
package com.sk89q.worldedit;
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
import com.boydti.fawe.config.Caption;
/**
* Raised when a world is missing but is required.
@ -27,6 +27,6 @@ import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
public class MissingWorldException extends WorldEditException {
public MissingWorldException() {
super(TranslatableComponent.of("worldedit.error.missing-world"));
super(Caption.of("worldedit.error.missing-world"));
}
}

View File

@ -19,8 +19,8 @@
package com.sk89q.worldedit;
import com.boydti.fawe.config.Caption;
import com.sk89q.worldedit.util.formatting.text.TextComponent;
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
import com.sk89q.worldedit.world.item.ItemType;
/**
@ -32,7 +32,7 @@ public class NotABlockException extends WorldEditException {
* Create a new instance.
*/
public NotABlockException() {
super(TranslatableComponent.of("worldedit.error.not-a-block"));
super(Caption.of("worldedit.error.not-a-block"));
}
/**
@ -42,7 +42,7 @@ public class NotABlockException extends WorldEditException {
*/
@Deprecated
public NotABlockException(String input) {
super(TranslatableComponent.of("worldedit.error.not-a-block.item", TextComponent.of(input)));
super(Caption.of("worldedit.error.not-a-block.item", TextComponent.of(input)));
}
/**
@ -52,7 +52,7 @@ public class NotABlockException extends WorldEditException {
*/
@Deprecated
public NotABlockException(int input) {
super(TranslatableComponent.of("worldedit.error.not-a-block.item", TextComponent.of(input)));
super(Caption.of("worldedit.error.not-a-block.item", TextComponent.of(input)));
}
/**
@ -61,6 +61,6 @@ public class NotABlockException extends WorldEditException {
* @param input the input that was used
*/
public NotABlockException(ItemType input) {
super(TranslatableComponent.of("worldedit.error.not-a-block.item", input.getRichName()));
super(Caption.of("worldedit.error.not-a-block.item", input.getRichName()));
}
}

View File

@ -19,8 +19,8 @@
package com.sk89q.worldedit;
import com.boydti.fawe.config.Caption;
import com.sk89q.worldedit.util.formatting.text.TextComponent;
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
/**
* Thrown when an unknown direction is specified or detected.
@ -35,7 +35,7 @@ public class UnknownDirectionException extends WorldEditException {
* @param dir the input that was tried
*/
public UnknownDirectionException(String dir) {
super(TranslatableComponent.of("worldedit.error.unknown-direction", TextComponent.of(dir)));
super(Caption.of("worldedit.error.unknown-direction", TextComponent.of(dir)));
this.dir = dir;
}

View File

@ -19,6 +19,7 @@
package com.sk89q.worldedit;
import com.boydti.fawe.config.Caption;
import com.google.common.base.Throwables;
import com.google.common.collect.HashMultimap;
import com.google.common.collect.ImmutableList;
@ -58,7 +59,6 @@ import com.sk89q.worldedit.util.concurrency.EvenMoreExecutors;
import com.sk89q.worldedit.util.concurrency.LazyReference;
import com.sk89q.worldedit.util.eventbus.EventBus;
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.io.file.FileSelectionAbortedException;
import com.sk89q.worldedit.util.io.file.FilenameException;
@ -315,7 +315,7 @@ public final class WorldEdit {
}
if (f == null) {
throw new FileSelectionAbortedException(TranslatableComponent.of("worldedit.error.no-file-selected"));
throw new FileSelectionAbortedException(Caption.of("worldedit.error.no-file-selected"));
}
} else {
List<String> exts = extensions == null ? ImmutableList.of(defaultExt) : Lists.asList(defaultExt, extensions);
@ -334,12 +334,12 @@ public final class WorldEdit {
boolean isSym = existingParent != null && !existingParent.toRealPath().equals(existingParent);
if (!inDir || (!getConfiguration().allowSymlinks && isSym)) {
throw new FilenameResolutionException(filename, TranslatableComponent.of("worldedit.error.file-resolution.outside-root"));
throw new FilenameResolutionException(filename, Caption.of("worldedit.error.file-resolution.outside-root"));
}
return filePath.toFile();
} catch (IOException e) {
throw new FilenameResolutionException(filename, TranslatableComponent.of("worldedit.error.file-resolution.resolve-failed"));
throw new FilenameResolutionException(filename, Caption.of("worldedit.error.file-resolution.resolve-failed"));
}
}
@ -366,7 +366,7 @@ public final class WorldEdit {
result = getSafeFileWithExtension(dir, filename, iter.next());
}
if (result == null) {
throw new InvalidFilenameException(filename, TranslatableComponent.of("worldedit.error.invalid-filename.invalid-characters"));
throw new InvalidFilenameException(filename, Caption.of("worldedit.error.invalid-filename.invalid-characters"));
}
return result;
}
@ -717,7 +717,7 @@ public final class WorldEdit {
String ext = filename.substring(index + 1);
if (!ext.equalsIgnoreCase("js")) {
player.printError(TranslatableComponent.of("worldedit.script.unsupported"));
player.print(Caption.of("worldedit.script.unsupported"));
return;
}
@ -730,7 +730,7 @@ public final class WorldEdit {
file = WorldEdit.class.getResourceAsStream("craftscripts/" + filename);
if (file == null) {
player.printError(TranslatableComponent.of("worldedit.script.file-not-found", TextComponent.of(filename)));
player.print(Caption.of("worldedit.script.file-not-found", TextComponent.of(filename)));
return;
}
} else {
@ -743,7 +743,7 @@ public final class WorldEdit {
in.close();
script = new String(data, 0, data.length, StandardCharsets.UTF_8);
} catch (IOException e) {
player.printError(TranslatableComponent.of("worldedit.script.read-error", TextComponent.of(e.getMessage())));
player.print(Caption.of("worldedit.script.read-error", TextComponent.of(e.getMessage())));
return;
}
@ -756,7 +756,7 @@ public final class WorldEdit {
try {
engine = new RhinoCraftScriptEngine();
} catch (NoClassDefFoundError ignored) {
player.printError(TranslatableComponent.of("worldedit.script.no-script-engine"));
player.print(Caption.of("worldedit.script.no-script-engine"));
return;
}
@ -772,13 +772,13 @@ public final class WorldEdit {
} catch (ScriptException e) {
// non-exceptional return check
if (!(Throwables.getRootCause(e) instanceof ReturnException)) {
player.printError(TranslatableComponent.of("worldedit.script.failed", TextComponent.of(e.getMessage(), TextColor.WHITE)));
player.print(Caption.of("worldedit.script.failed", TextComponent.of(e.getMessage(), TextColor.WHITE)));
logger.warn("Failed to execute script", e);
}
} catch (NumberFormatException | WorldEditException e) {
throw e;
} catch (Throwable e) {
player.printError(TranslatableComponent.of("worldedit.script.failed-console", TextComponent.of(e.getClass().getCanonicalName(),
player.print(Caption.of("worldedit.script.failed-console", TextComponent.of(e.getClass().getCanonicalName(),
TextColor.WHITE)));
logger.warn("Failed to execute script", e);
} finally {

View File

@ -19,6 +19,7 @@
package com.sk89q.worldedit.command;
import com.boydti.fawe.config.Caption;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableSet;
import com.sk89q.worldedit.LocalSession;
@ -41,7 +42,6 @@ import com.sk89q.worldedit.internal.expression.Expression;
import com.sk89q.worldedit.regions.factory.RegionFactory;
import com.sk89q.worldedit.util.TreeGenerator;
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.format.TextDecoration;
import org.enginehub.piston.CommandManager;
@ -62,19 +62,19 @@ import static org.enginehub.piston.part.CommandParts.arg;
@CommandContainer(superTypes = CommandPermissionsConditionGenerator.Registration.class)
public class ApplyBrushCommands {
private static final CommandArgument REGION_FACTORY = arg(TranslatableComponent.of("shape"), TranslatableComponent.of("worldedit.brush.apply.shape"))
private static final CommandArgument REGION_FACTORY = arg(Caption.of("shape"), Caption.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"), TranslatableComponent.of("worldedit.brush.apply.radius"))
private static final CommandArgument RADIUS = arg(Caption.of("radius"), Caption.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(TranslatableComponent.of("worldedit.brush.apply.description"));
builder.description(Caption.of("worldedit.brush.apply.description"));
builder.action(org.enginehub.piston.Command.Action.NULL_ACTION);
CommandManager manager = service.newCommandManager();
@ -86,7 +86,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"), TranslatableComponent.of("worldedit.brush.apply.type"))
builder.addPart(SubCommandPart.builder(Caption.of("type"), Caption.of("worldedit.brush.apply.type"))
.withCommands(manager.getAllCommands().collect(Collectors.toList()))
.required()
.build());
@ -126,7 +126,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(TranslatableComponent.of("worldedit.brush.apply.item.warning")).build());
.append(Caption.of("worldedit.brush.apply.item.warning")).build());
setApplyBrush(parameters, player, localSession, new ItemUseFactory(item, direction));
}

View File

@ -19,6 +19,7 @@
package com.sk89q.worldedit.command;
import com.boydti.fawe.config.Caption;
import com.sk89q.worldedit.EditSession;
import com.sk89q.worldedit.LocalSession;
import com.sk89q.worldedit.WorldEdit;
@ -49,7 +50,6 @@ 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.BiomeType;
@ -124,7 +124,7 @@ public class BiomeCommands {
if (useLineOfSight) {
Location blockPosition = player.getBlockTrace(300);
if (blockPosition == null) {
player.printError(TranslatableComponent.of("worldedit.raytrace.noblock"));
player.print(Caption.of("worldedit.raytrace.noblock"));
return;
}
@ -153,7 +153,7 @@ public class BiomeCommands {
HoverEvent.showText(TextComponent.of(biome.getId()))
)
).collect(Collectors.toList());
player.printInfo(TranslatableComponent.of(messageKey, TextUtils.join(components, TextComponent.of(", "))));
player.print(Caption.of(messageKey, TextUtils.join(components, TextComponent.of(", "))));
}
@Command(
@ -185,7 +185,7 @@ public class BiomeCommands {
RegionVisitor visitor = new RegionVisitor(region, replace);
Operations.completeLegacy(visitor);
player.printInfo(TranslatableComponent.of(
player.print(Caption.of(
"worldedit.setbiome.changed",
TextComponent.of(visitor.getAffected())
));

View File

@ -106,7 +106,6 @@ import com.sk89q.worldedit.util.HandSide;
import com.sk89q.worldedit.util.TreeGenerator;
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.block.BlockID;
@ -315,7 +314,7 @@ public class BrushCommands {
public void sweepBrush(Player player, InjectedValueAccess context,
@Arg(desc = "int", def = "-1")
int copies) throws WorldEditException {
player.print(TranslatableComponent.of("fawe.worldedit.brush.brush.spline"));
player.print(Caption.of("fawe.worldedit.brush.brush.spline"));
set(context, new SweepBrush(copies));
}
@ -428,7 +427,7 @@ public class BrushCommands {
case BlockID.SAND:
case BlockID.GRAVEL:
player.print(
TranslatableComponent.of("fawe.worldedit.brush.brush.try.other"));
Caption.of("fawe.worldedit.brush.brush.try.other"));
falling = true;
break;
default:
@ -1111,7 +1110,7 @@ public class BrushCommands {
}
player.print(Caption.of("fawe.worldedit.schematic.schematic.saved", name));
} else {
player.printError(TranslatableComponent.of("fawe.worldedit.brush.brush.none"));
player.print(Caption.of("fawe.worldedit.brush.brush.none"));
}
}
@ -1145,7 +1144,7 @@ public class BrushCommands {
player.print(Caption.of("fawe.worldedit.brush.brush.equipped", name));
} catch (Throwable e) {
e.printStackTrace();
player.printError(TranslatableComponent.of("fawe.error.brush.incompatible"));
player.print(Caption.of("fawe.error.brush.incompatible"));
}
} */
@ -1273,7 +1272,7 @@ public class BrushCommands {
tool.setFill(null);
tool.setBrush(new OperationFactoryBrush(factory, shape, session), permission);
player.printInfo(TranslatableComponent.of("worldedit.brush.operation.equip", TextComponent.of(factory.toString())));
player.print(Caption.of("worldedit.brush.operation.equip", TextComponent.of(factory.toString())));
ToolCommands.sendUnbindInstruction(player, UNBIND_COMMAND_COMPONENT);
}
}

View File

@ -19,6 +19,7 @@
package com.sk89q.worldedit.command;
import com.boydti.fawe.config.Caption;
import com.google.gson.JsonIOException;
import com.sk89q.worldedit.LocalSession;
import com.sk89q.worldedit.WorldEdit;
@ -86,9 +87,9 @@ public class ChunkCommands {
int chunkZ = (int) Math.floor(pos.getBlockZ() / 16.0);
final BlockVector2 chunkPos = BlockVector2.at(chunkX, chunkZ);
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))));
player.print(Caption.of("worldedit.chunkinfo.chunk", TextComponent.of(chunkX), TextComponent.of(chunkZ)));
player.print(Caption.of("worldedit.chunkinfo.old-filename", TextComponent.of(LegacyChunkStore.getFilename(chunkPos))));
player.print(Caption.of("worldedit.chunkinfo.mcregion-filename", TextComponent.of(McRegionChunkStore.getFilename(chunkPos))));
}
@Command(
@ -101,7 +102,7 @@ public class ChunkCommands {
@ArgFlag(name = 'p', desc = "Page number.", def = "1") int page) throws WorldEditException {
final Region region = session.getSelection(world);
actor.print(TranslatableComponent.of("worldedit.listchunks.listfor", TextComponent.of(actor.getName())));
actor.print(Caption.of("worldedit.listchunks.listfor", TextComponent.of(actor.getName())));
actor.print(new ChunkListPaginationBox(region).create(page));
}

View File

@ -77,7 +77,6 @@ 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.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.world.World;
import org.enginehub.piston.annotation.Command;
@ -185,7 +184,7 @@ public class ClipboardCommands {
long volume = (((long) max.getX() - (long) min.getX() + 1) * ((long) max.getY() - (long) min.getY() + 1) * ((long) max.getZ() - (long) min.getZ() + 1));
FaweLimit limit = actor.getLimit();
if (volume >= limit.MAX_CHECKS) {
throw new FaweException(TranslatableComponent.of("fawe.cancel.worldedit.cancel.reason.max.checks"));
throw new FaweException(Caption.of("fawe.cancel.worldedit.cancel.reason.max.checks"));
}
session.setClipboard(null);
ReadOnlyClipboard lazyClipboard = ReadOnlyClipboard.of(region, !skipEntities, copyBiomes);
@ -224,7 +223,7 @@ public class ClipboardCommands {
ReadOnlyClipboard lazyClipboard = new WorldCutClipboard(editSession, region, !skipEntities, copyBiomes);
clipboard.setOrigin(session.getPlacementPosition(actor));
session.setClipboard(new ClipboardHolder(lazyClipboard));
actor.print(TranslatableComponent.of("fawe.worldedit.cut.command.cut.lazy", region.getArea()));
actor.print(Caption.of("fawe.worldedit.cut.command.cut.lazy", region.getArea()));
}*/
@Command(
@ -289,7 +288,7 @@ public class ClipboardCommands {
session.setClipboard(new ClipboardHolder(clipboard));
if (!actor.hasPermission("fawe.tips")) {
actor.print(TranslatableComponent.of("fawe.tips.tip.lazycut"));
actor.print(Caption.of("fawe.tips.tip.lazycut"));
}
copy.getStatusMessages().forEach(actor::print);
}
@ -384,7 +383,7 @@ public class ClipboardCommands {
}
}
if (url == null) {
player.printError(TranslatableComponent.of("fawe.web.generating.link.failed"));
player.print(Caption.of("fawe.web.generating.link.failed"));
} else {
String urlText = url.toString();
if (Settings.IMP.WEB.SHORTEN_URLS) {
@ -459,9 +458,9 @@ public class ClipboardCommands {
}
if (onlySelect) {
actor.printInfo(TranslatableComponent.of("worldedit.paste.selected"));
actor.print(Caption.of("worldedit.paste.selected"));
} else {
actor.printInfo(TranslatableComponent.of("worldedit.paste.pasted", TextComponent.of(to.toString())));
actor.print(Caption.of("worldedit.paste.pasted", TextComponent.of(to.toString())));
}
messages.forEach(actor::print);
}
@ -474,7 +473,7 @@ public class ClipboardCommands {
PasteEvent event = new PasteEvent(player, clipboard, uri, editSession, to);
WorldEdit.getInstance().getEventBus().post(event);
if (event.isCancelled()) {
throw new FaweException(TranslatableComponent.of("fawe.cancel.worldedit.cancel.reason.manual"));
throw new FaweException(Caption.of("fawe.cancel.worldedit.cancel.reason.manual"));
}
}
@ -516,7 +515,7 @@ public class ClipboardCommands {
actor.print(Caption.of("fawe.worldedit.paste.command.paste", to));
if (!actor.hasPermission("fawe.tips")) {
actor.print(TranslatableComponent.of("fawe.tips.tip.copypaste"));
actor.print(Caption.of("fawe.tips.tip.copypaste"));
}
}
@ -541,7 +540,7 @@ public class ClipboardCommands {
transform = transform.rotateX(-rotateX);
transform = transform.rotateZ(-rotateZ);
holder.setTransform(transform.combine(holder.getTransform()));
actor.printInfo(TranslatableComponent.of("worldedit.rotate.rotated"));
actor.print(Caption.of("worldedit.rotate.rotated"));
}
@Command(
@ -556,7 +555,7 @@ public class ClipboardCommands {
AffineTransform transform = new AffineTransform();
transform = transform.scale(direction.abs().multiply(-2).add(1, 1, 1).toVector3());
holder.setTransform(transform.combine(holder.getTransform()));
actor.printInfo(TranslatableComponent.of("worldedit.flip.flipped"));
actor.print(Caption.of("worldedit.flip.flipped"));
}
@Command(
@ -567,7 +566,7 @@ public class ClipboardCommands {
@CommandPermissions("worldedit.clipboard.clear")
public void clearClipboard(Actor actor, LocalSession session) throws WorldEditException {
session.setClipboard(null);
actor.printInfo(TranslatableComponent.of("worldedit.clearclipboard.cleared"));
actor.print(Caption.of("worldedit.clearclipboard.cleared"));
}
private void saveDiskClipboard(Clipboard clipboard) {

View File

@ -19,6 +19,7 @@
package com.sk89q.worldedit.command;
import com.boydti.fawe.config.Caption;
import com.google.common.collect.ImmutableSet;
import com.sk89q.worldedit.IncompleteRegionException;
import com.sk89q.worldedit.LocalSession;
@ -33,7 +34,6 @@ import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.regions.Region;
import com.sk89q.worldedit.regions.RegionOperationException;
import com.sk89q.worldedit.util.formatting.text.TextComponent;
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
import com.sk89q.worldedit.world.World;
import org.enginehub.piston.Command;
import org.enginehub.piston.CommandManager;
@ -73,7 +73,7 @@ public class ExpandCommands {
command.condition(new PermissionCondition(ImmutableSet.of("worldedit.selection.expand")));
command.addPart(SubCommandPart.builder(
TranslatableComponent.of("vert"),
Caption.of("vert"),
TextComponent.of("Vertical expansion sub-command")
)
.withCommands(ImmutableSet.of(createVertCommand(commandManager)))
@ -88,7 +88,7 @@ public class ExpandCommands {
private static Command createVertCommand(CommandManager commandManager) {
return commandManager.newCommand("vert")
.description(TranslatableComponent.of("worldedit.expand.description.vert"))
.description(Caption.of("worldedit.expand.description.vert"))
.action(parameters -> {
expandVert(
requireIV(Key.of(LocalSession.class), "localSession", parameters),
@ -112,7 +112,7 @@ public class ExpandCommands {
session.getRegionSelector(world).explainRegionAdjust(actor, session);
long changeSize = newSize - oldSize;
actor.printInfo(
TranslatableComponent.of("worldedit.expand.expanded.vert", TextComponent.of(changeSize))
Caption.of("worldedit.expand.expanded.vert", TextComponent.of(changeSize))
);
} catch (RegionOperationException e) {
actor.printError(TextComponent.of(e.getMessage()));
@ -151,7 +151,7 @@ public class ExpandCommands {
session.getRegionSelector(world).explainRegionAdjust(actor, session);
long changeSize = newSize - oldSize;
actor.printInfo(TranslatableComponent.of("worldedit.expand.expanded", TextComponent.of(changeSize)));
actor.print(Caption.of("worldedit.expand.expanded", TextComponent.of(changeSize)));
}
}

View File

@ -172,7 +172,7 @@ public class GeneralCommands {
limit = limit == null ? config.defaultChangeLimit : Math.max(-1, limit);
if (!mayDisable && config.maxChangeLimit > -1) {
if (limit > config.maxChangeLimit) {
actor.printError(TranslatableComponent.of("worldedit.limit.too-high", TextComponent.of(config.maxChangeLimit)));
actor.print(Caption.of("worldedit.limit.too-high", TextComponent.of(config.maxChangeLimit)));
return;
}
}
@ -199,7 +199,7 @@ public class GeneralCommands {
limit = limit == null ? config.calculationTimeout : Math.max(-1, limit);
if (!mayDisable && config.maxCalculationTimeout > -1) {
if (limit > config.maxCalculationTimeout) {
actor.printError(TranslatableComponent.of("worldedit.timeout.too-high", TextComponent.of(config.maxCalculationTimeout)));
actor.print(Caption.of("worldedit.timeout.too-high", TextComponent.of(config.maxCalculationTimeout)));
return;
}
}
@ -223,16 +223,16 @@ public class GeneralCommands {
Boolean fastMode) {
boolean hasFastMode = session.hasFastMode();
if (fastMode != null && fastMode == hasFastMode) {
actor.printError(TranslatableComponent.of(fastMode ? "worldedit.fast.enabled.already" : "worldedit.fast.disabled.already"));
actor.print(Caption.of(fastMode ? "worldedit.fast.enabled.already" : "worldedit.fast.disabled.already"));
return;
}
if (hasFastMode) {
session.setFastMode(false);
actor.printInfo(TranslatableComponent.of("worldedit.fast.disabled"));
actor.print(Caption.of("worldedit.fast.disabled"));
} else {
session.setFastMode(true);
actor.printInfo(TranslatableComponent.of("worldedit.fast.enabled"));
actor.print(Caption.of("worldedit.fast.enabled"));
}
}
@ -254,7 +254,7 @@ public class GeneralCommands {
SideEffect.State currentState = session.getSideEffectSet().getState(sideEffect);
if (newState != null && newState == currentState) {
if (!showInfoBox) {
actor.printError(TranslatableComponent.of(
actor.print(Caption.of(
"worldedit.perf.sideeffect.already-set",
TranslatableComponent.of(sideEffect.getDisplayName()),
TranslatableComponent.of(newState.getDisplayName())
@ -266,14 +266,14 @@ public class GeneralCommands {
if (newState != null) {
session.setSideEffectSet(session.getSideEffectSet().with(sideEffect, newState));
if (!showInfoBox) {
actor.printInfo(TranslatableComponent.of(
actor.print(Caption.of(
"worldedit.perf.sideeffect.set",
TranslatableComponent.of(sideEffect.getDisplayName()),
TranslatableComponent.of(newState.getDisplayName())
));
}
} else {
actor.printInfo(TranslatableComponent.of(
actor.print(Caption.of(
"worldedit.perf.sideeffect.get",
TranslatableComponent.of(sideEffect.getDisplayName()),
TranslatableComponent.of(currentState.getDisplayName())
@ -286,7 +286,7 @@ public class GeneralCommands {
}
session.setSideEffectSet(applier);
if (!showInfoBox) {
actor.printInfo(TranslatableComponent.of(
actor.print(Caption.of(
"worldedit.perf.sideeffect.set-all",
TranslatableComponent.of(newState.getDisplayName())
));
@ -308,10 +308,10 @@ public class GeneralCommands {
@Arg(desc = "The reorder mode", def = "")
EditSession.ReorderMode reorderMode) {
if (reorderMode == null) {
actor.printInfo(TranslatableComponent.of("worldedit.reorder.current", TextComponent.of(session.getReorderMode().getDisplayName())));
actor.print(Caption.of("worldedit.reorder.current", TextComponent.of(session.getReorderMode().getDisplayName())));
} else {
session.setReorderMode(reorderMode);
actor.printInfo(TranslatableComponent.of("worldedit.reorder.set", TextComponent.of(session.getReorderMode().getDisplayName())));
actor.print(Caption.of("worldedit.reorder.set", TextComponent.of(session.getReorderMode().getDisplayName())));
}
}
@ -328,18 +328,18 @@ public class GeneralCommands {
}
boolean useServerCui = session.shouldUseServerCUI();
if (drawSelection != null && drawSelection == useServerCui) {
player.printError(TranslatableComponent.of("worldedit.drawsel." + (useServerCui ? "enabled" : "disabled") + ".already"));
player.print(Caption.of("worldedit.drawsel." + (useServerCui ? "enabled" : "disabled") + ".already"));
return;
}
if (useServerCui) {
session.setUseServerCUI(false);
session.updateServerCUI(player);
player.printInfo(TranslatableComponent.of("worldedit.drawsel.disabled"));
player.print(Caption.of("worldedit.drawsel.disabled"));
} else {
session.setUseServerCUI(true);
session.updateServerCUI(player);
player.printInfo(TranslatableComponent.of("worldedit.drawsel.enabled"));
player.print(Caption.of("worldedit.drawsel.enabled"));
}
}
@ -352,9 +352,9 @@ public class GeneralCommands {
@Arg(desc = "The world override", def = "") World world) {
session.setWorldOverride(world);
if (world == null) {
actor.printInfo(TranslatableComponent.of("worldedit.world.remove"));
actor.print(Caption.of("worldedit.world.remove"));
} else {
actor.printInfo(TranslatableComponent.of("worldedit.world.set", TextComponent.of(world.getId())));
actor.print(Caption.of("worldedit.world.set", TextComponent.of(world.getId())));
}
}
@ -369,16 +369,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(TranslatableComponent.of("worldedit.watchdog.no-hook"));
actor.print(Caption.of("worldedit.watchdog.no-hook"));
return;
}
boolean previousMode = session.isTickingWatchdog();
if (hookMode != null && (hookMode == HookMode.ACTIVE) == previousMode) {
actor.printError(TranslatableComponent.of(previousMode ? "worldedit.watchdog.active.already" : "worldedit.watchdog.inactive.already"));
actor.print(Caption.of(previousMode ? "worldedit.watchdog.active.already" : "worldedit.watchdog.inactive.already"));
return;
}
session.setTickingWatchdog(!previousMode);
actor.printInfo(TranslatableComponent.of(previousMode ? "worldedit.watchdog.inactive" : "worldedit.watchdog.active"));
actor.print(Caption.of(previousMode ? "worldedit.watchdog.inactive" : "worldedit.watchdog.active"));
}
@Command(
@ -392,10 +392,10 @@ public class GeneralCommands {
Mask mask) {
if (mask == null) {
session.setMask(null);
actor.printInfo(TranslatableComponent.of("worldedit.gmask.disabled"));
actor.print(Caption.of("worldedit.gmask.disabled"));
} else {
session.setMask(mask);
actor.printInfo(TranslatableComponent.of("worldedit.gmask.set"));
actor.print(Caption.of("worldedit.gmask.set"));
}
}
@ -407,9 +407,9 @@ public class GeneralCommands {
@CommandPermissions("worldedit.toggleplace")
public void togglePlace(Player player, LocalSession session) {
if (session.togglePlacementPosition()) {
player.printInfo(TranslatableComponent.of("worldedit.toggleplace.pos1"));
player.print(Caption.of("worldedit.toggleplace.pos1"));
} else {
player.printInfo(TranslatableComponent.of("worldedit.toggleplace.player"));
player.print(Caption.of("worldedit.toggleplace.player"));
}
}
@ -430,11 +430,11 @@ public class GeneralCommands {
List<String> query) {
String search = String.join(" ", query);
if (search.length() <= 2) {
actor.printError(TranslatableComponent.of("worldedit.searchitem.too-short"));
actor.print(Caption.of("worldedit.searchitem.too-short"));
return;
}
if (blocksOnly && itemsOnly) {
actor.printError(TranslatableComponent.of("worldedit.searchitem.either-b-or-i"));
actor.print(Caption.of("worldedit.searchitem.either-b-or-i"));
return;
}

View File

@ -49,7 +49,6 @@ import com.sk89q.worldedit.regions.CuboidRegion;
import com.sk89q.worldedit.regions.Region;
import com.sk89q.worldedit.util.TreeGenerator.TreeType;
import com.sk89q.worldedit.util.formatting.text.TextComponent;
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
import com.sk89q.worldedit.world.biome.BiomeType;
import com.sk89q.worldedit.world.block.BlockType;
import org.enginehub.piston.annotation.Command;
@ -239,7 +238,7 @@ public class GenerationCommands {
break;
default:
actor.printError(TranslatableComponent.of("worldedit.cyl.invalid-radius"));
actor.print(Caption.of("worldedit.cyl.invalid-radius"));
return 0;
}
@ -249,7 +248,7 @@ public class GenerationCommands {
BlockVector3 pos = session.getPlacementPosition(actor);
int affected = editSession.makeCylinder(pos, pattern, radiusX, radiusZ, height, !hollow);
actor.printInfo(TranslatableComponent.of("worldedit.cyl.created", TextComponent.of(affected)));
actor.print(Caption.of("worldedit.cyl.created", TextComponent.of(affected)));
return affected;
}
@ -301,7 +300,7 @@ public class GenerationCommands {
break;
default:
actor.printError(TranslatableComponent.of("worldedit.sphere.invalid-radius"));
actor.print(Caption.of("worldedit.sphere.invalid-radius"));
return 0;
}
@ -317,7 +316,7 @@ public class GenerationCommands {
if (actor instanceof Player) {
((Player) actor).findFreePosition();
}
actor.printInfo(TranslatableComponent.of("worldedit.sphere.created", TextComponent.of(affected)));
actor.print(Caption.of("worldedit.sphere.created", TextComponent.of(affected)));
return affected;
}
@ -339,7 +338,7 @@ public class GenerationCommands {
worldEdit.checkMaxRadius(size);
density /= 100;
int affected = editSession.makeForest(session.getPlacementPosition(actor), size, density, type);
actor.printInfo(TranslatableComponent.of("worldedit.forestgen.created", TextComponent.of(affected)));
actor.print(Caption.of("worldedit.forestgen.created", TextComponent.of(affected)));
return affected;
}
@ -358,7 +357,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.printInfo(TranslatableComponent.of("worldedit.pumpkins.created", TextComponent.of(affected)));
actor.print(Caption.of("worldedit.pumpkins.created", TextComponent.of(affected)));
return affected;
}
@ -395,7 +394,7 @@ public class GenerationCommands {
if (actor instanceof Player) {
((Player) actor).findFreePosition();
}
actor.printInfo(TranslatableComponent.of("worldedit.pyramid.created", TextComponent.of(affected)));
actor.print(Caption.of("worldedit.pyramid.created", TextComponent.of(affected)));
return affected;
}
@ -463,7 +462,7 @@ public class GenerationCommands {
if (actor instanceof Player) {
((Player) actor).findFreePosition();
}
actor.printInfo(TranslatableComponent.of("worldedit.generate.created", TextComponent.of(affected)));
actor.print(Caption.of("worldedit.generate.created", TextComponent.of(affected)));
return affected;
} catch (ExpressionException e) {
actor.printError(TextComponent.of(e.getMessage()));
@ -532,7 +531,7 @@ public class GenerationCommands {
final Vector3 unit1 = unit;
try {
final int affected = editSession.makeBiomeShape(region, zero, unit1, target, String.join(" ", expression), hollow, session.getTimeout());
actor.printInfo(TranslatableComponent.of("worldedit.generatebiome.changed", TextComponent.of(affected)));
actor.print(Caption.of("worldedit.generatebiome.changed", TextComponent.of(affected)));
return affected;
} catch (ExpressionException e) {
actor.printError(TextComponent.of(e.getMessage()));

View File

@ -19,6 +19,7 @@
package com.sk89q.worldedit.command;
import com.boydti.fawe.config.Caption;
import com.sk89q.worldedit.EditSession;
import com.sk89q.worldedit.LocalSession;
import com.sk89q.worldedit.WorldEdit;
@ -30,7 +31,6 @@ import com.sk89q.worldedit.entity.Player;
import com.sk89q.worldedit.extension.platform.Actor;
import com.sk89q.worldedit.extent.inventory.BlockBag;
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;
@ -69,14 +69,14 @@ public class HistoryCommands {
times = Math.max(1, times);
LocalSession undoSession = session;
if (session.hasFastMode()) {
actor.print(TranslatableComponent.of("fawe.worldedit.history.command.undo.disabled"));
actor.print(Caption.of("fawe.worldedit.history.command.undo.disabled"));
return;
}
if (playerName != null) {
actor.checkPermission("worldedit.history.undo.other");
undoSession = worldEdit.getSessionManager().findByName(playerName);
if (undoSession == null) {
actor.printError(TranslatableComponent.of("worldedit.session.cant-find-session", TextComponent.of(playerName)));
actor.print(Caption.of("worldedit.session.cant-find-session", TextComponent.of(playerName)));
return;
}
}
@ -92,9 +92,9 @@ public class HistoryCommands {
}
}
if (timesUndone > 0) {
actor.printInfo(TranslatableComponent.of("worldedit.undo.undone", TextComponent.of(timesUndone)));
actor.print(Caption.of("worldedit.undo.undone", TextComponent.of(timesUndone)));
} else {
actor.printError(TranslatableComponent.of("worldedit.undo.none"));
actor.print(Caption.of("worldedit.undo.none"));
}
}
@ -115,7 +115,7 @@ public class HistoryCommands {
actor.checkPermission("worldedit.history.redo.other");
redoSession = worldEdit.getSessionManager().findByName(playerName);
if (redoSession == null) {
actor.printError(TranslatableComponent.of("worldedit.session.cant-find-session", TextComponent.of(playerName)));
actor.print(Caption.of("worldedit.session.cant-find-session", TextComponent.of(playerName)));
return;
}
}
@ -131,9 +131,9 @@ public class HistoryCommands {
}
}
if (timesRedone > 0) {
actor.printInfo(TranslatableComponent.of("worldedit.redo.redone", TextComponent.of(timesRedone)));
actor.print(Caption.of("worldedit.redo.redone", TextComponent.of(timesRedone)));
} else {
actor.printError(TranslatableComponent.of("worldedit.redo.none"));
actor.print(Caption.of("worldedit.redo.none"));
}
}
@ -145,7 +145,7 @@ public class HistoryCommands {
@CommandPermissions("worldedit.history.clear")
public void clearHistory(Actor actor, LocalSession session) {
session.clearHistory();
actor.printInfo(TranslatableComponent.of("worldedit.clearhistory.cleared"));
actor.print(Caption.of("worldedit.clearhistory.cleared"));
}
}

View File

@ -221,7 +221,7 @@ public class HistorySubCommands {
Integer index) throws WorldEditException, ExecutionException, InterruptedException {
RollbackOptimizedHistory edit = database.getEdit(other, index).get();
if (edit == null) {
player.print(TranslatableComponent.of("fawe.worldedit.schematic.schematic.none"));
player.print(Caption.of("fawe.worldedit.schematic.schematic.none"));
return;
}
Location origin = player.getLocation();
@ -341,10 +341,10 @@ public class HistorySubCommands {
return;
}
if (other == null && radius == 0 && timeDiff == 0) {
throw new InsufficientArgumentsException(TranslatableComponent.of("fawe.error.invalid-user"));
throw new InsufficientArgumentsException(Caption.of("fawe.error.invalid-user"));
}
checkCommandArgument(radius > 0, TranslatableComponent.of("fawe.error.radius-too-small"));
checkCommandArgument(timeDiff > 0, TranslatableComponent.of("fawe.error.time-too-less"));
checkCommandArgument(radius > 0, Caption.of("fawe.error.radius-too-small"));
checkCommandArgument(timeDiff > 0, Caption.of("fawe.error.time-too-less"));
Location origin = player.getLocation();
String pageCommand = "/" + arguments.get().replaceAll("-p [0-9]+", "").trim();

View File

@ -21,6 +21,7 @@
package com.sk89q.worldedit.command;
import com.boydti.fawe.config.Caption;
import com.sk89q.worldedit.LocalConfiguration;
import com.sk89q.worldedit.LocalSession;
import com.sk89q.worldedit.WorldEdit;
@ -67,7 +68,7 @@ class LegacySnapshotCommands {
if (!snapshots.isEmpty()) {
actor.print(new SnapshotListBox(world.getName(), snapshots).create(page));
} else {
actor.printError(TranslatableComponent.of("worldedit.restore.none-found-console"));
actor.print(Caption.of("worldedit.restore.none-found-console"));
// Okay, let's toss some debugging information!
File dir = config.snapshotRepo.getDirectory();
@ -82,7 +83,7 @@ class LegacySnapshotCommands {
}
}
} catch (MissingWorldException ex) {
actor.printError(TranslatableComponent.of("worldedit.restore.none-for-world"));
actor.print(Caption.of("worldedit.restore.none-for-world"));
}
}
@ -96,19 +97,19 @@ class LegacySnapshotCommands {
if (snapshot != null) {
session.setSnapshot(null);
actor.printInfo(TranslatableComponent.of("worldedit.snapshot.use.newest"));
actor.print(Caption.of("worldedit.snapshot.use.newest"));
} else {
actor.printError(TranslatableComponent.of("worldedit.restore.none-found"));
actor.print(Caption.of("worldedit.restore.none-found"));
}
} catch (MissingWorldException ex) {
actor.printError(TranslatableComponent.of("worldedit.restore.none-for-world"));
actor.print(Caption.of("worldedit.restore.none-for-world"));
}
} else {
try {
session.setSnapshot(config.snapshotRepo.getSnapshot(name));
actor.printInfo(TranslatableComponent.of("worldedit.snapshot.use", TextComponent.of(name)));
actor.print(Caption.of("worldedit.snapshot.use", TextComponent.of(name)));
} catch (InvalidSnapshotException e) {
actor.printError(TranslatableComponent.of("worldedit.restore.not-available"));
actor.print(Caption.of("worldedit.restore.not-available"));
}
}
}
@ -117,25 +118,25 @@ class LegacySnapshotCommands {
LocalConfiguration config = we.getConfiguration();
if (index < 1) {
actor.printError(TranslatableComponent.of("worldedit.snapshot.index-above-0"));
actor.print(Caption.of("worldedit.snapshot.index-above-0"));
return;
}
try {
List<Snapshot> snapshots = config.snapshotRepo.getSnapshots(true, world.getName());
if (snapshots.size() < index) {
actor.printError(TranslatableComponent.of("worldedit.snapshot.index-oob", TextComponent.of(snapshots.size())));
actor.print(Caption.of("worldedit.snapshot.index-oob", TextComponent.of(snapshots.size())));
return;
}
Snapshot snapshot = snapshots.get(index - 1);
if (snapshot == null) {
actor.printError(TranslatableComponent.of("worldedit.restore.not-available"));
actor.print(Caption.of("worldedit.restore.not-available"));
return;
}
session.setSnapshot(snapshot);
actor.printInfo(TranslatableComponent.of("worldedit.snapshot.use", TextComponent.of(snapshot.getName())));
actor.print(Caption.of("worldedit.snapshot.use", TextComponent.of(snapshot.getName())));
} catch (MissingWorldException e) {
actor.printError(TranslatableComponent.of("worldedit.restore.none-for-world"));
actor.print(Caption.of("worldedit.restore.none-for-world"));
}
}
@ -146,16 +147,16 @@ class LegacySnapshotCommands {
Snapshot snapshot = config.snapshotRepo.getSnapshotBefore(date, world.getName());
if (snapshot == null) {
actor.printError(TranslatableComponent.of(
actor.print(Caption.of(
"worldedit.snapshot.none-before",
TextComponent.of(dateFormat.withZone(session.getTimeZone()).format(date)))
);
} else {
session.setSnapshot(snapshot);
actor.printInfo(TranslatableComponent.of("worldedit.snapshot.use", TextComponent.of(snapshot.getName())));
actor.print(Caption.of("worldedit.snapshot.use", TextComponent.of(snapshot.getName())));
}
} catch (MissingWorldException ex) {
actor.printError(TranslatableComponent.of("worldedit.restore.none-for-world"));
actor.print(Caption.of("worldedit.restore.none-for-world"));
}
}
@ -165,16 +166,16 @@ class LegacySnapshotCommands {
try {
Snapshot snapshot = config.snapshotRepo.getSnapshotAfter(date, world.getName());
if (snapshot == null) {
actor.printError(TranslatableComponent.of(
actor.print(Caption.of(
"worldedit.snapshot.none-after",
TextComponent.of(dateFormat.withZone(session.getTimeZone()).format(date)))
);
} else {
session.setSnapshot(snapshot);
actor.printInfo(TranslatableComponent.of("worldedit.snapshot.use", TextComponent.of(snapshot.getName())));
actor.print(Caption.of("worldedit.snapshot.use", TextComponent.of(snapshot.getName())));
}
} catch (MissingWorldException ex) {
actor.printError(TranslatableComponent.of("worldedit.restore.none-for-world"));
actor.print(Caption.of("worldedit.restore.none-for-world"));
}
}

View File

@ -19,6 +19,7 @@
package com.sk89q.worldedit.command;
import com.boydti.fawe.config.Caption;
import com.sk89q.worldedit.EditSession;
import com.sk89q.worldedit.LocalConfiguration;
import com.sk89q.worldedit.LocalSession;
@ -58,7 +59,7 @@ class LegacySnapshotUtilCommands {
try {
snapshot = config.snapshotRepo.getSnapshot(snapshotName);
} catch (InvalidSnapshotException e) {
actor.printError(TranslatableComponent.of("worldedit.restore.not-available"));
actor.print(Caption.of("worldedit.restore.not-available"));
return;
}
} else {
@ -71,7 +72,7 @@ class LegacySnapshotUtilCommands {
snapshot = config.snapshotRepo.getDefaultSnapshot(world.getName());
if (snapshot == null) {
actor.printError(TranslatableComponent.of("worldedit.restore.none-found-console"));
actor.print(Caption.of("worldedit.restore.none-found-console"));
// Okay, let's toss some debugging information!
File dir = config.snapshotRepo.getDirectory();
@ -88,7 +89,7 @@ class LegacySnapshotUtilCommands {
return;
}
} catch (MissingWorldException ex) {
actor.printError(TranslatableComponent.of("worldedit.restore.none-for-world"));
actor.print(Caption.of("worldedit.restore.none-for-world"));
return;
}
}
@ -98,9 +99,9 @@ class LegacySnapshotUtilCommands {
// Load chunk store
try {
chunkStore = snapshot.getChunkStore();
actor.printInfo(TranslatableComponent.of("worldedit.restore.loaded", TextComponent.of(snapshot.getName())));
actor.print(Caption.of("worldedit.restore.loaded", TextComponent.of(snapshot.getName())));
} catch (DataException | IOException e) {
actor.printError(TranslatableComponent.of("worldedit.restore.failed", TextComponent.of(e.getMessage())));
actor.print(Caption.of("worldedit.restore.failed", TextComponent.of(e.getMessage())));
return;
}
@ -114,15 +115,15 @@ class LegacySnapshotUtilCommands {
if (restore.hadTotalFailure()) {
String error = restore.getLastErrorMessage();
if (!restore.getMissingChunks().isEmpty()) {
actor.printError(TranslatableComponent.of("worldedit.restore.chunk-not-present"));
actor.print(Caption.of("worldedit.restore.chunk-not-present"));
} else if (error != null) {
actor.printError(TranslatableComponent.of("worldedit.restore.block-place-failed"));
actor.printError(TranslatableComponent.of("worldedit.restore.block-place-error", TextComponent.of(error)));
actor.print(Caption.of("worldedit.restore.block-place-failed"));
actor.print(Caption.of("worldedit.restore.block-place-error", TextComponent.of(error)));
} else {
actor.printError(TranslatableComponent.of("worldedit.restore.chunk-load-failed"));
actor.print(Caption.of("worldedit.restore.chunk-load-failed"));
}
} else {
actor.printInfo(TranslatableComponent.of("worldedit.restore.restored",
actor.print(Caption.of("worldedit.restore.restored",
TextComponent.of(restore.getMissingChunks().size()),
TextComponent.of(restore.getErrorChunks().size())));
}

View File

@ -19,6 +19,7 @@
package com.sk89q.worldedit.command;
import com.boydti.fawe.config.Caption;
import com.sk89q.worldedit.LocalConfiguration;
import com.sk89q.worldedit.WorldEdit;
import com.sk89q.worldedit.WorldEditException;
@ -63,7 +64,7 @@ public class NavigationCommands {
@CommandPermissions("worldedit.navigation.unstuck")
public void unstuck(Player player) throws WorldEditException {
player.findFreePosition();
player.printInfo(TranslatableComponent.of("worldedit.unstuck.moved"));
player.print(Caption.of("worldedit.unstuck.moved"));
}
@Command(
@ -83,9 +84,9 @@ public class NavigationCommands {
}
}
if (ascentLevels == 0) {
player.printError(TranslatableComponent.of("worldedit.ascend.obstructed"));
player.print(Caption.of("worldedit.ascend.obstructed"));
} else {
player.printInfo(TranslatableComponent.of("worldedit.ascend.moved", TextComponent.of(ascentLevels)));
player.print(Caption.of("worldedit.ascend.moved", TextComponent.of(ascentLevels)));
}
}
@ -106,9 +107,9 @@ public class NavigationCommands {
}
}
if (descentLevels == 0) {
player.printError(TranslatableComponent.of("worldedit.descend.obstructed"));
player.print(Caption.of("worldedit.descend.obstructed"));
} else {
player.printInfo(TranslatableComponent.of("worldedit.descend.moved", TextComponent.of(descentLevels)));
player.print(Caption.of("worldedit.descend.moved", TextComponent.of(descentLevels)));
}
}
@ -130,9 +131,9 @@ public class NavigationCommands {
boolean alwaysGlass = getAlwaysGlass(forceFlight, forceGlass);
if (player.ascendToCeiling(clearance, alwaysGlass)) {
player.printInfo(TranslatableComponent.of("worldedit.ceil.moved"));
player.print(Caption.of("worldedit.ceil.moved"));
} else {
player.printError(TranslatableComponent.of("worldedit.ceil.obstructed"));
player.print(Caption.of("worldedit.ceil.obstructed"));
}
}
@ -144,9 +145,9 @@ public class NavigationCommands {
@CommandPermissions("worldedit.navigation.thru.command")
public void thru(Player player) throws WorldEditException {
if (player.passThroughForwardWall(6)) {
player.printInfo(TranslatableComponent.of("worldedit.thru.moved"));
player.print(Caption.of("worldedit.thru.moved"));
} else {
player.printError(TranslatableComponent.of("worldedit.thru.obstructed"));
player.print(Caption.of("worldedit.thru.obstructed"));
}
}
@ -167,9 +168,9 @@ public class NavigationCommands {
}
if (pos != null) {
player.findFreePosition(pos);
player.printInfo(TranslatableComponent.of("worldedit.jumpto.moved"));
player.print(Caption.of("worldedit.jumpto.moved"));
} else {
player.printError(TranslatableComponent.of("worldedit.jumpto.none"));
player.print(Caption.of("worldedit.jumpto.none"));
}
}
@ -189,9 +190,9 @@ public class NavigationCommands {
boolean forceGlass) throws WorldEditException {
boolean alwaysGlass = getAlwaysGlass(forceFlight, forceGlass);
if (player.ascendUpwards(distance, alwaysGlass)) {
player.printInfo(TranslatableComponent.of("worldedit.up.moved"));
player.print(Caption.of("worldedit.up.moved"));
} else {
player.printError(TranslatableComponent.of("worldedit.up.obstructed"));
player.print(Caption.of("worldedit.up.obstructed"));
}
}

View File

@ -112,7 +112,7 @@ public class RegionCommands {
Pattern pattern) {
int affected = editSession.setBlocks(region, pattern);
if (affected != 0) {
actor.printInfo(TranslatableComponent.of("worldedit.set.done"));
actor.print(Caption.of("worldedit.set.done"));
}
return affected;
}
@ -194,14 +194,14 @@ public class RegionCommands {
public void nbtinfo(Player player, EditSession editSession) {
Location pos = player.getBlockTrace(128);
if (pos == null) {
player.printError(TranslatableComponent.of("fawe.navigation.no.block"));
player.print(Caption.of("fawe.navigation.no.block"));
return;
}
CompoundTag nbt = editSession.getFullBlock(pos.toBlockPoint()).getNbtData();
if (nbt != null) {
player.print(TextComponent.of(nbt.getValue().toString()));
} else {
player.printError(TranslatableComponent.of("fawe.navigation.no.block"));
player.print(Caption.of("fawe.navigation.no.block"));
}
}
@ -240,7 +240,7 @@ public class RegionCommands {
@Switch(name = 'h', desc = "Generate only a shell")
boolean shell) throws WorldEditException {
if (!(region instanceof CuboidRegion)) {
actor.printError(TranslatableComponent.of("worldedit.line.cuboid-only"));
actor.print(Caption.of("worldedit.line.cuboid-only"));
return 0;
}
checkCommandArgument(thickness >= 0, "Thickness must be >= 0");
@ -250,7 +250,7 @@ public class RegionCommands {
BlockVector3 pos2 = cuboidregion.getPos2();
int blocksChanged = editSession.drawLine(pattern, pos1, pos2, thickness, !shell);
actor.printInfo(TranslatableComponent.of("worldedit.line.changed", TextComponent.of(blocksChanged)));
actor.print(Caption.of("worldedit.line.changed", TextComponent.of(blocksChanged)));
return blocksChanged;
}
@ -271,7 +271,7 @@ public class RegionCommands {
@Switch(name = 'h', desc = "Generate only a shell")
boolean shell) throws WorldEditException {
if (!(region instanceof ConvexPolyhedralRegion)) {
actor.printError(TranslatableComponent.of("worldedit.curve.invalid-type"));
actor.print(Caption.of("worldedit.curve.invalid-type"));
return 0;
}
checkCommandArgument(thickness >= 0, "Thickness must be >= 0");
@ -281,7 +281,7 @@ public class RegionCommands {
int blocksChanged = editSession.drawSpline(pattern, vectors, 0, 0, 0, 10, thickness, !shell);
actor.printInfo(TranslatableComponent.of("worldedit.curve.changed", TextComponent.of(blocksChanged)));
actor.print(Caption.of("worldedit.curve.changed", TextComponent.of(blocksChanged)));
return blocksChanged;
}
@ -305,7 +305,7 @@ public class RegionCommands {
((AbstractExtentMask) from).setExtent(editSession);
}
int affected = editSession.replaceBlocks(region, from, to);
actor.printInfo(TranslatableComponent.of("worldedit.replace.replaced", TextComponent.of(affected)));
actor.print(Caption.of("worldedit.replace.replaced", TextComponent.of(affected)));
return affected;
}
@ -320,7 +320,7 @@ public class RegionCommands {
@Arg(desc = "The pattern of blocks to overlay")
Pattern pattern) throws WorldEditException {
int affected = editSession.overlayCuboidBlocks(region, pattern);
actor.printInfo(TranslatableComponent.of("worldedit.overlay.overlaid", TextComponent.of(affected)));
actor.print(Caption.of("worldedit.overlay.overlaid", TextComponent.of(affected)));
return affected;
}
@ -360,7 +360,7 @@ public class RegionCommands {
@Arg(desc = "The pattern of blocks to set")
Pattern pattern) throws WorldEditException {
int affected = editSession.center(region, pattern);
actor.printInfo(TranslatableComponent.of("worldedit.center.changed", TextComponent.of(affected)));
actor.print(Caption.of("worldedit.center.changed", TextComponent.of(affected)));
return affected;
}
@ -373,7 +373,7 @@ public class RegionCommands {
@Confirm(Confirm.Processor.REGION)
public int naturalize(Actor actor, EditSession editSession, @Selection Region region) throws WorldEditException {
int affected = editSession.naturalizeCuboidBlocks(region);
actor.printInfo(TranslatableComponent.of("worldedit.naturalize.naturalized", TextComponent.of(affected)));
actor.print(Caption.of("worldedit.naturalize.naturalized", TextComponent.of(affected)));
return affected;
}
@ -388,7 +388,7 @@ public class RegionCommands {
@Arg(desc = "The pattern of blocks to set")
Pattern pattern) throws WorldEditException {
int affected = editSession.makeWalls(region, pattern);
actor.printInfo(TranslatableComponent.of("worldedit.walls.changed", TextComponent.of(affected)));
actor.print(Caption.of("worldedit.walls.changed", TextComponent.of(affected)));
return affected;
}
@ -404,7 +404,7 @@ public class RegionCommands {
@Arg(desc = "The pattern of blocks to set")
Pattern pattern) throws WorldEditException {
int affected = editSession.makeCuboidFaces(region, pattern);
actor.printInfo(TranslatableComponent.of("worldedit.faces.changed", TextComponent.of(affected)));
actor.print(Caption.of("worldedit.faces.changed", TextComponent.of(affected)));
return affected;
}
@ -435,7 +435,7 @@ public class RegionCommands {
HeightMap heightMap = new HeightMap(editSession, region, mask, snow);
HeightMapFilter filter = new HeightMapFilter(new GaussianKernel(5, 1.0));
affected = heightMap.applyFilter(filter, iterations);
actor.printInfo(TranslatableComponent.of("worldedit.smooth.changed", TextComponent.of(affected)));
actor.print(Caption.of("worldedit.smooth.changed", TextComponent.of(affected)));
} catch (Throwable e) {
throw new RuntimeException(e);
}
@ -451,9 +451,9 @@ public class RegionCommands {
@CommandPermissions("fawe.admin")
public void wea(Actor actor) throws WorldEditException {
if (actor.togglePermission("fawe.bypass")) {
actor.print(TranslatableComponent.of("fawe.info.worldedit.bypassed"));
actor.print(Caption.of("fawe.info.worldedit.bypassed"));
} else {
actor.print(TranslatableComponent.of("fawe.info.worldedit.restricted"));
actor.print(Caption.of("fawe.info.worldedit.restricted"));
}
}
@ -528,7 +528,7 @@ public class RegionCommands {
}
}
actor.printInfo(TranslatableComponent.of("worldedit.move.moved", TextComponent.of(affected)));
actor.print(Caption.of("worldedit.move.moved", TextComponent.of(affected)));
return affected;
}
@ -602,7 +602,7 @@ public class RegionCommands {
}
}
actor.printInfo(TranslatableComponent.of("worldedit.stack.changed", TextComponent.of(affected)));
actor.print(Caption.of("worldedit.stack.changed", TextComponent.of(affected)));
return affected;
}
@ -628,7 +628,7 @@ public class RegionCommands {
try {
session.setMask(null);
session.setSourceMask(null);
actor.printInfo(TranslatableComponent.of("fawe.regen.time"));
actor.print(Caption.of("fawe.regen.time"));
RegenOptions options = RegenOptions.builder()
.seed(seed)
.regenBiomes(regenBiomes)
@ -640,9 +640,9 @@ public class RegionCommands {
session.setSourceMask(mask);
}
if (success) {
actor.printInfo(TranslatableComponent.of("worldedit.regen.regenerated"));
actor.print(Caption.of("worldedit.regen.regenerated"));
} else {
actor.printError(TranslatableComponent.of("worldedit.regen.failed"));
actor.print(Caption.of("worldedit.regen.failed"));
}
}
@ -705,7 +705,7 @@ public class RegionCommands {
if (actor instanceof Player) {
((Player) actor).findFreePosition();
}
actor.printInfo(TranslatableComponent.of("worldedit.deform.deformed", TextComponent.of(affected)));
actor.print(Caption.of("worldedit.deform.deformed", TextComponent.of(affected)));
return affected;
} catch (ExpressionException e) {
actor.printError(TextComponent.of(e.getMessage()));
@ -735,7 +735,7 @@ public class RegionCommands {
Mask finalMask = mask == null ? new SolidBlockMask(editSession) : mask;
int affected = editSession.hollowOutRegion(region, thickness, pattern, finalMask);
actor.printInfo(TranslatableComponent.of("worldedit.hollow.changed", TextComponent.of(affected)));
actor.print(Caption.of("worldedit.hollow.changed", TextComponent.of(affected)));
return affected;
}
@ -753,7 +753,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.printInfo(TranslatableComponent.of("worldedit.forest.created", TextComponent.of(affected)));
actor.print(Caption.of("worldedit.forest.created", TextComponent.of(affected)));
return affected;
}
@ -776,7 +776,7 @@ public class RegionCommands {
Operations.completeLegacy(visitor);
int affected = ground.getAffected();
actor.printInfo(TranslatableComponent.of("worldedit.flora.created", TextComponent.of(affected)));
actor.print(Caption.of("worldedit.flora.created", TextComponent.of(affected)));
return affected;
}

View File

@ -53,7 +53,6 @@ import com.sk89q.worldedit.util.formatting.component.PaginationBox;
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.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;
@ -176,7 +175,7 @@ public class SchematicCommands {
@CommandPermissions({"worldedit.clipboard.clear", "worldedit.schematic.clear"})
public void clear(Player player, LocalSession session) throws WorldEditException {
session.setClipboard(null);
player.print(TranslatableComponent.of("fawe.worldedit.clipboard.clipboard.cleared"));
player.print(Caption.of("fawe.worldedit.clipboard.clipboard.cleared"));
}
@Command(
@ -208,7 +207,7 @@ public class SchematicCommands {
} else {
session.setClipboard(null);
}
player.print(TranslatableComponent.of("fawe.worldedit.clipboard.clipboard.cleared"));
player.print(Caption.of("fawe.worldedit.clipboard.clipboard.cleared"));
return;
}
}
@ -262,7 +261,7 @@ public class SchematicCommands {
}
file = actor.openFileOpenDialog(extensions);
if (file == null || !file.exists()) {
actor.printError(TranslatableComponent.of("worldedit.schematic.load.does-not-exist", TextComponent.of(filename)));
actor.print(Caption.of("worldedit.schematic.load.does-not-exist", TextComponent.of(filename)));
return;
}
} else {
@ -291,7 +290,7 @@ public class SchematicCommands {
if (format == null) {
format = ClipboardFormats.findByFile(file);
if (format == null) {
actor.printError(TranslatableComponent.of("worldedit.schematic.unknown-format", TextComponent.of(formatName)));
actor.print(Caption.of("worldedit.schematic.unknown-format", TextComponent.of(formatName)));
return;
}
}
@ -339,7 +338,7 @@ public class SchematicCommands {
ClipboardFormat format = ClipboardFormats.findByAlias(formatName);
if (format == null) {
actor.printError(TranslatableComponent.of("worldedit.schematic.unknown-format", TextComponent.of(formatName)));
actor.print(Caption.of("worldedit.schematic.unknown-format", TextComponent.of(formatName)));
return;
}
@ -370,7 +369,7 @@ public class SchematicCommands {
}
}
if (!allowOverwrite) {
actor.printError(TranslatableComponent.of("worldedit.schematic.save.already-exists"));
actor.print(Caption.of("worldedit.schematic.save.already-exists"));
return;
}
}
@ -379,7 +378,7 @@ public class SchematicCommands {
File parent = f.getParentFile();
if (parent != null && !parent.exists()) {
if (!parent.mkdirs()) {
throw new StopExecutionException(TranslatableComponent.of(
throw new StopExecutionException(Caption.of(
"worldedit.schematic.save.failed-directory"));
}
}
@ -389,7 +388,7 @@ public class SchematicCommands {
SchematicSaveTask task = new SchematicSaveTask(actor, f, dir, format, holder, overwrite);
AsyncCommandBuilder.wrap(task, actor)
.registerWithSupervisor(worldEdit.getSupervisor(), "Saving schematic " + filename)
.sendMessageAfterDelay(TranslatableComponent.of("worldedit.schematic.save.saving"))
.sendMessageAfterDelay(Caption.of("worldedit.schematic.save.saving"))
.onSuccess(filename + " saved" + (overwrite ? " (overwriting previous file)." : "."), null)
.onFailure("Failed to save schematic", worldEdit.getPlatformManager().getPlatformCommandManager().getExceptionConverter())
.buildAndExec(worldEdit.getExecutorService());
@ -417,7 +416,7 @@ public class SchematicCommands {
ClipboardHolder clipboard = session.getClipboard();
List<File> sources = getFiles(clipboard);
if (sources.isEmpty()) {
player.printError(TranslatableComponent.of("fawe.worldedit.schematic.schematic.none"));
player.print(Caption.of("fawe.worldedit.schematic.schematic.none"));
return;
}
if (!destDir.exists() && !destDir.mkdirs()) {
@ -470,7 +469,7 @@ public class SchematicCommands {
)
@CommandPermissions("worldedit.schematic.formats")
public void formats(Actor actor) {
actor.printInfo(TranslatableComponent.of("worldedit.schematic.formats.title"));
actor.print(Caption.of("worldedit.schematic.formats.title"));
StringBuilder builder;
boolean first = true;
for (ClipboardFormat format : ClipboardFormats.getAll()) {
@ -654,12 +653,12 @@ public class SchematicCommands {
}
if (files.isEmpty()) {
actor.printError(TranslatableComponent.of("worldedit.schematic.delete.does-not-exist", TextComponent.of(filename)));
actor.print(Caption.of("worldedit.schematic.delete.does-not-exist", TextComponent.of(filename)));
return;
}
for (File f : files) {
if (!MainUtil.isInSubDirectory(working, f) || !f.exists()) {
actor.printError(TranslatableComponent.of("worldedit.schematic.delete.does-not-exist", TextComponent.of(filename)));
actor.print(Caption.of("worldedit.schematic.delete.does-not-exist", TextComponent.of(filename)));
continue;
}
if (Settings.IMP.PATHS.PER_PLAYER_SCHEMATICS && !MainUtil.isInSubDirectory(dir, f) && !actor.hasPermission("worldedit.schematic.delete.other")) {
@ -667,7 +666,7 @@ public class SchematicCommands {
continue;
}
if (!deleteFile(f)) {
actor.printError(TranslatableComponent.of("worldedit.schematic.delete.failed", TextComponent.of(filename)));
actor.print(Caption.of("worldedit.schematic.delete.failed", TextComponent.of(filename)));
continue;
}
actor.print(Caption.of("worldedit.schematic.delete.deleted", filename));
@ -862,7 +861,7 @@ public class SchematicCommands {
}
LOGGER.info(actor.getName() + " saved " + file.getCanonicalPath());
} else {
actor.printError(TranslatableComponent.of("fawe.cancel.worldedit.cancel.reason.manual"));
actor.print(Caption.of("fawe.cancel.worldedit.cancel.reason.manual"));
}
}
return null;

View File

@ -19,6 +19,7 @@
package com.sk89q.worldedit.command;
import com.boydti.fawe.config.Caption;
import com.sk89q.worldedit.LocalSession;
import com.sk89q.worldedit.WorldEdit;
import com.sk89q.worldedit.WorldEditException;
@ -26,7 +27,6 @@ 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 org.enginehub.piston.annotation.Command;
import org.enginehub.piston.annotation.CommandContainer;
import org.enginehub.piston.annotation.param.Arg;
@ -70,7 +70,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(TranslatableComponent.of("worldedit.execute.script-permissions"));
player.print(Caption.of("worldedit.execute.script-permissions"));
return;
}
@ -97,12 +97,12 @@ public class ScriptingCommands {
String lastScript = session.getLastScript();
if (!player.hasPermission("worldedit.scripting.execute." + lastScript)) {
player.printError(TranslatableComponent.of("worldedit.execute.script-permissions"));
player.print(Caption.of("worldedit.execute.script-permissions"));
return;
}
if (lastScript == null) {
player.printError(TranslatableComponent.of("worldedit.executelast.no-script"));
player.print(Caption.of("worldedit.executelast.no-script"));
return;
}

View File

@ -70,7 +70,6 @@ import com.sk89q.worldedit.util.formatting.component.SubtleFormat;
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.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;
@ -124,12 +123,12 @@ public class SelectionCommands {
} else if (actor instanceof Locatable) {
pos = ((Locatable) actor).getBlockLocation().clampY(0, world.getMaxY());
} else {
actor.printError(TranslatableComponent.of("worldedit.pos.console-require-coords"));
actor.print(Caption.of("worldedit.pos.console-require-coords"));
return;
}
if (!session.getRegionSelector(world).selectPrimary(pos.toVector().toBlockPoint(), ActorSelectorLimits.forActor(actor))) {
actor.printError(TranslatableComponent.of("worldedit.pos.already-set"));
actor.print(Caption.of("worldedit.pos.already-set"));
return;
}
@ -153,12 +152,12 @@ public class SelectionCommands {
} else if (actor instanceof Locatable) {
pos = ((Locatable) actor).getBlockLocation().clampY(0, world.getMaxY());
} else {
actor.printError(TranslatableComponent.of("worldedit.pos.console-require-coords"));
actor.print(Caption.of("worldedit.pos.console-require-coords"));
return;
}
if (!session.getRegionSelector(world).selectSecondary(pos.toVector().toBlockPoint(), ActorSelectorLimits.forActor(actor))) {
actor.printError(TranslatableComponent.of("worldedit.pos.already-set"));
actor.print(Caption.of("worldedit.pos.already-set"));
return;
}
@ -177,14 +176,14 @@ public class SelectionCommands {
if (pos != null) {
if (!session.getRegionSelector(player.getWorld()).selectPrimary(pos.toVector().toBlockPoint(), ActorSelectorLimits.forActor(player))) {
player.printError(TranslatableComponent.of("worldedit.hpos.already-set"));
player.print(Caption.of("worldedit.hpos.already-set"));
return;
}
session.getRegionSelector(player.getWorld())
.explainPrimarySelection(player, session, pos.toBlockPoint());
} else {
player.printError(TranslatableComponent.of("worldedit.hpos.no-block"));
player.print(Caption.of("worldedit.hpos.no-block"));
}
}
@ -199,14 +198,14 @@ public class SelectionCommands {
if (pos != null) {
if (!session.getRegionSelector(player.getWorld()).selectSecondary(pos.toVector().toBlockPoint(), ActorSelectorLimits.forActor(player))) {
player.printError(TranslatableComponent.of("worldedit.hpos.already-set"));
player.print(Caption.of("worldedit.hpos.already-set"));
return;
}
session.getRegionSelector(player.getWorld())
.explainSecondarySelection(player, session, pos.toBlockPoint());
} else {
player.printError(TranslatableComponent.of("worldedit.hpos.no-block"));
player.print(Caption.of("worldedit.hpos.no-block"));
}
}
@ -235,7 +234,7 @@ 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.printInfo(TranslatableComponent.of(
actor.print(Caption.of(
"worldedit.chunk.selected-multiple",
TextComponent.of(min2D.getBlockX()),
TextComponent.of(min2D.getBlockZ()),
@ -261,7 +260,7 @@ public class SelectionCommands {
min = BlockVector3.at(min2D.getBlockX() * 16, 0, min2D.getBlockZ() * 16);
max = min.add(15, world.getMaxY(), 15);
actor.printInfo(TranslatableComponent.of("worldedit.chunk.selected", TextComponent.of(min2D.getBlockX()),
actor.print(Caption.of("worldedit.chunk.selected", TextComponent.of(min2D.getBlockX()),
TextComponent.of(min2D.getBlockZ())));
}
@ -293,16 +292,16 @@ public class SelectionCommands {
}
ItemType itemType = ItemTypes.parse(wandId);
if (itemType == null) {
player.printError(TranslatableComponent.of("worldedit.wand.invalid"));
player.print(Caption.of("worldedit.wand.invalid"));
return;
}
player.giveItem(new BaseItemStack(itemType, 1));
if (navWand) {
session.setTool(itemType, NavigationWand.INSTANCE);
player.printInfo(TranslatableComponent.of("worldedit.wand.navwand.info"));
player.print(Caption.of("worldedit.wand.navwand.info"));
} else {
session.setTool(itemType, SelectionWand.INSTANCE);
player.printInfo(TranslatableComponent.of("worldedit.wand.selwand.info"));
player.print(Caption.of("worldedit.wand.selwand.info"));
}
}
@ -314,7 +313,7 @@ public class SelectionCommands {
@CommandPermissions("worldedit.wand.toggle")
public void toggleWand(Player player) {
player.printInfo(
TranslatableComponent.of(
Caption.of(
"worldedit.wand.selwand.now.tool",
TextComponent.of("/tool none", TextColor.AQUA).clickEvent(
ClickEvent.of(ClickEvent.Action.RUN_COMMAND, "/tool none")),
@ -357,7 +356,7 @@ public class SelectionCommands {
session.getRegionSelector(world).explainRegionAdjust(actor, session);
actor.printInfo(TranslatableComponent.of("worldedit.contract.contracted", TextComponent.of(oldSize - newSize)));
actor.print(Caption.of("worldedit.contract.contracted", TextComponent.of(oldSize - newSize)));
} catch (RegionOperationException e) {
actor.printError(TextComponent.of(e.getMessage()));
}
@ -386,7 +385,7 @@ public class SelectionCommands {
session.getRegionSelector(world).explainRegionAdjust(actor, session);
actor.printInfo(TranslatableComponent.of("worldedit.shift.shifted"));
actor.print(Caption.of("worldedit.shift.shifted"));
} catch (RegionOperationException e) {
actor.printError(TextComponent.of(e.getMessage()));
}
@ -409,7 +408,7 @@ public class SelectionCommands {
region.expand(getChangesForEachDir(amount, onlyHorizontal, onlyVertical));
session.getRegionSelector(world).learnChanges();
session.getRegionSelector(world).explainRegionAdjust(actor, session);
actor.printInfo(TranslatableComponent.of("worldedit.outset.outset"));
actor.print(Caption.of("worldedit.outset.outset"));
}
@Command(
@ -429,7 +428,7 @@ public class SelectionCommands {
region.contract(getChangesForEachDir(amount, onlyHorizontal, onlyVertical));
session.getRegionSelector(world).learnChanges();
session.getRegionSelector(world).explainRegionAdjust(actor, session);
actor.printInfo(TranslatableComponent.of("worldedit.inset.inset"));
actor.print(Caption.of("worldedit.inset.inset"));
}
private BlockVector3[] getChangesForEachDir(int amount, boolean onlyHorizontal, boolean onlyVertical) {
@ -485,14 +484,14 @@ public class SelectionCommands {
String originStr = origin.getBlockX() + "," + origin.getBlockY() + "," + origin.getBlockZ();
long numBlocks = ((long) size.getBlockX() * size.getBlockY() * size.getBlockZ());
actor.printInfo(TranslatableComponent.of("worldedit.size.offset", TextComponent.of(name), TextComponent.of(sizeStr), TextComponent.of(originStr), TextComponent.of(numBlocks)));
actor.print(Caption.of("worldedit.size.offset", TextComponent.of(name), TextComponent.of(sizeStr), TextComponent.of(originStr), TextComponent.of(numBlocks)));
index++;
}
return;
} else {
region = session.getSelection(world);
actor.printInfo(TranslatableComponent.of("worldedit.size.type", TextComponent.of(session.getRegionSelector(world).getTypeName())));
actor.print(Caption.of("worldedit.size.type", TextComponent.of(session.getRegionSelector(world).getTypeName())));
for (Component line : session.getRegionSelector(world).getSelectionInfoLines()) {
actor.printInfo(line);
@ -502,9 +501,9 @@ public class SelectionCommands {
.subtract(region.getMinimumPoint())
.add(1, 1, 1);
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.getVolume())));
actor.print(Caption.of("worldedit.size.size", TextComponent.of(size.toString())));
actor.print(Caption.of("worldedit.size.distance", TextComponent.of(region.getMaximumPoint().distance(region.getMinimumPoint()))));
actor.print(Caption.of("worldedit.size.blocks", TextComponent.of(region.getVolume())));
}
@Command(
@ -516,7 +515,7 @@ public class SelectionCommands {
@Arg(desc = "The mask of blocks to match")
Mask mask) throws WorldEditException {
int count = editSession.countBlocks(session.getSelection(world), mask);
actor.printInfo(TranslatableComponent.of("worldedit.count.counted", TextComponent.of(count)));
actor.print(Caption.of("worldedit.count.counted", TextComponent.of(count)));
return count;
}
@ -551,13 +550,13 @@ public class SelectionCommands {
} else {
distribution = session.getLastDistribution();
if (distribution == null) {
actor.printError(TranslatableComponent.of("worldedit.distr.no-previous"));
actor.print(Caption.of("worldedit.distr.no-previous"));
return;
}
}
if (distribution.isEmpty()) { // *Should* always be false
actor.printError(TranslatableComponent.of("worldedit.distr.no-blocks"));
actor.print(Caption.of("worldedit.distr.no-blocks"));
return;
}
@ -582,7 +581,7 @@ public class SelectionCommands {
if (selector == null) {
session.getRegionSelector(world).clear();
session.dispatchCUISelection(actor);
actor.printInfo(TranslatableComponent.of("worldedit.select.cleared"));
actor.print(Caption.of("worldedit.select.cleared"));
return;
}
@ -592,54 +591,54 @@ public class SelectionCommands {
switch (selector) {
case CUBOID:
newSelector = new CuboidRegionSelector(oldSelector);
actor.printInfo(TranslatableComponent.of("worldedit.select.cuboid.message"));
actor.print(Caption.of("worldedit.select.cuboid.message"));
break;
case EXTEND:
newSelector = new ExtendingCuboidRegionSelector(oldSelector);
actor.printInfo(TranslatableComponent.of("worldedit.select.extend.message"));
actor.print(Caption.of("worldedit.select.extend.message"));
break;
case POLY: {
newSelector = new Polygonal2DRegionSelector(oldSelector);
actor.printInfo(TranslatableComponent.of("worldedit.select.poly.message"));
actor.print(Caption.of("worldedit.select.poly.message"));
Optional<Integer> limit = ActorSelectorLimits.forActor(actor).getPolygonVertexLimit();
limit.ifPresent(integer -> actor.printInfo(TranslatableComponent.of("worldedit.select.poly.limit-message", TextComponent.of(integer))));
limit.ifPresent(integer -> actor.print(Caption.of("worldedit.select.poly.limit-message", TextComponent.of(integer))));
break;
}
case ELLIPSOID:
newSelector = new EllipsoidRegionSelector(oldSelector);
actor.printInfo(TranslatableComponent.of("worldedit.select.ellipsoid.message"));
actor.print(Caption.of("worldedit.select.ellipsoid.message"));
break;
case SPHERE:
newSelector = new SphereRegionSelector(oldSelector);
actor.printInfo(TranslatableComponent.of("worldedit.select.sphere.message"));
actor.print(Caption.of("worldedit.select.sphere.message"));
break;
case CYL:
newSelector = new CylinderRegionSelector(oldSelector);
actor.printInfo(TranslatableComponent.of("worldedit.select.cyl.message"));
actor.print(Caption.of("worldedit.select.cyl.message"));
break;
case CONVEX:
case HULL:
case POLYHEDRON: {
newSelector = new ConvexPolyhedralRegionSelector(oldSelector);
actor.printInfo(TranslatableComponent.of("worldedit.select.convex.message"));
actor.print(Caption.of("worldedit.select.convex.message"));
Optional<Integer> limit = ActorSelectorLimits.forActor(actor).getPolyhedronVertexLimit();
limit.ifPresent(integer -> actor.printInfo(TranslatableComponent.of("worldedit.select.convex.limit-message", TextComponent.of(integer))));
limit.ifPresent(integer -> actor.print(Caption.of("worldedit.select.convex.limit-message", TextComponent.of(integer))));
break;
}
case POLYHEDRAL:
newSelector = new PolyhedralRegionSelector(world);
actor.print(TranslatableComponent.of("fawe.selection.sel.convex.polyhedral"));
actor.print(Caption.of("fawe.selection.sel.convex.polyhedral"));
Optional<Integer> limit = ActorSelectorLimits.forActor(actor).getPolyhedronVertexLimit();
limit.ifPresent(integer -> actor.print(Caption.of("fawe.selection.sel.max", integer)));
actor.print(TranslatableComponent.of("fawe.selection.sel.list"));
actor.print(Caption.of("fawe.selection.sel.list"));
break;
case FUZZY:
case MAGIC:
Mask maskOpt = new IdMask(world);
//TODO Make FuzzyRegionSelector accept actors
newSelector = new FuzzyRegionSelector((Player) actor, world, maskOpt);
actor.print(TranslatableComponent.of("fawe.selection.sel.fuzzy"));
actor.print(TranslatableComponent.of("fawe.selection.sel.list"));
actor.print(Caption.of("fawe.selection.sel.fuzzy"));
actor.print(Caption.of("fawe.selection.sel.list"));
break;
case LIST:
default:
@ -648,13 +647,13 @@ public class SelectionCommands {
TextComponentProducer contents = box.getContents();
contents.append(SubtleFormat.wrap("Select one of the modes below:")).newline();
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("cuboid", Caption.of("worldedit.select.cuboid.description"), "//sel cuboid");
box.appendCommand("extend", Caption.of("worldedit.select.extend.description"), "//sel extend");
box.appendCommand("poly", Caption.of("worldedit.select.poly.description"), "//sel poly");
box.appendCommand("ellipsoid", Caption.of("worldedit.select.ellipsoid.description"), "//sel ellipsoid");
box.appendCommand("sphere", Caption.of("worldedit.select.sphere.description"), "//sel sphere");
box.appendCommand("cyl", Caption.of("worldedit.select.cyl.description"), "//sel cyl");
box.appendCommand("convex", Caption.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>]");
@ -673,7 +672,7 @@ public class SelectionCommands {
if (found != null) {
session.setDefaultRegionSelector(found);
actor.printInfo(TranslatableComponent.of("worldedit.select.default-set", TextComponent.of(found.name())));
actor.print(Caption.of("worldedit.select.default-set", TextComponent.of(found.name())));
} else {
throw new RuntimeException("Something unexpected happened. Please report this.");
}
@ -740,7 +739,7 @@ public class SelectionCommands {
@Override
public Component create(int page) throws InvalidComponentException {
super.getContents().append(TranslatableComponent.of("worldedit.distr.total", TextColor.GRAY, TextComponent.of(totalBlocks)))
super.getContents().append(Caption.of("worldedit.distr.total", TextComponent.of(totalBlocks)))
.append(TextComponent.newline());
return super.create(page);
}

View File

@ -21,6 +21,7 @@
package com.sk89q.worldedit.command;
import com.boydti.fawe.config.Caption;
import com.sk89q.worldedit.LocalConfiguration;
import com.sk89q.worldedit.LocalSession;
import com.sk89q.worldedit.WorldEdit;
@ -74,7 +75,7 @@ public class SnapshotCommands {
static void checkSnapshotsConfigured(LocalConfiguration localConfiguration) {
if (!localConfiguration.snapshotsConfigured) {
throw new StopExecutionException(TranslatableComponent.of(
throw new StopExecutionException(Caption.of(
"worldedit.restore.not-configured"
));
}
@ -120,7 +121,7 @@ public class SnapshotCommands {
if (!snapshots.isEmpty()) {
actor.print(new SnapshotListBox(world.getName(), snapshots).create(page));
} else {
actor.printError(TranslatableComponent.of(
actor.print(Caption.of(
"worldedit.restore.none-for-specific-world",
TextComponent.of(world.getName())
));
@ -169,9 +170,9 @@ public class SnapshotCommands {
session.getSnapshotExperimental().close();
}
session.setSnapshot(null);
actor.printInfo(TranslatableComponent.of("worldedit.snapshot.use.newest"));
actor.print(Caption.of("worldedit.snapshot.use.newest"));
} else {
actor.printError(TranslatableComponent.of("worldedit.restore.none-for-world"));
actor.print(Caption.of("worldedit.restore.none-for-world"));
}
} else {
URI uri = resolveSnapshotName(config, name);
@ -181,11 +182,11 @@ public class SnapshotCommands {
session.getSnapshotExperimental().close();
}
session.setSnapshotExperimental(snapshot.get());
actor.printInfo(TranslatableComponent.of(
actor.print(Caption.of(
"worldedit.snapshot.use", TextComponent.of(name)
));
} else {
actor.printError(TranslatableComponent.of("worldedit.restore.not-available"));
actor.print(Caption.of("worldedit.restore.not-available"));
}
}
}
@ -207,7 +208,7 @@ public class SnapshotCommands {
}
if (index < 1) {
actor.printError(TranslatableComponent.of("worldedit.snapshot.index-above-0"));
actor.print(Caption.of("worldedit.snapshot.index-above-0"));
return;
}
@ -218,7 +219,7 @@ public class SnapshotCommands {
.collect(toList());
}
if (snapshots.size() < index) {
actor.printError(TranslatableComponent.of(
actor.print(Caption.of(
"worldedit.snapshot.index-oob",
TextComponent.of(snapshots.size())
));
@ -226,14 +227,14 @@ public class SnapshotCommands {
}
Snapshot snapshot = snapshots.get(index - 1);
if (snapshot == null) {
actor.printError(TranslatableComponent.of("worldedit.restore.not-available"));
actor.print(Caption.of("worldedit.restore.not-available"));
return;
}
if (session.getSnapshotExperimental() != null) {
session.getSnapshotExperimental().close();
}
session.setSnapshotExperimental(snapshot);
actor.printInfo(TranslatableComponent.of(
actor.print(Caption.of(
"worldedit.snapshot.use",
TextComponent.of(snapshot.getInfo().getDisplayName())
));
@ -263,7 +264,7 @@ public class SnapshotCommands {
}
if (snapshot == null) {
actor.printError(TranslatableComponent.of(
actor.print(Caption.of(
"worldedit.snapshot.none-before",
TextComponent.of(dateFormat.withZone(session.getTimeZone()).format(date)))
);
@ -272,7 +273,7 @@ public class SnapshotCommands {
session.getSnapshotExperimental().close();
}
session.setSnapshotExperimental(snapshot);
actor.printInfo(TranslatableComponent.of(
actor.print(Caption.of(
"worldedit.snapshot.use",
TextComponent.of(snapshot.getInfo().getDisplayName())
));
@ -302,7 +303,7 @@ public class SnapshotCommands {
.findFirst().orElse(null);
}
if (snapshot == null) {
actor.printError(TranslatableComponent.of(
actor.print(Caption.of(
"worldedit.snapshot.none-after",
TextComponent.of(dateFormat.withZone(session.getTimeZone()).format(date)))
);
@ -311,7 +312,7 @@ public class SnapshotCommands {
session.getSnapshotExperimental().close();
}
session.setSnapshotExperimental(snapshot);
actor.printInfo(TranslatableComponent.of(
actor.print(Caption.of(
"worldedit.snapshot.use",
TextComponent.of(snapshot.getInfo().getDisplayName())
));

View File

@ -19,6 +19,7 @@
package com.sk89q.worldedit.command;
import com.boydti.fawe.config.Caption;
import com.sk89q.worldedit.EditSession;
import com.sk89q.worldedit.LocalConfiguration;
import com.sk89q.worldedit.LocalSession;
@ -30,7 +31,6 @@ 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.World;
import com.sk89q.worldedit.world.snapshot.experimental.Snapshot;
import com.sk89q.worldedit.world.snapshot.experimental.SnapshotRestore;
@ -83,7 +83,7 @@ public class SnapshotUtilCommands {
URI uri = resolveSnapshotName(config, snapshotName);
Optional<Snapshot> snapOpt = config.snapshotDatabase.getSnapshot(uri);
if (!snapOpt.isPresent()) {
actor.printError(TranslatableComponent.of("worldedit.restore.not-available"));
actor.print(Caption.of("worldedit.restore.not-available"));
return;
}
snapshot = snapOpt.get();
@ -100,14 +100,14 @@ public class SnapshotUtilCommands {
}
if (snapshot == null) {
actor.printError(TranslatableComponent.of(
actor.print(Caption.of(
"worldedit.restore.none-for-specific-world",
TextComponent.of(world.getName())
));
return;
}
}
actor.printInfo(TranslatableComponent.of(
actor.print(Caption.of(
"worldedit.restore.loaded",
TextComponent.of(snapshot.getInfo().getDisplayName())
));
@ -122,15 +122,15 @@ public class SnapshotUtilCommands {
if (restore.hadTotalFailure()) {
String error = restore.getLastErrorMessage();
if (!restore.getMissingChunks().isEmpty()) {
actor.printError(TranslatableComponent.of("worldedit.restore.chunk-not-present"));
actor.print(Caption.of("worldedit.restore.chunk-not-present"));
} else if (error != null) {
actor.printError(TranslatableComponent.of("worldedit.restore.block-place-failed"));
actor.printError(TranslatableComponent.of("worldedit.restore.block-place-error", TextComponent.of(error)));
actor.print(Caption.of("worldedit.restore.block-place-failed"));
actor.print(Caption.of("worldedit.restore.block-place-error", TextComponent.of(error)));
} else {
actor.printError(TranslatableComponent.of("worldedit.restore.chunk-load-failed"));
actor.print(Caption.of("worldedit.restore.chunk-load-failed"));
}
} else {
actor.printInfo(TranslatableComponent.of("worldedit.restore.restored",
actor.print(Caption.of("worldedit.restore.restored",
TextComponent.of(restore.getMissingChunks().size()),
TextComponent.of(restore.getErrorChunks().size())));
}

View File

@ -19,6 +19,7 @@
package com.sk89q.worldedit.command;
import com.boydti.fawe.config.Caption;
import com.sk89q.worldedit.LocalConfiguration;
import com.sk89q.worldedit.LocalSession;
import com.sk89q.worldedit.WorldEdit;
@ -51,7 +52,7 @@ public class SuperPickaxeCommands {
public void single(Player player, LocalSession session) throws WorldEditException {
session.setSuperPickaxe(new SinglePickaxe());
session.enableSuperPickAxe();
player.printInfo(TranslatableComponent.of("worldedit.tool.superpickaxe.mode.single"));
player.print(Caption.of("worldedit.tool.superpickaxe.mode.single"));
}
@Command(
@ -66,12 +67,12 @@ public class SuperPickaxeCommands {
LocalConfiguration config = we.getConfiguration();
if (range > config.maxSuperPickaxeSize) {
player.printError(TranslatableComponent.of("worldedit.tool.superpickaxe.max-range", TextComponent.of(config.maxSuperPickaxeSize)));
player.print(Caption.of("worldedit.tool.superpickaxe.max-range", TextComponent.of(config.maxSuperPickaxeSize)));
return;
}
session.setSuperPickaxe(new AreaPickaxe(range));
session.enableSuperPickAxe();
player.printInfo(TranslatableComponent.of("worldedit.tool.superpickaxe.mode.area"));
player.print(Caption.of("worldedit.tool.superpickaxe.mode.area"));
}
@Command(
@ -87,12 +88,12 @@ public class SuperPickaxeCommands {
LocalConfiguration config = we.getConfiguration();
if (range > config.maxSuperPickaxeSize) {
player.printError(TranslatableComponent.of("worldedit.tool.superpickaxe.max-range", TextComponent.of(config.maxSuperPickaxeSize)));
player.print(Caption.of("worldedit.tool.superpickaxe.max-range", TextComponent.of(config.maxSuperPickaxeSize)));
return;
}
session.setSuperPickaxe(new RecursivePickaxe(range));
session.enableSuperPickAxe();
player.printInfo(TranslatableComponent.of("worldedit.tool.superpickaxe.mode.recursive"));
player.print(Caption.of("worldedit.tool.superpickaxe.mode.recursive"));
}
}

View File

@ -19,6 +19,7 @@
package com.sk89q.worldedit.command;
import com.boydti.fawe.config.Caption;
import com.boydti.fawe.object.brush.InspectBrush;
import com.google.common.collect.Collections2;
import com.sk89q.worldedit.LocalConfiguration;
@ -52,7 +53,6 @@ import com.sk89q.worldedit.util.HandSide;
import com.sk89q.worldedit.util.TreeGenerator;
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.block.BlockStateHolder;
@ -120,7 +120,7 @@ public class ToolCommands {
.collect(Collectors.toSet());
commandManager.register("tool", command -> {
command.addPart(SubCommandPart.builder(
TranslatableComponent.of("tool"),
Caption.of("tool"),
TextComponent.of("The tool to bind")
)
.withCommands(nonGlobalCommands)
@ -145,18 +145,18 @@ public class ToolCommands {
throws InvalidToolBindException {
isBrush = session.getTool(player) instanceof BrushTool;
session.setTool(player.getItemInHand(HandSide.MAIN_HAND).getType(), null);
player.printInfo(TranslatableComponent.of(isBrush ? "worldedit.brush.none.equip" : "worldedit.tool.none.equip"));
player.print(Caption.of(isBrush ? "worldedit.brush.none.equip" : "worldedit.tool.none.equip"));
}
static void sendUnbindInstruction(Player sender, Component commandComponent) {
sender.printDebug(TranslatableComponent.of("worldedit.tool.unbind-instruction", commandComponent));
sender.print(Caption.of("worldedit.tool.unbind-instruction", commandComponent));
}
private static void setTool(Player player, LocalSession session, Tool tool,
String translationKey) throws InvalidToolBindException {
BaseItemStack itemStack = player.getItemInHand(HandSide.MAIN_HAND);
session.setTool(itemStack.getType(), tool);
player.printInfo(TranslatableComponent.of(translationKey, itemStack.getRichName()));
player.print(Caption.of(translationKey, itemStack.getRichName()));
sendUnbindInstruction(player, UNBIND_COMMAND_COMPONENT);
}
@ -278,7 +278,7 @@ public class ToolCommands {
LocalConfiguration config = we.getConfiguration();
if (range > config.maxSuperPickaxeSize) {
player.printError(TranslatableComponent.of("worldedit.tool.superpickaxe.max-range", TextComponent.of(config.maxSuperPickaxeSize)));
player.print(Caption.of("worldedit.tool.superpickaxe.max-range", TextComponent.of(config.maxSuperPickaxeSize)));
return;
}
setTool(player, session, new FloodFillTool(range, pattern), "worldedit.tool.floodfill.equip");
@ -328,6 +328,6 @@ public class ToolCommands {
} else {
secondaryName = TextComponent.of("pattern");
}
player.printInfo(TranslatableComponent.of("worldedit.tool.lrbuild.set", primaryName, secondaryName));
player.print(Caption.of("worldedit.tool.lrbuild.set", primaryName, secondaryName));
}
}

View File

@ -43,7 +43,6 @@ 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;
@ -77,11 +76,11 @@ public class ToolUtilCommands {
Mask maskOpt, Arguments arguments) throws WorldEditException {
BrushTool tool = session.getBrushTool(player, false);
if (tool == null) {
player.print(TranslatableComponent.of("fawe.worldedit.brush.brush.none"));
player.print(Caption.of("fawe.worldedit.brush.brush.none"));
return;
}
if (maskOpt == null) {
player.printInfo(TranslatableComponent.of("worldedit.tool.mask.disabled"));
player.print(Caption.of("worldedit.tool.mask.disabled"));
tool.setMask(null);
} else {
BrushSettings settings = offHand ? tool.getOffHand() : tool.getContext();
@ -90,7 +89,7 @@ public class ToolUtilCommands {
settings.addSetting(BrushSettings.SettingType.MASK, lastArg);
settings.setMask(maskOpt);
tool.update();
player.printInfo(TranslatableComponent.of("worldedit.tool.mask.set"));
player.print(Caption.of("worldedit.tool.mask.set"));
}
}
@ -107,7 +106,7 @@ public class ToolUtilCommands {
boolean offHand, Arguments arguments) throws WorldEditException {
BrushTool tool = session.getBrushTool(player, false);
if (tool == null) {
player.printInfo(TranslatableComponent.of("fawe.worldedit.brush.brush.none"));
player.print(Caption.of("fawe.worldedit.brush.brush.none"));
return;
}
if (pattern == null) {
@ -119,7 +118,7 @@ public class ToolUtilCommands {
settings.addSetting(BrushSettings.SettingType.FILL, lastArg);
tool.update();
}
player.printInfo(TranslatableComponent.of("worldedit.tool.material.set"));
player.print(Caption.of("worldedit.tool.material.set"));
}
@Command(
@ -132,7 +131,7 @@ public class ToolUtilCommands {
@Arg(desc = "The range of the brush")
int range) throws WorldEditException {
session.getBrushTool(player, false).setRange(range);
player.printInfo(TranslatableComponent.of("worldedit.tool.range.set"));
player.print(Caption.of("worldedit.tool.range.set"));
}
@Command(
@ -146,7 +145,7 @@ public class ToolUtilCommands {
we.checkMaxBrushRadius(size);
session.getBrushTool(player.getItemInHand(HandSide.MAIN_HAND).getType()).setSize(size);
player.printInfo(TranslatableComponent.of("worldedit.tool.size.set"));
player.print(Caption.of("worldedit.tool.size.set"));
}
@Command(
@ -160,9 +159,9 @@ public class ToolUtilCommands {
Mask maskOpt) throws WorldEditException {
session.getBrushTool(player, false).setTraceMask(maskOpt);
if (maskOpt == null) {
player.printInfo(TranslatableComponent.of("worldedit.tool.tracemask.disabled"));
player.print(Caption.of("worldedit.tool.tracemask.disabled"));
} else {
player.printInfo(TranslatableComponent.of("worldedit.tool.tracemask.set"));
player.print(Caption.of("worldedit.tool.tracemask.set"));
}
}
@ -177,15 +176,15 @@ public class ToolUtilCommands {
Boolean superPickaxe) {
boolean hasSuperPickAxe = session.hasSuperPickAxe();
if (superPickaxe != null && superPickaxe == hasSuperPickAxe) {
player.printError(TranslatableComponent.of(superPickaxe ? "worldedit.tool.superpickaxe.enabled.already" : "worldedit.tool.superpickaxe.disabled.already"));
player.print(Caption.of(superPickaxe ? "worldedit.tool.superpickaxe.enabled.already" : "worldedit.tool.superpickaxe.disabled.already"));
return;
}
if (hasSuperPickAxe) {
session.disableSuperPickAxe();
player.printInfo(TranslatableComponent.of("worldedit.tool.superpickaxe.disabled"));
player.print(Caption.of("worldedit.tool.superpickaxe.disabled"));
} else {
session.enableSuperPickAxe();
player.printInfo(TranslatableComponent.of("worldedit.tool.superpickaxe.enabled"));
player.print(Caption.of("worldedit.tool.superpickaxe.enabled"));
}
}
@ -248,7 +247,7 @@ public class ToolUtilCommands {
int mode) throws WorldEditException {
BrushTool tool = session.getBrushTool(player, false);
if (tool == null) {
player.print(TranslatableComponent.of("fawe.worldedit.brush.brush.none"));
player.print(Caption.of("fawe.worldedit.brush.brush.none"));
return;
}
VisualMode[] modes = VisualMode.values();
@ -268,7 +267,7 @@ public class ToolUtilCommands {
int mode) throws WorldEditException {
BrushTool tool = session.getBrushTool(player, false);
if (tool == null) {
player.print(TranslatableComponent.of("fawe.worldedit.brush.brush.none"));
player.print(Caption.of("fawe.worldedit.brush.brush.none"));
return;
}
TargetMode[] modes = TargetMode.values();
@ -287,7 +286,7 @@ public class ToolUtilCommands {
@Arg(name = "offset", desc = "offset", def = "0") int offset) throws WorldEditException {
BrushTool tool = session.getBrushTool(player, false);
if (tool == null) {
player.print(TranslatableComponent.of("fawe.worldedit.brush.brush.none"));
player.print(Caption.of("fawe.worldedit.brush.brush.none"));
return;
}
tool.setTargetOffset(offset);
@ -308,7 +307,7 @@ public class ToolUtilCommands {
List<String> commandStr) throws WorldEditException {
BrushTool bt = session.getBrushTool(player, false);
if (bt == null) {
player.print(TranslatableComponent.of("fawe.worldedit.brush.brush.none"));
player.print(Caption.of("fawe.worldedit.brush.brush.none"));
return;
}
@ -316,7 +315,7 @@ public class ToolUtilCommands {
Scroll action = Scroll.fromArguments(bt, player, session, mode, commandStr, true);
settings.setScrollAction(action);
if (mode == Scroll.Action.NONE) {
player.print(TranslatableComponent.of("fawe.worldedit.brush.brush.scroll.action.unset"));
player.print(Caption.of("fawe.worldedit.brush.brush.scroll.action.unset"));
} else if (action != null) {
String full = (mode.name().toLowerCase(Locale.ROOT) + " " + StringMan.join(commandStr, " ")).trim();
settings.addSetting(BrushSettings.SettingType.SCROLL_ACTION, full);
@ -342,11 +341,11 @@ public class ToolUtilCommands {
Arguments arguments) throws WorldEditException {
BrushTool tool = session.getBrushTool(player, false);
if (tool == null) {
player.print(TranslatableComponent.of("fawe.worldedit.brush.brush.none"));
player.print(Caption.of("fawe.worldedit.brush.brush.none"));
return;
}
if (maskArg == null) {
player.print(TranslatableComponent.of("fawe.worldedit.brush.brush.source.mask.disabled"));
player.print(Caption.of("fawe.worldedit.brush.brush.source.mask.disabled"));
tool.setSourceMask(null);
return;
}
@ -355,7 +354,7 @@ public class ToolUtilCommands {
settings.addSetting(BrushSettings.SettingType.SOURCE_MASK, lastArg);
settings.setSourceMask(maskArg);
tool.update();
player.print(TranslatableComponent.of("fawe.worldedit.brush.brush.source.mask"));
player.print(Caption.of("fawe.worldedit.brush.brush.source.mask"));
}
// TODO: Ping @MattBDev to reimplement 2020-02-04

View File

@ -67,7 +67,6 @@ import com.sk89q.worldedit.regions.Region;
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.TranslatableComponent;
import com.sk89q.worldedit.util.formatting.text.format.TextColor;
import com.sk89q.worldedit.world.World;
import com.sk89q.worldedit.world.block.BlockTypes;
@ -217,7 +216,7 @@ public class UtilityCommands {
BlockVector3 pos = session.getPlacementPosition(actor);
int affected = editSession.fillDirection(pos, pattern, radius, depth, direction);
actor.printInfo(TranslatableComponent.of("worldedit.fill.created", TextComponent.of(affected)));
actor.print(Caption.of("worldedit.fill.created", TextComponent.of(affected)));
return affected;
}
@ -315,7 +314,7 @@ public class UtilityCommands {
BlockVector3 pos = session.getPlacementPosition(actor);
int affected = editSession.fillXZ(pos, pattern, radius, depth, true);
actor.printInfo(TranslatableComponent.of("worldedit.fillr.created", TextComponent.of(affected)));
actor.print(Caption.of("worldedit.fillr.created", TextComponent.of(affected)));
return affected;
}
@ -336,7 +335,7 @@ public class UtilityCommands {
radius = Math.max(0, radius);
we.checkMaxRadius(radius);
int affected = editSession.drainArea(session.getPlacementPosition(actor), radius, waterlogged, plants);
actor.printInfo(TranslatableComponent.of("worldedit.drain.drained", TextComponent.of(affected)));
actor.print(Caption.of("worldedit.drain.drained", TextComponent.of(affected)));
return affected;
}
@ -353,7 +352,7 @@ public class UtilityCommands {
radius = Math.max(0, radius);
we.checkMaxRadius(radius);
int affected = editSession.fixLiquid(session.getPlacementPosition(actor), radius, BlockTypes.LAVA);
actor.printInfo(TranslatableComponent.of("worldedit.fixlava.fixed", TextComponent.of(affected)));
actor.print(Caption.of("worldedit.fixlava.fixed", TextComponent.of(affected)));
return affected;
}
@ -370,7 +369,7 @@ public class UtilityCommands {
radius = Math.max(0, radius);
we.checkMaxRadius(radius);
int affected = editSession.fixLiquid(session.getPlacementPosition(actor), radius, BlockTypes.WATER);
actor.printInfo(TranslatableComponent.of("worldedit.fixwater.fixed", TextComponent.of(affected)));
actor.print(Caption.of("worldedit.fixwater.fixed", TextComponent.of(affected)));
return affected;
}
@ -391,7 +390,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.printInfo(TranslatableComponent.of("worldedit.removeabove.removed", TextComponent.of(affected)));
actor.print(Caption.of("worldedit.removeabove.removed", TextComponent.of(affected)));
return affected;
}
@ -412,7 +411,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.printInfo(TranslatableComponent.of("worldedit.removebelow.removed", TextComponent.of(affected)));
actor.print(Caption.of("worldedit.removebelow.removed", TextComponent.of(affected)));
return affected;
}
@ -432,7 +431,7 @@ public class UtilityCommands {
we.checkMaxRadius(radius);
int affected = editSession.removeNear(session.getPlacementPosition(actor), mask, radius);
actor.printInfo(TranslatableComponent.of("worldedit.removenear.removed", TextComponent.of(affected)));
actor.print(Caption.of("worldedit.removenear.removed", TextComponent.of(affected)));
return affected;
}
@ -463,7 +462,7 @@ public class UtilityCommands {
}
int affected = editSession.replaceBlocks(region, from, to);
actor.printInfo(TranslatableComponent.of("worldedit.replacenear.replaced", TextComponent.of(affected)));
actor.print(Caption.of("worldedit.replacenear.replaced", TextComponent.of(affected)));
return affected;
}
@ -494,7 +493,7 @@ public class UtilityCommands {
CylinderRegion region = new CylinderRegion(position, Vector2.at(size, size), position.getBlockY() - height, position.getBlockY() + height);
int affected = editSession.simulateSnow(region, stack);
actor.printInfo(TranslatableComponent.of(
actor.print(Caption.of(
"worldedit.snow.created", TextComponent.of(affected)
));
return affected;
@ -521,7 +520,7 @@ public class UtilityCommands {
we.checkMaxRadius(size);
int affected = editSession.thaw(session.getPlacementPosition(actor), size, height);
actor.printInfo(TranslatableComponent.of(
actor.print(Caption.of(
"worldedit.thaw.removed", TextComponent.of(affected)
));
return affected;
@ -553,7 +552,7 @@ public class UtilityCommands {
final int affected = editSession.green(
session.getPlacementPosition(actor), size, height, onlyNormalDirt
);
actor.printInfo(TranslatableComponent.of(
actor.print(Caption.of(
"worldedit.green.changed", TextComponent.of(affected)
));
return affected;
@ -578,7 +577,7 @@ public class UtilityCommands {
Mask mask = new BlockTypeMask(editSession, BlockTypes.FIRE);
int affected = editSession.removeNear(session.getPlacementPosition(actor), mask, size);
actor.printInfo(TranslatableComponent.of("worldedit.extinguish.removed", TextComponent.of(affected)));
actor.print(Caption.of("worldedit.extinguish.removed", TextComponent.of(affected)));
return affected;
}
@ -615,7 +614,7 @@ public class UtilityCommands {
if (radius == null) {
radius = config.butcherDefaultRadius;
} else if (radius < -1) {
actor.printError(TranslatableComponent.of("worldedit.butcher.explain-all"));
actor.print(Caption.of("worldedit.butcher.explain-all"));
return 0;
} else if (radius == -1) {
if (config.butcherMaxRadius != -1) {
@ -639,7 +638,7 @@ public class UtilityCommands {
int killed = killMatchingEntities(radius, actor, flags::createFunction);
actor.printInfo(TranslatableComponent.of(
actor.print(Caption.of(
"worldedit.butcher.killed",
TextComponent.of(killed),
TextComponent.of(radius)
@ -661,12 +660,12 @@ public class UtilityCommands {
@Arg(desc = "The radius of the cuboid to remove from")
int radius) throws WorldEditException {
if (radius < -1) {
actor.printError(TranslatableComponent.of("worldedit.remove.explain-all"));
actor.print(Caption.of("worldedit.remove.explain-all"));
return 0;
}
int removed = killMatchingEntities(radius, actor, remover::createFunction);
actor.printInfo(TranslatableComponent.of("worldedit.remove.removed", TextComponent.of(removed)));
actor.print(Caption.of("worldedit.remove.removed", TextComponent.of(removed)));
return removed;
}
@ -716,7 +715,7 @@ public class UtilityCommands {
try {
expression = Expression.compile(String.join(" ", input));
} catch (ExpressionException e) {
actor.printError(TranslatableComponent.of(
actor.print(Caption.of(
"worldedit.calc.invalid.with-error",
TextComponent.of(String.join(" ", input)),
TextComponent.of(e.getMessage())
@ -755,7 +754,7 @@ public class UtilityCommands {
@CommandPermissions(value = "fawe.confirm", queued = false)
public void confirm(Player player) throws WorldEditException {
if (!player.confirm()) {
player.print(TranslatableComponent.of("fawe.worldedit.utility.nothing.confirmed"));
player.print(Caption.of("fawe.worldedit.utility.nothing.confirmed"));
}
}
@ -819,7 +818,7 @@ public class UtilityCommands {
getFiles(dir, actor, args, formatName, playerFolder, fileList::add);
if (fileList.isEmpty()) {
actor.print(TranslatableComponent.of("fawe.worldedit.schematic.schematic.none"));
actor.print(Caption.of("fawe.worldedit.schematic.schematic.none"));
return Collections.emptyList();
}

View File

@ -21,6 +21,7 @@ package com.sk89q.worldedit.command;
import com.boydti.fawe.Fawe;
import com.boydti.fawe.FaweVersion;
import com.boydti.fawe.config.Caption;
import com.boydti.fawe.config.Settings;
import com.intellectualsites.paster.IncendoPaster;
import com.sk89q.worldedit.LocalSession;
@ -92,7 +93,7 @@ public class WorldEditCommands {
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.print(Caption.of("worldedit.version.version", dateArg, commitArg, buildArg, platformArg));
}
actor.printInfo(TextComponent.of("Wiki: https://wiki.intellectualsites.com/FastAsyncWorldEdit/index"));
@ -132,7 +133,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.printInfo(TranslatableComponent.of("worldedit.reload.config"));
actor.print(Caption.of("worldedit.reload.config"));
}
@Command(
@ -151,7 +152,7 @@ public class WorldEditCommands {
actor.printInfo(TextComponent.of(e.getMessage()));
return;
}
actor.printInfo(TranslatableComponent.of("worldedit.report.written", TextComponent.of(dest).clickEvent(
actor.print(Caption.of("worldedit.report.written", TextComponent.of(dest).clickEvent(
ClickEvent.openUrl(dest))));
}
@ -164,7 +165,7 @@ public class WorldEditCommands {
Map<Thread, StackTraceElement[]> stacks = Thread.getAllStackTraces();
for (Map.Entry<Thread, StackTraceElement[]> entry : stacks.entrySet()) {
Thread thread = entry.getKey();
actor.printDebug(TranslatableComponent.of(
actor.printDebug(TextComponent.of(
"--------------------------------------------------------------------------------------------"));
actor.printDebug("Thread: " + thread.getName() + " | Id: " + thread.getId() + " | Alive: " + thread.isAlive());
for (StackTraceElement elem : entry.getValue()) {
@ -194,13 +195,13 @@ public class WorldEditCommands {
try {
ZoneId tz = ZoneId.of(timezone);
session.setTimezone(tz);
actor.printInfo(TranslatableComponent.of("worldedit.timezone.set", TextComponent.of(tz.getDisplayName(
actor.print(Caption.of("worldedit.timezone.set", TextComponent.of(tz.getDisplayName(
TextStyle.FULL, actor.getLocale()
))));
actor.printInfo(TranslatableComponent.of("worldedit.timezone.current",
actor.print(Caption.of("worldedit.timezone.current",
TextComponent.of(dateFormat.withLocale(actor.getLocale()).format(ZonedDateTime.now(tz)))));
} catch (ZoneRulesException e) {
actor.printError(TranslatableComponent.of("worldedit.timezone.invalid"));
actor.print(Caption.of("worldedit.timezone.invalid"));
}
}

View File

@ -19,6 +19,7 @@
package com.sk89q.worldedit.command.tool;
import com.boydti.fawe.config.Caption;
import com.sk89q.worldedit.EditSession;
import com.sk89q.worldedit.LocalConfiguration;
import com.sk89q.worldedit.LocalSession;
@ -80,7 +81,7 @@ public class AreaPickaxe implements BlockTool {
}
editSession.flushQueue();
} catch (MaxChangedBlocksException e) {
player.printError(TranslatableComponent.of("worldedit.tool.max-block-changes"));
player.print(Caption.of("worldedit.tool.max-block-changes"));
} finally {
session.remember(editSession);
}

View File

@ -19,6 +19,7 @@
package com.sk89q.worldedit.command.tool;
import com.boydti.fawe.config.Caption;
import com.google.common.collect.Lists;
import com.sk89q.worldedit.EditSession;
import com.sk89q.worldedit.LocalConfiguration;
@ -65,12 +66,12 @@ public class BlockDataCyler implements DoubleActionBlockTool {
if (!config.allowedDataCycleBlocks.isEmpty()
&& !player.hasPermission("worldedit.override.data-cycler")
&& !config.allowedDataCycleBlocks.contains(block.getBlockType().getId())) {
player.printError(TranslatableComponent.of("worldedit.tool.data-cycler.block-not-permitted"));
player.print(Caption.of("worldedit.tool.data-cycler.block-not-permitted"));
return true;
}
if (block.getStates().keySet().isEmpty()) {
player.printError(TranslatableComponent.of("worldedit.tool.data-cycler.cant-cycle"));
player.print(Caption.of("worldedit.tool.data-cycler.cant-cycle"));
} else {
Property<?> currentProperty = selectedProperties.get(player.getUniqueId());
@ -92,13 +93,13 @@ public class BlockDataCyler implements DoubleActionBlockTool {
try {
editSession.setBlock(blockPoint, newBlock);
player.printInfo(TranslatableComponent.of(
player.print(Caption.of(
"worldedit.tool.data-cycler.new-value",
TextComponent.of(currentProperty.getName()),
TextComponent.of(String.valueOf(currentProperty.getValues().get(index)))
));
} catch (MaxChangedBlocksException e) {
player.printError(TranslatableComponent.of("worldedit.tool.max-block-changes"));
player.print(Caption.of("worldedit.tool.max-block-changes"));
} finally {
session.remember(editSession);
}
@ -109,7 +110,7 @@ public class BlockDataCyler implements DoubleActionBlockTool {
index = (index + 1) % properties.size();
currentProperty = properties.get(index);
selectedProperties.put(player.getUniqueId(), currentProperty);
player.printInfo(TranslatableComponent.of("worldedit.tool.data-cycler.cycling", TextComponent.of(currentProperty.getName())));
player.print(Caption.of("worldedit.tool.data-cycler.cycling", TextComponent.of(currentProperty.getName())));
}
}

View File

@ -19,6 +19,7 @@
package com.sk89q.worldedit.command.tool;
import com.boydti.fawe.config.Caption;
import com.sk89q.worldedit.EditSession;
import com.sk89q.worldedit.LocalConfiguration;
import com.sk89q.worldedit.LocalSession;
@ -78,7 +79,7 @@ public class BlockReplacer implements DoubleActionBlockTool {
if (targetBlock != null) {
pattern = targetBlock;
player.printInfo(TranslatableComponent.of("worldedit.tool.repl.switched", targetBlock.getBlockType().getRichName()));
player.print(Caption.of("worldedit.tool.repl.switched", targetBlock.getBlockType().getRichName()));
}
return true;

View File

@ -446,7 +446,7 @@ public class BrushTool
if (target == null) {
editSession.cancel();
player.printError(TranslatableComponent.of("worldedit.tool.no-block"));
player.print(Caption.of("worldedit.tool.no-block"));
return true;
}
BlockBag bag = session.getBlockBag(player);
@ -481,7 +481,7 @@ public class BrushTool
WorldEdit.getInstance().checkMaxBrushRadius(size);
brush.build(editSession, target.toBlockPoint(), current.getMaterial(), size);
} catch (MaxChangedBlocksException e) {
player.printError(TranslatableComponent.of("worldedit.tool.max-block-changes"));
player.print(Caption.of("worldedit.tool.max-block-changes"));
} finally {
session.remember(editSession);
if (bag != null) {

View File

@ -19,6 +19,7 @@
package com.sk89q.worldedit.command.tool;
import com.boydti.fawe.config.Caption;
import com.sk89q.worldedit.LocalConfiguration;
import com.sk89q.worldedit.LocalSession;
import com.sk89q.worldedit.entity.Player;
@ -79,7 +80,7 @@ public class DistanceWand extends BrushTool implements DoubleActionTraceTool {
}
if (target == null) {
player.printError(TranslatableComponent.of("worldedit.tool.no-block"));
player.print(Caption.of("worldedit.tool.no-block"));
return null;
}

View File

@ -19,6 +19,7 @@
package com.sk89q.worldedit.command.tool;
import com.boydti.fawe.config.Caption;
import com.boydti.fawe.object.collection.LocalBlockVectorSet;
import com.sk89q.worldedit.EditSession;
import com.sk89q.worldedit.LocalConfiguration;
@ -75,7 +76,7 @@ public class FloatingTreeRemover implements BlockTool {
final BlockState state = world.getBlock(clicked.toVector().toBlockPoint());
if (!isTreeBlock(state.getBlockType())) {
player.printError(TranslatableComponent.of("worldedit.tool.deltree.not-tree"));
player.print(Caption.of("worldedit.tool.deltree.not-tree"));
return true;
}
@ -83,7 +84,7 @@ public class FloatingTreeRemover implements BlockTool {
try {
final Set<BlockVector3> blockSet = bfs(world, clicked.toVector().toBlockPoint());
if (blockSet == null) {
player.printError(TranslatableComponent.of("worldedit.tool.deltree.not-floating"));
player.print(Caption.of("worldedit.tool.deltree.not-floating"));
return true;
}
@ -94,7 +95,7 @@ public class FloatingTreeRemover implements BlockTool {
}
}
} catch (MaxChangedBlocksException e) {
player.printError(TranslatableComponent.of("worldedit.tool.max-block-changes"));
player.print(Caption.of("worldedit.tool.max-block-changes"));
} finally {
session.remember(editSession);
}

View File

@ -19,6 +19,7 @@
package com.sk89q.worldedit.command.tool;
import com.boydti.fawe.config.Caption;
import com.sk89q.worldedit.EditSession;
import com.sk89q.worldedit.LocalConfiguration;
import com.sk89q.worldedit.LocalSession;
@ -83,7 +84,7 @@ public class FloodFillTool implements BlockTool {
visitor.visit(origin);
Operations.completeLegacy(visitor);
} catch (MaxChangedBlocksException e) {
player.printError(TranslatableComponent.of("worldedit.tool.max-block-changes"));
player.print(Caption.of("worldedit.tool.max-block-changes"));
} finally {
session.remember(editSession);
}

View File

@ -19,6 +19,7 @@
package com.sk89q.worldedit.command.tool;
import com.boydti.fawe.config.Caption;
import com.sk89q.worldedit.EditSession;
import com.sk89q.worldedit.LocalConfiguration;
import com.sk89q.worldedit.LocalSession;
@ -121,7 +122,7 @@ public class LongRangeBuildTool extends BrushTool implements DoubleActionTraceTo
}
if (target == null) {
player.printError(TranslatableComponent.of("worldedit.tool.no-block"));
player.print(Caption.of("worldedit.tool.no-block"));
return null;
}

View File

@ -19,6 +19,7 @@
package com.sk89q.worldedit.command.tool;
import com.boydti.fawe.config.Caption;
import com.sk89q.worldedit.LocalConfiguration;
import com.sk89q.worldedit.LocalSession;
import com.sk89q.worldedit.entity.Player;
@ -43,7 +44,7 @@ public enum NavigationWand implements DoubleActionTraceTool {
if (pos != null) {
player.findFreePosition(pos);
} else {
player.printError(TranslatableComponent.of("worldedit.jumpto.none"));
player.print(Caption.of("worldedit.jumpto.none"));
}
return true;
}
@ -59,7 +60,7 @@ public enum NavigationWand implements DoubleActionTraceTool {
}
if (!player.passThroughForwardWall(Math.max(1, maxDist - 10))) {
player.printError(TranslatableComponent.of("worldedit.thru.obstructed"));
player.print(Caption.of("worldedit.thru.obstructed"));
}
return true;
}

View File

@ -19,6 +19,7 @@
package com.sk89q.worldedit.command.tool;
import com.boydti.fawe.config.Caption;
import com.sk89q.worldedit.EditSession;
import com.sk89q.worldedit.LocalConfiguration;
import com.sk89q.worldedit.LocalSession;
@ -61,21 +62,21 @@ public class QueryTool implements BlockTool {
builder.append(TextComponent.of("@" + clicked.toVector().toBlockPoint() + ": ", TextColor.BLUE));
builder.append(block.getBlockType().getRichName().color(TextColor.YELLOW));
builder.append(TextComponent.of(" (" + block + ") ", TextColor.GRAY)
.hoverEvent(HoverEvent.of(HoverEvent.Action.SHOW_TEXT, TranslatableComponent.of("worldedit.tool.info.blockstate.hover"))));
.hoverEvent(HoverEvent.of(HoverEvent.Action.SHOW_TEXT, Caption.of("worldedit.tool.info.blockstate.hover"))));
final int internalId = BlockStateIdAccess.getBlockStateId(block.toImmutableState());
if (BlockStateIdAccess.isValidInternalId(internalId)) {
builder.append(TextComponent.of(" (" + internalId + ") ", TextColor.DARK_GRAY)
.hoverEvent(HoverEvent.of(HoverEvent.Action.SHOW_TEXT, TranslatableComponent.of("worldedit.tool.info.internalid.hover"))));
.hoverEvent(HoverEvent.of(HoverEvent.Action.SHOW_TEXT, Caption.of("worldedit.tool.info.internalid.hover"))));
}
final int[] legacy = LegacyMapper.getInstance().getLegacyFromBlock(block.toImmutableState());
if (legacy != null) {
builder.append(TextComponent.of(" (" + legacy[0] + ":" + legacy[1] + ") ", TextColor.DARK_GRAY)
.hoverEvent(HoverEvent.of(HoverEvent.Action.SHOW_TEXT, TranslatableComponent.of("worldedit.tool.info.legacy.hover"))));
.hoverEvent(HoverEvent.of(HoverEvent.Action.SHOW_TEXT, Caption.of("worldedit.tool.info.legacy.hover"))));
}
builder.append(TextComponent.of(" (" + world.getBlockLightLevel(blockPoint) + "/"
+ world.getBlockLightLevel(blockPoint.add(0, 1, 0)) + ")", TextColor.WHITE)
.hoverEvent(HoverEvent.of(HoverEvent.Action.SHOW_TEXT, TranslatableComponent.of("worldedit.tool.info.light.hover"))));
.hoverEvent(HoverEvent.of(HoverEvent.Action.SHOW_TEXT, Caption.of("worldedit.tool.info.light.hover"))));
player.print(builder.build());

View File

@ -19,6 +19,7 @@
package com.sk89q.worldedit.command.tool;
import com.boydti.fawe.config.Caption;
import com.sk89q.worldedit.EditSession;
import com.sk89q.worldedit.LocalConfiguration;
import com.sk89q.worldedit.LocalSession;
@ -57,7 +58,7 @@ public class SinglePickaxe implements BlockTool {
editSession.setBlock(blockPoint, BlockTypes.AIR.getDefaultState());
session.remember(editSession);
} catch (MaxChangedBlocksException e) {
player.printError(TranslatableComponent.of("worldedit.tool.max-block-changes"));
player.print(Caption.of("worldedit.tool.max-block-changes"));
}
return true;

View File

@ -19,6 +19,7 @@
package com.sk89q.worldedit.command.tool;
import com.boydti.fawe.config.Caption;
import com.sk89q.worldedit.EditSession;
import com.sk89q.worldedit.LocalConfiguration;
import com.sk89q.worldedit.LocalSession;
@ -63,10 +64,10 @@ public class TreePlanter implements BlockTool {
}
if (!successful) {
player.printError(TranslatableComponent.of("worldedit.tool.tree.obstructed"));
player.print(Caption.of("worldedit.tool.tree.obstructed"));
}
} catch (MaxChangedBlocksException e) {
player.printError(TranslatableComponent.of("worldedit.tool.max-block-changes"));
player.print(Caption.of("worldedit.tool.max-block-changes"));
} finally {
session.remember(editSession);
}

View File

@ -19,6 +19,7 @@
package com.sk89q.worldedit.command.util;
import com.boydti.fawe.config.Caption;
import com.google.common.base.Joiner;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.Iterables;
@ -79,7 +80,7 @@ public class PrintCommandHelp {
List<Command> visited = new ArrayList<>();
Command currentCommand = detectCommand(manager, commandPath.get(0));
if (currentCommand == null) {
actor.printError(TranslatableComponent.of("worldedit.help.command-not-found", TextComponent.of(commandPath.get(0))));
actor.print(Caption.of("worldedit.help.command-not-found", TextComponent.of(commandPath.get(0))));
return;
}
visited.add(currentCommand);
@ -90,7 +91,7 @@ public class PrintCommandHelp {
Map<String, Command> subCommands = getSubCommands(currentCommand);
if (subCommands.isEmpty()) {
actor.printError(TranslatableComponent.of("worldedit.help.no-subcommands",
actor.print(Caption.of("worldedit.help.no-subcommands",
TextComponent.of(toCommandString(visited)), TextComponent.of(subCommand)));
// full help for single command
CommandUsageBox box = new CommandUsageBox(visited, visited.stream()
@ -103,7 +104,7 @@ public class PrintCommandHelp {
currentCommand = subCommands.get(subCommand);
visited.add(currentCommand);
} else {
actor.printError(TranslatableComponent.of("worldedit.help.subcommand-not-found",
actor.print(Caption.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);

View File

@ -14,7 +14,6 @@ import com.sk89q.worldedit.internal.util.Substring;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.regions.Region;
import com.sk89q.worldedit.util.formatting.text.TextComponent;
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
import org.enginehub.piston.exception.StopExecutionException;
import org.enginehub.piston.inject.InjectAnnotation;
import org.enginehub.piston.inject.InjectedValueAccess;
@ -102,7 +101,7 @@ public @interface Confirm {
if (checkExisting(context)) {
return true;
}
actor.print(TranslatableComponent.of("fawe.cancel.worldedit.cancel.reason.confirm"));
actor.print(Caption.of("fawe.cancel.worldedit.cancel.reason.confirm"));
return confirm(actor, context);
}
};

View File

@ -20,6 +20,7 @@
package com.sk89q.worldedit.entity;
import com.boydti.fawe.Fawe;
import com.boydti.fawe.config.Caption;
import com.boydti.fawe.config.Settings;
import com.boydti.fawe.object.brush.visualization.VirtualWorld;
import com.boydti.fawe.object.clipboard.DiskOptimizedClipboard;
@ -47,14 +48,13 @@ import com.sk89q.worldedit.util.HandSide;
import com.sk89q.worldedit.util.Location;
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.world.World;
import com.sk89q.worldedit.world.block.BaseBlock;
import com.sk89q.worldedit.world.block.BlockStateHolder;
import com.sk89q.worldedit.world.gamemode.GameMode;
import java.io.File;
import javax.annotation.Nullable;
import java.io.File;
/**
* Represents a player.
@ -431,12 +431,12 @@ public interface Player extends Entity, Actor {
getSession().setClipboard(holder);
}
} catch (Exception event) {
printError(TranslatableComponent.of("====== INVALID CLIPBOARD ======"));
printError(TextComponent.of("====== INVALID CLIPBOARD ======"));
event.printStackTrace();
printError(TranslatableComponent.of("fawe.error.stacktrace"));
printError(TranslatableComponent.of("fawe.error.no-failure"));
printError(TranslatableComponent.of("File: ", TextComponent.of(file.getName()), TextComponent.of(" (len:"), TextComponent.of(file.length()), TextComponent.of(")")));
printError(TranslatableComponent.of("fawe.error.stacktrace"));
printError(Caption.of("fawe.error.stacktrace"));
printError(Caption.of("fawe.error.no-failure"));
printError(Caption.of("File: ", TextComponent.of(file.getName()), TextComponent.of(" (len:"), TextComponent.of(file.length()), TextComponent.of(")")));
printError(Caption.of("fawe.error.stacktrace"));
}
}
}

View File

@ -19,6 +19,7 @@
package com.sk89q.worldedit.extension.factory;
import com.boydti.fawe.config.Caption;
import com.sk89q.worldedit.WorldEdit;
import com.sk89q.worldedit.extension.factory.parser.mask.AdjacentMaskParser;
import com.sk89q.worldedit.extension.factory.parser.mask.AirMaskParser;
@ -138,14 +139,14 @@ public final class MaskFactory extends AbstractFactory<Mask> {
}
}
if (match == null) {
throw new NoMatchException(TranslatableComponent.of("worldedit.error.no-match", TextComponent.of(component)));
throw new NoMatchException(Caption.of("worldedit.error.no-match", TextComponent.of(component)));
}
masks.add(match);
}
switch (masks.size()) {
case 0:
throw new NoMatchException(TranslatableComponent.of("worldedit.error.no-match", TextComponent.of(input)));
throw new NoMatchException(Caption.of("worldedit.error.no-match", TextComponent.of(input)));
case 1:
return masks.get(0).optimize();
default:

View File

@ -84,10 +84,10 @@ public class DefaultBlockParser extends InputParser<BaseBlock> {
} catch (NotABlockException e) {
throw new InputParseException(e.getRichMessage());
} catch (WorldEditException e) {
throw new InputParseException(TranslatableComponent.of("worldedit.error.unknown", e.getRichMessage()), e);
throw new InputParseException(Caption.of("worldedit.error.unknown", e.getRichMessage()), e);
}
} else {
throw new InputParseException(TranslatableComponent.of(
throw new InputParseException(Caption.of(
"worldedit.error.parser.player-only",
TextComponent.of(handSide == HandSide.MAIN_HAND ? "hand" : "offhand")
));
@ -181,7 +181,7 @@ public class DefaultBlockParser extends InputParser<BaseBlock> {
String[] parts = parseableData.split("=");
if (parts.length != 2) {
throw new InputParseException(
TranslatableComponent.of("worldedit.error.parser.bad-state-format",
Caption.of("worldedit.error.parser.bad-state-format",
TextComponent.of(parseableData))
);
}
@ -190,7 +190,7 @@ public class DefaultBlockParser extends InputParser<BaseBlock> {
Property<Object> propertyKey = (Property<Object>) type.getPropertyMap().get(parts[0]);
if (propertyKey == null) {
if (context.getActor() != null) {
throw new NoMatchException(TranslatableComponent.of(
throw new NoMatchException(Caption.of(
"worldedit.error.parser.unknown-property",
TextComponent.of(parts[0]),
TextComponent.of(type.getId())
@ -201,7 +201,7 @@ public class DefaultBlockParser extends InputParser<BaseBlock> {
return Maps.newHashMap();
}
if (blockStates.containsKey(propertyKey)) {
throw new InputParseException(TranslatableComponent.of(
throw new InputParseException(Caption.of(
"worldedit.error.parser.duplicate-property",
TextComponent.of(parts[0])
));
@ -210,7 +210,7 @@ public class DefaultBlockParser extends InputParser<BaseBlock> {
try {
value = propertyKey.getValueFor(parts[1]);
} catch (IllegalArgumentException e) {
throw new NoMatchException(TranslatableComponent.of(
throw new NoMatchException(Caption.of(
"worldedit.error.parser.unknown-value",
TextComponent.of(parts[1]),
TextComponent.of(propertyKey.getName())
@ -221,7 +221,7 @@ public class DefaultBlockParser extends InputParser<BaseBlock> {
} catch (NoMatchException e) {
throw e; // Pass-through
} catch (Exception e) {
throw new InputParseException(TranslatableComponent.of(
throw new InputParseException(Caption.of(
"worldedit.error.parser.bad-state-format",
TextComponent.of(parseableData)
));
@ -264,14 +264,14 @@ public class DefaultBlockParser extends InputParser<BaseBlock> {
try {
String[] split = blockAndExtraData[0].split(":", 2);
if (split.length == 0) {
throw new InputParseException(TranslatableComponent.of("worldedit.error.parser.invalid-colon"));
throw new InputParseException(Caption.of("worldedit.error.parser.invalid-colon"));
} else if (split.length == 1) {
state = LegacyMapper.getInstance().getBlockFromLegacy(Integer.parseInt(split[0]));
} else if (MathMan.isInteger(split[0])) {
int id = Integer.parseInt(split[0]);
int data = Integer.parseInt(split[1]);
if (data < 0 || data >= 16) {
throw new InputParseException(TranslatableComponent.of("fawe.error.parser.invalid-data", TextComponent.of(data)));
throw new InputParseException(Caption.of("fawe.error.parser.invalid-data", TextComponent.of(data)));
}
state = LegacyMapper.getInstance().getBlockFromLegacy(id, data);
} else {
@ -279,7 +279,7 @@ public class DefaultBlockParser extends InputParser<BaseBlock> {
if (type != null) {
int data = Integer.parseInt(split[1]);
if (data < 0 || data >= 16) {
throw new InputParseException(TranslatableComponent.of("fawe.error.parser.invalid-data", TextComponent.of(data)));
throw new InputParseException(Caption.of("fawe.error.parser.invalid-data", TextComponent.of(data)));
}
state = LegacyMapper.getInstance().getBlockFromLegacy(type.getLegacyCombinedId() >> 4, data);
}
@ -298,11 +298,11 @@ public class DefaultBlockParser extends InputParser<BaseBlock> {
} else {
typeString = blockAndExtraData[0].substring(0, stateStart);
if (stateStart + 1 >= blockAndExtraData[0].length()) {
throw new InputParseException(TranslatableComponent.of("worldedit.error.parser.hanging-lbracket", TextComponent.of(stateStart)));
throw new InputParseException(Caption.of("worldedit.error.parser.hanging-lbracket", TextComponent.of(stateStart)));
}
int stateEnd = blockAndExtraData[0].lastIndexOf(']');
if (stateEnd < 0) {
throw new InputParseException(TranslatableComponent.of("worldedit.error.parser.missing-rbracket"));
throw new InputParseException(Caption.of("worldedit.error.parser.missing-rbracket"));
}
stateString = blockAndExtraData[0].substring(stateStart + 1, blockAndExtraData[0].length() - 1);
}
@ -311,7 +311,7 @@ public class DefaultBlockParser extends InputParser<BaseBlock> {
stateProperties = stateString.split(",");
}
if (typeString.isEmpty()) {
throw new InputParseException(TranslatableComponent.of(
throw new InputParseException(Caption.of(
"worldedit.error.parser.bad-state-format",
TextComponent.of(blockAndExtraData[0])
));
@ -334,25 +334,25 @@ public class DefaultBlockParser extends InputParser<BaseBlock> {
try {
primaryPosition = context.requireSession().getRegionSelector(world).getVertices().get(index - 1);
} catch (IncompleteRegionException e) {
throw new InputParseException(TranslatableComponent.of("worldedit.error.incomplete-region"));
throw new InputParseException(Caption.of("worldedit.error.incomplete-region"));
}
state = world.getBlock(primaryPosition);
} else if (typeString.matches("slot[0-9]+")) {
int slot = Integer.parseInt(typeString.substring(4)) - 1;
Actor actor = context.requireActor();
if (!(actor instanceof Player)) {
throw new InputParseException(TranslatableComponent.of("worldedit.command.player-only"));
throw new InputParseException(Caption.of("worldedit.command.player-only"));
}
Player player = (Player) actor;
BlockBag bag = player.getInventoryBlockBag();
if (!(bag instanceof SlottableBlockBag)) {
throw new InputParseException(TranslatableComponent.of("fawe.error.unsupported"));
throw new InputParseException(Caption.of("fawe.error.unsupported"));
}
SlottableBlockBag slottable = (SlottableBlockBag) bag;
BaseItem item = slottable.getItem(slot);
if (!item.getType().hasBlockType()) {
throw new InputParseException(TranslatableComponent.of("worldedit.error.not-a-block"));
throw new InputParseException(Caption.of("worldedit.error.not-a-block"));
}
state = item.getType().getBlockType().getDefaultState();
nbt = item.getNbtData();
@ -363,7 +363,7 @@ public class DefaultBlockParser extends InputParser<BaseBlock> {
state = type.getDefaultState();
}
if (state == null) {
throw new NoMatchException(TranslatableComponent.of("fawe.error.invalid-block-type", TextComponent.of(input)));
throw new NoMatchException(Caption.of("fawe.error.invalid-block-type", TextComponent.of(input)));
}
}
if (nbt == null) {
@ -394,7 +394,7 @@ public class DefaultBlockParser extends InputParser<BaseBlock> {
}
// this should be impossible but IntelliJ isn't that smart
if (state == null) {
throw new NoMatchException(TranslatableComponent.of("fawe.error.invalid-block-type", TextComponent.of(input)));
throw new NoMatchException(Caption.of("fawe.error.invalid-block-type", TextComponent.of(input)));
}
if (blockAndExtraData.length > 1 && blockAndExtraData[1].startsWith("{")) {
@ -402,7 +402,7 @@ public class DefaultBlockParser extends InputParser<BaseBlock> {
try {
nbt = JSON2NBT.getTagFromJson(joined);
} catch (NBTException e) {
throw new NoMatchException(TranslatableComponent.of(e.getMessage()));
throw new NoMatchException(Caption.of(e.getMessage()));
}
}
@ -413,7 +413,7 @@ public class DefaultBlockParser extends InputParser<BaseBlock> {
Actor actor = context.requireActor();
if (actor != null && !actor.hasPermission("worldedit.anyblock")
&& worldEdit.getConfiguration().disallowedBlocks.contains(blockType.getId())) {
throw new DisallowedUsageException(TranslatableComponent.of("fawe.error.block.not.allowed", TextComponent.of(input)));
throw new DisallowedUsageException(Caption.of("fawe.error.block.not.allowed", TextComponent.of(input)));
}
}
@ -436,11 +436,11 @@ public class DefaultBlockParser extends InputParser<BaseBlock> {
String mobName = blockAndExtraData[1];
EntityType ent = EntityTypes.get(mobName.toLowerCase(Locale.ROOT));
if (ent == null) {
throw new NoMatchException(TranslatableComponent.of("worldedit.error.unknown-entity", TextComponent.of(mobName)));
throw new NoMatchException(Caption.of("worldedit.error.unknown-entity", TextComponent.of(mobName)));
}
mobName = ent.getId();
if (!worldEdit.getPlatformManager().queryCapability(Capability.USER_COMMANDS).isValidMobType(mobName)) {
throw new NoMatchException(TranslatableComponent.of("worldedit.error.unknown-mob", TextComponent.of(mobName)));
throw new NoMatchException(Caption.of("worldedit.error.unknown-mob", TextComponent.of(mobName)));
}
return validate(context, new MobSpawnerBlock(state, mobName));
} else {
@ -465,12 +465,12 @@ public class DefaultBlockParser extends InputParser<BaseBlock> {
if (context.isRestricted()) {
Actor actor = context.requireActor();
if (!actor.hasPermission("worldedit.anyblock") && worldEdit.getConfiguration().checkDisallowedBlocks(holder)) {
throw new DisallowedUsageException(TranslatableComponent.of("fawe.error.block.not.allowed", TextComponent.of(String.valueOf(holder))));
throw new DisallowedUsageException(Caption.of("fawe.error.block.not.allowed", TextComponent.of(String.valueOf(holder))));
}
CompoundTag nbt = holder.getNbtData();
if (nbt != null) {
if (!actor.hasPermission("worldedit.anyblock")) {
throw new DisallowedUsageException(TranslatableComponent.of("fawe.error.nbt.forbidden"));
throw new DisallowedUsageException(Caption.of("fawe.error.nbt.forbidden"));
}
}
}

View File

@ -19,6 +19,7 @@
package com.sk89q.worldedit.extension.factory.parser;
import com.boydti.fawe.config.Caption;
import com.sk89q.worldedit.WorldEdit;
import com.sk89q.worldedit.blocks.BaseItem;
import com.sk89q.worldedit.blocks.BaseItemStack;
@ -58,7 +59,7 @@ public class DefaultItemParser extends InputParser<BaseItem> {
String[] split = input.split(":");
ItemType type;
if (split.length == 0) {
throw new InputParseException(TranslatableComponent.of("worldedit.error.parser.invalid-colon"));
throw new InputParseException(Caption.of("worldedit.error.parser.invalid-colon"));
} else if (split.length == 1) {
type = LegacyMapper.getInstance().getItemFromLegacy(Integer.parseInt(split[0]));
} else {
@ -85,7 +86,7 @@ public class DefaultItemParser extends InputParser<BaseItem> {
}
if (item == null) {
throw new InputParseException(TranslatableComponent.of("worldedit.error.unknown-item", TextComponent.of(input)));
throw new InputParseException(Caption.of("worldedit.error.unknown-item", TextComponent.of(input)));
} else {
return item;
}
@ -95,7 +96,7 @@ public class DefaultItemParser extends InputParser<BaseItem> {
if (actor instanceof Player) {
return ((Player) actor).getItemInHand(handSide);
} else {
throw new InputParseException(TranslatableComponent.of(
throw new InputParseException(Caption.of(
"worldedit.error.parser.player-only",
TextComponent.of(handSide == HandSide.MAIN_HAND ? "hand" : "offhand")
));

View File

@ -1,5 +1,6 @@
package com.sk89q.worldedit.extension.factory.parser;
import com.boydti.fawe.config.Caption;
import com.google.common.base.Preconditions;
import com.sk89q.worldedit.WorldEdit;
import com.sk89q.worldedit.extension.input.InputParseException;
@ -143,7 +144,7 @@ public abstract class RichParser<E> extends InputParser<E> {
arguments.add(input.substring(openIndex + 1));
}
if (requireClosing && open != 0) {
throw new InputParseException(TranslatableComponent.of("fawe.error.invalid-bracketing", TextComponent.of("'[' or ']'?")));
throw new InputParseException(Caption.of("fawe.error.invalid-bracketing", TextComponent.of("'[' or ']'?")));
}
return arguments.toArray(new String[0]);
}

View File

@ -1,5 +1,6 @@
package com.sk89q.worldedit.extension.factory.parser.mask;
import com.boydti.fawe.config.Caption;
import com.boydti.fawe.object.mask.AngleMask;
import com.sk89q.worldedit.WorldEdit;
import com.sk89q.worldedit.command.util.SuggestionHelper;
@ -40,7 +41,7 @@ public class AngleMaskParser extends RichParser<Mask> {
String maxArg = arguments[1];
boolean degree = minArg.endsWith("d");
if (degree ^ maxArg.endsWith("d")) {
throw new InputParseException(TranslatableComponent.of("fawe.error.mask.angle"));
throw new InputParseException(Caption.of("fawe.error.mask.angle"));
}
boolean overlay = false;
if (arguments.length > 2) {
@ -49,7 +50,7 @@ public class AngleMaskParser extends RichParser<Mask> {
if (flag.equals("-o")) {
overlay = true;
} else {
throw new InputParseException(TranslatableComponent.of("fawe.error.invalid-flag",
throw new InputParseException(Caption.of("fawe.error.invalid-flag",
TextComponent.of(flag)));
}
}

View File

@ -19,6 +19,7 @@
package com.sk89q.worldedit.extension.factory.parser.mask;
import com.boydti.fawe.config.Caption;
import com.google.common.base.Splitter;
import com.sk89q.worldedit.WorldEdit;
import com.sk89q.worldedit.command.util.SuggestionHelper;
@ -74,7 +75,7 @@ public class BiomeMaskParser extends InputParser<Mask> {
for (String biomeName : Splitter.on(",").split(input.substring(1))) {
BiomeType biome = BiomeType.REGISTRY.get(biomeName);
if (biome == null) {
throw new NoMatchException(TranslatableComponent.of("worldedit.error.unknown-biome", TextComponent.of(biomeName)));
throw new NoMatchException(Caption.of("worldedit.error.unknown-biome", TextComponent.of(biomeName)));
}
biomes.add(biome);
}

View File

@ -19,6 +19,7 @@
package com.sk89q.worldedit.extension.factory.parser.mask;
import com.boydti.fawe.config.Caption;
import com.sk89q.worldedit.WorldEdit;
import com.sk89q.worldedit.command.util.SuggestionHelper;
import com.sk89q.worldedit.extension.input.InputParseException;
@ -53,7 +54,7 @@ public class BlockCategoryMaskParser extends InputParser<Mask> {
// This means it's a tag mask.
BlockCategory category = BlockCategory.REGISTRY.get(input.substring(2).toLowerCase(Locale.ROOT));
if (category == null) {
throw new InputParseException(TranslatableComponent.of("fawe.error.unrecognised-tag", TextComponent.of(input.substring(2)), TextComponent.of("\\")));
throw new InputParseException(Caption.of("fawe.error.unrecognised-tag", TextComponent.of(input.substring(2)), TextComponent.of("\\")));
} else {
return new BlockCategoryMask(context.requireExtent(), category);
}

View File

@ -19,6 +19,7 @@
package com.sk89q.worldedit.extension.factory.parser.mask;
import com.boydti.fawe.config.Caption;
import com.google.common.base.Splitter;
import com.sk89q.worldedit.WorldEdit;
import com.sk89q.worldedit.extension.input.InputParseException;
@ -58,7 +59,7 @@ public class BlockStateMaskParser extends InputParser<Mask> {
Splitter.on(',').omitEmptyStrings().trimResults().withKeyValueSeparator('=').split(states),
strict);
} catch (Exception e) {
throw new InputParseException(TranslatableComponent.of("fawe.error.invalid-states", TextComponent.of(String.valueOf(e))));
throw new InputParseException(Caption.of("fawe.error.invalid-states", TextComponent.of(String.valueOf(e))));
}
}
}

View File

@ -19,6 +19,7 @@
package com.sk89q.worldedit.extension.factory.parser.mask;
import com.boydti.fawe.config.Caption;
import com.sk89q.worldedit.WorldEdit;
import com.sk89q.worldedit.extension.input.InputParseException;
import com.sk89q.worldedit.extension.input.ParserContext;
@ -68,7 +69,7 @@ public class ExpressionMaskParser extends InputParser<Mask> {
}
return new ExpressionMask(exp);
} catch (ExpressionException e) {
throw new InputParseException(TranslatableComponent.of("worldedit.error.parser.invalid-expression", TextComponent.of(e.getMessage())));
throw new InputParseException(Caption.of("worldedit.error.parser.invalid-expression", TextComponent.of(e.getMessage())));
}
}
}

View File

@ -1,5 +1,6 @@
package com.sk89q.worldedit.extension.factory.parser.mask;
import com.boydti.fawe.config.Caption;
import com.boydti.fawe.object.mask.ExtremaMask;
import com.sk89q.worldedit.WorldEdit;
import com.sk89q.worldedit.command.util.SuggestionHelper;
@ -40,7 +41,7 @@ public class ExtremaMaskParser extends RichParser<Mask> {
String maxArg = arguments[1];
boolean degree = minArg.endsWith("d");
if (degree ^ maxArg.endsWith("d")) {
throw new InputParseException(TranslatableComponent.of("fawe.error.mask.angle"));
throw new InputParseException(Caption.of("fawe.error.mask.angle"));
}
double min;
double max;
@ -51,7 +52,7 @@ public class ExtremaMaskParser extends RichParser<Mask> {
if (flag.equals("-o")) {
overlay = true;
} else {
throw new InputParseException(TranslatableComponent.of("fawe.error.invalid-flag",
throw new InputParseException(Caption.of("fawe.error.invalid-flag",
TextComponent.of(flag)));
}
}

View File

@ -19,6 +19,7 @@
package com.sk89q.worldedit.extension.factory.parser.mask;
import com.boydti.fawe.config.Caption;
import com.sk89q.worldedit.WorldEdit;
import com.sk89q.worldedit.extension.input.InputParseException;
import com.sk89q.worldedit.extension.input.ParserContext;
@ -55,7 +56,7 @@ public class NegateMaskParser extends InputParser<Mask> {
if (input.length() > 1) {
return Masks.negate(worldEdit.getMaskFactory().parseFromInput(input.substring(1), context));
} else {
throw new InputParseException(TranslatableComponent.of("worldedit.error.parser.negate-nothing"));
throw new InputParseException(Caption.of("worldedit.error.parser.negate-nothing"));
}
}
}

View File

@ -1,5 +1,6 @@
package com.sk89q.worldedit.extension.factory.parser.mask;
import com.boydti.fawe.config.Caption;
import com.boydti.fawe.object.mask.ROCAngleMask;
import com.sk89q.worldedit.WorldEdit;
import com.sk89q.worldedit.command.util.SuggestionHelper;
@ -40,7 +41,7 @@ public class ROCAngleMaskParser extends RichParser<Mask> {
String maxArg = arguments[1];
boolean degree = minArg.endsWith("d");
if (degree ^ maxArg.endsWith("d")) {
throw new InputParseException(TranslatableComponent.of("fawe.error.mask.angle"));
throw new InputParseException(Caption.of("fawe.error.mask.angle"));
}
double min;
double max;
@ -51,7 +52,7 @@ public class ROCAngleMaskParser extends RichParser<Mask> {
if (flag.equals("-o")) {
overlay = true;
} else {
throw new InputParseException(TranslatableComponent.of("fawe.error.invalid-flag",
throw new InputParseException(Caption.of("fawe.error.invalid-flag",
TextComponent.of(flag)));
}
}

View File

@ -19,6 +19,7 @@
package com.sk89q.worldedit.extension.factory.parser.mask;
import com.boydti.fawe.config.Caption;
import com.google.common.collect.ImmutableList;
import com.sk89q.worldedit.IncompleteRegionException;
import com.sk89q.worldedit.WorldEdit;
@ -49,7 +50,7 @@ public class RegionMaskParser extends SimpleInputParser<Mask> {
try {
return new RegionMask(context.requireSession().getSelection(context.requireWorld()).clone());
} catch (IncompleteRegionException e) {
throw new InputParseException(TranslatableComponent.of("worldedit.error.incomplete-region"));
throw new InputParseException(Caption.of("worldedit.error.incomplete-region"));
}
}
}

View File

@ -1,5 +1,6 @@
package com.sk89q.worldedit.extension.factory.parser.pattern;
import com.boydti.fawe.config.Caption;
import com.boydti.fawe.object.pattern.BiomeApplyingPattern;
import com.sk89q.worldedit.WorldEdit;
import com.sk89q.worldedit.extension.factory.parser.RichParser;
@ -34,7 +35,7 @@ public class BiomePatternParser extends RichParser<Pattern> {
String biomeId = input.substring(1);
BiomeType biomeType = BiomeTypes.get(biomeId);
if (biomeType == null) {
throw new NoMatchException(TranslatableComponent.of("worldedit.error.unknown-biome", TextComponent.of(biomeId)));
throw new NoMatchException(Caption.of("worldedit.error.unknown-biome", TextComponent.of(biomeId)));
}
return new BiomeApplyingPattern(context.requireExtent(), biomeType);
} else {
@ -63,11 +64,11 @@ public class BiomePatternParser extends RichParser<Pattern> {
@Override
protected Pattern parseFromInput(@NotNull String[] arguments, ParserContext context) throws InputParseException {
if (arguments.length != 1) {
throw new InputParseException(TranslatableComponent.of("fawe.error.invalid-arguments", TextComponent.of("#biome[<biome>]")));
throw new InputParseException(Caption.of("fawe.error.invalid-arguments", TextComponent.of("#biome[<biome>]")));
}
BiomeType biomeType = BiomeTypes.get(arguments[0]);
if (biomeType == null) {
throw new NoMatchException(TranslatableComponent.of("worldedit.error.unknown-biome", TextComponent.of(arguments[0])));
throw new NoMatchException(Caption.of("worldedit.error.unknown-biome", TextComponent.of(arguments[0])));
}
return new BiomeApplyingPattern(context.requireExtent(), biomeType);
}

View File

@ -19,6 +19,7 @@
package com.sk89q.worldedit.extension.factory.parser.pattern;
import com.boydti.fawe.config.Caption;
import com.sk89q.worldedit.WorldEdit;
import com.sk89q.worldedit.command.util.SuggestionHelper;
import com.sk89q.worldedit.extension.input.InputParseException;
@ -60,13 +61,13 @@ public class BlockCategoryPatternParser extends InputParser<Pattern> {
BlockCategory category = BlockCategory.REGISTRY.get(tag);
if (category == null) {
throw new InputParseException(TranslatableComponent.of("fawe.error.unknown-block-tag", TextComponent.of(tag)));
throw new InputParseException(Caption.of("fawe.error.unknown-block-tag", TextComponent.of(tag)));
}
RandomPattern randomPattern = new RandomPattern();
Set<BlockType> blocks = category.getAll();
if (blocks.isEmpty()) {
throw new InputParseException(TranslatableComponent.of("fawe.error.block-tag-no-blocks", TextComponent.of(category.getId())));
throw new InputParseException(Caption.of("fawe.error.block-tag-no-blocks", TextComponent.of(category.getId())));
}
if (anyState) {

View File

@ -1,5 +1,6 @@
package com.sk89q.worldedit.extension.factory.parser.pattern;
import com.boydti.fawe.config.Caption;
import com.boydti.fawe.object.pattern.BufferedPattern;
import com.sk89q.worldedit.WorldEdit;
import com.sk89q.worldedit.extension.factory.parser.RichParser;
@ -34,7 +35,7 @@ public class BufferedPatternParser extends RichParser<Pattern> {
@Override
protected Pattern parseFromInput(@NotNull String[] arguments, ParserContext context) throws InputParseException {
if (arguments.length != 1) {
throw new InputParseException(TranslatableComponent.of("fawe.error.command.syntax",
throw new InputParseException(Caption.of("fawe.error.command.syntax",
TextComponent.of(getPrefix() + "[pattern] (e.g. " + getPrefix() + "[stone,dirt])")));
}
Pattern inner = this.worldEdit.getPatternFactory().parseFromInput(arguments[0], context);

View File

@ -19,6 +19,7 @@
package com.sk89q.worldedit.extension.factory.parser.pattern;
import com.boydti.fawe.config.Caption;
import com.sk89q.worldedit.EmptyClipboardException;
import com.sk89q.worldedit.LocalSession;
import com.sk89q.worldedit.WorldEdit;
@ -80,11 +81,11 @@ public class ClipboardPatternParser extends InputParser<Pattern> {
String coords = offsetParts[1];
if (coords.length() < 7 // min length of `[x,y,z]`
|| coords.charAt(0) != '[' || coords.charAt(coords.length() - 1) != ']') {
throw new InputParseException(TranslatableComponent.of("worldedit.error.parser.clipboard.missing-offset"));
throw new InputParseException(Caption.of("worldedit.error.parser.clipboard.missing-offset"));
}
String[] offsetSplit = coords.substring(1, coords.length() - 1).split(",");
if (offsetSplit.length != 3) {
throw new InputParseException(TranslatableComponent.of("worldedit.error.parser.clipboard.missing-coordinates"));
throw new InputParseException(Caption.of("worldedit.error.parser.clipboard.missing-coordinates"));
}
offset = BlockVector3.at(
Integer.valueOf(offsetSplit[0]),
@ -99,10 +100,10 @@ public class ClipboardPatternParser extends InputParser<Pattern> {
Clipboard clipboard = holder.getClipboard();
return new ClipboardPattern(clipboard, offset);
} catch (EmptyClipboardException e) {
throw new InputParseException(TranslatableComponent.of("fawe.error.empty-clipboard", TextComponent.of("#clipboard")));
throw new InputParseException(Caption.of("fawe.error.empty-clipboard", TextComponent.of("#clipboard")));
}
} else {
throw new InputParseException(TranslatableComponent.of("fawe.error.no-session"));
throw new InputParseException(Caption.of("fawe.error.no-session"));
}
}

View File

@ -1,5 +1,6 @@
package com.sk89q.worldedit.extension.factory.parser.pattern;
import com.boydti.fawe.config.Caption;
import com.boydti.fawe.object.pattern.Linear2DBlockPattern;
import com.google.common.base.Preconditions;
import com.sk89q.worldedit.WorldEdit;
@ -44,7 +45,7 @@ public class Linear2DPatternParser extends RichParser<Pattern> {
@Override
protected Pattern parseFromInput(@NotNull String[] arguments, ParserContext context) throws InputParseException {
if (arguments.length == 0 || arguments.length > 3) {
throw new InputParseException(TranslatableComponent.of("fawe.error.command.syntax",
throw new InputParseException(Caption.of("fawe.error.command.syntax",
TextComponent.of(getPrefix() + "[pattern] (e.g. " + getPrefix() + "[stone,dirt])")));
}
Pattern inner = this.worldEdit.getPatternFactory().parseFromInput(arguments[0], context);

View File

@ -1,5 +1,6 @@
package com.sk89q.worldedit.extension.factory.parser.pattern;
import com.boydti.fawe.config.Caption;
import com.boydti.fawe.object.pattern.Linear3DBlockPattern;
import com.google.common.base.Preconditions;
import com.sk89q.worldedit.WorldEdit;
@ -45,7 +46,7 @@ public class Linear3DPatternParser extends RichParser<Pattern> {
@Override
protected Pattern parseFromInput(@NotNull String[] arguments, ParserContext context) throws InputParseException {
if (arguments.length == 0 || arguments.length > 4) {
throw new InputParseException(TranslatableComponent.of("fawe.error.command.syntax",
throw new InputParseException(Caption.of("fawe.error.command.syntax",
TextComponent.of(getPrefix() + "[pattern] (e.g. " + getPrefix() + "[stone,dirt])")));
}
Pattern inner = this.worldEdit.getPatternFactory().parseFromInput(arguments[0], context);

View File

@ -1,5 +1,6 @@
package com.sk89q.worldedit.extension.factory.parser.pattern;
import com.boydti.fawe.config.Caption;
import com.boydti.fawe.object.random.NoiseRandom;
import com.sk89q.worldedit.WorldEdit;
import com.sk89q.worldedit.command.util.SuggestionHelper;
@ -49,7 +50,7 @@ public abstract class NoisePatternParser extends RichParser<Pattern> {
@Override
protected Pattern parseFromInput(@NotNull String[] arguments, ParserContext context) {
if (arguments.length != 2) {
throw new InputParseException(TranslatableComponent.of("fawe.error.command.syntax",
throw new InputParseException(Caption.of("fawe.error.command.syntax",
TextComponent.of(getPrefix() + "[scale][pattern] (e.g. " + getPrefix() + "[5][dirt,stone])")));
}
double scale = parseScale(arguments[0]);

View File

@ -19,6 +19,7 @@
package com.sk89q.worldedit.extension.factory.parser.pattern;
import com.boydti.fawe.config.Caption;
import com.sk89q.util.StringUtil;
import com.sk89q.worldedit.WorldEdit;
import com.sk89q.worldedit.extension.input.InputParseException;
@ -81,7 +82,7 @@ public class RandomPatternParser extends InputParser<Pattern> {
String[] p = token.split("%", 2);
if (p.length < 2) {
throw new InputParseException(TranslatableComponent.of("worldedit.error.parser.missing-random-type", TextComponent.of(input)));
throw new InputParseException(Caption.of("worldedit.error.parser.missing-random-type", TextComponent.of(input)));
} else {
chance = Double.parseDouble(p[0]);
innerPattern = worldEdit.getPatternFactory().parseFromInput(p[1], context);

View File

@ -19,6 +19,7 @@
package com.sk89q.worldedit.extension.factory.parser.pattern;
import com.boydti.fawe.config.Caption;
import com.sk89q.worldedit.WorldEdit;
import com.sk89q.worldedit.command.util.SuggestionHelper;
import com.sk89q.worldedit.extension.input.InputParseException;
@ -85,28 +86,28 @@ public class TypeOrStateApplyingPatternParser extends InputParser<Pattern> {
} else {
// states given
if (!parts[1].endsWith("]")) {
throw new InputParseException(TranslatableComponent.of("worldedit.error.parser.missing-rbracket"));
throw new InputParseException(Caption.of("worldedit.error.parser.missing-rbracket"));
}
final String[] states = parts[1].substring(0, parts[1].length() - 1).split(",");
Map<String, String> statesToSet = new HashMap<>();
for (String state : states) {
if (state.isEmpty()) {
throw new InputParseException(TranslatableComponent.of("worldedit.error.parser.empty-state"));
throw new InputParseException(Caption.of("worldedit.error.parser.empty-state"));
}
String[] propVal = state.split("=", 2);
if (propVal.length != 2) {
throw new InputParseException(TranslatableComponent.of("worldedit.error.parser.missing-equals-separator"));
throw new InputParseException(Caption.of("worldedit.error.parser.missing-equals-separator"));
}
final String prop = propVal[0];
if (prop.isEmpty()) {
throw new InputParseException(TranslatableComponent.of("worldedit.error.parser.empty-property"));
throw new InputParseException(Caption.of("worldedit.error.parser.empty-property"));
}
final String value = propVal[1];
if (value.isEmpty()) {
throw new InputParseException(TranslatableComponent.of("worldedit.error.parser.empty-value"));
throw new InputParseException(Caption.of("worldedit.error.parser.empty-value"));
}
if (statesToSet.put(prop, value) != null) {
throw new InputParseException(TranslatableComponent.of("worldedit.error.parser.duplicate-property", TextComponent.of(prop)));
throw new InputParseException(Caption.of("worldedit.error.parser.duplicate-property", TextComponent.of(prop)));
}
}
if (type.isEmpty()) {

View File

@ -19,6 +19,7 @@
package com.sk89q.worldedit.extension.input;
import com.boydti.fawe.config.Caption;
import com.sk89q.worldedit.LocalSession;
import com.sk89q.worldedit.extension.factory.MaskFactory;
import com.sk89q.worldedit.extension.platform.Actor;
@ -157,7 +158,7 @@ public class ParserContext {
public Extent requireExtent() throws InputParseException {
Extent extent = getExtent();
if (extent == null) {
throw new InputParseException(TranslatableComponent.of("worldedit.error.missing-extent"));
throw new InputParseException(Caption.of("worldedit.error.missing-extent"));
}
return extent;
}
@ -171,7 +172,7 @@ public class ParserContext {
public LocalSession requireSession() throws InputParseException {
LocalSession session = getSession();
if (session == null) {
throw new InputParseException(TranslatableComponent.of("worldedit.error.missing-session"));
throw new InputParseException(Caption.of("worldedit.error.missing-session"));
}
return session;
}
@ -185,7 +186,7 @@ public class ParserContext {
public World requireWorld() throws InputParseException {
World world = getWorld();
if (world == null) {
throw new InputParseException(TranslatableComponent.of("worldedit.error.missing-world"));
throw new InputParseException(Caption.of("worldedit.error.missing-world"));
}
return world;
}
@ -199,7 +200,7 @@ public class ParserContext {
public Actor requireActor() throws InputParseException {
Actor actor = getActor();
if (actor == null) {
throw new InputParseException(TranslatableComponent.of("worldedit.error.missing-actor"));
throw new InputParseException(Caption.of("worldedit.error.missing-actor"));
}
return actor;
}

View File

@ -19,6 +19,7 @@
package com.sk89q.worldedit.extension.platform;
import com.boydti.fawe.config.Caption;
import com.boydti.fawe.object.exception.FaweException;
import com.boydti.fawe.object.task.AsyncNotifyQueue;
import com.boydti.fawe.util.TaskManager;
@ -71,7 +72,7 @@ public abstract class AbstractNonPlayerActor implements Actor {
throwable = throwable.getCause();
}
if (throwable instanceof WorldEditException) {
printError(TranslatableComponent.of(throwable.getLocalizedMessage()));
printError(Caption.of(throwable.getLocalizedMessage()));
} else {
FaweException fe = FaweException.get(throwable);
if (fe != null) {

View File

@ -19,6 +19,7 @@
package com.sk89q.worldedit.extension.platform;
import com.boydti.fawe.config.Caption;
import com.boydti.fawe.object.exception.FaweException;
import com.boydti.fawe.object.task.AsyncNotifyQueue;
import com.boydti.fawe.regions.FaweMaskManager;
@ -86,7 +87,7 @@ public abstract class AbstractPlayerActor implements Actor, Player, Cloneable {
throwable = throwable.getCause();
}
if (throwable instanceof WorldEditException) {
printError(TranslatableComponent.of(throwable.getLocalizedMessage()));
printError(Caption.of(throwable.getLocalizedMessage()));
} else {
FaweException fe = FaweException.get(throwable);
if (fe != null) {
@ -666,13 +667,13 @@ public abstract class AbstractPlayerActor implements Actor, Player, Cloneable {
@Override
public File openFileOpenDialog(String[] extensions) {
printError(TranslatableComponent.of("worldedit.platform.no-file-dialog"));
printError(Caption.of("worldedit.platform.no-file-dialog"));
return null;
}
@Override
public File openFileSaveDialog(String[] extensions) {
printError(TranslatableComponent.of("worldedit.platform.no-file-dialog"));
printError(Caption.of("worldedit.platform.no-file-dialog"));
return null;
}

View File

@ -354,7 +354,7 @@ public final class PlatformCommandManager {
additionalConfig.accept(manager);
final List<Command> subCommands = manager.getAllCommands().collect(Collectors.toList());
cmd.addPart(SubCommandPart.builder(TranslatableComponent.of("worldedit.argument.action"),
cmd.addPart(SubCommandPart.builder(Caption.of("worldedit.argument.action"),
TextComponent.of("Sub-command to run."))
.withCommands(subCommands)
.required()
@ -384,7 +384,7 @@ public final class PlatformCommandManager {
additionalConfig.accept(manager);
final List<Command> subCommands = manager.getAllCommands().collect(Collectors.toList());
cmd.addPart(SubCommandPart.builder(TranslatableComponent.of("worldedit.argument.action"),
cmd.addPart(SubCommandPart.builder(Caption.of("worldedit.argument.action"),
TextComponent.of("Sub-command to run."))
.withCommands(subCommands)
.required()
@ -724,16 +724,16 @@ public final class PlatformCommandManager {
actor.print(e.getRichMessage());
}
} catch (FaweException e) {
actor.printError(TranslatableComponent.of("fawe.cancel.worldedit.cancel.reason", e.getComponent()));
actor.print(Caption.of("fawe.cancel.worldedit.cancel.reason", e.getComponent()));
} catch (UsageException e) {
ImmutableList<Command> cmd = e.getCommands();
if (!cmd.isEmpty()) {
actor.printError(TranslatableComponent.of("fawe.error.command.syntax", HelpGenerator.create(e.getCommandParseResult()).getFullHelp()));
actor.print(Caption.of("fawe.error.command.syntax", HelpGenerator.create(e.getCommandParseResult()).getFullHelp()));
}
actor.printError(e.getRichMessage());
} catch (CommandExecutionException e) {
if (e.getCause() instanceof FaweException) {
actor.printError(TranslatableComponent.of("fawe.cancel.worldedit.cancel.reason", ((FaweException)e.getCause()).getComponent()));
actor.print(Caption.of("fawe.cancel.worldedit.cancel.reason", ((FaweException)e.getCause()).getComponent()));
} else {
handleUnknownException(actor, e.getCause());
}
@ -741,7 +741,6 @@ public final class PlatformCommandManager {
Component msg = e.getRichMessage();
if (msg != TextComponent.empty()) {
actor.print(TextComponent.builder("")
.color(TextColor.RED)
.append(e.getRichMessage())
.build());
List<String> argList = parseArgs(event.getArguments()).map(Substring::getSubstring).collect(Collectors.toList());
@ -765,7 +764,7 @@ public final class PlatformCommandManager {
int changed = editSession.getBlockChangeCount();
double throughput = timeS == 0 ? changed : changed / timeS;
if (time > 1000) {
actor.printDebug(TranslatableComponent.of(
actor.print(Caption.of(
"worldedit.command.time-elapsed",
TextComponent.of(timeS),
TextComponent.of(changed),
@ -807,7 +806,7 @@ public final class PlatformCommandManager {
store.injectValue(Key.of(Player.class), ValueProvider.constant((Player) actor));
} else {
store.injectValue(Key.of(Player.class), context -> {
throw new CommandException(TranslatableComponent.of("worldedit.command.player-only"), ImmutableList.of());
throw new CommandException(Caption.of("worldedit.command.player-only"), ImmutableList.of());
});
}
store.injectValue(Key.of(Arguments.class), ValueProvider.constant(arguments));
@ -826,7 +825,7 @@ public final class PlatformCommandManager {
}
private void handleUnknownException(Actor actor, Throwable t) {
actor.printError(TranslatableComponent.of("worldedit.command.error.report"));
actor.print(Caption.of("worldedit.command.error.report"));
actor.print(TextComponent.of(t.getClass().getName() + ": " + t.getMessage()));
LOGGER.error("An unexpected error while handling a WorldEdit command", t);
}

View File

@ -19,6 +19,7 @@
package com.sk89q.worldedit.extension.platform;
import com.boydti.fawe.config.Caption;
import com.boydti.fawe.config.Settings;
import com.boydti.fawe.object.brush.visualization.VirtualWorld;
import com.boydti.fawe.object.exception.FaweException;
@ -407,10 +408,10 @@ public class PlatformManager {
public void handleThrowable(Throwable e, Actor actor) {
FaweException faweException = FaweException.get(e);
if (faweException != null) {
actor.print(TranslatableComponent.of("fawe.cancel.worldedit.cancel.reason", faweException.getComponent()));
actor.print(Caption.of("fawe.cancel.worldedit.cancel.reason", faweException.getComponent()));
} else {
actor.printError(TranslatableComponent.of("worldedit.command.error.report"));
actor.print(TranslatableComponent.of(e.getClass().getName(), TextComponent.of(": "), TextComponent.of(e.getMessage())));
actor.print(Caption.of("worldedit.command.error.report"));
actor.print(Caption.of(e.getClass().getName(), TextComponent.of(": "), TextComponent.of(e.getMessage())));
e.printStackTrace();
}
}
@ -462,10 +463,10 @@ public class PlatformManager {
} catch (Throwable e) {
FaweException faweException = FaweException.get(e);
if (faweException != null) {
player.print(TranslatableComponent.of("fawe.cancel.worldedit.cancel.reason", faweException.getComponent()));
player.print(Caption.of("fawe.cancel.worldedit.cancel.reason", faweException.getComponent()));
} else {
player.printError(TranslatableComponent.of("worldedit.command.error.report"));
player.print(TranslatableComponent.of(e.getClass().getName() + ": " + e.getMessage()));
player.print(Caption.of("worldedit.command.error.report"));
player.print(Caption.of(e.getClass().getName() + ": " + e.getMessage()));
e.printStackTrace();
}
} finally {

View File

@ -116,7 +116,7 @@ public class ConsumeBindings extends Bindings {
uuid = Fawe.imp().getUUID(argument);
}
if (uuid == null) {
throw new InputParseException(TranslatableComponent.of("fawe.error.player.not.found", TextComponent.of(argument)));
throw new InputParseException(Caption.of("fawe.error.player.not.found", TextComponent.of(argument)));
}
return uuid;
}
@ -156,7 +156,7 @@ public class ConsumeBindings extends Bindings {
try {
return getWorldEdit().getBlockFactory().parseFromInput(argument, parserContext);
} catch (NoMatchException e) {
throw new InputParseException(TranslatableComponent.of(e.getMessage()));
throw new InputParseException(Caption.of(e.getMessage()));
}
}
}

Some files were not shown because too many files have changed in this diff Show More