Move Fawe commands to Captions

Dieser Commit ist enthalten in:
NotMyFault 2021-05-24 11:36:37 +02:00
Ursprung d2dee87ab9
Commit cbe5cd4eb3
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 158F5701A6AAD00C
16 geänderte Dateien mit 24 neuen und 37 gelöschten Zeilen

Datei anzeigen

@ -8,8 +8,6 @@ import com.boydti.fawe.util.MathMan;
import com.sk89q.worldedit.extension.input.InputParseException;
import com.sk89q.worldedit.extension.platform.binding.ProvideBindings;
import com.sk89q.worldedit.util.formatting.text.TextComponent;
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
import org.w3c.dom.Text;
import java.awt.Graphics2D;
import java.awt.RenderingHints;

Datei anzeigen

@ -206,7 +206,7 @@ public class GeneralCommands {
session.setTimeout(limit);
Component component = TextComponent.empty().append(Caption.of("worldedit.timeout.set", TextComponent.of(limit)));
if (limit != config.calculationTimeout) {
component.append(TranslatableComponent.of("worldedit.timeout.return-to-default"));
component.append(Caption.of("worldedit.timeout.return-to-default"));
}
actor.print(component);
}
@ -323,7 +323,7 @@ public class GeneralCommands {
@Arg(desc = "The new draw selection state", def = "")
Boolean drawSelection) throws WorldEditException {
if (!WorldEdit.getInstance().getConfiguration().serverSideCUI) {
throw new AuthorizationException(TranslatableComponent.of("worldedit.error.disabled"));
throw new AuthorizationException(Caption.of("worldedit.error.disabled"));
}
boolean useServerCui = session.shouldUseServerCUI();
if (drawSelection != null && drawSelection == useServerCui) {
@ -499,7 +499,7 @@ public class GeneralCommands {
// TODO NOT IMPLEMENTED convert this to an ArgumentConverter
if (arguments.isEmpty()) {
session.setTextureUtil(null);
player.print(TranslatableComponent.of("fawe.worldedit.general.texture.disabled"));
player.print(Caption.of("fawe.worldedit.general.texture.disabled"));
} else {
String arg = arguments.get(0);
String argLower = arg.toLowerCase(Locale.ROOT);
@ -512,7 +512,7 @@ public class GeneralCommands {
int min = Integer.parseInt(arguments.get(0));
int max = Integer.parseInt(arguments.get(1));
if (min < 0 || max > 100) {
throw new InputParseException(TranslatableComponent.of("fawe.error.too-simple"));
throw new InputParseException(Caption.of("fawe.error.too-simple"));
}
if (min != 0 || max != 100) {
util = new CleanTextureUtil(util, min, max);
@ -566,9 +566,9 @@ public class GeneralCommands {
public void gsmask(Player player, LocalSession session, EditSession editSession, @Arg(desc = "The mask to set", def = "") Mask maskOpt) throws WorldEditException {
session.setSourceMask(maskOpt);
if (maskOpt == null) {
player.print(TranslatableComponent.of("fawe.worldedit.general.source.mask.disabled"));
player.print(Caption.of("fawe.worldedit.general.source.mask.disabled"));
} else {
player.print(TranslatableComponent.of("fawe.worldedit.general.source.mask"));
player.print(Caption.of("fawe.worldedit.general.source.mask"));
}
}
@ -582,9 +582,9 @@ public class GeneralCommands {
public void gtransform(Player player, EditSession editSession, LocalSession session, ResettableExtent transform) throws WorldEditException {
session.setTransform(transform);
if (transform == null) {
player.print(TranslatableComponent.of("fawe.worldedit.general.transform.disabled"));
player.print(Caption.of("fawe.worldedit.general.transform.disabled"));
} else {
player.print(TranslatableComponent.of("fawe.worldedit.general.transform"));
player.print(Caption.of("fawe.worldedit.general.transform"));
}
}
@ -596,9 +596,9 @@ public class GeneralCommands {
@CommandPermissions("fawe.tips")
public void tips(Player player, LocalSession session) throws WorldEditException {
if (player.togglePermission("fawe.tips")) {
player.print(TranslatableComponent.of("fawe.info.worldedit.toggle.tips.on"));
player.print(Caption.of("fawe.info.worldedit.toggle.tips.on"));
} else {
player.print(TranslatableComponent.of("fawe.info.worldedit.toggle.tips.off"));
player.print(Caption.of("fawe.info.worldedit.toggle.tips.off"));
}
}
}

Datei anzeigen

@ -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;
@ -59,24 +60,24 @@ import static org.enginehub.piston.part.CommandParts.arg;
@CommandContainer(superTypes = CommandPermissionsConditionGenerator.Registration.class)
public class PaintBrushCommands {
private static final CommandArgument REGION_FACTORY = arg(TranslatableComponent.of("shape") , TranslatableComponent.of("worldedit.brush.paint.shape"))
private static final CommandArgument REGION_FACTORY = arg(TranslatableComponent.of("shape") , Caption.of("worldedit.brush.paint.shape"))
.defaultsTo(ImmutableList.of())
.ofTypes(ImmutableList.of(Key.of(RegionFactory.class)))
.build();
private static final CommandArgument RADIUS = arg(TranslatableComponent.of("radius") , TranslatableComponent.of("worldedit.brush.paint.size"))
private static final CommandArgument RADIUS = arg(TranslatableComponent.of("radius") , Caption.of("worldedit.brush.paint.size"))
.defaultsTo(ImmutableList.of("5"))
.ofTypes(ImmutableList.of(Key.of(double.class)))
.build();
private static final CommandArgument DENSITY = arg(TranslatableComponent.of("density") , TranslatableComponent.of("worldedit.brush.paint.density"))
private static final CommandArgument DENSITY = arg(TranslatableComponent.of("density") , Caption.of("worldedit.brush.paint.density"))
.defaultsTo(ImmutableList.of("20"))
.ofTypes(ImmutableList.of(Key.of(double.class)))
.build();
public static void register(CommandManagerService service, CommandManager commandManager, CommandRegistrationHandler registration) {
commandManager.register("paint", builder -> {
builder.description(TranslatableComponent.of("worldedit.brush.paint.description"));
builder.description(Caption.of("worldedit.brush.paint.description"));
builder.action(org.enginehub.piston.Command.Action.NULL_ACTION);
CommandManager manager = service.newCommandManager();
@ -89,7 +90,7 @@ public class PaintBrushCommands {
builder.condition(new PermissionCondition(ImmutableSet.of("worldedit.brush.paint")));
builder.addParts(REGION_FACTORY, RADIUS, DENSITY);
builder.addPart(SubCommandPart.builder(TranslatableComponent.of("type") , TranslatableComponent.of("worldedit.brush.paint.type"))
builder.addPart(SubCommandPart.builder(TranslatableComponent.of("type") , Caption.of("worldedit.brush.paint.type"))
.withCommands(manager.getAllCommands().collect(Collectors.toList()))
.required()
.build());
@ -129,7 +130,7 @@ public class PaintBrushCommands {
@Direction(includeDiagonals = true)
com.sk89q.worldedit.util.Direction direction) throws WorldEditException {
player.print(TextComponent.builder().append("WARNING: ")
.append(TranslatableComponent.of("worldedit.brush.paint.item.warning")).build());
.append(Caption.of("worldedit.brush.paint.item.warning")).build());
setPaintBrush(parameters, player, localSession, new ItemUseFactory(item, direction));
}

Datei anzeigen

@ -63,7 +63,6 @@ import com.sk89q.worldedit.regions.Regions;
import com.sk89q.worldedit.util.Location;
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.RegenOptions;
import com.sk89q.worldedit.world.World;
import com.sk89q.worldedit.world.biome.BiomeType;
@ -467,10 +466,10 @@ public class RegionCommands {
public void wer(Player player) throws WorldEditException {
final Region region = player.getLargestRegion();
if (region == null) {
player.print(TranslatableComponent.of("fawe.error.no.region"));
player.print(Caption.of("fawe.error.no.region"));
} else {
player.setSelection(region);
player.print(TranslatableComponent.of("fawe.info.set.region"));
player.print(Caption.of("fawe.info.set.region"));
}
}

Datei anzeigen

@ -302,7 +302,7 @@ public class SchematicCommands {
} catch (IllegalArgumentException e) {
actor.print(Caption.of("worldedit.schematic.unknown-filename", TextComponent.of(filename)));
} catch (URISyntaxException | IOException e) {
actor.print(TranslatableComponent.of("worldedit.schematic.file-not-exist", TextComponent.of(e.getMessage())));
actor.print(Caption.of("worldedit.schematic.file-not-exist", TextComponent.of(e.getMessage())));
LOGGER.warn("Failed to load a saved clipboard", e);
} finally {
if (in != null) {
@ -360,7 +360,7 @@ public class SchematicCommands {
boolean overwrite = f.exists();
if (overwrite) {
if (!actor.hasPermission("worldedit.schematic.delete")) {
throw new StopExecutionException(TranslatableComponent.of("worldedit.schematic.already-exists"));
throw new StopExecutionException(Caption.of("worldedit.schematic.already-exists"));
}
if (other) {
if (!actor.hasPermission("worldedit.schematic.delete.other")) {
@ -390,7 +390,7 @@ public class SchematicCommands {
.registerWithSupervisor(worldEdit.getSupervisor(), "Saving schematic " + filename)
.sendMessageAfterDelay(Caption.of("worldedit.schematic.save.saving"))
.onSuccess(filename + " saved" + (overwrite ? " (overwriting previous file)." : "."), null)
.onFailure(TranslatableComponent.of("worldedit.schematic.failed-to-save"), worldEdit.getPlatformManager().getPlatformCommandManager().getExceptionConverter())
.onFailure(Caption.of("worldedit.schematic.failed-to-save"), worldEdit.getPlatformManager().getPlatformCommandManager().getExceptionConverter())
.buildAndExec(worldEdit.getExecutorService());
}

Datei anzeigen

@ -33,7 +33,6 @@ import com.sk89q.worldedit.registry.state.Property;
import com.sk89q.worldedit.util.Direction;
import com.sk89q.worldedit.util.Location;
import com.sk89q.worldedit.util.formatting.text.TextComponent;
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
import com.sk89q.worldedit.world.World;
import com.sk89q.worldedit.world.block.BlockState;

Datei anzeigen

@ -61,7 +61,6 @@ import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.math.Vector3;
import com.sk89q.worldedit.session.request.Request;
import com.sk89q.worldedit.util.Location;
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
import com.sk89q.worldedit.world.World;
import com.sk89q.worldedit.world.block.BlockType;

Datei anzeigen

@ -30,7 +30,6 @@ import com.sk89q.worldedit.internal.util.LogManagerCompat;
import com.sk89q.worldedit.util.formatting.component.ErrorFormat;
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.task.FutureForwardingTask;
import com.sk89q.worldedit.util.task.Supervisor;
@ -164,7 +163,7 @@ public final class AsyncCommandBuilder<T> {
if (message == null) {
if (Strings.isNullOrEmpty(converted.getMessage())) {
message = TranslatableComponent.of("worldedit.error.unknown");
message = Caption.of("worldedit.error.unknown");
} else {
message = converted.getRichMessage();
}

Datei anzeigen

@ -50,7 +50,6 @@ import com.sk89q.worldedit.util.HandSide;
import com.sk89q.worldedit.util.Location;
import com.sk89q.worldedit.util.TargetBlock;
import com.sk89q.worldedit.util.auth.AuthorizationException;
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.BlockCategories;

Datei anzeigen

@ -18,7 +18,6 @@ import com.sk89q.worldedit.internal.annotation.AllowedRegion;
import com.sk89q.worldedit.internal.annotation.Selection;
import com.sk89q.worldedit.regions.Region;
import com.sk89q.worldedit.session.request.Request;
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
import com.sk89q.worldedit.world.World;
import org.enginehub.piston.inject.InjectedValueAccess;
import org.enginehub.piston.inject.InjectedValueStore;
@ -42,7 +41,7 @@ public class ProvideBindings extends Bindings {
if (actor.isPlayer()) {
return (Player) actor;
}
throw new InputParseException(TranslatableComponent.of("worldedit.command.player-only"));
throw new InputParseException(Caption.of("worldedit.command.player-only"));
}
@Binding

Datei anzeigen

@ -25,7 +25,6 @@ import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.math.Vector3;
import com.sk89q.worldedit.math.transform.Identity;
import com.sk89q.worldedit.math.transform.Transform;
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
import com.sk89q.worldedit.world.World;
import java.util.ArrayList;

Datei anzeigen

@ -35,7 +35,6 @@ import com.sk89q.worldedit.regions.polyhedron.Triangle;
import com.sk89q.worldedit.regions.selector.limit.SelectorLimits;
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 java.util.ArrayList;

Datei anzeigen

@ -33,7 +33,6 @@ import com.sk89q.worldedit.regions.RegionSelector;
import com.sk89q.worldedit.regions.selector.limit.SelectorLimits;
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.world.World;

Datei anzeigen

@ -37,7 +37,6 @@ import com.sk89q.worldedit.regions.RegionSelector;
import com.sk89q.worldedit.regions.selector.limit.SelectorLimits;
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.world.World;

Datei anzeigen

@ -34,7 +34,6 @@ import com.sk89q.worldedit.regions.RegionSelector;
import com.sk89q.worldedit.regions.selector.limit.SelectorLimits;
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.world.World;

Datei anzeigen

@ -35,7 +35,6 @@ import com.sk89q.worldedit.regions.RegionSelector;
import com.sk89q.worldedit.regions.selector.limit.SelectorLimits;
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 java.util.Collections;