Remove TranslatableComponent override

use Caption class
Dieser Commit ist enthalten in:
Jesse Boyd 2019-12-16 09:01:41 +00:00
Ursprung fe1215ff38
Commit aac30742de
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 59F1DE6293AF6E1F
29 geänderte Dateien mit 131 neuen und 265 gelöschten Zeilen

Datei anzeigen

@ -7,7 +7,7 @@ import static com.sk89q.worldedit.util.formatting.text.TextComponent.newline;
import com.boydti.fawe.Fawe;
import com.boydti.fawe.FaweAPI;
import com.boydti.fawe.beta.implementation.filter.block.SingleFilterBlock;
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
import com.boydti.fawe.config.Caption;
import com.boydti.fawe.object.RunnableVal;
import com.boydti.fawe.object.brush.visualization.cfi.HeightMapMCAGenerator;
import com.boydti.fawe.object.clipboard.MultiClipboardHolder;
@ -949,7 +949,7 @@ public class CFICommands {
JsonObject data1 = obj.get("data").getAsJsonObject();
String link = data1.get("link").getAsString();
URL url = new URL(link);
player.print(TranslatableComponent.of("fawe.web.download.link" , url));
player.print(Caption.of("fawe.web.download.link" , url));
}
@Command(

Datei anzeigen

@ -4,12 +4,19 @@ import com.sk89q.worldedit.WorldEdit;
import com.sk89q.worldedit.util.formatting.WorldEditText;
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.util.formatting.text.serializer.legacy.LegacyComponentSerializer;
import org.jetbrains.annotations.Nullable;
import javax.annotation.Nonnull;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Locale;
import java.util.Objects;
import java.util.stream.Collectors;
public class Caption {
public static String toString(Component component) {
@ -74,4 +81,15 @@ public class Caption {
return parent;
}
public static TranslatableComponent of(@Nonnull final String key, @Nullable final TextColor color, @Nonnull final List<? extends Component> args) {
return TranslatableComponent.of(key, color, Collections.emptySet(), args);
}
@Nonnull
public static TranslatableComponent of(@Nonnull final String key, final Object... args) {
List<Component> components = Arrays.stream(args)
.map(arg -> arg instanceof Component ? (Component) arg : TextComponent.of(Objects.toString(arg)))
.collect(Collectors.toList());
return TranslatableComponent.of(key, components);
}
}

Datei anzeigen

@ -1,5 +1,6 @@
package com.boydti.fawe.object.brush;
import com.boydti.fawe.config.Caption;
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
import com.boydti.fawe.object.brush.visualization.VisualExtent;
import com.sk89q.worldedit.EditSession;
@ -35,14 +36,14 @@ public class CatenaryBrush implements Brush, ResettableTool {
if (pos1 == null || pos2.equals(pos1)) {
if (!visual) {
pos1 = pos2;
editSession.getPlayer().print(TranslatableComponent.of("fawe.worldedit.brush.brush.line.primary", pos2));
editSession.getPlayer().print(Caption.of("fawe.worldedit.brush.brush.line.primary", pos2));
}
return;
}
if (this.vertex == null) {
vertex = getVertex(pos1.toVector3(), pos2.toVector3(), slack);
if (this.direction) {
editSession.getPlayer().print(TranslatableComponent.of("fawe.worldedit.brush.brush.catenary.direction", 2));
editSession.getPlayer().print(Caption.of("fawe.worldedit.brush.brush.catenary.direction", 2));
return;
}
} else if (this.direction) {

Datei anzeigen

@ -1,5 +1,6 @@
package com.boydti.fawe.object.brush;
import com.boydti.fawe.config.Caption;
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
import com.boydti.fawe.object.brush.visualization.VisualExtent;
import com.boydti.fawe.object.clipboard.ResizableClipboardBuilder;
@ -87,7 +88,7 @@ public class CopyPastaBrush implements Brush, ResettableTool {
ClipboardHolder holder = new ClipboardHolder(newClipboard);
session.setClipboard(holder);
int blocks = builder.size();
player.print(TranslatableComponent.of("fawe.worldedit.copy.command.copy" , blocks));
player.print(Caption.of("fawe.worldedit.copy.command.copy" , blocks));
} else {
AffineTransform transform = null;
if (randomRotate) {

Datei anzeigen

@ -1,6 +1,7 @@
package com.boydti.fawe.object.brush;
import com.boydti.fawe.Fawe;
import com.boydti.fawe.config.Caption;
import com.boydti.fawe.logging.rollback.RollbackOptimizedHistory;
import com.sk89q.worldedit.util.formatting.text.TextComponent;
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
@ -8,7 +9,6 @@ import com.boydti.fawe.config.Settings;
import com.boydti.fawe.database.DBHandler;
import com.boydti.fawe.database.RollbackDatabase;
import com.boydti.fawe.object.change.MutableFullBlockChange;
import com.boydti.fawe.object.changeset.DiskStorageHistory;
import com.boydti.fawe.util.MainUtil;
import com.sk89q.worldedit.LocalConfiguration;
import com.sk89q.worldedit.LocalSession;
@ -62,11 +62,11 @@ public class InspectBrush extends BrushTool implements DoubleActionTraceTool {
public boolean perform(final Player player, LocalSession session, boolean rightClick) {
if (!session.isToolControlEnabled() || !player.hasPermission("worldedit.tool.inspect")) {
player.print(TranslatableComponent.of("", "worldedit.tool.inspect"));
player.print(Caption.of("", "worldedit.tool.inspect"));
return false;
}
if (!Settings.IMP.HISTORY.USE_DATABASE) {
player.print(TranslatableComponent.of("fawe.error.setting.disable", ("history.use-database (Import with /history import )")));
player.print(Caption.of("fawe.error.setting.disable", ("history.use-database (Import with /history import )")));
return false;
}
try {
@ -95,7 +95,7 @@ public class InspectBrush extends BrushTool implements DoubleActionTraceTool {
String ageFormatted = MainUtil.secToTime(age / 1000);
BlockState blockFrom = BlockState.getFromOrdinal(from);
BlockState blockTo = BlockState.getFromOrdinal(to);
TranslatableComponent msg = TranslatableComponent.of("fawe.worldedit.tool.tool.inspect.info", name, blockFrom, blockTo, ageFormatted);
TranslatableComponent msg = Caption.of("fawe.worldedit.tool.tool.inspect.info", name, blockFrom, blockTo, ageFormatted);
String cmd = edit.getCommand();
TextComponent hover = TextComponent.of(cmd, TextColor.GOLD);
@ -105,7 +105,7 @@ public class InspectBrush extends BrushTool implements DoubleActionTraceTool {
player.print(msg);
}
}
player.print(TranslatableComponent.of("fawe.worldedit.tool.tool.inspect.info.footer" , count));
player.print(Caption.of("fawe.worldedit.tool.tool.inspect.info.footer" , count));
} catch (IOException e) {
throw new RuntimeException(e);
}

Datei anzeigen

@ -1,5 +1,6 @@
package com.boydti.fawe.object.brush;
import com.boydti.fawe.config.Caption;
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
import com.boydti.fawe.object.brush.visualization.VisualExtent;
import com.sk89q.worldedit.EditSession;
@ -25,7 +26,7 @@ public class LineBrush implements Brush, ResettableTool {
if (pos1 == null) {
if (!visual) {
pos1 = position;
editSession.getPlayer().print(TranslatableComponent.of("fawe.worldedit.brush.brush.line.primary", position));
editSession.getPlayer().print(Caption.of("fawe.worldedit.brush.brush.line.primary", position));
}
return;
}

Datei anzeigen

@ -1,6 +1,6 @@
package com.boydti.fawe.object.brush.scroll;
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
import com.boydti.fawe.config.Caption;
import com.boydti.fawe.object.clipboard.MultiClipboardHolder;
import com.sk89q.worldedit.LocalSession;
import com.sk89q.worldedit.WorldEdit;
@ -46,7 +46,7 @@ public abstract class Scroll implements ScrollTool {
return null;
case CLIPBOARD:
if (arguments.size() != 2) {
if (message) player.print(TranslatableComponent.of("fawe.error.command.syntax" , "clipboard [file]"));
if (message) player.print(Caption.of("fawe.error.command.syntax" , "clipboard [file]"));
return null;
}
String filename = arguments.get(1);
@ -61,7 +61,7 @@ public abstract class Scroll implements ScrollTool {
}
case MASK:
if (arguments.size() < 2) {
if (message) player.print(TranslatableComponent.of("fawe.error.command.syntax" , "mask [mask 1] [mask 2] [mask 3]..."));
if (message) player.print(Caption.of("fawe.error.command.syntax" , "mask [mask 1] [mask 2] [mask 3]..."));
return null;
}
Mask[] masks = new Mask[arguments.size() - 1];
@ -72,7 +72,7 @@ public abstract class Scroll implements ScrollTool {
return (new ScrollMask(tool, masks));
case PATTERN:
if (arguments.size() < 2) {
if (message) player.print(TranslatableComponent.of("fawe.error.command.syntax" , "pattern [pattern 1] [pattern 2] [pattern 3]..."));
if (message) player.print(Caption.of("fawe.error.command.syntax" , "pattern [pattern 1] [pattern 2] [pattern 3]..."));
return null;
}
Pattern[] patterns = new Pattern[arguments.size() - 1];

Datei anzeigen

@ -1,5 +1,6 @@
package com.boydti.fawe.object.progress;
import com.boydti.fawe.config.Caption;
import com.sk89q.worldedit.util.formatting.text.Component;
import com.sk89q.worldedit.util.formatting.text.TextComponent;
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
@ -114,7 +115,7 @@ public class DefaultProgressTracker implements BiConsumer<DefaultProgressTracker
String speedStr = StringMan.padRight("" + speed, 3);
String percent = StringMan.padRight("" + (amountDispatch != 0 ? (amountDispatch * 100) / totalQueue : 0), 3);
int remaining = speed != 0 ? amountQueue / speed : -1;
sendTile(TextComponent.empty(), TranslatableComponent.of("fawe.progress.progress.message", queue, dispatch, percent, StringMan.padLeft("" + speed, 3), StringMan.padLeft("" + remaining, 3)));
sendTile(TextComponent.empty(), Caption.of("fawe.progress.progress.message", queue, dispatch, percent, StringMan.padLeft("" + speed, 3), StringMan.padLeft("" + remaining, 3)));
}
public void sendTile(Component title, Component sub) {

Datei anzeigen

@ -1,6 +1,6 @@
package com.boydti.fawe.object.regions.selector;
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
import com.boydti.fawe.config.Caption;
import com.boydti.fawe.object.regions.FuzzyRegion;
import com.boydti.fawe.util.EditSessionBuilder;
import com.boydti.fawe.util.ExtentTraverser;
@ -88,13 +88,13 @@ public class FuzzyRegionSelector extends PassthroughExtent implements RegionSele
@Override
public void explainPrimarySelection(Actor actor, LocalSession session, BlockVector3 position) {
int size = this.region.getArea();
player.print(TranslatableComponent.of("fawe.worldedit.selector.selector.fuzzy.pos1", position, "(" + region.getArea() + ")"));
player.print(Caption.of("fawe.worldedit.selector.selector.fuzzy.pos1", position, "(" + region.getArea() + ")"));
}
@Override
public void explainSecondarySelection(Actor actor, LocalSession session, BlockVector3 position) {
int size = this.region.getArea();
player.print(TranslatableComponent.of("fawe.worldedit.selector.selector.fuzzy.pos2", position, "(" + region.getArea() + ")"));
player.print(Caption.of("fawe.worldedit.selector.selector.fuzzy.pos2", position, "(" + region.getArea() + ")"));
}
@Override

Datei anzeigen

@ -20,7 +20,7 @@
package com.sk89q.worldedit;
import com.boydti.fawe.FaweCache;
import com.sk89q.worldedit.extent.clipboard.io.BuiltInClipboardFormat;
import com.boydti.fawe.config.Caption;
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
import com.boydti.fawe.config.Settings;
import com.boydti.fawe.object.FaweLimit;
@ -138,7 +138,6 @@ import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.UUID;
import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.base.Preconditions.checkNotNull;
@ -685,7 +684,7 @@ public class EditSession extends PassthroughExtent implements AutoCloseable {
}
}
player.print(TranslatableComponent.of("fawe.error.worldedit.some.fails.blockbag", str.toString()));
player.print(Caption.of("fawe.error.worldedit.some.fails.blockbag", str.toString()));
}
}
return Collections.emptyMap();
@ -1005,7 +1004,7 @@ public class EditSession extends PassthroughExtent implements AutoCloseable {
FaweLimit used = getLimitUsed();
if (used.MAX_FAILS > 0) {
if (used.MAX_CHANGES > 0 || used.MAX_ENTITIES > 0) {
player.print(TranslatableComponent.of("fawe.error.worldedit.some.fails", used.MAX_FAILS));
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"));
} else {

Datei anzeigen

@ -20,6 +20,7 @@
package com.sk89q.worldedit.command;
import com.boydti.fawe.Fawe;
import com.boydti.fawe.config.Caption;
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
import com.boydti.fawe.config.Settings;
import com.boydti.fawe.object.FaweLimit;
@ -270,7 +271,7 @@ public class BrushCommands {
@Arg(desc = "The radius to sample for blending", def = "25")
Expression radius) throws WorldEditException {
worldEdit.checkMaxBrushRadius(radius);
player.print(TranslatableComponent.of("fawe.worldedit.brush.brush.spline", (radius)));
player.print(Caption.of("fawe.worldedit.brush.brush.spline", (radius)));
set(context,
new SplineBrush(player))
.setSize(radius)
@ -331,7 +332,7 @@ public class BrushCommands {
@Arg(desc = "double", def = "0") double bias,
@Arg(desc = "double", def = "0") double continuity,
@Arg(desc = "double", def = "10") double quality) throws WorldEditException {
player.print(TranslatableComponent.of("fawe.worldedit.brush.brush.spline", (radius)));
player.print(Caption.of("fawe.worldedit.brush.brush.spline", (radius)));
worldEdit.checkMaxBrushRadius(radius);
set(context,
new SurfaceSpline(tension, bias, continuity, quality))
@ -537,12 +538,12 @@ public class BrushCommands {
try {
MultiClipboardHolder clipboards = ClipboardFormats.loadAllFromInput(player, clipboardStr, null, true);
if (clipboards == null) {
player.print(TranslatableComponent.of("fawe.error.schematic.not.found" , clipboardStr));
player.print(Caption.of("fawe.error.schematic.not.found" , clipboardStr));
return;
}
List<ClipboardHolder> holders = clipboards.getHolders();
if (holders == null) {
player.print(TranslatableComponent.of("fawe.error.schematic.not.found" , clipboardStr));
player.print(Caption.of("fawe.error.schematic.not.found" , clipboardStr));
return;
}
@ -843,7 +844,7 @@ public class BrushCommands {
@Switch(name = 'r', desc = "Apply random rotation on paste") boolean randomRotate,
@Switch(name = 'a', desc = "Apply auto view based rotation on paste") boolean autoRotate) throws WorldEditException {
worldEdit.checkMaxBrushRadius(radius);
player.print(TranslatableComponent.of("fawe.worldedit.brush.brush.copy", (radius)));
player.print(Caption.of("fawe.worldedit.brush.brush.copy", (radius)));
set(context,
new CopyPastaBrush(player, session, randomRotate, autoRotate))
@ -918,7 +919,7 @@ public class BrushCommands {
tool.setPrimary(settings);
tool.setSecondary(settings);
player.print(TranslatableComponent.of("fawe.worldedit.brush.brush.equipped" , arguments.get().split(" ")[1]));
player.print(Caption.of("fawe.worldedit.brush.brush.equipped" , arguments.get().split(" ")[1]));
}
return settings;
}
@ -981,7 +982,7 @@ public class BrushCommands {
} catch (Throwable e) {
e.printStackTrace();
}
player.print(TranslatableComponent.of("fawe.worldedit.schematic.schematic.saved" , name));
player.print(Caption.of("fawe.worldedit.schematic.schematic.saved" , name));
} else {
player.printError(TranslatableComponent.of("fawe.worldedit.brush.brush.none"));
}
@ -1004,7 +1005,7 @@ public class BrushCommands {
}
if (!file.exists()) {
File[] files = folder.listFiles(pathname -> false);
player.print(TranslatableComponent.of("fawe.error.brush.not.found" , name));
player.print(Caption.of("fawe.error.brush.not.found" , name));
return;
}
try (DataInputStream in = new DataInputStream(
@ -1013,7 +1014,7 @@ public class BrushCommands {
BrushTool tool = BrushTool.fromString(player, session, json);
BaseItem item = player.getItemInHand(HandSide.MAIN_HAND);
session.setTool(item, tool, player);
player.print(TranslatableComponent.of("fawe.worldedit.brush.brush.equipped" , name));
player.print(Caption.of("fawe.worldedit.brush.brush.equipped" , name));
} catch (Throwable e) {
e.printStackTrace();
player.printError(TranslatableComponent.of("fawe.error.brush.incompatible"));

Datei anzeigen

@ -19,6 +19,7 @@
package com.sk89q.worldedit.command;
import com.boydti.fawe.config.Caption;
import com.google.common.collect.Lists;
import com.boydti.fawe.FaweAPI;
@ -182,7 +183,7 @@ public class ClipboardCommands {
lazyClipboard.setOrigin(session.getPlacementPosition(actor));
session.setClipboard(new ClipboardHolder(lazyClipboard));
actor.print(TranslatableComponent.of("fawe.worldedit.copy.command.copy" , region.getArea()));
actor.print(Caption.of("fawe.worldedit.copy.command.copy" , region.getArea()));
if (!actor.hasPermission("fawe.tips")) {
System.out.println("TODO FIXME tips");
// TranslatableComponent.of("fawe.tips.tip.paste").or(TranslatableComponent.of("fawe.tips.tip.lazycopy"), TranslatableComponent.of("fawe.tips.tip.download"), TranslatableComponent.of("fawe.tips.tip.rotate"), TranslatableComponent.of("fawe.tips.tip.copypaste"), TranslatableComponent.of("fawe.tips.tip.replace.marker"), TranslatableComponent.of("fawe.tips.tip.copy.pattern")).send(actor);
@ -287,11 +288,11 @@ public class ClipboardCommands {
public void download(final Player player, final LocalSession session, @Arg(name = "format", desc = "String", def = "schem") final String formatName) throws WorldEditException {
final ClipboardFormat format = ClipboardFormats.findByAlias(formatName);
if (format == null) {
player.print(TranslatableComponent.of("fawe.worldedit.clipboard.clipboard.invalid.format" , formatName));
player.print(Caption.of("fawe.worldedit.clipboard.clipboard.invalid.format" , formatName));
return;
}
player.print(TranslatableComponent.of("fawe.web.generating.link" , formatName));
player.print(Caption.of("fawe.web.generating.link" , formatName));
ClipboardHolder holder = session.getClipboard();
URL url;
@ -360,7 +361,7 @@ public class ClipboardCommands {
}
} else {
if (Settings.IMP.WEB.URL.isEmpty()) {
player.print(TranslatableComponent.of("fawe.error.setting.disable", "web.url"));
player.print(Caption.of("fawe.error.setting.disable", "web.url"));
return;
}
url = FaweAPI.upload(target, format);
@ -377,7 +378,7 @@ public class ClipboardCommands {
e.printStackTrace();
}
}
player.print(TranslatableComponent.of("fawe.web.download.link" , urlText));
player.print(Caption.of("fawe.web.download.link" , urlText));
}
}
@ -401,16 +402,16 @@ public class ClipboardCommands {
} else {
target = clipboard;
}
player.print(TranslatableComponent.of("fawe.web.generating.link" , format.getName()));
player.print(Caption.of("fawe.web.generating.link" , format.getName()));
if (Settings.IMP.WEB.ASSETS.isEmpty()) {
player.print(TranslatableComponent.of("fawe.error.setting.disable", "web.assets"));
player.print(Caption.of("fawe.error.setting.disable", "web.assets"));
return;
}
URL url = format.uploadPublic(target, category.replaceAll("[/|\\\\]", "."), player.getName());
if (url == null) {
player.printError(TranslatableComponent.of("fawe.web.generating.link.failed"));
} else {
player.print(TranslatableComponent.of("fawe.web.download.link" , Settings.IMP.WEB.ASSETS));
player.print(Caption.of("fawe.web.download.link" , Settings.IMP.WEB.ASSETS));
}
}
@ -528,7 +529,7 @@ public class ClipboardCommands {
selector.learnChanges();
selector.explainRegionAdjust(actor, session);
}
actor.print(TranslatableComponent.of("fawe.worldedit.paste.command.paste" , to));
actor.print(Caption.of("fawe.worldedit.paste.command.paste" , to));
if (!actor.hasPermission("fawe.tips")) {
actor.print(TranslatableComponent.of("fawe.tips.tip.copypaste"));

Datei anzeigen

@ -22,6 +22,7 @@ package com.sk89q.worldedit.command;
import static com.google.common.base.Preconditions.checkNotNull;
import com.boydti.fawe.Fawe;
import com.boydti.fawe.config.Caption;
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
import com.boydti.fawe.object.extent.ResettableExtent;
import com.boydti.fawe.util.CachedTextureUtil;
@ -398,7 +399,7 @@ public class GeneralCommands {
}
if (!(util instanceof CachedTextureUtil)) util = new CachedTextureUtil(util);
session.setTextureUtil(util);
player.print(TranslatableComponent.of("fawe.worldedit.general.texture.set" , StringMan.join(arguments, " ")));
player.print(Caption.of("fawe.worldedit.general.texture.set" , StringMan.join(arguments, " ")));
}
}

Datei anzeigen

@ -24,6 +24,7 @@ import static com.sk89q.worldedit.command.util.Logging.LogMode.POSITION;
import static com.sk89q.worldedit.internal.command.CommandUtil.checkCommandArgument;
import com.boydti.fawe.Fawe;
import com.boydti.fawe.config.Caption;
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
import com.boydti.fawe.util.MainUtil;
import com.boydti.fawe.util.MathMan;
@ -109,7 +110,7 @@ public class GenerationCommands {
@Arg(name = "pocketMax", desc = "TODO", def = "3") int pocketMaxOpt) throws WorldEditException {
CavesGen gen = new CavesGen(sizeOpt, frequencyOpt, rarityOpt, minYOpt, maxYOpt, systemFrequencyOpt, individualRarityOpt, pocketChanceOpt, pocketMinOpt, pocketMaxOpt);
editSession.generate(region, gen);
actor.print(TranslatableComponent.of("fawe.worldedit.visitor.visitor.block" , editSession.getBlockChangeCount()));
actor.print(Caption.of("fawe.worldedit.visitor.visitor.block" , editSession.getBlockChangeCount()));
}
@ -122,7 +123,7 @@ public class GenerationCommands {
@Confirm(Confirm.Processor.REGION)
public void ores(Actor actor, LocalSession session, EditSession editSession, @Selection Region region, @Arg(desc = "Mask") Mask mask) throws WorldEditException {
editSession.addOres(region, mask);
actor.print(TranslatableComponent.of("fawe.worldedit.visitor.visitor.block" , editSession.getBlockChangeCount()));
actor.print(Caption.of("fawe.worldedit.visitor.visitor.block" , editSession.getBlockChangeCount()));
}
@Command(
@ -164,7 +165,7 @@ public class GenerationCommands {
return false;
});
Operations.completeBlindly(visitor);
actor.print(TranslatableComponent.of("fawe.worldedit.visitor.visitor.block" , editSession.getBlockChangeCount()));
actor.print(Caption.of("fawe.worldedit.visitor.visitor.block" , editSession.getBlockChangeCount()));
}
@Command(
@ -176,7 +177,7 @@ public class GenerationCommands {
@Confirm(Confirm.Processor.REGION)
public void ore(Actor actor, LocalSession session, EditSession editSession, @Selection Region region, @Arg(desc = "Mask") Mask mask, @Arg(desc = "Pattern") Pattern material, @Arg(desc="Ore vein size") @Range(from = 0, to=Integer.MAX_VALUE) int size, int freq, @Range(from=0, to=100) int rarity, @Range(from=0, to=255) int minY, @Range(from=0, to=255) int maxY) throws WorldEditException {
editSession.addOre(region, mask, material, size, freq, rarity, minY, maxY);
actor.print(TranslatableComponent.of("fawe.worldedit.visitor.visitor.block" , editSession.getBlockChangeCount()));
actor.print(Caption.of("fawe.worldedit.visitor.visitor.block" , editSession.getBlockChangeCount()));
}
@Command(

Datei anzeigen

@ -2,6 +2,7 @@ package com.sk89q.worldedit.command;
import com.boydti.fawe.Fawe;
import com.boydti.fawe.FaweAPI;
import com.boydti.fawe.config.Caption;
import com.boydti.fawe.config.Settings;
import com.boydti.fawe.database.DBHandler;
import com.boydti.fawe.database.RollbackDatabase;
@ -9,9 +10,7 @@ import com.boydti.fawe.logging.rollback.RollbackOptimizedHistory;
import com.boydti.fawe.object.RegionWrapper;
import com.boydti.fawe.object.changeset.DiskStorageHistory;
import com.boydti.fawe.util.MainUtil;
import com.boydti.fawe.util.MathMan;
import com.google.common.base.Function;
import com.google.common.base.Suppliers;
import com.google.common.collect.Lists;
import com.sk89q.worldedit.LocalSession;
import com.sk89q.worldedit.WorldEditException;
@ -21,15 +20,10 @@ import com.sk89q.worldedit.command.util.CommandPermissionsConditionGenerator;
import com.sk89q.worldedit.command.util.annotation.Confirm;
import com.sk89q.worldedit.entity.Player;
import com.sk89q.worldedit.extension.platform.Actor;
import com.sk89q.worldedit.extent.clipboard.Clipboard;
import com.sk89q.worldedit.extent.clipboard.io.BuiltInClipboardFormat;
import com.sk89q.worldedit.extent.clipboard.io.ClipboardFormat;
import com.sk89q.worldedit.extent.clipboard.io.ClipboardFormats;
import com.sk89q.worldedit.internal.annotation.AllowedRegion;
import com.sk89q.worldedit.internal.annotation.Time;
import com.sk89q.worldedit.math.BlockVector2;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.regions.CuboidRegion;
import com.sk89q.worldedit.regions.Region;
import com.sk89q.worldedit.util.Countable;
import com.sk89q.worldedit.util.Direction;
@ -54,13 +48,10 @@ import javax.annotation.Nullable;
import java.io.File;
import java.lang.ref.Reference;
import java.lang.ref.SoftReference;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.UUID;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future;
import java.util.concurrent.atomic.LongAdder;
import java.util.function.Supplier;
@ -109,7 +100,7 @@ public class HistorySubCommands {
@ArgFlag(name = 't', desc = "Time e.g. 20s", def = "0") @Time long timeDiff,
@Switch(name = 'f', desc = "Restore instead of rollback") boolean restore) throws WorldEditException {
if (!Settings.IMP.HISTORY.USE_DATABASE) {
player.print(TranslatableComponent.of("fawe.error.setting.disable" , "history.use-database (Import with /history import )"));
player.print(Caption.of("fawe.error.setting.disable" , "history.use-database (Import with /history import )"));
return;
}
checkCommandArgument(radius > 0, "Radius must be >= 0");
@ -140,9 +131,9 @@ public class HistorySubCommands {
RollbackOptimizedHistory edit = supplier.get();
edit.undo(player, allowedRegions);
String path = edit.getWorld().getName() + "/" + finalOther + "-" + edit.getIndex();
player.print(TranslatableComponent.of("fawe.worldedit.rollback.rollback.element", path));
player.print(Caption.of("fawe.worldedit.rollback.rollback.element", path));
}
player.print(TranslatableComponent.of("fawe.worldedit.tool.tool.inspect.info.footer" , count));
player.print(Caption.of("fawe.worldedit.tool.tool.inspect.info.footer" , count));
}
@Command(
@ -292,7 +283,7 @@ public class HistorySubCommands {
@Time long timeDiff,
@ArgFlag(name = 'p', desc = "Page to view.", def = "1") int page) throws WorldEditException {
if (!Settings.IMP.HISTORY.USE_DATABASE) {
player.print(TranslatableComponent.of("fawe.error.setting.disable" , "history.use-database (Import with //history import )"));
player.print(Caption.of("fawe.error.setting.disable" , "history.use-database (Import with //history import )"));
return;
}
checkCommandArgument(radius > 0, "Radius must be >= 0");
@ -355,10 +346,10 @@ public class HistorySubCommands {
int size = edit.size();
TranslatableComponent elem = TranslatableComponent.of("fawe.worldedit.history.find.element", name, timeStr, distance, direction.name(), cmd);
TranslatableComponent elem = Caption.of("fawe.worldedit.history.find.element", name, timeStr, distance, direction.name(), cmd);
String infoCmd = "//history summary " + uuid + " " + index;
TranslatableComponent hover = TranslatableComponent.of("fawe.worldedit.history.find.hover", size);
TranslatableComponent hover = Caption.of("fawe.worldedit.history.find.hover", size);
elem = elem.hoverEvent(HoverEvent.of(HoverEvent.Action.SHOW_TEXT, hover));
elem = elem.clickEvent(ClickEvent.of(ClickEvent.Action.RUN_COMMAND, infoCmd));

Datei anzeigen

@ -29,6 +29,7 @@ import static com.sk89q.worldedit.regions.Regions.minimumBlockY;
import com.boydti.fawe.FaweAPI;
import com.boydti.fawe.FaweCache;
import com.boydti.fawe.config.Caption;
import com.boydti.fawe.object.FaweLimit;
import com.sk89q.jnbt.CompoundTag;
import com.sk89q.worldedit.EditSession;
@ -153,7 +154,7 @@ public class RegionCommands {
selection = new CuboidRegion(BlockVector3.at(cx - 8, 0, cz - 8).multiply(16), BlockVector3.at(cx + 8, 0, cz + 8).multiply(16));
}
int count = FaweAPI.fixLighting(player.getWorld(), selection,null);
player.print(TranslatableComponent.of("fawe.info.lighting.propagate.selection" , count));
player.print(Caption.of("fawe.info.lighting.propagate.selection" , count));
}
@Command(
@ -181,7 +182,7 @@ public class RegionCommands {
selection = new CuboidRegion(BlockVector3.at(cx - 8, 0, cz - 8).multiply(16), BlockVector3.at(cx + 8, 0, cz + 8).multiply(16));
}
int count = FaweAPI.fixLighting(player.getWorld(), selection, null);
player.print(TranslatableComponent.of("fawe.info.updated.lighting.selection" , count));
player.print(Caption.of("fawe.info.updated.lighting.selection" , count));
}
@Command(
@ -338,7 +339,7 @@ public class RegionCommands {
editSession.setBlock(x, y, z, patternArg);
affected++;
}
player.print(TranslatableComponent.of("fawe.worldedit.visitor.visitor.block" , affected));
player.print(Caption.of("fawe.worldedit.visitor.visitor.block" , affected));
}
@Command(
@ -532,7 +533,7 @@ public class RegionCommands {
@Arg(desc = "BlockStateHolder", def = "air") BlockStateHolder replace,
@Switch(name = 'm', desc = "TODO") boolean notFullHeight) throws WorldEditException {
int affected = editSession.fall(region, !notFullHeight, replace);
player.print(TranslatableComponent.of("fawe.worldedit.visitor.visitor.block" , affected));
player.print(Caption.of("fawe.worldedit.visitor.visitor.block" , affected));
}
@Command(

Datei anzeigen

@ -22,6 +22,7 @@ package com.sk89q.worldedit.command;
import static com.boydti.fawe.util.ReflectionUtils.as;
import static com.google.common.base.Preconditions.checkNotNull;
import com.boydti.fawe.config.Caption;
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
import com.boydti.fawe.config.Settings;
import com.boydti.fawe.object.clipboard.MultiClipboardHolder;
@ -131,14 +132,14 @@ public class SchematicCommands {
boolean randomRotate) throws FilenameException {
final ClipboardFormat format = ClipboardFormats.findByAlias(formatName);
if (format == null) {
player.print(TranslatableComponent.of("fawe.worldedit.clipboard.clipboard.invalid.format" , formatName));
player.print(Caption.of("fawe.worldedit.clipboard.clipboard.invalid.format" , formatName));
return;
}
try {
MultiClipboardHolder all = ClipboardFormats.loadAllFromInput(player, filename, null, true);
if (all != null) {
session.addClipboard(all);
player.print(TranslatableComponent.of("fawe.worldedit.schematic.schematic.loaded" , filename));
player.print(Caption.of("fawe.worldedit.schematic.schematic.loaded" , filename));
}
} catch (IOException e) {
throw new RuntimeException(e);
@ -186,7 +187,7 @@ public class SchematicCommands {
return;
}
}
player.print(TranslatableComponent.of("fawe.worldedit.clipboard.clipboard.uri.not.found" , fileName));
player.print(Caption.of("fawe.worldedit.clipboard.clipboard.uri.not.found" , fileName));
}
@Command(
@ -222,7 +223,7 @@ public class SchematicCommands {
URI uri;
if (filename.startsWith("url:")) {
if (!actor.hasPermission("worldedit.schematic.load.web")) {
actor.print(TranslatableComponent.of("fawe.error.no.perm", "worldedit.schematic.load.web"));
actor.print(Caption.of("fawe.error.no.perm", "worldedit.schematic.load.web"));
return;
}
UUID uuid = UUID.fromString(filename.substring(4));
@ -249,7 +250,7 @@ public class SchematicCommands {
}
} else {
if (Settings.IMP.PATHS.PER_PLAYER_SCHEMATICS && !actor.hasPermission("worldedit.schematic.load.other") && Pattern.compile("[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}").matcher(filename).find()) {
actor.print(TranslatableComponent.of("fawe.error.no.perm", "worldedit.schematic.load.other"));
actor.print(Caption.of("fawe.error.no.perm", "worldedit.schematic.load.other"));
return;
}
if (format == null && filename.matches(".*\\.[\\w].*")) {
@ -279,7 +280,7 @@ public class SchematicCommands {
uri = file.toURI();
}
format.hold(actor, uri, in);
actor.print(TranslatableComponent.of("fawe.worldedit.schematic.schematic.loaded" , filename));
actor.print(Caption.of("fawe.worldedit.schematic.schematic.loaded" , filename));
} catch (IllegalArgumentException e) {
actor.printError("Unknown filename: " + filename);
} catch (URISyntaxException | IOException e) {
@ -328,7 +329,7 @@ public class SchematicCommands {
if (filename.contains("../")) {
other = true;
if (!actor.hasPermission("worldedit.schematic.save.other")) {
actor.print(TranslatableComponent.of("fawe.error.no.perm", "worldedit.schematic.save.other"));
actor.print(Caption.of("fawe.error.no.perm", "worldedit.schematic.save.other"));
return;
}
if (filename.startsWith("../")) {
@ -346,7 +347,7 @@ public class SchematicCommands {
}
if (other) {
if (!actor.hasPermission("worldedit.schematic.delete.other")) {
actor.print(TranslatableComponent.of("fawe.error.no.perm", "worldedit.schematic.delete.other"));
actor.print(Caption.of("fawe.error.no.perm", "worldedit.schematic.delete.other"));
return;
}
}
@ -392,7 +393,7 @@ public class SchematicCommands {
return;
}
if (Settings.IMP.PATHS.PER_PLAYER_SCHEMATICS && !MainUtil.isInSubDirectory(dir, destDir) && !player.hasPermission("worldedit.schematic.move.other")) {
player.print(TranslatableComponent.of("fawe.error.no.perm", "worldedit.schematic.move.other"));
player.print(Caption.of("fawe.error.no.perm", "worldedit.schematic.move.other"));
return;
}
ClipboardHolder clipboard = session.getClipboard();
@ -408,19 +409,19 @@ public class SchematicCommands {
for (File source : sources) {
File destFile = new File(destDir, source.getName());
if (destFile.exists()) {
player.print(TranslatableComponent.of("fawe.worldedit.schematic.schematic.move.exists" , destFile));
player.print(Caption.of("fawe.worldedit.schematic.schematic.move.exists" , destFile));
continue;
}
if (Settings.IMP.PATHS.PER_PLAYER_SCHEMATICS && (!MainUtil.isInSubDirectory(dir, destFile) || !MainUtil.isInSubDirectory(dir, source)) && !player.hasPermission("worldedit.schematic.delete.other")) {
player.print(TranslatableComponent.of("fawe.worldedit.schematic.schematic.move.failed", destFile,
TranslatableComponent.of("fawe.error.no.perm", ("worldedit.schematic.move.other"))));
player.print(Caption.of("fawe.worldedit.schematic.schematic.move.failed", destFile,
Caption.of("fawe.error.no.perm", ("worldedit.schematic.move.other"))));
continue;
}
try {
File cached = new File(source.getParentFile(), "." + source.getName() + ".cached");
Files.move(source.toPath(), destFile.toPath());
if (cached.exists()) Files.move(cached.toPath(), destFile.toPath());
player.print(TranslatableComponent.of("fawe.worldedit.schematic.schematic.move.success" , source, destFile));
player.print(Caption.of("fawe.worldedit.schematic.schematic.move.success" , source, destFile));
} catch (IOException e) {
throw new RuntimeException(e);
}
@ -712,7 +713,7 @@ public class SchematicCommands {
writer.write(target);
}
log.info(actor.getName() + " saved " + file.getCanonicalPath());
actor.print(TranslatableComponent.of("fawe.worldedit.schematic.schematic.saved" , file.getName()));
actor.print(Caption.of("fawe.worldedit.schematic.schematic.saved" , file.getName()));
} else {
actor.printError(TranslatableComponent.of("fawe.cancel.worldedit.cancel.reason.manual"));
}
@ -828,14 +829,14 @@ public class SchematicCommands {
continue;
}
if (Settings.IMP.PATHS.PER_PLAYER_SCHEMATICS && !MainUtil.isInSubDirectory(dir, f) && !actor.hasPermission("worldedit.schematic.delete.other")) {
actor.print(TranslatableComponent.of("fawe.error.no.perm", "worldedit.schematic.delete.other"));
actor.print(Caption.of("fawe.error.no.perm", "worldedit.schematic.delete.other"));
continue;
}
if (!deleteFile(f)) {
actor.printError(TranslatableComponent.of("worldedit.schematic.delete.failed", TextComponent.of(filename)));
continue;
}
actor.print(TranslatableComponent.of("worldedit.schematic.delete.deleted" , filename));
actor.print(Caption.of("worldedit.schematic.delete.deleted" , filename));
}
}

Datei anzeigen

@ -19,6 +19,7 @@
package com.sk89q.worldedit.command;
import com.boydti.fawe.config.Caption;
import com.google.common.base.Strings;
import static com.sk89q.worldedit.command.util.Logging.LogMode.POSITION;
@ -683,7 +684,7 @@ public class SelectionCommands {
newSelector = new PolyhedralRegionSelector(world);
actor.print(TranslatableComponent.of("fawe.selection.sel.convex.polyhedral"));
Optional<Integer> limit = ActorSelectorLimits.forActor(actor).getPolyhedronVertexLimit();
limit.ifPresent(integer -> actor.print(TranslatableComponent.of("fawe.selection.sel.max", (integer))));
limit.ifPresent(integer -> actor.print(Caption.of("fawe.selection.sel.max", (integer))));
actor.print(TranslatableComponent.of("fawe.selection.sel.list"));
break;
case FUZZY:

Datei anzeigen

@ -19,6 +19,7 @@
package com.sk89q.worldedit.command;
import com.boydti.fawe.config.Caption;
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
import com.boydti.fawe.object.brush.BrushSettings;
import com.boydti.fawe.object.brush.TargetMode;
@ -263,7 +264,7 @@ public class ToolUtilCommands {
VisualMode[] modes = VisualMode.values();
VisualMode newMode = modes[MathMan.wrap(mode, 0, modes.length - 1)];
tool.setVisualMode(player, newMode);
player.print(TranslatableComponent.of("fawe.worldedit.brush.brush.visual.mode.set" , newMode));
player.print(Caption.of("fawe.worldedit.brush.brush.visual.mode.set" , newMode));
}
@Command(
@ -282,7 +283,7 @@ public class ToolUtilCommands {
TargetMode[] modes = TargetMode.values();
TargetMode newMode = modes[MathMan.wrap(mode, 0, modes.length - 1)];
tool.setTargetMode(newMode);
player.print(TranslatableComponent.of("fawe.worldedit.brush.brush.target.mode.set" , newMode));
player.print(Caption.of("fawe.worldedit.brush.brush.target.mode.set" , newMode));
}
@Command(
@ -299,7 +300,7 @@ public class ToolUtilCommands {
return;
}
tool.setTargetOffset(offset);
player.print(TranslatableComponent.of("fawe.worldedit.brush.brush.target.offset.set" , offset));
player.print(Caption.of("fawe.worldedit.brush.brush.target.offset.set" , offset));
}
@Command(
@ -328,7 +329,7 @@ public class ToolUtilCommands {
} else if (action != null) {
String full = (mode.name().toLowerCase() + " " + StringMan.join(commandStr, " ")).trim();
settings.addSetting(BrushSettings.SettingType.SCROLL_ACTION, full);
player.print(TranslatableComponent.of("fawe.worldedit.brush.brush.scroll.action.set" , mode));
player.print(Caption.of("fawe.worldedit.brush.brush.scroll.action.set" , mode));
}
bt.update();
}

Datei anzeigen

@ -22,6 +22,7 @@ package com.sk89q.worldedit.command;
import static com.sk89q.worldedit.command.util.Logging.LogMode.PLACEMENT;
import com.boydti.fawe.Fawe;
import com.boydti.fawe.config.Caption;
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
import com.boydti.fawe.config.Settings;
import com.boydti.fawe.object.DelegateConsumer;
@ -188,7 +189,7 @@ public class UtilityCommands {
@SkipQueue
public void cancel(Player player) {
int cancelled = player.cancel(false);
player.print(TranslatableComponent.of("fawe.cancel.worldedit.cancel.count" , cancelled));
player.print(Caption.of("fawe.cancel.worldedit.cancel.count" , cancelled));
}
@Command(

Datei anzeigen

@ -19,7 +19,6 @@
package com.sk89q.worldedit.command.tool;
import static com.boydti.fawe.object.brush.BrushSettings.SettingType.BRUSH;
import static com.google.common.base.Preconditions.checkNotNull;
import static org.slf4j.LoggerFactory.getLogger;
@ -27,6 +26,7 @@ import com.boydti.fawe.Fawe;
import com.boydti.fawe.beta.implementation.IChunkExtent;
import com.boydti.fawe.beta.implementation.processors.NullProcessor;
import com.boydti.fawe.beta.implementation.processors.PersistentChunkSendProcessor;
import com.boydti.fawe.config.Caption;
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
import com.boydti.fawe.object.brush.BrushSettings;
import com.boydti.fawe.object.brush.MovableTool;
@ -79,8 +79,6 @@ import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;
import java.util.function.Supplier;
import javax.annotation.Nullable;
@ -493,7 +491,7 @@ public class BrushTool implements DoubleActionTraceTool, ScrollTool, MovableTool
if (brush == null) return false;
if (current.setWorld(player.getWorld().getName()) && !current.canUse(player)) {
player.print(TranslatableComponent.of("fawe.error.no.perm" , StringMan.join(current.getPermissions(), ",")));
player.print(Caption.of("fawe.error.no.perm" , StringMan.join(current.getPermissions(), ",")));
return false;
}
try (EditSession editSession = session.createEditSession(player, current.toString())) {

Datei anzeigen

@ -1,5 +1,6 @@
package com.sk89q.worldedit.command.util.annotation;
import com.boydti.fawe.config.Caption;
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
import com.boydti.fawe.util.task.InterruptableCondition;
import com.sk89q.worldedit.IncompleteRegionException;
@ -47,7 +48,7 @@ public @interface Confirm {
long area = (pos2.getX() - pos1.getX()) * (pos2.getZ() - pos1.getZ() + 1) * (long) value;
long max = 2 << 18;
if (max != -1 && area > max) {
actor.print(TranslatableComponent.of("fawe.cancel.worldedit.cancel.reason.confirm.region" , pos1, pos2, getArgs(context)));
actor.print(Caption.of("fawe.cancel.worldedit.cancel.reason.confirm.region" , pos1, pos2, getArgs(context)));
return confirm(actor, context);
}
return true;
@ -58,7 +59,7 @@ public @interface Confirm {
public boolean passes(Actor actor, InjectedValueAccess context, double value) {
int max = WorldEdit.getInstance().getConfiguration().maxRadius;
if (max != -1 && value > max) {
actor.print(TranslatableComponent.of("fawe.cancel.worldedit.cancel.reason.confirm.region" , value, max, getArgs(context)));
actor.print(Caption.of("fawe.cancel.worldedit.cancel.reason.confirm.region" , value, max, getArgs(context)));
return Processor.confirm(actor, context);
}
return true;
@ -69,7 +70,7 @@ public @interface Confirm {
public boolean passes(Actor actor, InjectedValueAccess context, double value) {
int max = 50;// TODO configurable, get Key.of(Method.class) @Limit
if (max != -1 && value > max) {
actor.print(TranslatableComponent.of("fawe.cancel.worldedit.cancel.reason.confirm.region" , value, max, getArgs(context)));
actor.print(Caption.of("fawe.cancel.worldedit.cancel.reason.confirm.region" , value, max, getArgs(context)));
return Processor.confirm(actor, context);
}
return true;

Datei anzeigen

@ -22,8 +22,6 @@ package com.sk89q.worldedit.extension.factory.parser;
import com.boydti.fawe.config.Caption;
import com.google.common.collect.Maps;
import com.sk89q.worldedit.util.formatting.WorldEditText;
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
import com.boydti.fawe.jnbt.JSON2NBT;
import com.boydti.fawe.jnbt.NBTException;
import com.boydti.fawe.util.MathMan;
@ -423,7 +421,7 @@ 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(Caption.toString(TranslatableComponent.of("fawe.error.block.not.allowed", holder)));
throw new DisallowedUsageException(Caption.toString(Caption.of("fawe.error.block.not.allowed", holder)));
}
CompoundTag nbt = holder.getNbtData();
if (nbt != null) {

Datei anzeigen

@ -21,7 +21,7 @@ package com.sk89q.worldedit.extension.factory.parser.mask;
import com.boydti.fawe.command.FaweParser;
import com.boydti.fawe.command.SuggestInputParseException;
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
import com.boydti.fawe.config.Caption;
import com.boydti.fawe.util.StringMan;
import com.sk89q.minecraft.util.commands.CommandLocals;
import com.sk89q.worldedit.WorldEdit;
@ -145,7 +145,7 @@ public class DefaultMaskParser extends FaweParser<Mask> {
input = input.substring(input.indexOf(char0) + 1);
mask = parseFromInput(char0 + "[" + input + "]", context);
if (actor != null) {
actor.print(TranslatableComponent.of("fawe.worldedit.help.command.clarifying.bracket" , char0 + "[" + input + "]"));
actor.print(Caption.of("fawe.worldedit.help.command.clarifying.bracket" , char0 + "[" + input + "]"));
}
return mask;
}

Datei anzeigen

@ -619,7 +619,7 @@ public abstract class AbstractPlayerActor implements Actor, Player, Cloneable {
@Override
public void checkPermission(String permission) throws AuthorizationException {
if (!hasPermission(permission)) {
throw new AuthorizationException(Caption.toString(TranslatableComponent.of("fawe.error.no.perm", permission)));
throw new AuthorizationException(Caption.toString(Caption.of("fawe.error.no.perm", permission)));
}
}

Datei anzeigen

@ -24,6 +24,7 @@ import com.boydti.fawe.command.AnvilCommands;
import com.boydti.fawe.command.AnvilCommandsRegistration;
import com.boydti.fawe.command.CFICommands;
import com.boydti.fawe.command.CFICommandsRegistration;
import com.boydti.fawe.config.Caption;
import com.boydti.fawe.util.StringMan;
import com.sk89q.worldedit.command.HistorySubCommands;
import com.sk89q.worldedit.command.HistorySubCommandsRegistration;
@ -34,7 +35,6 @@ import com.boydti.fawe.object.changeset.CFIChangeSet;
import com.boydti.fawe.object.exception.FaweException;
import com.boydti.fawe.object.task.ThrowableSupplier;
import com.boydti.fawe.util.TaskManager;
import com.boydti.fawe.wrappers.LocationMaskedPlayerWrapper;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Lists;
@ -106,7 +106,6 @@ import com.sk89q.worldedit.command.argument.RegistryConverter;
import com.sk89q.worldedit.command.argument.VectorConverter;
import com.sk89q.worldedit.command.argument.WorldConverter;
import com.sk89q.worldedit.command.argument.ZonedDateTimeConverter;
import com.sk89q.worldedit.command.util.CommandPermissions;
import com.sk89q.worldedit.command.util.CommandQueuedCondition;
import com.sk89q.worldedit.command.util.PermissionCondition;
import com.sk89q.worldedit.command.util.PrintCommandHelp;
@ -133,7 +132,6 @@ import com.sk89q.worldedit.internal.util.Substring;
import com.sk89q.worldedit.regions.Region;
import com.sk89q.worldedit.session.SessionKey;
import com.sk89q.worldedit.session.request.Request;
import com.sk89q.worldedit.util.auth.AuthorizationException;
import com.sk89q.worldedit.util.eventbus.Subscribe;
import com.sk89q.worldedit.util.formatting.text.Component;
import com.sk89q.worldedit.util.formatting.text.TextComponent;
@ -168,14 +166,11 @@ import org.slf4j.LoggerFactory;
import javax.annotation.Nullable;
import java.io.File;
import java.io.IOException;
import java.lang.annotation.Annotation;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Optional;
import java.util.Set;
import java.util.function.BiConsumer;
import java.util.function.Consumer;
import java.util.logging.FileHandler;
@ -704,7 +699,7 @@ public final class PlatformCommandManager {
}
} catch (ConditionFailedException e) {
if (e.getCondition() instanceof PermissionCondition) {
actor.printError(TranslatableComponent.of("fawe.error.no.perm", StringMan.getString(((PermissionCondition) e.getCondition()).getPermissions())));
actor.printError(Caption.of("fawe.error.no.perm", StringMan.getString(((PermissionCondition) e.getCondition()).getPermissions())));
} else {
actor.print(e.getRichMessage());
}

Datei anzeigen

@ -24,8 +24,6 @@ import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.regions.Region;
import com.sk89q.worldedit.util.Identifiable;
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.world.World;
import com.sk89q.worldedit.world.biome.BiomeType;
import com.sk89q.worldedit.world.biome.BiomeTypes;
@ -35,11 +33,7 @@ import com.sk89q.worldedit.world.block.BlockState;
import com.sk89q.worldedit.world.block.BlockStateHolder;
import com.sk89q.worldedit.world.block.BlockType;
import com.sk89q.worldedit.world.registry.BiomeRegistry;
import org.enginehub.piston.CommandManager;
import org.enginehub.piston.converter.ConversionResult;
import org.enginehub.piston.exception.StopExecutionException;
import org.enginehub.piston.inject.InjectedValueAccess;
import org.enginehub.piston.inject.Key;
import java.util.Collection;
import java.util.UUID;
@ -129,7 +123,7 @@ public class ConsumeBindings extends Bindings {
uuid = Fawe.imp().getUUID(argument);
}
if (uuid == null) {
throw new InputParseException(Caption.toString(TranslatableComponent.of("fawe.error.player.not.found" , argument)));
throw new InputParseException(Caption.toString(Caption.of("fawe.error.player.not.found" , argument)));
}
return uuid;
}

Datei anzeigen

@ -21,7 +21,7 @@ package com.sk89q.worldedit.extent.clipboard.io;
import static com.google.common.base.Preconditions.checkNotNull;
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
import com.boydti.fawe.config.Caption;
import com.boydti.fawe.config.Settings;
import com.boydti.fawe.object.clipboard.LazyClipboardHolder;
import com.boydti.fawe.object.clipboard.MultiClipboardHolder;
@ -170,7 +170,7 @@ public class ClipboardFormats {
LocalConfiguration config = worldEdit.getConfiguration();
if (input.startsWith("url:")) {
if (!player.hasPermission("worldedit.schematic.load.web")) {
if (message) player.print(TranslatableComponent.of("fawe.error.no.perm", "worldedit.schematic.load.web"));
if (message) player.print(Caption.of("fawe.error.no.perm", "worldedit.schematic.load.web"));
return null;
}
URL base = new URL(Settings.IMP.WEB.URL);
@ -178,19 +178,19 @@ public class ClipboardFormats {
}
if (input.startsWith("http")) {
if (!player.hasPermission("worldedit.schematic.load.asset")) {
if (message) player.print(TranslatableComponent.of("fawe.error.no.perm", "worldedit.schematic.load.asset"));
if (message) player.print(Caption.of("fawe.error.no.perm", "worldedit.schematic.load.asset"));
return null;
}
URL url = new URL(input);
URL webInterface = new URL(Settings.IMP.WEB.ASSETS);
if (!url.getHost().equalsIgnoreCase(webInterface.getHost())) {
if (message) player.print(TranslatableComponent.of("fawe.error.web.unauthorized", url));
if (message) player.print(Caption.of("fawe.error.web.unauthorized", url));
return null;
}
return loadAllFromUrl(url);
} else {
if (Settings.IMP.PATHS.PER_PLAYER_SCHEMATICS && Pattern.compile("[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}").matcher(input).find() && !player.hasPermission("worldedit.schematic.load.other")) {
player.print(TranslatableComponent.of("fawe.error.no.perm", "worldedit.schematic.load.other"));
player.print(Caption.of("fawe.error.no.perm", "worldedit.schematic.load.other"));
return null;
}
File working = worldEdit.getWorkingDirectoryFile(config.saveDir);
@ -210,7 +210,7 @@ public class ClipboardFormats {
}
} else {
if (Settings.IMP.PATHS.PER_PLAYER_SCHEMATICS && Pattern.compile("[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}").matcher(input).find() && !player.hasPermission("worldedit.schematic.load.other")) {
if (message) player.print(TranslatableComponent.of("fawe.error.no.perm", "worldedit.schematic.load.other"));
if (message) player.print(Caption.of("fawe.error.no.perm", "worldedit.schematic.load.other"));
return null;
}
if (format == null && input.matches(".*\\.[\\w].*")) {
@ -232,12 +232,12 @@ public class ClipboardFormats {
if (format == null && f.isFile()) {
format = findByFile(f);
if (format == null) {
player.print(TranslatableComponent.of("fawe.worldedit.clipboard.clipboard.invalid.format" , f.getName()));
player.print(Caption.of("fawe.worldedit.clipboard.clipboard.invalid.format" , f.getName()));
return null;
}
}
if (!f.exists()) {
if (message) player.print(TranslatableComponent.of("fawe.error.schematic.not.found" , input));
if (message) player.print(Caption.of("fawe.error.schematic.not.found" , input));
return null;
}
if (!f.isDirectory()) {
@ -247,7 +247,7 @@ public class ClipboardFormats {
}
URIClipboardHolder[] clipboards = loadAllFromDirectory(f);
if (clipboards.length < 1) {
if (message) player.print(TranslatableComponent.of("fawe.error.schematic.not.found" , input));
if (message) player.print(Caption.of("fawe.error.schematic.not.found" , input));
return null;
}
return new MultiClipboardHolder(f.toURI(), clipboards);

Datei anzeigen

@ -1,141 +0,0 @@
//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by Fernflower decompiler)
//
package com.sk89q.worldedit.util.formatting.text;
import com.sk89q.worldedit.util.formatting.text.TranslatableComponentImpl.BuilderImpl;
import com.sk89q.worldedit.util.formatting.text.format.TextColor;
import com.sk89q.worldedit.util.formatting.text.format.TextDecoration;
import org.jetbrains.annotations.Nullable;
import javax.annotation.Nonnull;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Objects;
import java.util.Set;
import java.util.function.Consumer;
import java.util.stream.Collectors;
public interface TranslatableComponent extends BuildableComponent<TranslatableComponent, TranslatableComponent.Builder>, ScopedComponent<TranslatableComponent> {
@Nonnull
static TranslatableComponent.Builder builder() {
return new BuilderImpl();
}
@Nonnull
static TranslatableComponent.Builder builder(@Nonnull final String key) {
return builder().key(key);
}
@Nonnull
static TranslatableComponent of(@Nonnull final String key) {
return (TranslatableComponent)builder(key).build();
}
@Nonnull
static TranslatableComponent of(@Nonnull final String key, @Nullable final TextColor color) {
return (TranslatableComponent)((TranslatableComponent.Builder)builder(key).color(color)).build();
}
@Nonnull
static TranslatableComponent of(@Nonnull final String key, @Nullable final TextColor color, @Nonnull final TextDecoration... decorations) {
Set<TextDecoration> activeDecorations = new HashSet(decorations.length);
Collections.addAll(activeDecorations, decorations);
return of(key, color, (Set)activeDecorations);
}
@Nonnull
static TranslatableComponent of(@Nonnull final String key, @Nullable final TextColor color, @Nonnull final Set<TextDecoration> decorations) {
return (TranslatableComponent)((TranslatableComponent.Builder)((TranslatableComponent.Builder)builder(key).color(color)).decorations(decorations, true)).build();
}
@Nonnull
static TranslatableComponent of(@Nonnull final String key, final Component... args) {
return of(key, (TextColor)null, (Component[])args);
}
@Nonnull
static TranslatableComponent of(@Nonnull final String key, @Nullable final TextColor color, final Component... args) {
return of(key, color, Collections.emptySet(), args);
}
@Nonnull
static TranslatableComponent of(@Nonnull final String key, @Nullable final TextColor color, @Nonnull final Set<TextDecoration> decorations, final Component... args) {
return of(key, color, decorations, Arrays.asList(args));
}
@Nonnull
static TranslatableComponent of(@Nonnull final String key, @Nonnull final List<? extends Component> args) {
return of(key, (TextColor)null, (List)args);
}
static TranslatableComponent of(@Nonnull final String key, @Nullable final TextColor color, @Nonnull final List<? extends Component> args) {
return of(key, color, Collections.emptySet(), args);
}
@Nonnull
static TranslatableComponent of(@Nonnull final String key, @Nullable final TextColor color, @Nonnull final Set<TextDecoration> decorations, @Nonnull final List<? extends Component> args) {
return (TranslatableComponent)((TranslatableComponent.Builder)((TranslatableComponent.Builder)builder(key).color(color)).decorations(decorations, true)).args(args).build();
}
@Nonnull
static TranslatableComponent make(@Nonnull final Consumer<? super TranslatableComponent.Builder> consumer) {
TranslatableComponent.Builder builder = builder();
consumer.accept(builder);
return (TranslatableComponent)builder.build();
}
@Nonnull
static TranslatableComponent make(@Nonnull final String key, @Nonnull final Consumer<? super TranslatableComponent.Builder> consumer) {
TranslatableComponent.Builder builder = builder(key);
consumer.accept(builder);
return (TranslatableComponent)builder.build();
}
@Nonnull
static TranslatableComponent make(@Nonnull final String key, @Nonnull final List<? extends Component> args, @Nonnull final Consumer<? super TranslatableComponent.Builder> consumer) {
TranslatableComponent.Builder builder = builder(key).args(args);
consumer.accept(builder);
return (TranslatableComponent)builder.build();
}
@Nonnull
String key();
@Nonnull
TranslatableComponent key(@Nonnull final String key);
@Nonnull
List<Component> args();
@Nonnull
TranslatableComponent args(@Nonnull final List<? extends Component> args);
public interface Builder extends ComponentBuilder<TranslatableComponent, TranslatableComponent.Builder> {
@Nonnull
TranslatableComponent.Builder key(@Nonnull final String key);
@Nonnull
TranslatableComponent.Builder args(final ComponentBuilder... args);
@Nonnull
TranslatableComponent.Builder args(final Component... args);
@Nonnull
TranslatableComponent.Builder args(@Nonnull final List<? extends Component> args);
}
// FAWE added
//TODO REMOVE THIS BECAUSE IT'S SO STUPID!
@Nonnull
public static TranslatableComponent of(@Nonnull final String key, final Object... args) {
List<Component> components = Arrays.stream(args)
.map(arg -> arg instanceof Component ? (Component) arg : TextComponent.of(Objects.toString(arg)))
.collect(Collectors.toList());
return of(key, components);
}
}