Finalize Captions

Follow up to a9d1202ce1
This commit is contained in:
NotMyFault
2021-04-05 19:54:49 +02:00
parent a9d1202ce1
commit 5e534ff9e2
135 changed files with 671 additions and 622 deletions

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()));
}
}
}