geforkt von Mirrors/FastAsyncWorldEdit
Merge pull request #257 from IntellectualSites/i18n-merge
FAWE branch for i18n
Dieser Commit ist enthalten in:
Commit
38d1e79fcb
@ -53,4 +53,5 @@ dependencies {
|
||||
// implementation("net.minecraftforge.gradle:ForgeGradle:3.0.143")
|
||||
// implementation("net.fabricmc:fabric-loom:$loomVersion")
|
||||
// implementation("net.fabricmc:sponge-mixin:$mixinVersion")
|
||||
implementation("gradle.plugin.com.mendhak.gradlecrowdin:plugin:0.1.0")
|
||||
}
|
@ -1,6 +1,7 @@
|
||||
package com.boydti.fawe.bukkit;
|
||||
|
||||
import com.boydti.fawe.config.BBC;
|
||||
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
|
||||
import com.boydti.fawe.object.FaweCommand;
|
||||
import com.sk89q.worldedit.bukkit.BukkitAdapter;
|
||||
import com.sk89q.worldedit.bukkit.BukkitBlockCommandSender;
|
||||
|
@ -21,6 +21,8 @@ package com.sk89q.worldedit.bukkit;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
|
||||
import com.sk89q.worldedit.extension.platform.AbstractNonPlayerActor;
|
||||
import com.sk89q.worldedit.extension.platform.Locatable;
|
||||
import com.sk89q.worldedit.extent.Extent;
|
||||
@ -33,10 +35,13 @@ import com.sk89q.worldedit.util.formatting.text.TextComponent;
|
||||
import com.sk89q.worldedit.util.formatting.text.adapter.bukkit.TextAdapter;
|
||||
import com.sk89q.worldedit.util.formatting.text.format.TextColor;
|
||||
import java.util.UUID;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.command.BlockCommandSender;
|
||||
|
||||
import java.util.Locale;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
@ -72,7 +77,7 @@ public class BukkitBlockCommandSender extends AbstractNonPlayerActor implements
|
||||
@Override
|
||||
public void print(String msg) {
|
||||
for (String part : msg.split("\n")) {
|
||||
print(TextComponent.of(part, TextColor.LIGHT_PURPLE));
|
||||
print(TextComponent.of(part, TextColor.GRAY));
|
||||
}
|
||||
}
|
||||
|
||||
@ -92,7 +97,12 @@ public class BukkitBlockCommandSender extends AbstractNonPlayerActor implements
|
||||
|
||||
@Override
|
||||
public void print(Component component) {
|
||||
TextAdapter.sendComponent(sender, WorldEditText.format(component));
|
||||
TextAdapter.sendComponent(sender, WorldEditText.format(component, getLocale()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Locale getLocale() {
|
||||
return WorldEdit.getInstance().getConfiguration().defaultLocale;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -23,6 +23,7 @@ import static com.google.common.base.Preconditions.checkNotNull;
|
||||
import static com.sk89q.worldedit.util.formatting.WorldEditText.reduceToText;
|
||||
|
||||
import com.sk89q.bukkit.util.CommandInspector;
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
import com.sk89q.worldedit.extension.platform.Actor;
|
||||
import java.util.Optional;
|
||||
import org.bukkit.command.Command;
|
||||
@ -32,6 +33,8 @@ import org.enginehub.piston.inject.InjectedValueStore;
|
||||
import org.enginehub.piston.inject.Key;
|
||||
import org.enginehub.piston.inject.MapBackedValueStore;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
import java.util.Locale;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
class BukkitCommandInspector implements CommandInspector {
|
||||
@ -51,7 +54,7 @@ class BukkitCommandInspector implements CommandInspector {
|
||||
public String getShortText(Command command) {
|
||||
Optional<org.enginehub.piston.Command> mapping = dispatcher.getCommand(command.getName());
|
||||
if (mapping.isPresent()) {
|
||||
return reduceToText(mapping.get().getDescription());
|
||||
return reduceToText(mapping.get().getDescription(), WorldEdit.getInstance().getConfiguration().defaultLocale);
|
||||
} else {
|
||||
logger.warn("BukkitCommandInspector doesn't know how about the command '" + command + "'");
|
||||
return "Help text not available";
|
||||
@ -62,7 +65,7 @@ class BukkitCommandInspector implements CommandInspector {
|
||||
public String getFullText(Command command) {
|
||||
Optional<org.enginehub.piston.Command> mapping = dispatcher.getCommand(command.getName());
|
||||
if (mapping.isPresent()) {
|
||||
return reduceToText(mapping.get().getFullHelp());
|
||||
return reduceToText(mapping.get().getFullHelp(), WorldEdit.getInstance().getConfiguration().defaultLocale);
|
||||
} else {
|
||||
logger.warn("BukkitCommandInspector doesn't know how about the command '" + command + "'");
|
||||
return "Help text not available";
|
||||
|
@ -22,6 +22,8 @@ package com.sk89q.worldedit.bukkit;
|
||||
import static com.google.common.base.Preconditions.checkArgument;
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
|
||||
import com.sk89q.worldedit.extension.platform.AbstractNonPlayerActor;
|
||||
import com.sk89q.worldedit.session.SessionKey;
|
||||
import com.sk89q.worldedit.util.auth.AuthorizationException;
|
||||
@ -29,6 +31,8 @@ import com.sk89q.worldedit.util.formatting.WorldEditText;
|
||||
import com.sk89q.worldedit.util.formatting.text.Component;
|
||||
import com.sk89q.worldedit.util.formatting.text.adapter.bukkit.TextAdapter;
|
||||
import java.util.UUID;
|
||||
|
||||
import java.util.Locale;
|
||||
import javax.annotation.Nullable;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Entity;
|
||||
@ -93,7 +97,7 @@ public class BukkitCommandSender extends AbstractNonPlayerActor {
|
||||
|
||||
@Override
|
||||
public void print(Component component) {
|
||||
TextAdapter.sendComponent(sender, WorldEditText.format(component));
|
||||
TextAdapter.sendComponent(sender, WorldEditText.format(component, getLocale()));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -113,6 +117,11 @@ public class BukkitCommandSender extends AbstractNonPlayerActor {
|
||||
public void checkPermission(String permission) throws AuthorizationException {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Locale getLocale() {
|
||||
return WorldEdit.getInstance().getConfiguration().defaultLocale;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SessionKey getSessionKey() {
|
||||
return new SessionKey() {
|
||||
|
@ -21,6 +21,8 @@ package com.sk89q.worldedit.bukkit;
|
||||
|
||||
import com.boydti.fawe.Fawe;
|
||||
import com.boydti.fawe.bukkit.FaweBukkit;
|
||||
import com.boydti.fawe.config.BBC;
|
||||
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
|
||||
import com.boydti.fawe.config.Settings;
|
||||
import com.boydti.fawe.object.RunnableVal;
|
||||
import com.boydti.fawe.util.TaskManager;
|
||||
@ -40,11 +42,17 @@ import com.sk89q.worldedit.session.SessionKey;
|
||||
import com.sk89q.worldedit.util.HandSide;
|
||||
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.adapter.bukkit.TextAdapter;
|
||||
import com.sk89q.worldedit.util.formatting.text.serializer.gson.GsonComponentSerializer;
|
||||
import com.sk89q.worldedit.util.formatting.text.serializer.legacy.LegacyComponentSerializer;
|
||||
import com.sk89q.worldedit.world.World;
|
||||
import com.sk89q.worldedit.world.block.BaseBlock;
|
||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import com.sk89q.worldedit.world.block.BlockTypes;
|
||||
import com.sk89q.worldedit.world.gamemode.GameMode;
|
||||
@ -167,28 +175,25 @@ public class BukkitPlayer extends AbstractPlayerActor {
|
||||
|
||||
@Override
|
||||
public void print(String msg) {
|
||||
for (String part : msg.split("\n")) {
|
||||
player.sendMessage("\u00A7d" + part);
|
||||
}
|
||||
print(LegacyComponentSerializer.legacy().deserialize("&7" + msg, '&'));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void printDebug(String msg) {
|
||||
for (String part : msg.split("\n")) {
|
||||
player.sendMessage("\u00A77" + part);
|
||||
}
|
||||
print(LegacyComponentSerializer.legacy().deserialize("&3" + msg, '&'));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void printError(String msg) {
|
||||
for (String part : msg.split("\n")) {
|
||||
player.sendMessage("\u00A7c" + part);
|
||||
}
|
||||
print(LegacyComponentSerializer.legacy().deserialize("&c" + msg, '&'));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void print(Component component) {
|
||||
TextAdapter.sendComponent(player, WorldEditText.format(component));
|
||||
Component prefix = TranslatableComponent.of("fawe.prefix");
|
||||
component = TextComponent.builder().append(prefix).append(component).build();
|
||||
component = BBC.color(component, getLocale());
|
||||
TextAdapter.sendComponent(player, component);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -292,6 +297,11 @@ public class BukkitPlayer extends AbstractPlayerActor {
|
||||
return player.teleport(BukkitAdapter.adapt(location));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Locale getLocale() {
|
||||
return Locale.forLanguageTag(player.getLocale().replace('_', '-'));
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public <T> T getFacet(Class<? extends T> cls) {
|
||||
@ -361,10 +371,10 @@ public class BukkitPlayer extends AbstractPlayerActor {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendTitle(String title, String sub) {
|
||||
player.sendTitle(ChatColor.GOLD + title, ChatColor.GOLD + sub, 0, 70, 20);
|
||||
Bukkit.getServer().dispatchCommand(player, "title " + getName() + " subtitle [{\"text\":\"" + sub + "\",\"color\":\"gold\"}]");
|
||||
Bukkit.getServer().dispatchCommand(player, "title " + getName() + " title [{\"text\":\"" + title + "\",\"color\":\"gold\"}]");
|
||||
public void sendTitle(Component title, Component sub) {
|
||||
String titleStr = WorldEditText.reduceToText(title, getLocale());
|
||||
String subStr = WorldEditText.reduceToText(sub, getLocale());
|
||||
player.sendTitle(titleStr, subStr, 0, 70, 20);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -24,6 +24,7 @@ import static com.sk89q.worldedit.util.formatting.WorldEditText.reduceToText;
|
||||
import com.sk89q.bukkit.util.CommandInfo;
|
||||
import com.sk89q.bukkit.util.CommandRegistration;
|
||||
import com.sk89q.worldedit.LocalConfiguration;
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
import com.sk89q.worldedit.command.util.PermissionCondition;
|
||||
import com.sk89q.worldedit.entity.Player;
|
||||
import com.sk89q.worldedit.extension.platform.Actor;
|
||||
@ -38,6 +39,7 @@ import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.EnumMap;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
@ -167,8 +169,9 @@ public class BukkitServerInterface implements MultiUserPlatform {
|
||||
Stream.of(command.getName()),
|
||||
command.getAliases().stream()
|
||||
).toArray(String[]::new);
|
||||
return new CommandInfo(reduceToText(command.getUsage()),
|
||||
reduceToText(command.getDescription()), aliases,
|
||||
// TODO Handle localisation correctly
|
||||
return new CommandInfo(reduceToText(command.getUsage(), WorldEdit.getInstance().getConfiguration().defaultLocale),
|
||||
reduceToText(command.getDescription(), WorldEdit.getInstance().getConfiguration().defaultLocale), aliases,
|
||||
inspector, permissionsArray);
|
||||
}).collect(Collectors.toList()));
|
||||
}
|
||||
|
@ -21,6 +21,7 @@ package com.sk89q.worldedit.cli;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
import com.sk89q.worldedit.extension.platform.Actor;
|
||||
import com.sk89q.worldedit.internal.cui.CUIEvent;
|
||||
import com.sk89q.worldedit.session.SessionKey;
|
||||
@ -32,6 +33,7 @@ import com.sk89q.worldedit.util.formatting.text.serializer.plain.PlainComponentS
|
||||
import org.slf4j.Logger;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Locale;
|
||||
import java.util.UUID;
|
||||
|
||||
public class CLICommandSender implements Actor {
|
||||
@ -97,7 +99,7 @@ public class CLICommandSender implements Actor {
|
||||
|
||||
@Override
|
||||
public void print(Component component) {
|
||||
print(PlainComponentSerializer.INSTANCE.serialize(WorldEditText.format(component)));
|
||||
print(PlainComponentSerializer.INSTANCE.serialize(WorldEditText.format(component, getLocale())));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -138,6 +140,11 @@ public class CLICommandSender implements Actor {
|
||||
public void dispatchCUIEvent(CUIEvent event) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Locale getLocale() {
|
||||
return WorldEdit.getInstance().getConfiguration().defaultLocale;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SessionKey getSessionKey() {
|
||||
return new SessionKey() {
|
||||
|
@ -32,6 +32,7 @@ import com.sk89q.worldedit.extent.clipboard.io.ClipboardFormat;
|
||||
import com.sk89q.worldedit.extent.clipboard.io.ClipboardFormats;
|
||||
import com.sk89q.worldedit.extent.clipboard.io.ClipboardReader;
|
||||
import com.sk89q.worldedit.registry.state.Property;
|
||||
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
|
||||
import com.sk89q.worldedit.world.biome.BiomeType;
|
||||
import com.sk89q.worldedit.world.block.BlockCategory;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
@ -237,13 +238,13 @@ public class CLIWorldEdit {
|
||||
while (scanner.hasNextLine()) {
|
||||
String line = scanner.nextLine();
|
||||
if (line.equals("stop")) {
|
||||
commandSender.print("Stopping!");
|
||||
commandSender.printInfo(TranslatableComponent.of("worldedit.cli.stopping"));
|
||||
break;
|
||||
}
|
||||
CommandEvent event = new CommandEvent(commandSender, line);
|
||||
WorldEdit.getInstance().getEventBus().post(event);
|
||||
if (!event.isCancelled()) {
|
||||
commandSender.printError("Unknown command!");
|
||||
commandSender.printError(TranslatableComponent.of("worldedit.cli.unknown-command"));
|
||||
} else {
|
||||
saveAllWorlds(false);
|
||||
}
|
||||
|
@ -1,11 +1,14 @@
|
||||
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
|
||||
import org.gradle.plugins.ide.idea.model.IdeaModel
|
||||
import com.mendhak.gradlecrowdin.DownloadTranslationsTask
|
||||
import com.mendhak.gradlecrowdin.UploadSourceFileTask
|
||||
|
||||
plugins {
|
||||
id("java-library")
|
||||
id("net.ltgt.apt-eclipse")
|
||||
id("net.ltgt.apt-idea")
|
||||
id("antlr")
|
||||
id("com.mendhak.gradlecrowdin")
|
||||
}
|
||||
|
||||
repositories {
|
||||
@ -101,3 +104,28 @@ tasks.named<ShadowJar>("shadowJar") {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
val crowdinApiKey = "crowdin_apikey"
|
||||
|
||||
if (project.hasProperty(crowdinApiKey)) {
|
||||
tasks.named<UploadSourceFileTask>("crowdinUpload") {
|
||||
apiKey = "${project.property(crowdinApiKey)}"
|
||||
projectId = "worldedit-core"
|
||||
files = arrayOf(
|
||||
object {
|
||||
var name = "strings.json"
|
||||
var source = "${file("src/main/resources/lang/strings.json")}"
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
tasks.named<DownloadTranslationsTask>("crowdinDownload") {
|
||||
apiKey = "${project.property(crowdinApiKey)}"
|
||||
destination = "${file("build/resources/main/lang")}"
|
||||
projectId = "worldedit-core"
|
||||
}
|
||||
|
||||
tasks.named("classes").configure {
|
||||
dependsOn("crowdinDownload")
|
||||
}
|
||||
}
|
||||
|
@ -7,9 +7,10 @@ import com.sk89q.worldedit.util.formatting.text.TranslatableComponent
|
||||
import com.sk89q.worldedit.util.formatting.text.event.ClickEvent
|
||||
import com.sk89q.worldedit.util.formatting.text.format.TextDecoration
|
||||
import org.enginehub.piston.util.TextHelper
|
||||
import java.util.Locale
|
||||
|
||||
fun reduceToRst(component: Component): String {
|
||||
val formatted = WorldEditText.format(component)
|
||||
val formatted = WorldEditText.format(component, Locale.US)
|
||||
return formatAsRst(formatted).toString()
|
||||
}
|
||||
|
||||
|
@ -2,6 +2,7 @@ package com.boydti.fawe;
|
||||
|
||||
import com.boydti.fawe.beta.implementation.queue.QueueHandler;
|
||||
import com.boydti.fawe.config.BBC;
|
||||
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
|
||||
import com.boydti.fawe.config.Settings;
|
||||
import com.boydti.fawe.object.brush.visualization.VisualQueue;
|
||||
import com.boydti.fawe.regions.general.integrations.plotquared.PlotSquaredFeature;
|
||||
|
@ -2,6 +2,8 @@ package com.boydti.fawe;
|
||||
|
||||
import com.boydti.fawe.beta.IQueueExtent;
|
||||
import com.boydti.fawe.config.BBC;
|
||||
import com.sk89q.worldedit.util.formatting.text.Component;
|
||||
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
|
||||
import com.boydti.fawe.config.Settings;
|
||||
import com.boydti.fawe.object.RegionWrapper;
|
||||
import com.boydti.fawe.object.changeset.DiskStorageHistory;
|
||||
@ -232,7 +234,7 @@ public class FaweAPI {
|
||||
* @param reason
|
||||
* @see EditSession#getRegionExtent() To get the FaweExtent for an EditSession
|
||||
*/
|
||||
public static void cancelEdit(Extent extent, BBC reason) {
|
||||
public static void cancelEdit(Extent extent, Component reason) {
|
||||
try {
|
||||
WEManager.IMP.cancelEdit(extent, new FaweException(reason));
|
||||
} catch (WorldEditException ignore) {
|
||||
|
@ -5,6 +5,7 @@ import static org.slf4j.LoggerFactory.getLogger;
|
||||
|
||||
import com.boydti.fawe.beta.Trimable;
|
||||
import com.boydti.fawe.config.BBC;
|
||||
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
|
||||
import com.boydti.fawe.config.Settings;
|
||||
import com.boydti.fawe.object.collection.BitArray4096;
|
||||
import com.boydti.fawe.object.collection.CleanableThreadLocal;
|
||||
@ -199,15 +200,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(BBC.WORLDEDIT_CANCEL_REASON_MANUAL);
|
||||
public static final FaweException NO_REGION = new FaweException(BBC.WORLDEDIT_CANCEL_REASON_NO_REGION);
|
||||
public static final FaweException OUTSIDE_REGION = new FaweException(BBC.WORLDEDIT_CANCEL_REASON_OUTSIDE_REGION);
|
||||
public static final FaweException MAX_CHECKS = new FaweException(BBC.WORLDEDIT_CANCEL_REASON_MAX_CHECKS);
|
||||
public static final FaweException MAX_CHANGES = new FaweException(BBC.WORLDEDIT_CANCEL_REASON_MAX_CHANGES);
|
||||
public static final FaweException LOW_MEMORY = new FaweException(BBC.WORLDEDIT_CANCEL_REASON_LOW_MEMORY);
|
||||
public static final FaweException MAX_ENTITIES = new FaweException(BBC.WORLDEDIT_CANCEL_REASON_MAX_ENTITIES);
|
||||
public static final FaweException MAX_TILES = new FaweException(BBC.WORLDEDIT_CANCEL_REASON_MAX_TILES);
|
||||
public static final FaweException MAX_ITERATIONS = new FaweException(BBC.WORLDEDIT_CANCEL_REASON_MAX_ITERATIONS);
|
||||
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"));
|
||||
|
||||
/*
|
||||
thread cache
|
||||
|
@ -52,7 +52,7 @@ public class AnvilCommands {
|
||||
// boolean copy = false;
|
||||
// if (FaweAPI.getWorld(folder) != null) {
|
||||
// if (!force) {
|
||||
// BBC.WORLD_IS_LOADED.send(player);
|
||||
// player.print(TranslatableComponent.of("fawe.worldedit.anvil.world.is.loaded"))
|
||||
// return null;
|
||||
// }
|
||||
// copy = true;
|
||||
@ -80,7 +80,7 @@ public class AnvilCommands {
|
||||
// @Deprecated
|
||||
// public static <G, T extends MCAFilter<G>> T runWithSelection(Player player, EditSession editSession, Region selection, T filter) {
|
||||
// if (!(selection instanceof CuboidRegion)) {
|
||||
// BBC.NO_REGION.send(player);
|
||||
// player.print(TranslatableComponent.of("fawe.error.no.region"))
|
||||
// return null;
|
||||
// }
|
||||
// CuboidRegion cuboid = (CuboidRegion) selection;
|
||||
@ -131,7 +131,7 @@ public class AnvilCommands {
|
||||
// final FaweBlockMatcher matchTo = FaweBlockMatcher.setBlocks(worldEdit.getBlocks(player, to, true));
|
||||
// ReplaceSimpleFilter filter = new ReplaceSimpleFilter(matchFrom, matchTo);
|
||||
// ReplaceSimpleFilter result = runWithWorld(player, folder, filter, true);
|
||||
// if (result != null) player.print(BBC.VISITOR_BLOCK.format(result.getTotal()));
|
||||
// if (result != null) player.print(TranslatableComponent.of("fawe.worldedit.visitor.visitor.block", (result.getTotal())));
|
||||
}
|
||||
|
||||
@Command(
|
||||
@ -148,7 +148,7 @@ public class AnvilCommands {
|
||||
// RemapFilter filter = new RemapFilter(from, to);
|
||||
// RemapFilter result = runWithWorld(player, folder, filter, true);
|
||||
// if (result != null) {
|
||||
// player.print(BBC.VISITOR_BLOCK.format(result.getTotal()));
|
||||
// player.print(TranslatableComponent.of("fawe.worldedit.visitor.visitor.block", (result.getTotal())));
|
||||
// }
|
||||
}
|
||||
|
||||
@ -167,7 +167,7 @@ public class AnvilCommands {
|
||||
// DeleteUninhabitedFilter filter = new DeleteUninhabitedFilter(fileDurationMillis, inhabitedTicks, fileDurationMillis); TODO NOT IMPLEMENTED
|
||||
// DeleteUninhabitedFilter result = runWithWorld(player, folder, filter, true);
|
||||
// if (result != null) {
|
||||
// player.print(BBC.VISITOR_BLOCK.format(result.getTotal()));
|
||||
// player.print(TranslatableComponent.of("fawe.worldedit.visitor.visitor.block", (result.getTotal())));
|
||||
// }
|
||||
}
|
||||
|
||||
@ -190,7 +190,7 @@ public class AnvilCommands {
|
||||
// }
|
||||
// DeleteUnclaimedFilter result = runWithWorld(player, folder, filter, true);
|
||||
// if (result != null) {
|
||||
// player.print(BBC.VISITOR_BLOCK.format(result.getTotal()));
|
||||
// player.print(TranslatableComponent.of("fawe.worldedit.visitor.visitor.block", (result.getTotal())));
|
||||
// }
|
||||
}
|
||||
|
||||
@ -212,7 +212,7 @@ public class AnvilCommands {
|
||||
// }
|
||||
// DeleteUnclaimedFilter result = runWithSelection(player, editSession, selection, filter);
|
||||
// if (result != null) {
|
||||
// player.print(BBC.VISITOR_BLOCK.format(result.getTotal()));
|
||||
// player.print(TranslatableComponent.of("fawe.worldedit.visitor.visitor.block", (result.getTotal())));
|
||||
// }
|
||||
}
|
||||
|
||||
@ -229,7 +229,7 @@ public class AnvilCommands {
|
||||
// DeleteOldFilter filter = new DeleteOldFilter(duration);
|
||||
// DeleteOldFilter result = runWithWorld(player, folder, filter, true);
|
||||
// if (result != null) {
|
||||
// player.print(BBC.VISITOR_BLOCK.format(result.getTotal()));
|
||||
// player.print(TranslatableComponent.of("fawe.worldedit.visitor.visitor.block", (result.getTotal())));
|
||||
// }
|
||||
}
|
||||
|
||||
@ -249,7 +249,7 @@ public class AnvilCommands {
|
||||
// MCAQueue queue = new MCAQueue(defaultQueue);
|
||||
// PlotTrimFilter result = queue.filterWorld(filter);
|
||||
// if (result != null) {
|
||||
// player.print(BBC.VISITOR_BLOCK.format(result.getTotal()));
|
||||
// player.print(TranslatableComponent.of("fawe.worldedit.visitor.visitor.block", (result.getTotal())));
|
||||
// }
|
||||
}
|
||||
|
||||
@ -262,7 +262,7 @@ public class AnvilCommands {
|
||||
// DeleteBiomeFilterSimple filter = new DeleteBiomeFilterSimple(biome); TODO NOT IMPLEMENTED
|
||||
// DeleteBiomeFilterSimple result = runWithWorld(player, folder, filter, true, unsafe);
|
||||
// if (result != null) {
|
||||
// player.print(BBC.VISITOR_BLOCK.format(result.getTotal()));
|
||||
// player.print(TranslatableComponent.of("fawe.worldedit.visitor.visitor.block", (result.getTotal())));
|
||||
// }
|
||||
}
|
||||
|
||||
@ -275,7 +275,7 @@ public class AnvilCommands {
|
||||
// TrimAirFilter filter = new TrimAirFilter(); TODO NOT IMPLEMENTED
|
||||
// TrimAirFilter result = runWithWorld(player, folder, filter, true, unsafe);
|
||||
// if (result != null) {
|
||||
// player.print(BBC.VISITOR_BLOCK.format(result.getTotal()));
|
||||
// player.print(TranslatableComponent.of("fawe.worldedit.visitor.visitor.block", (result.getTotal())));
|
||||
// }
|
||||
}
|
||||
|
||||
@ -289,7 +289,7 @@ public class AnvilCommands {
|
||||
// DebugFixP2Roads filter = new DebugFixP2Roads(); TODO NOT IMPLEMENTED
|
||||
// DebugFixP2Roads result = runWithWorld(player, folder, filter, true, true);
|
||||
// if (result != null) {
|
||||
// player.print(BBC.VISITOR_BLOCK.format(result.getTotal()));
|
||||
// player.print(TranslatableComponent.of("fawe.worldedit.visitor.visitor.block", (result.getTotal())));
|
||||
// }
|
||||
}
|
||||
|
||||
@ -319,7 +319,7 @@ public class AnvilCommands {
|
||||
// filter = new ReplacePatternFilter(matchFrom, to);
|
||||
// }
|
||||
// MCAFilterCounter result = runWithWorld(player, folder, filter, true);
|
||||
// if (result != null) player.print(BBC.VISITOR_BLOCK.format(result.getTotal()));
|
||||
// if (result != null) player.print(TranslatableComponent.of("fawe.worldedit.visitor.visitor.block", (result.getTotal())));
|
||||
}
|
||||
|
||||
//
|
||||
@ -341,7 +341,7 @@ public class AnvilCommands {
|
||||
// filter = counter;
|
||||
// }
|
||||
// MCAFilterCounter result = runWithWorld(player, folder, filter, true);
|
||||
// if (result != null) player.print(BBC.SELECTION_COUNT.format(result.getTotal()));
|
||||
// if (result != null) player.print(TranslatableComponent.of("fawe.worldedit.selection.selection.count", (result.getTotal())));
|
||||
}
|
||||
|
||||
@Command(
|
||||
@ -393,7 +393,7 @@ public class AnvilCommands {
|
||||
// };
|
||||
// MCAFilterCounter result = runWithSelection(player, editSession, selection, filter);
|
||||
// if (result != null) {
|
||||
// player.print(BBC.VISITOR_BLOCK.format(result.getTotal()));
|
||||
// player.print(TranslatableComponent.of("fawe.worldedit.visitor.visitor.block", (result.getTotal())));
|
||||
// }
|
||||
}
|
||||
|
||||
@ -415,7 +415,7 @@ public class AnvilCommands {
|
||||
// filter = counter;
|
||||
// }
|
||||
// MCAFilterCounter result = runWithSelection(player, editSession, selection, filter);
|
||||
// if (result != null) player.print(BBC.SELECTION_COUNT.format(result.getTotal()));
|
||||
// if (result != null) player.print(TranslatableComponent.of("fawe.worldedit.selection.selection.count", (result.getTotal())));
|
||||
}
|
||||
|
||||
//
|
||||
@ -514,7 +514,7 @@ public class AnvilCommands {
|
||||
// ReplaceSimpleFilter filter = new ReplaceSimpleFilter(matchFrom, matchTo);
|
||||
// MCAFilterCounter result = runWithSelection(player, editSession, selection, filter);
|
||||
// if (result != null) {
|
||||
// player.print(BBC.VISITOR_BLOCK.format(result.getTotal()));
|
||||
// player.print(TranslatableComponent.of("fawe.worldedit.visitor.visitor.block", (result.getTotal())));
|
||||
// }
|
||||
}
|
||||
|
||||
@ -546,7 +546,7 @@ public class AnvilCommands {
|
||||
// }
|
||||
// MCAFilterCounter result = runWithSelection(player, editSession, selection, filter);
|
||||
// if (result != null) {
|
||||
// player.print(BBC.VISITOR_BLOCK.format(result.getTotal()));
|
||||
// player.print(TranslatableComponent.of("fawe.worldedit.visitor.visitor.block", (result.getTotal())));
|
||||
// }
|
||||
}
|
||||
|
||||
@ -560,7 +560,7 @@ public class AnvilCommands {
|
||||
// MCAFilterCounter filter = new SetPatternFilter(to); TODO NOT IMPLEMENTED
|
||||
// MCAFilterCounter result = runWithSelection(player, editSession, selection, filter);
|
||||
// if (result != null) {
|
||||
// player.print(BBC.VISITOR_BLOCK.format(result.getTotal()));
|
||||
// player.print(TranslatableComponent.of("fawe.worldedit.visitor.visitor.block", (result.getTotal())));
|
||||
// }
|
||||
}
|
||||
|
||||
@ -578,7 +578,7 @@ public class AnvilCommands {
|
||||
// RemoveLayerFilter filter = new RemoveLayerFilter(minY, maxY, id);
|
||||
// MCAFilterCounter result = runWithSelection(player, editSession, selection, filter);
|
||||
// if (result != null) {
|
||||
// player.print(BBC.VISITOR_BLOCK.format(result.getTotal()));
|
||||
// player.print(TranslatableComponent.of("fawe.worldedit.visitor.visitor.block", (result.getTotal())));
|
||||
// }
|
||||
}
|
||||
|
||||
@ -590,7 +590,7 @@ public class AnvilCommands {
|
||||
@CommandPermissions("worldedit.anvil.copychunks")
|
||||
public void copy(Player player, LocalSession session, EditSession editSession, @Selection Region selection) throws WorldEditException {
|
||||
// if (!(selection instanceof CuboidRegion)) { TODO NOT IMPLEMENTED
|
||||
// BBC.NO_REGION.send(player);
|
||||
// player.print(TranslatableComponent.of("fawe.error.no.region"))
|
||||
// return;
|
||||
// }
|
||||
// CuboidRegion cuboid = (CuboidRegion) selection;
|
||||
@ -601,7 +601,7 @@ public class AnvilCommands {
|
||||
// MCAClipboard clipboard = new MCAClipboard(queue, cuboid, origin);
|
||||
// FawePlayer fp = FawePlayer.wrap(player);
|
||||
// fp.setMeta(FawePlayer.METADATA_KEYS.ANVIL_CLIPBOARD, clipboard);
|
||||
// BBC.COMMAND_COPY.send(player, selection.getArea());
|
||||
// player.print(TranslatableComponent.of("fawe.worldedit.copy.command.copy" , selection.getArea()));
|
||||
}
|
||||
|
||||
@Command(
|
||||
@ -638,6 +638,6 @@ public class AnvilCommands {
|
||||
// pasteQueue.pasteRegion(copyQueue, copyRegion, offset, iAnvilHistory);
|
||||
// } catch (IOException e) { throw new RuntimeException(e); }
|
||||
// });
|
||||
// BBC.COMMAND_PASTE.send(player, player.getPosition().toBlockVector());
|
||||
// player.print(TranslatableComponent.of("fawe.worldedit.paste.command.paste" , player.getPosition().toBlockVector()));
|
||||
}
|
||||
}
|
||||
|
@ -8,6 +8,7 @@ import com.boydti.fawe.Fawe;
|
||||
import com.boydti.fawe.FaweAPI;
|
||||
import com.boydti.fawe.beta.implementation.filter.block.SingleFilterBlock;
|
||||
import com.boydti.fawe.config.BBC;
|
||||
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
|
||||
import com.boydti.fawe.object.RunnableVal;
|
||||
import com.boydti.fawe.object.brush.visualization.cfi.HeightMapMCAGenerator;
|
||||
import com.boydti.fawe.object.clipboard.MultiClipboardHolder;
|
||||
@ -949,7 +950,7 @@ public class CFICommands {
|
||||
JsonObject data1 = obj.get("data").getAsJsonObject();
|
||||
String link = data1.get("link").getAsString();
|
||||
URL url = new URL(link);
|
||||
BBC.DOWNLOAD_LINK.send(player, url);
|
||||
player.print(TranslatableComponent.of("fawe.web.download.link" , url));
|
||||
}
|
||||
|
||||
@Command(
|
||||
|
@ -3,6 +3,7 @@ package com.boydti.fawe.command;
|
||||
import com.boydti.fawe.Fawe;
|
||||
import com.boydti.fawe.FaweAPI;
|
||||
import com.boydti.fawe.config.BBC;
|
||||
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
|
||||
import com.boydti.fawe.config.Settings;
|
||||
import com.boydti.fawe.object.FaweCommand;
|
||||
import com.boydti.fawe.object.RegionWrapper;
|
||||
@ -34,11 +35,11 @@ public class Rollback extends FaweCommand {
|
||||
}
|
||||
Player player = (Player) actor;
|
||||
if (!Settings.IMP.HISTORY.USE_DATABASE) {
|
||||
BBC.SETTING_DISABLE.send(player, "history.use-database (Import with /frb #import )");
|
||||
player.print(TranslatableComponent.of("fawe.error.setting.disable" , "history.use-database (Import with /frb #import )"));
|
||||
return false;
|
||||
}
|
||||
if (args.length != 3) {
|
||||
BBC.COMMAND_SYNTAX.send(player, "/frb u:<uuid> r:<radius> t:<time>");
|
||||
player.print(TranslatableComponent.of("fawe.error.command.syntax" , "/frb u:<uuid> r:<radius> t:<time>"));
|
||||
return false;
|
||||
}
|
||||
switch (args[0]) {
|
||||
@ -46,13 +47,13 @@ public class Rollback extends FaweCommand {
|
||||
case "info":
|
||||
case "undo":
|
||||
case "revert":
|
||||
BBC.COMMAND_SYNTAX.send(player, "/frb u:<uuid> r:<radius> t:<time>");
|
||||
player.print(TranslatableComponent.of("fawe.error.command.syntax" , "/frb u:<uuid> r:<radius> t:<time>"));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
if (args.length < 1) {
|
||||
BBC.COMMAND_SYNTAX.send(player, "/frb <info|undo> u:<uuid> r:<radius> t:<time>");
|
||||
player.print(TranslatableComponent.of("fawe.error.command.syntax" , "/frb <info|undo> u:<uuid> r:<radius> t:<time>"));
|
||||
return false;
|
||||
}
|
||||
World world = player.getWorld();
|
||||
@ -60,7 +61,7 @@ public class Rollback extends FaweCommand {
|
||||
case "i":
|
||||
case "info":
|
||||
if (args.length < 2) {
|
||||
BBC.COMMAND_SYNTAX.send(player, "/frb <info|undo> u:<uuid> r:<radius> t:<time>");
|
||||
player.print(TranslatableComponent.of("fawe.error.command.syntax" , "/frb <info|undo> u:<uuid> r:<radius> t:<time>"));
|
||||
return false;
|
||||
}
|
||||
player.deleteMeta(Player.METADATA_KEYS.ROLLBACK);
|
||||
@ -101,13 +102,13 @@ public class Rollback extends FaweCommand {
|
||||
case "undo":
|
||||
case "revert":
|
||||
if (!player.hasPermission("fawe.rollback.perform")) {
|
||||
BBC.NO_PERM.send(player, "fawe.rollback.perform");
|
||||
player.print(TranslatableComponent.of("fawe.error.no.perm", "fawe.rollback.perform"));
|
||||
return false;
|
||||
}
|
||||
final List<DiskStorageHistory> edits = player.getMeta(Player.METADATA_KEYS.ROLLBACK);
|
||||
player.deleteMeta(Player.METADATA_KEYS.ROLLBACK);
|
||||
if (edits == null) {
|
||||
BBC.COMMAND_SYNTAX.send(player, "/frb info u:<uuid> r:<radius> t:<time>");
|
||||
player.print(TranslatableComponent.of("fawe.error.command.syntax" , "/frb info u:<uuid> r:<radius> t:<time>"));
|
||||
return false;
|
||||
}
|
||||
for (DiskStorageHistory edit : edits) {
|
||||
@ -119,7 +120,7 @@ public class Rollback extends FaweCommand {
|
||||
}
|
||||
player.print("Rollback complete!");
|
||||
default:
|
||||
BBC.COMMAND_SYNTAX.send(player, "/frb info u:<uuid> r:<radius> t:<time>");
|
||||
player.print(TranslatableComponent.of("fawe.error.command.syntax" , "/frb info u:<uuid> r:<radius> t:<time>"));
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@ -132,7 +133,7 @@ public class Rollback extends FaweCommand {
|
||||
for (String arg : args) {
|
||||
String[] split = arg.split(":");
|
||||
if (split.length != 2) {
|
||||
BBC.COMMAND_SYNTAX.send(player, "/frb <info|undo> u:<uuid> r:<radius> t:<time>");
|
||||
player.print(TranslatableComponent.of("fawe.error.command.syntax" , "/frb <info|undo> u:<uuid> r:<radius> t:<time>"));
|
||||
return;
|
||||
}
|
||||
switch (split[0].toLowerCase()) {
|
||||
@ -165,7 +166,7 @@ public class Rollback extends FaweCommand {
|
||||
time = MainUtil.timeToSec(split[1]) * 1000;
|
||||
break;
|
||||
default:
|
||||
BBC.COMMAND_SYNTAX.send(player, "/frb <info|undo> u:<uuid> r:<radius> t:<time>");
|
||||
player.print(TranslatableComponent.of("fawe.error.command.syntax" , "/frb <info|undo> u:<uuid> r:<radius> t:<time>"));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -4,12 +4,21 @@ import static org.slf4j.LoggerFactory.getLogger;
|
||||
|
||||
import com.boydti.fawe.configuration.MemorySection;
|
||||
import com.boydti.fawe.configuration.file.YamlConfiguration;
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
import com.sk89q.worldedit.extension.platform.Actor;
|
||||
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.serializer.legacy.LegacyComponentSerializer;
|
||||
|
||||
import java.io.File;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.ArrayList;
|
||||
import java.util.EnumSet;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ThreadLocalRandom;
|
||||
@ -20,6 +29,7 @@ public enum BBC {
|
||||
* Things to note about this class:
|
||||
* Can use multiple arguments %s, %s1, %s2, %s3 etc
|
||||
*/
|
||||
PREFIX("&4&lFAWE&7: ", "Info"),
|
||||
FILE_DELETED("%s0 has been deleted.", "Info"),
|
||||
SCHEMATIC_PASTING("&7The schematic is pasting. This cannot be undone.", "Info"),
|
||||
LIGHTING_PROPAGATE_SELECTION("Lighting has been propogated in %s0 chunks. (Note: To remove light use //removelight)", "Info"),
|
||||
@ -136,7 +146,6 @@ public enum BBC {
|
||||
BRUSH_TRANSFORM("Brush transform set", "WorldEdit.Brush"),
|
||||
BRUSH_MATERIAL("Brush material set", "WorldEdit.Brush"),
|
||||
|
||||
|
||||
ROLLBACK_ELEMENT("Undoing %s0", "WorldEdit.Rollback"),
|
||||
|
||||
TOOL_INSPECT("Inspect tool bound to %s0.", "WorldEdit.Tool"),
|
||||
@ -309,6 +318,8 @@ public enum BBC {
|
||||
SCRIPTING_CS("Use /cs with a script name first.", "WorldEdit.Scripting"),
|
||||
SCRIPTING_ERROR("An error occured while executing a craft script", "WorldEdit.Scripting"),
|
||||
|
||||
|
||||
|
||||
TIP_SEL_LIST("Tip: See the different selection modes with //sel list", "Tips"),
|
||||
TIP_SELECT_CONNECTED("Tip: Select all connected blocks with //sel fuzzy", "Tips"),
|
||||
TIP_SET_POS1("Tip: Use pos1 as a pattern with //set pos1", "Tips"),
|
||||
@ -377,7 +388,7 @@ public enum BBC {
|
||||
*/
|
||||
BBC(String defaultMessage, String category) {
|
||||
this.defaultMessage = defaultMessage;
|
||||
this.translatedMessage = defaultMessage;
|
||||
setTranslated(defaultMessage);
|
||||
this.category = category.toLowerCase(Locale.ROOT);
|
||||
}
|
||||
|
||||
@ -428,7 +439,7 @@ public enum BBC {
|
||||
yml.set(caption.category + "." + caption.name().toLowerCase(Locale.ROOT), value);
|
||||
}
|
||||
captions.add(caption);
|
||||
caption.translatedMessage = (String) value;
|
||||
caption.setTranslated((String) value);
|
||||
} else {
|
||||
toRemove.add(key);
|
||||
}
|
||||
@ -451,6 +462,10 @@ public enum BBC {
|
||||
}
|
||||
}
|
||||
|
||||
private void setTranslated(String msg) {
|
||||
this.translatedMessage = msg;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return s();
|
||||
@ -509,4 +524,47 @@ public enum BBC {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Colorize a component with legacy color codes
|
||||
* @param parent
|
||||
* @param locale
|
||||
* @return Component
|
||||
*/
|
||||
public static Component color(Component component, Locale locale) {
|
||||
return color(WorldEditText.format(component, locale));
|
||||
}
|
||||
|
||||
public static Component color(Component parent) {
|
||||
if (parent instanceof TextComponent) {
|
||||
TextComponent text = (TextComponent) parent;
|
||||
String content = text.content();
|
||||
if (content.indexOf('&') != -1) {
|
||||
Component legacy = LegacyComponentSerializer.legacy().deserialize(content, '&');
|
||||
legacy = legacy.style(parent.style());
|
||||
if (!parent.children().isEmpty()) {
|
||||
parent = TextComponent.builder().append(legacy).append(parent.children()).build();
|
||||
} else {
|
||||
parent = legacy;
|
||||
}
|
||||
}
|
||||
}
|
||||
List<Component> children = parent.children();
|
||||
if (!children.isEmpty()) {
|
||||
for (int i = 0; i < children.size(); i++) {
|
||||
Component child = children.get(i);
|
||||
Component coloredChild = color(child);
|
||||
if (coloredChild != child) {
|
||||
if (!(children instanceof ArrayList)) {
|
||||
children = new ArrayList<>(children);
|
||||
}
|
||||
children.set(i, coloredChild);
|
||||
}
|
||||
}
|
||||
if (children instanceof ArrayList) {
|
||||
parent = parent.children(children);
|
||||
}
|
||||
}
|
||||
return parent;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
package com.boydti.fawe.object;
|
||||
|
||||
import com.boydti.fawe.config.BBC;
|
||||
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
|
||||
import com.boydti.fawe.util.TaskManager;
|
||||
import com.sk89q.worldedit.extension.platform.Actor;
|
||||
|
||||
@ -30,7 +31,7 @@ public abstract class FaweCommand<T> {
|
||||
TaskManager.IMP.async(() -> execute(player, args));
|
||||
} else {
|
||||
if (!player.runAction(() -> execute(player, args), true, true)) {
|
||||
player.printError(BBC.WORLDEDIT_COMMAND_LIMIT.s());
|
||||
player.printError(TranslatableComponent.of("fawe.info.worldedit.command.limit"));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
package com.boydti.fawe.object.brush;
|
||||
|
||||
import com.boydti.fawe.config.BBC;
|
||||
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
|
||||
import com.boydti.fawe.object.brush.visualization.VisualExtent;
|
||||
import com.sk89q.worldedit.EditSession;
|
||||
import com.sk89q.worldedit.MaxChangedBlocksException;
|
||||
@ -35,14 +36,14 @@ public class CatenaryBrush implements Brush, ResettableTool {
|
||||
if (pos1 == null || pos2.equals(pos1)) {
|
||||
if (!visual) {
|
||||
pos1 = pos2;
|
||||
BBC.BRUSH_LINE_PRIMARY.send(editSession.getPlayer(), pos2);
|
||||
editSession.getPlayer().print(TranslatableComponent.of("fawe.worldedit.brush.brush.line.primary", pos2));
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (this.vertex == null) {
|
||||
vertex = getVertex(pos1.toVector3(), pos2.toVector3(), slack);
|
||||
if (this.direction) {
|
||||
BBC.BRUSH_CATENARY_DIRECTION.send(editSession.getPlayer(), 2);
|
||||
editSession.getPlayer().print(TranslatableComponent.of("fawe.worldedit.brush.brush.catenary.direction", 2));
|
||||
return;
|
||||
}
|
||||
} else if (this.direction) {
|
||||
@ -60,7 +61,7 @@ public class CatenaryBrush implements Brush, ResettableTool {
|
||||
e.printStackTrace();
|
||||
}
|
||||
if (!visual) {
|
||||
BBC.BRUSH_LINE_SECONDARY.send(editSession.getPlayer());
|
||||
editSession.getPlayer().print(TranslatableComponent.of("fawe.worldedit.brush.brush.line.secondary"));
|
||||
if (!select) {
|
||||
pos1 = null;
|
||||
return;
|
||||
|
@ -1,6 +1,7 @@
|
||||
package com.boydti.fawe.object.brush;
|
||||
|
||||
import com.boydti.fawe.config.BBC;
|
||||
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
|
||||
import com.boydti.fawe.object.brush.visualization.VisualExtent;
|
||||
import com.boydti.fawe.object.clipboard.ResizableClipboardBuilder;
|
||||
import com.boydti.fawe.object.function.NullRegionFunction;
|
||||
@ -42,7 +43,7 @@ public class CopyPastaBrush implements Brush, ResettableTool {
|
||||
@Override
|
||||
public boolean reset() {
|
||||
session.setClipboard(null);
|
||||
player.print(BBC.BRUSH_RESET.s());
|
||||
player.print(TranslatableComponent.of("fawe.worldedit.brush.brush.reset"));
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -87,7 +88,7 @@ public class CopyPastaBrush implements Brush, ResettableTool {
|
||||
ClipboardHolder holder = new ClipboardHolder(newClipboard);
|
||||
session.setClipboard(holder);
|
||||
int blocks = builder.size();
|
||||
BBC.COMMAND_COPY.send(player, blocks);
|
||||
player.print(TranslatableComponent.of("fawe.worldedit.copy.command.copy" , blocks));
|
||||
} else {
|
||||
AffineTransform transform = null;
|
||||
if (randomRotate) {
|
||||
|
@ -1,6 +1,7 @@
|
||||
package com.boydti.fawe.object.brush;
|
||||
|
||||
import com.boydti.fawe.config.BBC;
|
||||
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
|
||||
import com.boydti.fawe.object.brush.visualization.cfi.HeightMapMCAGenerator;
|
||||
import com.boydti.fawe.beta.IQueueExtent;
|
||||
import com.boydti.fawe.object.brush.heightmap.HeightMap;
|
||||
@ -46,7 +47,7 @@ public class HeightBrush implements Brush {
|
||||
try {
|
||||
heightMap = ScalableHeightMap.fromPNG(stream);
|
||||
} catch (IOException e) {
|
||||
throw new FaweException(BBC.BRUSH_HEIGHT_INVALID);
|
||||
throw new FaweException(TranslatableComponent.of("fawe.worldedit.brush.brush.height.invalid"));
|
||||
}
|
||||
} else if (clipboard != null) {
|
||||
heightMap = ScalableHeightMap.fromClipboard(clipboard);
|
||||
|
@ -2,6 +2,7 @@ package com.boydti.fawe.object.brush;
|
||||
|
||||
import com.boydti.fawe.Fawe;
|
||||
import com.boydti.fawe.config.BBC;
|
||||
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
|
||||
import com.boydti.fawe.config.Settings;
|
||||
import com.boydti.fawe.database.DBHandler;
|
||||
import com.boydti.fawe.database.RollbackDatabase;
|
||||
@ -20,6 +21,7 @@ import com.sk89q.worldedit.extension.platform.Platform;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.math.Vector3;
|
||||
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.BlockState;
|
||||
import java.io.IOException;
|
||||
@ -58,11 +60,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(BBC.NO_PERM.format("worldedit.tool.inspect"));
|
||||
player.print(TranslatableComponent.of("", "worldedit.tool.inspect"));
|
||||
return false;
|
||||
}
|
||||
if (!Settings.IMP.HISTORY.USE_DATABASE) {
|
||||
player.print(BBC.SETTING_DISABLE.format("history.use-database (Import with /frb #import )"));
|
||||
player.print(TranslatableComponent.of("fawe.error.setting.disable", ("history.use-database (Import with /frb #import )")));
|
||||
return false;
|
||||
}
|
||||
BlockVector3 target = getTarget(player, rightClick).toBlockPoint();
|
||||
@ -89,7 +91,7 @@ public class InspectBrush extends BrushTool implements DoubleActionTraceTool {
|
||||
int index = value.getIndex();
|
||||
long age = System.currentTimeMillis() - value.getBDFile().lastModified();
|
||||
String ageFormatted = MainUtil.secToTime(age / 1000);
|
||||
BBC.TOOL_INSPECT_INFO.send(player, name, BlockState.getFromOrdinal(from).getAsString(), BlockState.getFromOrdinal(to).getAsString(), ageFormatted);
|
||||
player.print(TranslatableComponent.of("fawe.worldedit.tool.tool.inspect.info" , name, BlockState.getFromOrdinal(from).getAsString(), BlockState.getFromOrdinal(to).getAsString(), ageFormatted));
|
||||
count.incrementAndGet();
|
||||
return;
|
||||
}
|
||||
@ -100,7 +102,7 @@ public class InspectBrush extends BrushTool implements DoubleActionTraceTool {
|
||||
}, new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
BBC.TOOL_INSPECT_INFO_FOOTER.send(player, count);
|
||||
player.print(TranslatableComponent.of("fawe.worldedit.tool.tool.inspect.info.footer" , count));
|
||||
}
|
||||
}, false, false);
|
||||
return true;
|
||||
|
@ -1,6 +1,7 @@
|
||||
package com.boydti.fawe.object.brush;
|
||||
|
||||
import com.boydti.fawe.config.BBC;
|
||||
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
|
||||
import com.boydti.fawe.object.brush.visualization.VisualExtent;
|
||||
import com.sk89q.worldedit.EditSession;
|
||||
import com.sk89q.worldedit.MaxChangedBlocksException;
|
||||
@ -25,13 +26,13 @@ public class LineBrush implements Brush, ResettableTool {
|
||||
if (pos1 == null) {
|
||||
if (!visual) {
|
||||
pos1 = position;
|
||||
BBC.BRUSH_LINE_PRIMARY.send(editSession.getPlayer(), position);
|
||||
editSession.getPlayer().print(TranslatableComponent.of("fawe.worldedit.brush.brush.line.primary", position));
|
||||
}
|
||||
return;
|
||||
}
|
||||
editSession.drawLine(pattern, pos1, position, size, !shell, flat);
|
||||
if (!visual) {
|
||||
BBC.BRUSH_LINE_SECONDARY.send(editSession.getPlayer());
|
||||
editSession.getPlayer().print(TranslatableComponent.of("fawe.worldedit.brush.brush.line.secondary"));
|
||||
if (!select) {
|
||||
pos1 = null;
|
||||
} else {
|
||||
|
@ -2,6 +2,7 @@ package com.boydti.fawe.object.brush;
|
||||
|
||||
import com.boydti.fawe.FaweCache;
|
||||
import com.boydti.fawe.config.BBC;
|
||||
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
|
||||
import com.boydti.fawe.object.brush.visualization.VisualExtent;
|
||||
import com.boydti.fawe.object.exception.FaweException;
|
||||
import com.boydti.fawe.object.mask.IdMask;
|
||||
@ -94,13 +95,13 @@ public class SplineBrush implements Brush, ResettableTool {
|
||||
points.add(position);
|
||||
}
|
||||
this.positionSets.add(points);
|
||||
player.print(BBC.BRUSH_SPLINE_PRIMARY_2.s());
|
||||
player.print(TranslatableComponent.of("fawe.worldedit.brush.brush.spline.primary.2"));
|
||||
if (!visualization) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (positionSets.size() < 2) {
|
||||
player.print(BBC.BRUSH_SPLINE_SECONDARY_ERROR.s());
|
||||
player.print(TranslatableComponent.of("fawe.worldedit.brush.brush.spline.secondary.error"));
|
||||
return;
|
||||
}
|
||||
List<Vector3> centroids = new ArrayList<>();
|
||||
@ -132,7 +133,7 @@ public class SplineBrush implements Brush, ResettableTool {
|
||||
}
|
||||
editSession.drawSpline(pattern, currentSpline, 0, 0, 0, 10, 0, true);
|
||||
}
|
||||
player.print(BBC.BRUSH_SPLINE_SECONDARY.s());
|
||||
player.print(TranslatableComponent.of("fawe.worldedit.brush.brush.spline.secondary"));
|
||||
if (visualization) {
|
||||
numSplines = originalSize;
|
||||
positionSets.remove(positionSets.size() - 1);
|
||||
|
@ -1,6 +1,7 @@
|
||||
package com.boydti.fawe.object.brush;
|
||||
|
||||
import com.boydti.fawe.config.BBC;
|
||||
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
|
||||
import com.boydti.fawe.object.brush.visualization.VisualExtent;
|
||||
import com.boydti.fawe.object.collection.LocalBlockVectorSet;
|
||||
import com.boydti.fawe.util.MathMan;
|
||||
@ -39,7 +40,7 @@ public class SurfaceSpline implements Brush {
|
||||
if (max == -1) return;
|
||||
// pos.mutY(max);
|
||||
path.add(BlockVector3.at(pos.getBlockX(), max, pos.getBlockZ()));
|
||||
editSession.getPlayer().print(BBC.BRUSH_SPLINE_PRIMARY_2.s());
|
||||
editSession.getPlayer().print(TranslatableComponent.of("fawe.worldedit.brush.brush.spline.primary.2"));
|
||||
if (!vis) return;
|
||||
}
|
||||
LocalBlockVectorSet vset = new LocalBlockVectorSet();
|
||||
@ -93,6 +94,6 @@ public class SurfaceSpline implements Brush {
|
||||
editSession.setBlocks(newSet, pattern);
|
||||
if (!vis) path.clear();
|
||||
}
|
||||
editSession.getPlayer().print(BBC.BRUSH_SPLINE_SECONDARY.s());
|
||||
editSession.getPlayer().print(TranslatableComponent.of("fawe.worldedit.brush.brush.spline.secondary"));
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
package com.boydti.fawe.object.brush.scroll;
|
||||
|
||||
import com.boydti.fawe.config.BBC;
|
||||
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
|
||||
import com.boydti.fawe.object.clipboard.MultiClipboardHolder;
|
||||
import com.sk89q.worldedit.LocalSession;
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
@ -46,7 +47,7 @@ public abstract class Scroll implements ScrollTool {
|
||||
return null;
|
||||
case CLIPBOARD:
|
||||
if (arguments.size() != 2) {
|
||||
if (message) BBC.COMMAND_SYNTAX.send(player, "clipboard [file]");
|
||||
if (message) player.print(TranslatableComponent.of("fawe.error.command.syntax" , "clipboard [file]"));
|
||||
return null;
|
||||
}
|
||||
String filename = arguments.get(1);
|
||||
@ -61,7 +62,7 @@ public abstract class Scroll implements ScrollTool {
|
||||
}
|
||||
case MASK:
|
||||
if (arguments.size() < 2) {
|
||||
if (message) BBC.COMMAND_SYNTAX.send(player, "mask [mask 1] [mask 2] [mask 3]...");
|
||||
if (message) player.print(TranslatableComponent.of("fawe.error.command.syntax" , "mask [mask 1] [mask 2] [mask 3]..."));
|
||||
return null;
|
||||
}
|
||||
Mask[] masks = new Mask[arguments.size() - 1];
|
||||
@ -72,7 +73,7 @@ public abstract class Scroll implements ScrollTool {
|
||||
return (new ScrollMask(tool, masks));
|
||||
case PATTERN:
|
||||
if (arguments.size() < 2) {
|
||||
if (message) BBC.COMMAND_SYNTAX.send(player, "pattern [pattern 1] [pattern 2] [pattern 3]...");
|
||||
if (message) player.print(TranslatableComponent.of("fawe.error.command.syntax" , "pattern [pattern 1] [pattern 2] [pattern 3]..."));
|
||||
return null;
|
||||
}
|
||||
Pattern[] patterns = new Pattern[arguments.size() - 1];
|
||||
|
@ -1,6 +1,7 @@
|
||||
package com.boydti.fawe.object.brush.sweep;
|
||||
|
||||
import com.boydti.fawe.config.BBC;
|
||||
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
|
||||
import com.boydti.fawe.object.brush.ResettableTool;
|
||||
import com.boydti.fawe.object.brush.visualization.VisualExtent;
|
||||
import com.boydti.fawe.util.MathMan;
|
||||
@ -53,13 +54,13 @@ public class SweepBrush implements Brush, ResettableTool {
|
||||
return;
|
||||
}
|
||||
if (newPos) {
|
||||
player.print(BBC.BRUSH_SPLINE_PRIMARY_2.s());
|
||||
player.print(TranslatableComponent.of("fawe.worldedit.brush.brush.spline.primary.2"));
|
||||
positions.add(position);
|
||||
return;
|
||||
}
|
||||
|
||||
if (positions.size() < 2) {
|
||||
player.printError(BBC.BRUSH_SPLINE_SECONDARY_ERROR.s());
|
||||
player.printError(TranslatableComponent.of("fawe.worldedit.brush.brush.spline.secondary.error"));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -122,7 +123,7 @@ public class SweepBrush implements Brush, ResettableTool {
|
||||
break;
|
||||
}
|
||||
}
|
||||
player.print(BBC.BRUSH_SPLINE_SECONDARY.s());
|
||||
player.print(TranslatableComponent.of("fawe.worldedit.brush.brush.spline.secondary"));
|
||||
reset();
|
||||
}
|
||||
|
||||
|
@ -1,9 +1,10 @@
|
||||
package com.boydti.fawe.object.exception;
|
||||
|
||||
import com.boydti.fawe.config.BBC;
|
||||
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
|
||||
|
||||
public class FaweBlockBagException extends FaweException {
|
||||
public FaweBlockBagException() {
|
||||
super(BBC.WORLDEDIT_SOME_FAILS_BLOCKBAG);
|
||||
super(TranslatableComponent.of("fawe.error.worldedit.some.fails.blockbag"));
|
||||
}
|
||||
}
|
@ -1,9 +1,10 @@
|
||||
package com.boydti.fawe.object.exception;
|
||||
|
||||
import com.boydti.fawe.config.BBC;
|
||||
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
|
||||
|
||||
public class FaweChunkLoadException extends FaweException {
|
||||
public FaweChunkLoadException() {
|
||||
super(BBC.WORLDEDIT_FAILED_LOAD_CHUNK);
|
||||
super(TranslatableComponent.of("fawe.cancel.worldedit.failed.load.chunk"));
|
||||
}
|
||||
}
|
@ -1,8 +1,15 @@
|
||||
package com.boydti.fawe.object.exception;
|
||||
|
||||
import com.boydti.fawe.config.BBC;
|
||||
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.extent.Extent;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
public class FaweException extends RuntimeException {
|
||||
// DEBUG
|
||||
public static final FaweException _enableQueue;
|
||||
@ -18,18 +25,22 @@ public class FaweException extends RuntimeException {
|
||||
}
|
||||
}
|
||||
|
||||
private final String message;
|
||||
private final Component message;
|
||||
|
||||
public FaweException(String reason) {
|
||||
this.message = reason;
|
||||
this(TextComponent.of(reason));
|
||||
}
|
||||
|
||||
public FaweException(BBC reason) {
|
||||
this(reason.format());
|
||||
public FaweException(Component reason) {
|
||||
this.message = reason;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMessage() {
|
||||
return WorldEditText.reduceToText(message, Locale.ROOT);
|
||||
}
|
||||
|
||||
public Component getComponent() {
|
||||
return message;
|
||||
}
|
||||
|
||||
|
@ -9,6 +9,7 @@ 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 {
|
||||
private final Player player;
|
||||
@ -22,9 +23,9 @@ public class MemoryCheckingExtent extends PassthroughExtent {
|
||||
public Extent getExtent() {
|
||||
if (MemUtil.isMemoryLimited()) {
|
||||
if (this.player != null) {
|
||||
player.print(BBC.WORLDEDIT_CANCEL_REASON.format(BBC.WORLDEDIT_CANCEL_REASON_LOW_MEMORY.s()));
|
||||
player.print(TranslatableComponent.of("fawe.cancel.worldedit.cancel.reason", (TranslatableComponent.of("fawe.cancel.worldedit.cancel.reason.low.memory"))));
|
||||
if (Permission.hasPermission(this.player, "worldedit.fast")) {
|
||||
BBC.WORLDEDIT_OOM_ADMIN.send(this.player);
|
||||
this.player.print(TranslatableComponent.of("fawe.info.worldedit.oom.admin"));
|
||||
}
|
||||
}
|
||||
WEManager.IMP.cancelEdit(this, FaweCache.LOW_MEMORY);
|
||||
|
@ -6,6 +6,8 @@ import com.boydti.fawe.beta.IChunk;
|
||||
import com.boydti.fawe.beta.IChunkGet;
|
||||
import com.boydti.fawe.beta.IChunkSet;
|
||||
import com.boydti.fawe.config.BBC;
|
||||
import com.sk89q.worldedit.util.formatting.text.Component;
|
||||
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
|
||||
import com.boydti.fawe.object.FaweLimit;
|
||||
import com.boydti.fawe.object.exception.FaweException;
|
||||
import com.sk89q.worldedit.MaxChangedBlocksException;
|
||||
@ -44,7 +46,7 @@ public class NullExtent extends FaweRegionExtent implements IBatchProcessor {
|
||||
*
|
||||
* @param extent the extent
|
||||
*/
|
||||
public NullExtent(Extent extent, BBC failReason) {
|
||||
public NullExtent(Extent extent, Component failReason) {
|
||||
this(extent, new FaweException(failReason));
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,8 @@
|
||||
package com.boydti.fawe.object.progress;
|
||||
|
||||
import com.sk89q.worldedit.entity.Player;
|
||||
import com.sk89q.worldedit.util.formatting.text.Component;
|
||||
import com.sk89q.worldedit.util.formatting.text.TextComponent;
|
||||
|
||||
public class ChatProgressTracker extends DefaultProgressTracker {
|
||||
public ChatProgressTracker(Player player) {
|
||||
@ -9,7 +11,7 @@ public class ChatProgressTracker extends DefaultProgressTracker {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendTile(String title, String sub) {
|
||||
getPlayer().print(title + sub);
|
||||
public void sendTile(Component title, Component sub) {
|
||||
getPlayer().print(TextComponent.builder().append(title).append("\n").append(sub).build());
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,9 @@
|
||||
package com.boydti.fawe.object.progress;
|
||||
|
||||
import com.boydti.fawe.config.BBC;
|
||||
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.boydti.fawe.config.Settings;
|
||||
import com.boydti.fawe.util.StringMan;
|
||||
import com.boydti.fawe.util.TaskManager;
|
||||
@ -101,7 +104,7 @@ public class DefaultProgressTracker implements BiConsumer<DefaultProgressTracker
|
||||
}
|
||||
|
||||
public void doneTask() {
|
||||
sendTile("", BBC.PROGRESS_FINISHED.s());
|
||||
sendTile(TextComponent.empty(), TranslatableComponent.of("fawe.progress.progress.finished"));
|
||||
}
|
||||
|
||||
public void sendTask() {
|
||||
@ -112,10 +115,10 @@ 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("", BBC.PROGRESS_MESSAGE.format(queue, dispatch, percent, StringMan.padLeft("" + speed, 3), StringMan.padLeft("" + remaining, 3)));
|
||||
sendTile(TextComponent.empty(), TranslatableComponent.of("fawe.progress.progress.message", queue, dispatch, percent, StringMan.padLeft("" + speed, 3), StringMan.padLeft("" + remaining, 3)));
|
||||
}
|
||||
|
||||
public void sendTile(String title, String sub) {
|
||||
public void sendTile(Component title, Component sub) {
|
||||
player.sendTitle(title, sub);
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
package com.boydti.fawe.object.regions.selector;
|
||||
|
||||
import com.boydti.fawe.config.BBC;
|
||||
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
|
||||
import com.boydti.fawe.object.regions.FuzzyRegion;
|
||||
import com.boydti.fawe.util.EditSessionBuilder;
|
||||
import com.boydti.fawe.util.ExtentTraverser;
|
||||
@ -88,13 +89,13 @@ public class FuzzyRegionSelector extends PassthroughExtent implements RegionSele
|
||||
@Override
|
||||
public void explainPrimarySelection(Actor actor, LocalSession session, BlockVector3 position) {
|
||||
int size = this.region.getArea();
|
||||
BBC.SELECTOR_FUZZY_POS1.send(player, position, "(" + region.getArea() + ")");
|
||||
player.print(TranslatableComponent.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();
|
||||
BBC.SELECTOR_FUZZY_POS2.send(player, position, "(" + region.getArea() + ")");
|
||||
player.print(TranslatableComponent.of("fawe.worldedit.selector.selector.fuzzy.pos2", position, "(" + region.getArea() + ")"));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -5,6 +5,7 @@
|
||||
//import com.boydti.fawe.beta.IChunk;
|
||||
//import com.boydti.fawe.beta.IQueueExtent;
|
||||
//import com.boydti.fawe.config.BBC;
|
||||
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
|
||||
//import com.boydti.fawe.object.*;
|
||||
//import com.boydti.fawe.object.brush.visualization.ImmutableVirtualWorld;
|
||||
//import com.boydti.fawe.object.clipboard.LazyClipboardHolder;
|
||||
@ -129,7 +130,7 @@
|
||||
// URI uri = file.toURI();
|
||||
// ClipboardFormat format = ClipboardFormats.findByFile(file);
|
||||
// format.hold(player, uri, new FileInputStream(file));
|
||||
// BBC.SCHEMATIC_LOADED.send(player, filename);
|
||||
// player.print(TranslatableComponent.of("fawe.worldedit.schematic.schematic.loaded" , filename));
|
||||
// session.setVirtualWorld(null);
|
||||
// return;
|
||||
// }
|
||||
@ -157,7 +158,7 @@
|
||||
// session.setClipboard(null);
|
||||
// }
|
||||
// select.put(clicked, false);
|
||||
// BBC.CLIPBOARD_CLEARED.send(player);
|
||||
// player.print(TranslatableComponent.of("fawe.worldedit.clipboard.clipboard.cleared"))
|
||||
// }
|
||||
// } else {
|
||||
// // Add it
|
||||
@ -165,7 +166,7 @@
|
||||
// MultiClipboardHolder multi = new MultiClipboardHolder(URI.create(""), new LazyClipboardHolder(uri, source, format, null));
|
||||
// session.addClipboard(multi);
|
||||
// select.put(clicked, true);
|
||||
// BBC.SCHEMATIC_LOADED.send(player, file.getName());
|
||||
// player.print(TranslatableComponent.of("fawe.worldedit.schematic.schematic.loaded" , file.getName()));
|
||||
// }
|
||||
// }
|
||||
// // Resend relevant chunks
|
||||
|
@ -1,12 +1,18 @@
|
||||
package com.boydti.fawe.object.visitor;
|
||||
|
||||
import com.boydti.fawe.config.BBC;
|
||||
import com.google.common.collect.Lists;
|
||||
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.boydti.fawe.object.IntegerTrio;
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
import com.sk89q.worldedit.function.RegionFunction;
|
||||
import com.sk89q.worldedit.function.operation.Operation;
|
||||
import com.sk89q.worldedit.function.operation.RunContext;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.util.formatting.text.format.TextColor;
|
||||
|
||||
import java.util.ArrayDeque;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
@ -139,9 +145,11 @@ public abstract class DFSVisitor implements Operation {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addStatusMessages(List<String> messages) {
|
||||
messages.add(BBC.VISITOR_BLOCK.format(getAffected()));
|
||||
public Iterable<Component> getStatusMessages() {
|
||||
return Lists.newArrayList(TranslatableComponent.of(
|
||||
"fawe.worldedit.visitor.visitor.block",
|
||||
TextComponent.of(getAffected())
|
||||
).color(TextColor.GRAY));
|
||||
}
|
||||
|
||||
public int getAffected() {
|
||||
|
@ -10,6 +10,7 @@ import com.boydti.fawe.beta.IQueueExtent;
|
||||
import com.boydti.fawe.beta.implementation.processors.LimitProcessor;
|
||||
import com.boydti.fawe.beta.implementation.queue.ParallelQueueExtent;
|
||||
import com.boydti.fawe.config.BBC;
|
||||
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
|
||||
import com.boydti.fawe.config.Settings;
|
||||
import com.boydti.fawe.logging.LoggingChangeSet;
|
||||
import com.boydti.fawe.logging.rollback.RollbackOptimizedHistory;
|
||||
@ -306,7 +307,7 @@ public class EditSessionBuilder {
|
||||
if (checkMemory) {
|
||||
if (MemUtil.isMemoryLimitedSlow()) {
|
||||
if (Permission.hasPermission(player, "worldedit.fast")) {
|
||||
player.print(BBC.WORLDEDIT_OOM_ADMIN.s());
|
||||
player.print(TranslatableComponent.of("fawe.info.worldedit.oom.admin"));
|
||||
}
|
||||
throw FaweCache.LOW_MEMORY;
|
||||
}
|
||||
|
@ -5,6 +5,10 @@ import static org.slf4j.LoggerFactory.getLogger;
|
||||
|
||||
import com.boydti.fawe.Fawe;
|
||||
import com.boydti.fawe.config.BBC;
|
||||
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.TranslatableComponent;
|
||||
import com.boydti.fawe.config.Settings;
|
||||
import com.boydti.fawe.object.FaweInputStream;
|
||||
import com.boydti.fawe.object.FaweOutputStream;
|
||||
@ -61,6 +65,7 @@ import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Scanner;
|
||||
import java.util.UUID;
|
||||
@ -831,7 +836,8 @@ public class MainUtil {
|
||||
long age = now - file.lastModified();
|
||||
if (age > timeDiff) {
|
||||
pool.submit(file::delete);
|
||||
if (printDebug) BBC.FILE_DELETED.send((Player)null, file);
|
||||
Component msg = WorldEditText.format(TranslatableComponent.of("fawe.info.file.deleted"), Locale.ROOT);
|
||||
if (printDebug) Fawe.debug(msg);
|
||||
}
|
||||
});
|
||||
pool.shutdown();
|
||||
|
@ -21,6 +21,7 @@ package com.sk89q.worldedit;
|
||||
|
||||
import com.boydti.fawe.FaweCache;
|
||||
import com.boydti.fawe.config.BBC;
|
||||
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
|
||||
import com.boydti.fawe.config.Settings;
|
||||
import com.boydti.fawe.object.FaweLimit;
|
||||
import com.boydti.fawe.object.RegionWrapper;
|
||||
@ -700,7 +701,7 @@ public class EditSession extends PassthroughExtent implements AutoCloseable {
|
||||
}
|
||||
}
|
||||
|
||||
BBC.WORLDEDIT_SOME_FAILS_BLOCKBAG.send(player, str.toString());
|
||||
player.print(TranslatableComponent.of("fawe.error.worldedit.some.fails.blockbag", str.toString()));
|
||||
}
|
||||
}
|
||||
return Collections.emptyMap();
|
||||
@ -1020,11 +1021,11 @@ public class EditSession extends PassthroughExtent implements AutoCloseable {
|
||||
FaweLimit used = getLimitUsed();
|
||||
if (used.MAX_FAILS > 0) {
|
||||
if (used.MAX_CHANGES > 0 || used.MAX_ENTITIES > 0) {
|
||||
BBC.WORLDEDIT_SOME_FAILS.send(player, used.MAX_FAILS);
|
||||
player.print(TranslatableComponent.of("fawe.error.worldedit.some.fails", used.MAX_FAILS));
|
||||
} else if (new ExtentTraverser<>(getExtent()).findAndGet(FaweRegionExtent.class) != null){
|
||||
player.printError(BBC.WORLDEDIT_CANCEL_REASON_OUTSIDE_REGION.s());
|
||||
player.printError(TranslatableComponent.of("fawe.cancel.worldedit.cancel.reason.outside.region"));
|
||||
} else {
|
||||
player.printError(BBC.WORLDEDIT_CANCEL_REASON_OUTSIDE_LEVEL.s());
|
||||
player.printError(TranslatableComponent.of("fawe.cancel.worldedit.cancel.reason.outside.level"));
|
||||
}
|
||||
}
|
||||
// Reset limit
|
||||
|
@ -34,6 +34,7 @@ import com.sk89q.worldedit.world.snapshot.SnapshotRepository;
|
||||
import java.io.File;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
|
||||
@ -82,6 +83,8 @@ public abstract class LocalConfiguration {
|
||||
public boolean allowSymlinks = false;
|
||||
public boolean serverSideCUI = true;
|
||||
public boolean extendedYLimit = false;
|
||||
public String defaultLocaleName = "default";
|
||||
public Locale defaultLocale = Locale.getDefault();
|
||||
|
||||
protected String[] getDefaultDisallowedBlocks() {
|
||||
List<BlockType> blockTypes = Lists.newArrayList(
|
||||
|
@ -52,12 +52,16 @@ import com.sk89q.worldedit.util.Direction;
|
||||
import com.sk89q.worldedit.util.Location;
|
||||
import com.sk89q.worldedit.util.concurrency.EvenMoreExecutors;
|
||||
import com.sk89q.worldedit.util.eventbus.EventBus;
|
||||
import com.sk89q.worldedit.util.formatting.text.TextComponent;
|
||||
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
|
||||
import com.sk89q.worldedit.util.formatting.text.format.TextColor;
|
||||
import com.sk89q.worldedit.util.io.file.FileSelectionAbortedException;
|
||||
import com.sk89q.worldedit.util.io.file.FilenameException;
|
||||
import com.sk89q.worldedit.util.io.file.FilenameResolutionException;
|
||||
import com.sk89q.worldedit.util.io.file.InvalidFilenameException;
|
||||
import com.sk89q.worldedit.util.task.SimpleSupervisor;
|
||||
import com.sk89q.worldedit.util.task.Supervisor;
|
||||
import com.sk89q.worldedit.util.translation.TranslationManager;
|
||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||
import com.sk89q.worldedit.world.block.BlockType;
|
||||
import com.sk89q.worldedit.world.registry.BundledBlockData;
|
||||
@ -109,6 +113,7 @@ public final class WorldEdit {
|
||||
private final ListeningExecutorService executorService = MoreExecutors.listeningDecorator(
|
||||
EvenMoreExecutors.newBoundedCachedThreadPool(0, 1, 20, "WorldEdit Task Executor - %s"));
|
||||
private final Supervisor supervisor = new SimpleSupervisor();
|
||||
private final TranslationManager translationManager = new TranslationManager(this);
|
||||
|
||||
private final BlockFactory blockFactory = new BlockFactory(this);
|
||||
private final ItemFactory itemFactory = new ItemFactory(this);
|
||||
@ -224,6 +229,15 @@ public final class WorldEdit {
|
||||
return sessions;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the translation manager.
|
||||
*
|
||||
* @return the translation manager
|
||||
*/
|
||||
public TranslationManager getTranslationManager() {
|
||||
return translationManager;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the path to a file. This method will check to see if the filename
|
||||
* has valid characters and has an extension. It also prevents directory
|
||||
@ -631,7 +645,7 @@ public final class WorldEdit {
|
||||
* @param player the player
|
||||
* @param f the script file to execute
|
||||
* @param args arguments for the script
|
||||
* @throws WorldEditException
|
||||
* @throws WorldEditException if something goes wrong
|
||||
*/
|
||||
public void runScript(Player player, File f, String[] args) throws WorldEditException {
|
||||
String filename = f.getPath();
|
||||
@ -639,7 +653,7 @@ public final class WorldEdit {
|
||||
String ext = filename.substring(index + 1);
|
||||
|
||||
if (!ext.equalsIgnoreCase("js")) {
|
||||
player.printError("Only .js scripts are currently supported");
|
||||
player.printError(TranslatableComponent.of("worldedit.script.unsupported"));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -652,7 +666,7 @@ public final class WorldEdit {
|
||||
file = WorldEdit.class.getResourceAsStream("craftscripts/" + filename);
|
||||
|
||||
if (file == null) {
|
||||
player.printError("Script does not exist: " + filename);
|
||||
player.printError(TranslatableComponent.of("worldedit.script.file-not-found", TextComponent.of(filename)));
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
@ -665,7 +679,7 @@ public final class WorldEdit {
|
||||
in.close();
|
||||
script = new String(data, 0, data.length, StandardCharsets.UTF_8);
|
||||
} catch (IOException e) {
|
||||
player.printError("Script read error: " + e.getMessage());
|
||||
player.printError(TranslatableComponent.of("worldedit.script.read-error", TextComponent.of(e.getMessage())));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -678,8 +692,7 @@ public final class WorldEdit {
|
||||
try {
|
||||
engine = new RhinoCraftScriptEngine();
|
||||
} catch (NoClassDefFoundError ignored) {
|
||||
player.printError("Failed to find an installed script engine.");
|
||||
player.printError("Please see https://worldedit.enginehub.org/en/latest/usage/other/craftscripts/");
|
||||
player.printError(TranslatableComponent.of("worldedit.script.no-script-engine"));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -693,14 +706,13 @@ public final class WorldEdit {
|
||||
try {
|
||||
engine.evaluate(script, filename, vars);
|
||||
} catch (ScriptException e) {
|
||||
player.printError("Failed to execute:");
|
||||
player.printRaw(e.getMessage());
|
||||
player.printError(TranslatableComponent.of("worldedit.script.failed", TextComponent.of(e.getMessage(), TextColor.WHITE)));
|
||||
logger.warn("Failed to execute script", e);
|
||||
} catch (NumberFormatException | WorldEditException e) {
|
||||
throw e;
|
||||
} catch (Throwable e) {
|
||||
player.printError("Failed to execute (see console):");
|
||||
player.printRaw(e.getClass().getCanonicalName());
|
||||
player.printError(TranslatableComponent.of("worldedit.script.failed-console", TextComponent.of(e.getClass().getCanonicalName(),
|
||||
TextColor.WHITE)));
|
||||
logger.warn("Failed to execute script", e);
|
||||
} finally {
|
||||
for (EditSession editSession : scriptContext.getEditSessions()) {
|
||||
|
@ -61,19 +61,19 @@ import org.enginehub.piston.part.SubCommandPart;
|
||||
@CommandContainer(superTypes = CommandPermissionsConditionGenerator.Registration.class)
|
||||
public class ApplyBrushCommands {
|
||||
|
||||
private static final CommandArgument REGION_FACTORY = arg(TranslatableComponent.of("shape"), TextComponent.of("The shape of the region"))
|
||||
private static final CommandArgument REGION_FACTORY = arg(TranslatableComponent.of("shape") , TranslatableComponent.of("worldedit.brush.apply.shape"))
|
||||
.defaultsTo(ImmutableList.of())
|
||||
.ofTypes(ImmutableList.of(Key.of(RegionFactory.class)))
|
||||
.build();
|
||||
|
||||
private static final CommandArgument RADIUS = arg(TranslatableComponent.of("radius"), TextComponent.of("The size of the brush"))
|
||||
private static final CommandArgument RADIUS = arg(TranslatableComponent.of("radius") , TranslatableComponent.of("worldedit.brush.apply.radius"))
|
||||
.defaultsTo(ImmutableList.of("5"))
|
||||
.ofTypes(ImmutableList.of(Key.of(double.class)))
|
||||
.build();
|
||||
|
||||
public static void register(CommandManagerService service, CommandManager commandManager, CommandRegistrationHandler registration) {
|
||||
commandManager.register("apply", builder -> {
|
||||
builder.description(TextComponent.of("Apply brush, apply a function to every block"));
|
||||
builder.description(TranslatableComponent.of("worldedit.brush.apply.description"));
|
||||
builder.action(org.enginehub.piston.Command.Action.NULL_ACTION);
|
||||
|
||||
CommandManager manager = service.newCommandManager();
|
||||
@ -85,7 +85,7 @@ public class ApplyBrushCommands {
|
||||
|
||||
builder.condition(new PermissionCondition(ImmutableSet.of("worldedit.brush.apply")));
|
||||
builder.addParts(REGION_FACTORY, RADIUS);
|
||||
builder.addPart(SubCommandPart.builder(TranslatableComponent.of("type"), TextComponent.of("Type of brush to use"))
|
||||
builder.addPart(SubCommandPart.builder(TranslatableComponent.of("type") , TranslatableComponent.of("worldedit.brush.apply.type"))
|
||||
.withCommands(manager.getAllCommands().collect(Collectors.toList()))
|
||||
.required()
|
||||
.build());
|
||||
@ -125,8 +125,7 @@ public class ApplyBrushCommands {
|
||||
@Direction(includeDiagonals = true)
|
||||
com.sk89q.worldedit.util.Direction direction) throws WorldEditException {
|
||||
player.print(TextComponent.builder().append("WARNING: ", TextColor.RED, TextDecoration.BOLD)
|
||||
.append("This brush simulates item usages. Its effects may not work on all platforms, may not be undo-able," +
|
||||
" and may cause strange interactions with other mods/plugins. Use at your own risk.").build());
|
||||
.append(TranslatableComponent.of("worldedit.brush.apply.item.warning")).build());
|
||||
setApplyBrush(parameters, player, localSession, new ItemUseFactory(item, direction));
|
||||
}
|
||||
|
||||
|
@ -22,6 +22,7 @@ package com.sk89q.worldedit.command;
|
||||
import static com.sk89q.worldedit.command.util.Logging.LogMode.REGION;
|
||||
|
||||
import com.boydti.fawe.config.BBC;
|
||||
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
|
||||
import com.sk89q.worldedit.EditSession;
|
||||
import com.sk89q.worldedit.LocalSession;
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
@ -49,6 +50,11 @@ import com.sk89q.worldedit.regions.Region;
|
||||
import com.sk89q.worldedit.regions.Regions;
|
||||
import com.sk89q.worldedit.util.Location;
|
||||
import com.sk89q.worldedit.util.formatting.component.PaginationBox;
|
||||
import com.sk89q.worldedit.util.formatting.component.TextUtils;
|
||||
import com.sk89q.worldedit.util.formatting.text.Component;
|
||||
import com.sk89q.worldedit.util.formatting.text.TextComponent;
|
||||
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
|
||||
import com.sk89q.worldedit.util.formatting.text.event.HoverEvent;
|
||||
import com.sk89q.worldedit.world.World;
|
||||
import com.sk89q.worldedit.world.biome.BiomeData;
|
||||
import com.sk89q.worldedit.world.biome.BiomeType;
|
||||
@ -58,6 +64,7 @@ import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
import org.enginehub.piston.annotation.Command;
|
||||
import org.enginehub.piston.annotation.CommandContainer;
|
||||
import java.util.List;
|
||||
import org.enginehub.piston.annotation.param.Arg;
|
||||
import org.enginehub.piston.annotation.param.ArgFlag;
|
||||
import org.enginehub.piston.annotation.param.Switch;
|
||||
@ -101,7 +108,7 @@ public class BiomeCommands {
|
||||
})
|
||||
.collect(Collectors.toList()));
|
||||
return paginationBox.create(page);
|
||||
}, null);
|
||||
}, (Component) null);
|
||||
}
|
||||
|
||||
@Command(
|
||||
@ -118,24 +125,24 @@ public class BiomeCommands {
|
||||
BiomeRegistry biomeRegistry = WorldEdit.getInstance().getPlatformManager()
|
||||
.queryCapability(Capability.GAME_HOOKS).getRegistries().getBiomeRegistry();
|
||||
Set<BiomeType> biomes = new HashSet<>();
|
||||
String qualifier;
|
||||
String messageKey;
|
||||
|
||||
if (useLineOfSight) {
|
||||
Location blockPosition = player.getBlockTrace(300);
|
||||
if (blockPosition == null) {
|
||||
player.printError(BBC.NO_BLOCK.s());
|
||||
player.printError(TranslatableComponent.of("worldedit.raytrace.noblock"));
|
||||
return;
|
||||
}
|
||||
|
||||
BiomeType biome = player.getWorld().getBiome(blockPosition.toVector().toBlockPoint().toBlockVector2());
|
||||
biomes.add(biome);
|
||||
|
||||
qualifier = "at line of sight point";
|
||||
messageKey = "worldedit.biomeinfo.lineofsight";
|
||||
} else if (usePosition) {
|
||||
BiomeType biome = player.getWorld().getBiome(player.getLocation().toVector().toBlockPoint().toBlockVector2());
|
||||
biomes.add(biome);
|
||||
|
||||
qualifier = "at your position";
|
||||
messageKey = "worldedit.biomeinfo.position";
|
||||
} else {
|
||||
World world = player.getWorld();
|
||||
Region region = session.getSelection(world);
|
||||
@ -150,19 +157,18 @@ public class BiomeCommands {
|
||||
}
|
||||
}
|
||||
|
||||
qualifier = "in your selection";
|
||||
messageKey = "worldedit.biomeinfo.selection";
|
||||
}
|
||||
|
||||
BBC.BIOME_LIST_HEADER.send(player, 1, 1);
|
||||
player.print(biomes.size() != 1 ? "Biomes " + qualifier + ":" : "Biome " + qualifier + ":");
|
||||
for (BiomeType biome : biomes) {
|
||||
List<Component> components = biomes.stream().map(biome -> {
|
||||
BiomeData data = biomeRegistry.getData(biome);
|
||||
if (data != null) {
|
||||
player.print(" " + data.getName());
|
||||
return TextComponent.of(data.getName()).hoverEvent(HoverEvent.showText(TextComponent.of(biome.getId())));
|
||||
} else {
|
||||
player.print(" <unknown #" + biome.getId() + ">");
|
||||
return TextComponent.of(biome.getId());
|
||||
}
|
||||
}
|
||||
}).collect(Collectors.toList());
|
||||
player.printInfo(TranslatableComponent.of(messageKey, TextUtils.join(components, TextComponent.of(", "))));
|
||||
}
|
||||
|
||||
@Command(
|
||||
@ -195,9 +201,13 @@ public class BiomeCommands {
|
||||
FlatRegionVisitor visitor = new FlatRegionVisitor(Regions.asFlatRegion(region), replace);
|
||||
Operations.completeLegacy(visitor);
|
||||
|
||||
BBC.BIOME_CHANGED.send(player, visitor.getAffected());
|
||||
player.printInfo(TranslatableComponent.of(
|
||||
"worldedit.setbiome.changed",
|
||||
TextComponent.of(visitor.getAffected())
|
||||
));
|
||||
if (!player.hasPermission("fawe.tips")) {
|
||||
BBC.TIP_BIOME_PATTERN.or(BBC.TIP_BIOME_MASK).send(player);
|
||||
System.out.println("TODO FIXME tips");
|
||||
// TranslatableComponent.of("fawe.tips.tip.biome.pattern").or(TranslatableComponent.of("fawe.tips.tip.biome.mask")).send(player);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -21,6 +21,7 @@ package com.sk89q.worldedit.command;
|
||||
|
||||
import com.boydti.fawe.Fawe;
|
||||
import com.boydti.fawe.config.BBC;
|
||||
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
|
||||
import com.boydti.fawe.config.Settings;
|
||||
import com.boydti.fawe.object.FaweLimit;
|
||||
import com.boydti.fawe.object.brush.BlendBall;
|
||||
@ -124,6 +125,8 @@ import java.net.URI;
|
||||
import java.nio.file.FileSystems;
|
||||
import java.util.List;
|
||||
import java.util.zip.GZIPInputStream;
|
||||
import com.sk89q.worldedit.util.formatting.text.TextComponent;
|
||||
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
|
||||
import org.enginehub.piston.annotation.Command;
|
||||
import com.sk89q.worldedit.function.factory.Apply;
|
||||
import org.enginehub.piston.annotation.CommandContainer;
|
||||
@ -270,7 +273,7 @@ public class BrushCommands {
|
||||
@Arg(desc = "The radius to sample for blending", def = "25")
|
||||
Expression radius) throws WorldEditException {
|
||||
worldEdit.checkMaxBrushRadius(radius);
|
||||
player.print(BBC.BRUSH_SPLINE.format(radius));
|
||||
player.print(TranslatableComponent.of("fawe.worldedit.brush.brush.spline", (radius)));
|
||||
set(context,
|
||||
new SplineBrush(player))
|
||||
.setSize(radius)
|
||||
@ -288,7 +291,7 @@ public class BrushCommands {
|
||||
@CommandPermissions("worldedit.brush.sweep")
|
||||
public void sweepBrush(Player player, InjectedValueAccess context,
|
||||
@Arg(desc = "int", def = "-1") int copies) throws WorldEditException {
|
||||
player.print(BBC.BRUSH_SPLINE.s());
|
||||
player.print(TranslatableComponent.of("fawe.worldedit.brush.brush.spline"));
|
||||
set(context, new SweepBrush(copies));
|
||||
}
|
||||
|
||||
@ -331,7 +334,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(BBC.BRUSH_SPLINE.format(radius));
|
||||
player.print(TranslatableComponent.of("fawe.worldedit.brush.brush.spline", (radius)));
|
||||
worldEdit.checkMaxBrushRadius(radius);
|
||||
set(context,
|
||||
new SurfaceSpline(tension, bias, continuity, quality))
|
||||
@ -386,7 +389,7 @@ public class BrushCommands {
|
||||
switch (type.getInternalId()) {
|
||||
case BlockID.SAND:
|
||||
case BlockID.GRAVEL:
|
||||
player.print(BBC.BRUSH_TRY_OTHER.s());
|
||||
player.print(TranslatableComponent.of("fawe.worldedit.brush.brush.try.other"));
|
||||
falling = true;
|
||||
}
|
||||
}
|
||||
@ -537,12 +540,12 @@ public class BrushCommands {
|
||||
try {
|
||||
MultiClipboardHolder clipboards = ClipboardFormats.loadAllFromInput(player, clipboardStr, null, true);
|
||||
if (clipboards == null) {
|
||||
BBC.SCHEMATIC_NOT_FOUND.send(player, clipboardStr);
|
||||
player.print(TranslatableComponent.of("fawe.error.schematic.not.found" , clipboardStr));
|
||||
return;
|
||||
}
|
||||
List<ClipboardHolder> holders = clipboards.getHolders();
|
||||
if (holders == null) {
|
||||
BBC.SCHEMATIC_NOT_FOUND.send(player, clipboardStr);
|
||||
player.print(TranslatableComponent.of("fawe.error.schematic.not.found" , clipboardStr));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -843,7 +846,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(BBC.BRUSH_COPY.format(radius));
|
||||
player.print(TranslatableComponent.of("fawe.worldedit.brush.brush.copy", (radius)));
|
||||
|
||||
set(context,
|
||||
new CopyPastaBrush(player, session, randomRotate, autoRotate))
|
||||
@ -918,7 +921,7 @@ public class BrushCommands {
|
||||
tool.setPrimary(settings);
|
||||
tool.setSecondary(settings);
|
||||
|
||||
BBC.BRUSH_EQUIPPED.send(player, arguments.get().split(" ")[1]);
|
||||
player.print(TranslatableComponent.of("fawe.worldedit.brush.brush.equipped" , arguments.get().split(" ")[1]));
|
||||
}
|
||||
return settings;
|
||||
}
|
||||
@ -981,9 +984,9 @@ public class BrushCommands {
|
||||
} catch (Throwable e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
BBC.SCHEMATIC_SAVED.send(player, name);
|
||||
player.print(TranslatableComponent.of("fawe.worldedit.schematic.schematic.saved" , name));
|
||||
} else {
|
||||
player.printError(BBC.BRUSH_NONE.s());
|
||||
player.printError(TranslatableComponent.of("fawe.worldedit.brush.brush.none"));
|
||||
}
|
||||
}
|
||||
|
||||
@ -1004,7 +1007,7 @@ public class BrushCommands {
|
||||
}
|
||||
if (!file.exists()) {
|
||||
File[] files = folder.listFiles(pathname -> false);
|
||||
BBC.BRUSH_NOT_FOUND.send(player, name);
|
||||
player.print(TranslatableComponent.of("fawe.error.brush.not.found" , name));
|
||||
return;
|
||||
}
|
||||
try (DataInputStream in = new DataInputStream(
|
||||
@ -1013,10 +1016,10 @@ public class BrushCommands {
|
||||
BrushTool tool = BrushTool.fromString(player, session, json);
|
||||
BaseItem item = player.getItemInHand(HandSide.MAIN_HAND);
|
||||
session.setTool(item, tool, player);
|
||||
BBC.BRUSH_EQUIPPED.send(player, name);
|
||||
player.print(TranslatableComponent.of("fawe.worldedit.brush.brush.equipped" , name));
|
||||
} catch (Throwable e) {
|
||||
e.printStackTrace();
|
||||
player.printError(BBC.BRUSH_INCOMPATIBLE.s());
|
||||
player.printError(TranslatableComponent.of("fawe.error.brush.incompatible"));
|
||||
}
|
||||
}
|
||||
|
||||
@ -1147,6 +1150,6 @@ public class BrushCommands {
|
||||
tool.setFill(null);
|
||||
tool.setBrush(new OperationFactoryBrush(factory, shape, session), permission);
|
||||
|
||||
player.print("Set brush to " + factory);
|
||||
player.printInfo(TranslatableComponent.of("worldedit.brush.operation.equip", TextComponent.of(factory.toString())));
|
||||
}
|
||||
}
|
||||
|
@ -40,6 +40,7 @@ import com.sk89q.worldedit.util.formatting.component.PaginationBox;
|
||||
import com.sk89q.worldedit.command.util.WorldEditAsyncCommandBuilder;
|
||||
import com.sk89q.worldedit.util.formatting.text.Component;
|
||||
import com.sk89q.worldedit.util.formatting.text.TextComponent;
|
||||
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
|
||||
import com.sk89q.worldedit.util.formatting.text.event.ClickEvent;
|
||||
import com.sk89q.worldedit.util.formatting.text.format.TextColor;
|
||||
import com.sk89q.worldedit.world.World;
|
||||
@ -85,9 +86,9 @@ public class ChunkCommands {
|
||||
int chunkZ = (int) Math.floor(pos.getBlockZ() / 16.0);
|
||||
|
||||
final BlockVector2 chunkPos = BlockVector2.at(chunkX, chunkZ);
|
||||
player.print("Chunk: " + chunkX + ", " + chunkZ);
|
||||
player.print("Old format: " + LegacyChunkStore.getFilename(chunkPos));
|
||||
player.print("McRegion: region/" + McRegionChunkStore.getFilename(chunkPos));
|
||||
player.printInfo(TranslatableComponent.of("worldedit.chunkinfo.chunk", TextComponent.of(chunkX), TextComponent.of(chunkZ)));
|
||||
player.printInfo(TranslatableComponent.of("worldedit.chunkinfo.old-filename", TextComponent.of(LegacyChunkStore.getFilename(chunkPos))));
|
||||
player.printInfo(TranslatableComponent.of("worldedit.chunkinfo.mcregion-filename", TextComponent.of(McRegionChunkStore.getFilename(chunkPos))));
|
||||
}
|
||||
|
||||
@Command(
|
||||
@ -99,7 +100,7 @@ public class ChunkCommands {
|
||||
@ArgFlag(name = 'p', desc = "Page number.", def = "1") int page) throws WorldEditException {
|
||||
final Region region = session.getSelection(world);
|
||||
|
||||
actor.print("Listing chunks for " + actor.getName());
|
||||
actor.print(TranslatableComponent.of("worldedit.listchunks.listfor", TextComponent.of(actor.getName())));
|
||||
actor.print(new ChunkListPaginationBox(region).create(page));
|
||||
}
|
||||
|
||||
@ -166,7 +167,7 @@ public class ChunkCommands {
|
||||
actor.printDebug(String.format("%d chunks total marked for deletion. (May have overlaps).",
|
||||
currentInfo.batches.stream().mapToInt(ChunkDeletionInfo.ChunkBatch::getChunkCount).sum()));
|
||||
}
|
||||
actor.print(TextComponent.of("You can mark more chunks for deletion, or to stop now, run: ", TextColor.LIGHT_PURPLE)
|
||||
actor.print(TextComponent.of("You can mark more chunks for deletion, or to stop now, run: ", TextColor.GRAY)
|
||||
.append(TextComponent.of("/stop", TextColor.AQUA)
|
||||
.clickEvent(ClickEvent.of(ClickEvent.Action.SUGGEST_COMMAND, "/stop"))));
|
||||
}
|
||||
|
@ -24,6 +24,7 @@ import com.google.common.collect.Lists;
|
||||
import com.boydti.fawe.FaweAPI;
|
||||
import com.boydti.fawe.FaweCache;
|
||||
import com.boydti.fawe.config.BBC;
|
||||
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
|
||||
import com.boydti.fawe.config.Settings;
|
||||
import com.boydti.fawe.object.FaweLimit;
|
||||
import com.boydti.fawe.object.RunnableVal;
|
||||
@ -73,7 +74,10 @@ import com.sk89q.worldedit.regions.Region;
|
||||
import com.sk89q.worldedit.regions.RegionSelector;
|
||||
import com.sk89q.worldedit.regions.selector.CuboidRegionSelector;
|
||||
import com.sk89q.worldedit.session.ClipboardHolder;
|
||||
import com.sk89q.worldedit.util.formatting.text.Component;
|
||||
import com.sk89q.worldedit.world.World;
|
||||
import com.sk89q.worldedit.util.formatting.text.TextComponent;
|
||||
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
|
||||
import org.enginehub.piston.annotation.Command;
|
||||
import org.enginehub.piston.annotation.CommandContainer;
|
||||
import org.enginehub.piston.annotation.param.Arg;
|
||||
@ -149,10 +153,11 @@ public class ClipboardCommands {
|
||||
copy.setSourceMask(mask);
|
||||
}
|
||||
Operations.completeLegacy(copy);
|
||||
BBC.COMMAND_COPY.send(actor, region.getArea());
|
||||
if (!actor.hasPermission("fawe.tips")) {
|
||||
BBC.TIP_PASTE.or(BBC.TIP_DOWNLOAD, BBC.TIP_ROTATE, BBC.TIP_COPYPASTE, BBC.TIP_REPLACE_MARKER, BBC.TIP_COPY_PATTERN).send(actor);
|
||||
System.out.println("TODO FIXME tips");
|
||||
// TranslatableComponent.of("fawe.tips.tip.paste").or(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);
|
||||
}
|
||||
copy.getStatusMessages().forEach(actor::print);
|
||||
}
|
||||
|
||||
@Command(
|
||||
@ -173,16 +178,17 @@ public class ClipboardCommands {
|
||||
long volume = (((long) max.getX() - (long) min.getX() + 1) * ((long) max.getY() - (long) min.getY() + 1) * ((long) max.getZ() - (long) min.getZ() + 1));
|
||||
FaweLimit limit = actor.getLimit();
|
||||
if (volume >= limit.MAX_CHECKS) {
|
||||
throw new FaweException(BBC.WORLDEDIT_CANCEL_REASON_MAX_CHECKS);
|
||||
throw new FaweException(TranslatableComponent.of("fawe.cancel.worldedit.cancel.reason.max.checks"));
|
||||
}
|
||||
session.setClipboard(null);
|
||||
ReadOnlyClipboard lazyClipboard = ReadOnlyClipboard.of(region, !skipEntities, copyBiomes);
|
||||
|
||||
lazyClipboard.setOrigin(session.getPlacementPosition(actor));
|
||||
session.setClipboard(new ClipboardHolder(lazyClipboard));
|
||||
BBC.COMMAND_COPY.send(actor, region.getArea());
|
||||
actor.print(TranslatableComponent.of("fawe.worldedit.copy.command.copy" , region.getArea()));
|
||||
if (!actor.hasPermission("fawe.tips")) {
|
||||
BBC.TIP_PASTE.or(BBC.TIP_LAZYCOPY, BBC.TIP_DOWNLOAD, BBC.TIP_ROTATE, BBC.TIP_COPYPASTE, BBC.TIP_REPLACE_MARKER, BBC.TIP_COPY_PATTERN).send(actor);
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
@ -214,7 +220,7 @@ public class ClipboardCommands {
|
||||
// ReadOnlyClipboard lazyClipboard = new WorldCutClipboard(editSession, region, !skipEntities, copyBiomes);
|
||||
// clipboard.setOrigin(session.getPlacementPosition(actor));
|
||||
// session.setClipboard(new ClipboardHolder(lazyClipboard));
|
||||
// BBC.COMMAND_CUT_LAZY.send(actor, region.getArea());
|
||||
// actor.print(TranslatableComponent.of("fawe.worldedit.cut.command.cut.lazy" , region.getArea()));
|
||||
// }
|
||||
|
||||
@Command(
|
||||
@ -269,10 +275,10 @@ public class ClipboardCommands {
|
||||
Operations.completeLegacy(copy);
|
||||
session.setClipboard(new ClipboardHolder(clipboard));
|
||||
|
||||
BBC.COMMAND_CUT_SLOW.send(actor, region.getArea());
|
||||
if (!actor.hasPermission("fawe.tips")) {
|
||||
BBC.TIP_LAZYCUT.send(actor);
|
||||
actor.print(TranslatableComponent.of("fawe.tips.tip.lazycut"));
|
||||
}
|
||||
copy.getStatusMessages().forEach(actor::print);
|
||||
}
|
||||
|
||||
@Command(
|
||||
@ -284,11 +290,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) {
|
||||
BBC.CLIPBOARD_INVALID_FORMAT.send(player, formatName);
|
||||
player.print(TranslatableComponent.of("fawe.worldedit.clipboard.clipboard.invalid.format" , formatName));
|
||||
return;
|
||||
}
|
||||
|
||||
BBC.GENERATING_LINK.send(player, formatName);
|
||||
player.print(TranslatableComponent.of("fawe.web.generating.link" , formatName));
|
||||
ClipboardHolder holder = session.getClipboard();
|
||||
|
||||
URL url;
|
||||
@ -357,14 +363,14 @@ public class ClipboardCommands {
|
||||
}
|
||||
} else {
|
||||
if (Settings.IMP.WEB.URL.isEmpty()) {
|
||||
BBC.SETTING_DISABLE.send(player, "web.url");
|
||||
player.print(TranslatableComponent.of("fawe.error.setting.disable", "web.url"));
|
||||
return;
|
||||
}
|
||||
url = FaweAPI.upload(target, format);
|
||||
}
|
||||
}
|
||||
if (url == null) {
|
||||
player.printError(BBC.GENERATING_LINK_FAILED.s());
|
||||
player.printError(TranslatableComponent.of("fawe.web.generating.link.failed"));
|
||||
} else {
|
||||
String urlText = url.toString();
|
||||
if (Settings.IMP.WEB.SHORTEN_URLS) {
|
||||
@ -374,7 +380,7 @@ public class ClipboardCommands {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
BBC.DOWNLOAD_LINK.send(player, urlText);
|
||||
player.print(TranslatableComponent.of("fawe.web.download.link" , urlText));
|
||||
}
|
||||
}
|
||||
|
||||
@ -398,16 +404,16 @@ public class ClipboardCommands {
|
||||
} else {
|
||||
target = clipboard;
|
||||
}
|
||||
BBC.GENERATING_LINK.send(player, format.getName());
|
||||
player.print(TranslatableComponent.of("fawe.web.generating.link" , format.getName()));
|
||||
if (Settings.IMP.WEB.ASSETS.isEmpty()) {
|
||||
BBC.SETTING_DISABLE.send(player, "web.assets");
|
||||
player.print(TranslatableComponent.of("fawe.error.setting.disable", "web.assets"));
|
||||
return;
|
||||
}
|
||||
URL url = format.uploadPublic(target, category.replaceAll("[/|\\\\]", "."), player.getName());
|
||||
if (url == null) {
|
||||
player.printError(BBC.GENERATING_LINK_FAILED.s());
|
||||
player.printError(TranslatableComponent.of("fawe.web.generating.link.failed"));
|
||||
} else {
|
||||
BBC.DOWNLOAD_LINK.send(player, Settings.IMP.WEB.ASSETS);
|
||||
player.print(TranslatableComponent.of("fawe.web.download.link" , Settings.IMP.WEB.ASSETS));
|
||||
}
|
||||
}
|
||||
|
||||
@ -443,7 +449,7 @@ public class ClipboardCommands {
|
||||
}
|
||||
Clipboard clipboard = holder.getClipboard();
|
||||
Region region = clipboard.getRegion();
|
||||
List<String> messages = Lists.newArrayList();
|
||||
List<Component> messages = Lists.newArrayList();
|
||||
|
||||
BlockVector3 to = atOrigin ? clipboard.getOrigin() : session.getPlacementPosition(actor);
|
||||
checkPaste(actor, editSession, to, holder, clipboard);
|
||||
@ -458,6 +464,7 @@ public class ClipboardCommands {
|
||||
.maskSource(sourceMask)
|
||||
.build();
|
||||
Operations.completeLegacy(operation);
|
||||
messages.addAll(Lists.newArrayList(operation.getStatusMessages()));
|
||||
}
|
||||
|
||||
if (selectPasted || onlySelect) {
|
||||
@ -469,9 +476,14 @@ public class ClipboardCommands {
|
||||
selector.learnChanges();
|
||||
selector.explainRegionAdjust(actor, session);
|
||||
}
|
||||
BBC.COMMAND_PASTE.send(actor, to);
|
||||
if (!actor.hasPermission("fawe.tips")) {
|
||||
BBC.TIP_COPYPASTE.or(BBC.TIP_SOURCE_MASK, BBC.TIP_REPLACE_MARKER).send(actor, to);
|
||||
System.out.println("TODO FIXME tips");
|
||||
// TranslatableComponent.of("fawe.tips.tip.copypaste").or(TranslatableComponent.of("fawe.tips.tip.source.mask"), TranslatableComponent.of("fawe.tips.tip.replace.marker")).send(actor, to);
|
||||
}
|
||||
if (onlySelect) {
|
||||
actor.printInfo(TranslatableComponent.of("worldedit.paste.selected"));
|
||||
} else {
|
||||
actor.printInfo(TranslatableComponent.of("worldedit.paste.pasted", TextComponent.of(to.toString())));
|
||||
}
|
||||
}
|
||||
|
||||
@ -483,7 +495,7 @@ public class ClipboardCommands {
|
||||
PasteEvent event = new PasteEvent(player, clipboard, uri, editSession, to);
|
||||
WorldEdit.getInstance().getEventBus().post(event);
|
||||
if (event.isCancelled()) {
|
||||
throw new FaweException(BBC.WORLDEDIT_CANCEL_REASON_MANUAL);
|
||||
throw new FaweException(TranslatableComponent.of("fawe.cancel.worldedit.cancel.reason.manual"));
|
||||
}
|
||||
}
|
||||
|
||||
@ -519,10 +531,10 @@ public class ClipboardCommands {
|
||||
selector.learnChanges();
|
||||
selector.explainRegionAdjust(actor, session);
|
||||
}
|
||||
BBC.COMMAND_PASTE.send(actor, to);
|
||||
actor.print(TranslatableComponent.of("fawe.worldedit.paste.command.paste" , to));
|
||||
|
||||
if (!actor.hasPermission("fawe.tips")) {
|
||||
actor.print(BBC.TIP_COPYPASTE.s());
|
||||
actor.print(TranslatableComponent.of("fawe.tips.tip.copypaste"));
|
||||
}
|
||||
}
|
||||
|
||||
@ -548,9 +560,10 @@ public class ClipboardCommands {
|
||||
transform = transform.rotateX(-xRotate);
|
||||
transform = transform.rotateZ(-zRotate);
|
||||
holder.setTransform(holder.getTransform().combine(transform));
|
||||
actor.print(BBC.COMMAND_ROTATE.s());
|
||||
actor.printInfo(TranslatableComponent.of("worldedit.rotate.rotated"));
|
||||
if (!actor.hasPermission("fawe.tips")) {
|
||||
BBC.TIP_FLIP.or(BBC.TIP_DEFORM, BBC.TIP_TRANSFORM).send(actor);
|
||||
System.out.println("TODO FIXME tips");
|
||||
// TranslatableComponent.of("fawe.tips.tip.flip").or(TranslatableComponent.of("fawe.tips.tip.deform"), TranslatableComponent.of("fawe.tips.tip.transform")).send(actor);
|
||||
}
|
||||
}
|
||||
|
||||
@ -567,7 +580,7 @@ public class ClipboardCommands {
|
||||
AffineTransform transform = new AffineTransform();
|
||||
transform = transform.scale(direction.abs().multiply(-2).add(1, 1, 1).toVector3());
|
||||
holder.setTransform(holder.getTransform().combine(transform));
|
||||
actor.print("The clipboard copy has been flipped.");
|
||||
actor.printInfo(TranslatableComponent.of("worldedit.flip.flipped"));
|
||||
}
|
||||
|
||||
@Command(
|
||||
@ -577,6 +590,6 @@ public class ClipboardCommands {
|
||||
@CommandPermissions("worldedit.clipboard.clear")
|
||||
public void clearClipboard(Actor actor, LocalSession session) throws WorldEditException {
|
||||
session.setClipboard(null);
|
||||
actor.print("Clipboard cleared.");
|
||||
actor.printInfo(TranslatableComponent.of("worldedit.clearclipboard.cleared"));
|
||||
}
|
||||
}
|
||||
|
@ -89,7 +89,7 @@ public class ExpandCommands {
|
||||
|
||||
private static Command createVertCommand(CommandManager commandManager) {
|
||||
return commandManager.newCommand("vert")
|
||||
.description(TextComponent.of("Vertically expand the selection to world limits."))
|
||||
.description(TranslatableComponent.of("worldedit.expand.description.vert"))
|
||||
.action(parameters -> {
|
||||
expandVert(
|
||||
requireIV(Key.of(LocalSession.class), "localSession", parameters),
|
||||
@ -110,10 +110,12 @@ public class ExpandCommands {
|
||||
session.getRegionSelector(player.getWorld()).learnChanges();
|
||||
int newSize = region.getArea();
|
||||
session.getRegionSelector(player.getWorld()).explainRegionAdjust(player, session);
|
||||
player.print("Region expanded " + (newSize - oldSize)
|
||||
+ " blocks [top-to-bottom].");
|
||||
int changeSize = newSize - oldSize;
|
||||
player.printInfo(
|
||||
TranslatableComponent.of("worldedit.expand.expanded.vert", TextComponent.of(changeSize))
|
||||
);
|
||||
} catch (RegionOperationException e) {
|
||||
player.printError(e.getMessage());
|
||||
player.printError(TextComponent.of(e.getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
@ -148,7 +150,8 @@ public class ExpandCommands {
|
||||
|
||||
session.getRegionSelector(world).explainRegionAdjust(actor, session);
|
||||
|
||||
actor.print("Region expanded " + (newSize - oldSize) + " block(s).");
|
||||
int changeSize = newSize - oldSize;
|
||||
actor.printInfo(TranslatableComponent.of("worldedit.expand.expanded", TextComponent.of(changeSize)));
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -19,8 +19,11 @@
|
||||
|
||||
package com.sk89q.worldedit.command;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import com.boydti.fawe.Fawe;
|
||||
import com.boydti.fawe.config.BBC;
|
||||
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
|
||||
import com.boydti.fawe.object.extent.ResettableExtent;
|
||||
import com.boydti.fawe.util.CachedTextureUtil;
|
||||
import com.boydti.fawe.util.CleanTextureUtil;
|
||||
@ -48,6 +51,9 @@ import com.sk89q.worldedit.extent.clipboard.Clipboard;
|
||||
import com.sk89q.worldedit.extension.platform.Capability;
|
||||
import com.sk89q.worldedit.function.mask.Mask;
|
||||
import com.sk89q.worldedit.util.formatting.component.PaginationBox;
|
||||
import com.sk89q.worldedit.util.formatting.text.TextComponent;
|
||||
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
|
||||
import com.sk89q.worldedit.util.formatting.text.format.TextColor;
|
||||
import com.sk89q.worldedit.util.formatting.text.Component;
|
||||
import com.sk89q.worldedit.world.World;
|
||||
import com.sk89q.worldedit.world.item.ItemType;
|
||||
@ -63,8 +69,6 @@ import org.enginehub.piston.annotation.param.Arg;
|
||||
import org.enginehub.piston.annotation.param.ArgFlag;
|
||||
import org.enginehub.piston.annotation.param.Switch;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
/**
|
||||
* General WorldEdit commands.
|
||||
*/
|
||||
@ -98,14 +102,17 @@ public class GeneralCommands {
|
||||
limit = limit == null ? config.defaultChangeLimit : Math.max(-1, limit);
|
||||
if (!mayDisable && config.maxChangeLimit > -1) {
|
||||
if (limit > config.maxChangeLimit) {
|
||||
actor.printError("Your maximum allowable limit is " + config.maxChangeLimit + ".");
|
||||
actor.printError(TranslatableComponent.of("worldedit.limit.too-high", TextComponent.of(config.maxChangeLimit)));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
session.setBlockChangeLimit(limit);
|
||||
actor.print("Block change limit set to " + limit + "."
|
||||
+ (limit == config.defaultChangeLimit ? "" : " (Use //limit to go back to the default.)"));
|
||||
Component component = TextComponent.empty().append(TranslatableComponent.of("worldedit.limit.set", TextComponent.of(limit)));
|
||||
if (limit != config.defaultChangeLimit) {
|
||||
component.append(TextComponent.space()).append(TranslatableComponent.of("worldedit.limit.return-to-default", TextColor.GRAY));
|
||||
}
|
||||
actor.printInfo(component);
|
||||
}
|
||||
|
||||
@Command(
|
||||
@ -122,14 +129,17 @@ public class GeneralCommands {
|
||||
limit = limit == null ? config.calculationTimeout : Math.max(-1, limit);
|
||||
if (!mayDisable && config.maxCalculationTimeout > -1) {
|
||||
if (limit > config.maxCalculationTimeout) {
|
||||
actor.printError("Your maximum allowable timeout is " + config.maxCalculationTimeout + " ms.");
|
||||
actor.printError(TranslatableComponent.of("worldedit.timeout.too-high", TextComponent.of(config.maxCalculationTimeout)));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
session.setTimeout(limit);
|
||||
actor.print("Timeout time set to " + limit + " ms."
|
||||
+ (limit == config.calculationTimeout ? "" : " (Use //timeout to go back to the default.)"));
|
||||
Component component = TextComponent.empty().append(TranslatableComponent.of("worldedit.timeout.set", TextComponent.of(limit)));
|
||||
if (limit != config.calculationTimeout) {
|
||||
component.append(TranslatableComponent.of("worldedit.timeout.return-to-default", TextColor.GRAY));
|
||||
}
|
||||
actor.printInfo(component);
|
||||
}
|
||||
|
||||
@Command(
|
||||
@ -142,16 +152,16 @@ public class GeneralCommands {
|
||||
Boolean fastMode) {
|
||||
boolean hasFastMode = session.hasFastMode();
|
||||
if (fastMode != null && fastMode == hasFastMode) {
|
||||
actor.printError("Fast mode already " + (fastMode ? "enabled" : "disabled") + ".");
|
||||
actor.printError(TranslatableComponent.of(fastMode ? "worldedit.fast.enabled.already" : "worldedit.fast.disabled.already"));
|
||||
return;
|
||||
}
|
||||
|
||||
if (hasFastMode) {
|
||||
session.setFastMode(false);
|
||||
actor.print("Fast mode disabled.");
|
||||
actor.printInfo(TranslatableComponent.of("worldedit.fast.disabled"));
|
||||
} else {
|
||||
session.setFastMode(true);
|
||||
actor.print("Fast mode enabled. Lighting in the affected chunks may be wrong and/or you may need to rejoin to see changes.");
|
||||
actor.printInfo(TranslatableComponent.of("worldedit.fast.enabled"));
|
||||
}
|
||||
}
|
||||
|
||||
@ -164,10 +174,10 @@ public class GeneralCommands {
|
||||
@Arg(desc = "The reorder mode", def = "")
|
||||
EditSession.ReorderMode reorderMode) {
|
||||
if (reorderMode == null) {
|
||||
actor.print("The reorder mode is " + session.getReorderMode().getDisplayName());
|
||||
actor.printInfo(TranslatableComponent.of("worldedit.reorder.current", TextComponent.of(session.getReorderMode().getDisplayName())));
|
||||
} else {
|
||||
session.setReorderMode(reorderMode);
|
||||
actor.print("The reorder mode is now " + session.getReorderMode().getDisplayName());
|
||||
actor.printInfo(TranslatableComponent.of("worldedit.reorder.set", TextComponent.of(session.getReorderMode().getDisplayName())));
|
||||
}
|
||||
}
|
||||
|
||||
@ -184,17 +194,18 @@ public class GeneralCommands {
|
||||
}
|
||||
boolean useServerCui = session.shouldUseServerCUI();
|
||||
if (drawSelection != null && drawSelection == useServerCui) {
|
||||
player.printError("Server CUI already " + (useServerCui ? "enabled" : "disabled") + ".");
|
||||
player.printError(TranslatableComponent.of("worldedit.drawsel." + (useServerCui ? "enabled" : "disabled") + ".already"));
|
||||
|
||||
return;
|
||||
}
|
||||
if (useServerCui) {
|
||||
session.setUseServerCUI(false);
|
||||
session.updateServerCUI(player);
|
||||
player.print("Server CUI disabled.");
|
||||
player.printInfo(TranslatableComponent.of("worldedit.drawsel.disabled"));
|
||||
} else {
|
||||
session.setUseServerCUI(true);
|
||||
session.updateServerCUI(player);
|
||||
player.print("Server CUI enabled. This only supports cuboid regions, with a maximum size of 32x32x32.");
|
||||
player.printInfo(TranslatableComponent.of("worldedit.drawsel.enabled"));
|
||||
}
|
||||
}
|
||||
|
||||
@ -207,9 +218,9 @@ public class GeneralCommands {
|
||||
@Arg(desc = "The world override", def = "") World world) {
|
||||
session.setWorldOverride(world);
|
||||
if (world == null) {
|
||||
actor.print("Removed world override.");
|
||||
actor.printInfo(TranslatableComponent.of("worldedit.world.remove"));
|
||||
} else {
|
||||
actor.print("Set the world override to " + world.getId() + ". (Use //world to go back to default)");
|
||||
actor.printInfo(TranslatableComponent.of("worldedit.world.set", TextComponent.of(world.getId())));
|
||||
}
|
||||
}
|
||||
|
||||
@ -224,16 +235,16 @@ public class GeneralCommands {
|
||||
@Arg(desc = "The mode to set the watchdog hook to", def = "")
|
||||
HookMode hookMode) {
|
||||
if (WorldEdit.getInstance().getPlatformManager().queryCapability(Capability.GAME_HOOKS).getWatchdog() == null) {
|
||||
actor.printError("This platform has no watchdog hook.");
|
||||
actor.printError(TranslatableComponent.of("worldedit.watchdog.no-hook"));
|
||||
return;
|
||||
}
|
||||
boolean previousMode = session.isTickingWatchdog();
|
||||
if (hookMode != null && (hookMode == HookMode.ACTIVE) == previousMode) {
|
||||
actor.printError("Watchdog hook already " + (previousMode ? "active" : "inactive") + ".");
|
||||
actor.printError(TranslatableComponent.of(previousMode ? "worldedit.watchdog.active.already" : "worldedit.watchdog.inactive.already"));
|
||||
return;
|
||||
}
|
||||
session.setTickingWatchdog(!previousMode);
|
||||
actor.print("Watchdog hook now " + (previousMode ? "inactive" : "active") + ".");
|
||||
actor.printInfo(TranslatableComponent.of(previousMode ? "worldedit.watchdog.inactive" : "worldedit.watchdog.active"));
|
||||
}
|
||||
|
||||
@Command(
|
||||
@ -247,10 +258,10 @@ public class GeneralCommands {
|
||||
Mask mask) {
|
||||
if (mask == null) {
|
||||
session.setMask(null);
|
||||
actor.print("Global mask disabled.");
|
||||
actor.printInfo(TranslatableComponent.of("worldedit.gmask.disabled"));
|
||||
} else {
|
||||
session.setMask(mask);
|
||||
actor.print("Global mask set.");
|
||||
actor.printInfo(TranslatableComponent.of("worldedit.gmask.set"));
|
||||
}
|
||||
}
|
||||
|
||||
@ -261,9 +272,9 @@ public class GeneralCommands {
|
||||
)
|
||||
public void togglePlace(Player player, LocalSession session) {
|
||||
if (session.togglePlacementPosition()) {
|
||||
player.print(BBC.PLACE_ENABLED.s());
|
||||
player.printInfo(TranslatableComponent.of("worldedit.toggleplace.pos1"));
|
||||
} else {
|
||||
player.print(BBC.PLACE_DISABLED.s());
|
||||
player.printInfo(TranslatableComponent.of("worldedit.toggleplace.player"));
|
||||
}
|
||||
}
|
||||
|
||||
@ -284,11 +295,11 @@ public class GeneralCommands {
|
||||
List<String> query) throws Exception {
|
||||
String search = String.join(" ", query);
|
||||
if (search.length() <= 2) {
|
||||
actor.printError("Enter a longer search string (len > 2).");
|
||||
actor.printError(TranslatableComponent.of("worldedit.searchitem.too-short"));
|
||||
return;
|
||||
}
|
||||
if (blocksOnly && itemsOnly) {
|
||||
actor.printError("You cannot use both the 'b' and 'i' flags simultaneously.");
|
||||
actor.printError(TranslatableComponent.of("worldedit.searchitem.either-b-or-i"));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -347,7 +358,7 @@ public class GeneralCommands {
|
||||
// TODO NOT IMPLEMENTED convert this to an ArgumentConverter
|
||||
if (arguments.isEmpty()) {
|
||||
session.setTextureUtil(null);
|
||||
player.print(BBC.TEXTURE_DISABLED.s());
|
||||
player.print(TranslatableComponent.of("fawe.worldedit.general.texture.disabled"));
|
||||
} else {
|
||||
String arg = arguments.get(0);
|
||||
String argLower = arg.toLowerCase(Locale.ROOT);
|
||||
@ -390,7 +401,7 @@ public class GeneralCommands {
|
||||
}
|
||||
if (!(util instanceof CachedTextureUtil)) util = new CachedTextureUtil(util);
|
||||
session.setTextureUtil(util);
|
||||
BBC.TEXTURE_SET.send(player, StringMan.join(arguments, " "));
|
||||
player.print(TranslatableComponent.of("fawe.worldedit.general.texture.set" , StringMan.join(arguments, " ")));
|
||||
}
|
||||
}
|
||||
|
||||
@ -404,9 +415,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(BBC.SOURCE_MASK_DISABLED.s());
|
||||
player.print(TranslatableComponent.of("fawe.worldedit.general.source.mask.disabled"));
|
||||
} else {
|
||||
player.print(BBC.SOURCE_MASK.s());
|
||||
player.print(TranslatableComponent.of("fawe.worldedit.general.source.mask"));
|
||||
}
|
||||
}
|
||||
|
||||
@ -420,9 +431,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(BBC.TRANSFORM_DISABLED.s());
|
||||
player.print(TranslatableComponent.of("fawe.worldedit.general.transform.disabled"));
|
||||
} else {
|
||||
player.print(BBC.TRANSFORM.s());
|
||||
player.print(TranslatableComponent.of("fawe.worldedit.general.transform"));
|
||||
}
|
||||
}
|
||||
|
||||
@ -434,9 +445,9 @@ public class GeneralCommands {
|
||||
@CommandPermissions("fawe.tips")
|
||||
public void tips(Player player, LocalSession session) throws WorldEditException {
|
||||
if (player.togglePermission("fawe.tips")) {
|
||||
player.print(BBC.WORLDEDIT_TOGGLE_TIPS_ON.s());
|
||||
player.print(TranslatableComponent.of("fawe.info.worldedit.toggle.tips.on"));
|
||||
} else {
|
||||
player.print(BBC.WORLDEDIT_TOGGLE_TIPS_OFF.s());
|
||||
player.print(TranslatableComponent.of("fawe.info.worldedit.toggle.tips.off"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -26,6 +26,7 @@ import static com.sk89q.worldedit.internal.command.CommandUtil.checkCommandArgum
|
||||
|
||||
import com.boydti.fawe.Fawe;
|
||||
import com.boydti.fawe.config.BBC;
|
||||
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
|
||||
import com.boydti.fawe.util.MainUtil;
|
||||
import com.boydti.fawe.util.MathMan;
|
||||
import com.boydti.fawe.util.TextureUtil;
|
||||
@ -53,10 +54,12 @@ import com.sk89q.worldedit.math.BlockVector2;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.math.Vector3;
|
||||
import com.sk89q.worldedit.regions.CuboidRegion;
|
||||
import com.sk89q.worldedit.util.formatting.text.TextComponent;
|
||||
import com.sk89q.worldedit.regions.Region;
|
||||
import com.sk89q.worldedit.util.TreeGenerator.TreeType;
|
||||
import com.sk89q.worldedit.world.biome.BiomeType;
|
||||
import com.sk89q.worldedit.world.block.BlockType;
|
||||
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
|
||||
import java.awt.RenderingHints;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.io.IOException;
|
||||
@ -108,7 +111,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);
|
||||
BBC.VISITOR_BLOCK.send(actor, editSession.getBlockChangeCount());
|
||||
actor.print(TranslatableComponent.of("fawe.worldedit.visitor.visitor.block" , editSession.getBlockChangeCount()));
|
||||
}
|
||||
|
||||
|
||||
@ -121,7 +124,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);
|
||||
BBC.VISITOR_BLOCK.send(actor, editSession.getBlockChangeCount());
|
||||
actor.print(TranslatableComponent.of("fawe.worldedit.visitor.visitor.block" , editSession.getBlockChangeCount()));
|
||||
}
|
||||
|
||||
@Command(
|
||||
@ -162,7 +165,7 @@ public class GenerationCommands {
|
||||
return false;
|
||||
});
|
||||
Operations.completeBlindly(visitor);
|
||||
BBC.VISITOR_BLOCK.send(actor, editSession.getBlockChangeCount());
|
||||
actor.print(TranslatableComponent.of("fawe.worldedit.visitor.visitor.block" , editSession.getBlockChangeCount()));
|
||||
}
|
||||
|
||||
@Command(
|
||||
@ -174,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);
|
||||
BBC.VISITOR_BLOCK.send(actor, editSession.getBlockChangeCount());
|
||||
actor.print(TranslatableComponent.of("fawe.worldedit.visitor.visitor.block" , editSession.getBlockChangeCount()));
|
||||
}
|
||||
|
||||
@Command(
|
||||
@ -211,7 +214,7 @@ public class GenerationCommands {
|
||||
worldEdit.checkMaxRadius(max);
|
||||
BlockVector3 pos = session.getPlacementPosition(actor);
|
||||
int affected = editSession.makeCylinder(pos, pattern, radius.getX(), radius.getZ(), Math.min(256, height), !hollow);
|
||||
BBC.VISITOR_BLOCK.send(actor, affected);
|
||||
actor.printInfo(TranslatableComponent.of("worldedit.cyl.created", TextComponent.of(affected)));
|
||||
}
|
||||
|
||||
@Command(
|
||||
@ -252,7 +255,7 @@ public class GenerationCommands {
|
||||
if (actor instanceof Player) {
|
||||
((Player) actor).findFreePosition();
|
||||
}
|
||||
BBC.VISITOR_BLOCK.send(actor, affected);
|
||||
actor.printInfo(TranslatableComponent.of("worldedit.sphere.created", TextComponent.of(affected)));
|
||||
}
|
||||
|
||||
@Command(
|
||||
@ -272,7 +275,7 @@ public class GenerationCommands {
|
||||
worldEdit.checkMaxRadius(size);
|
||||
density /= 100;
|
||||
int affected = editSession.makeForest(session.getPlacementPosition(actor), size, density, type);
|
||||
actor.print(affected + " trees created.");
|
||||
actor.printInfo(TranslatableComponent.of("worldedit.forestgen.created", TextComponent.of(affected)));
|
||||
return affected;
|
||||
}
|
||||
|
||||
@ -290,7 +293,7 @@ public class GenerationCommands {
|
||||
checkCommandArgument(0 <= density && density <= 100, "Density must be between 0 and 100");
|
||||
worldEdit.checkMaxRadius(size);
|
||||
int affected = editSession.makePumpkinPatches(session.getPlacementPosition(actor), size, density);
|
||||
actor.print(affected + " pumpkin patches created.");
|
||||
actor.printInfo(TranslatableComponent.of("worldedit.pumpkins.created", TextComponent.of(affected)));
|
||||
return affected;
|
||||
}
|
||||
|
||||
@ -327,7 +330,7 @@ public class GenerationCommands {
|
||||
if (actor instanceof Player) {
|
||||
((Player) actor).findFreePosition();
|
||||
}
|
||||
BBC.VISITOR_BLOCK.send(actor, affected);
|
||||
actor.printInfo(TranslatableComponent.of("worldedit.pyramid.created", TextComponent.of(affected)));
|
||||
}
|
||||
|
||||
@Command(
|
||||
@ -388,9 +391,9 @@ public class GenerationCommands {
|
||||
if (actor instanceof Player) {
|
||||
((Player) actor).findFreePosition();
|
||||
}
|
||||
BBC.VISITOR_BLOCK.send(actor, affected);
|
||||
actor.printInfo(TranslatableComponent.of("worldedit.generate.created", TextComponent.of(affected)));
|
||||
} catch (ExpressionException e) {
|
||||
actor.printError(e.getMessage());
|
||||
actor.printError(TextComponent.of(e.getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
@ -449,9 +452,9 @@ public class GenerationCommands {
|
||||
final Vector3 unit1 = unit;
|
||||
try {
|
||||
final int affected = editSession.makeBiomeShape(region, zero, unit1, target, String.join(" ", expression), hollow, session.getTimeout());
|
||||
BBC.VISITOR_FLAT.send(actor, affected);
|
||||
actor.printInfo(TranslatableComponent.of("worldedit.generatebiome.changed", TextComponent.of(affected)));
|
||||
} catch (ExpressionException e) {
|
||||
actor.printError(e.getMessage());
|
||||
actor.printError(TextComponent.of(e.getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -22,6 +22,7 @@ package com.sk89q.worldedit.command;
|
||||
import com.boydti.fawe.Fawe;
|
||||
import com.boydti.fawe.FaweAPI;
|
||||
import com.boydti.fawe.config.BBC;
|
||||
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
|
||||
import com.boydti.fawe.config.Settings;
|
||||
import com.boydti.fawe.database.DBHandler;
|
||||
import com.boydti.fawe.database.RollbackDatabase;
|
||||
@ -41,6 +42,7 @@ import com.sk89q.worldedit.command.util.CommandPermissionsConditionGenerator;
|
||||
import com.sk89q.worldedit.command.util.annotation.Confirm;
|
||||
import com.sk89q.worldedit.entity.Player;
|
||||
import com.sk89q.worldedit.extension.platform.Actor;
|
||||
import com.sk89q.worldedit.util.formatting.text.TextComponent;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.regions.Region;
|
||||
import com.sk89q.worldedit.util.Location;
|
||||
@ -49,6 +51,7 @@ import java.io.File;
|
||||
import java.util.Objects;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
|
||||
import org.enginehub.piston.annotation.Command;
|
||||
import org.enginehub.piston.annotation.CommandContainer;
|
||||
import org.enginehub.piston.annotation.param.Arg;
|
||||
@ -86,13 +89,13 @@ public class HistoryCommands {
|
||||
@CommandPermissions("worldedit.history.rollback")
|
||||
public void faweRollback(Player player, LocalSession session, @Arg(desc = "String user") String user, @Arg(def = "0", desc = "radius") @Range(from = 0, to=Integer.MAX_VALUE) int radius, @Arg(name = "time", desc = "String", def = "0") String time, @Switch(name = 'r', desc = "TODO") boolean restore) throws WorldEditException {
|
||||
if (!Settings.IMP.HISTORY.USE_DATABASE) {
|
||||
BBC.SETTING_DISABLE.send(player, "history.use-database (Import with /frb #import )");
|
||||
player.print(TranslatableComponent.of("fawe.error.setting.disable" , "history.use-database (Import with /frb #import )"));
|
||||
return;
|
||||
}
|
||||
if (user.charAt(0) == '#') {
|
||||
if (user.equals("#import")) {
|
||||
if (!player.hasPermission("fawe.rollback.import")) {
|
||||
BBC.NO_PERM.send(player, "fawe.rollback.import");
|
||||
player.print(TranslatableComponent.of("fawe.error.no.perm", "fawe.rollback.import"));
|
||||
return;
|
||||
}
|
||||
File folder = MainUtil.getFile(Fawe.imp().getDirectory(), Settings.IMP.PATHS.HISTORY);
|
||||
@ -145,7 +148,7 @@ public class HistoryCommands {
|
||||
}
|
||||
String toParse = user.substring(1);
|
||||
if (!MathMan.isInteger(toParse)) {
|
||||
BBC.COMMAND_SYNTAX.send(player, "/frb #<index>");
|
||||
player.print(TranslatableComponent.of("fawe.error.command.syntax" , "/frb #<index>"));
|
||||
return;
|
||||
}
|
||||
int index = Integer.parseInt(toParse);
|
||||
@ -155,24 +158,24 @@ public class HistoryCommands {
|
||||
if (file.getBDFile().exists()) {
|
||||
if (restore) file.redo(player);
|
||||
else file.undo(player);
|
||||
BBC.ROLLBACK_ELEMENT.send(player, world.getName() + "/" + user + "-" + index);
|
||||
player.print(TranslatableComponent.of("fawe.worldedit.rollback.rollback.element" , world.getName() + "/" + user + "-" + index));
|
||||
} else {
|
||||
BBC.TOOL_INSPECT_INFO_FOOTER.send(player, 0);
|
||||
player.print(TranslatableComponent.of("fawe.worldedit.tool.tool.inspect.info.footer" , 0));
|
||||
}
|
||||
return;
|
||||
}
|
||||
UUID other = Fawe.imp().getUUID(user);
|
||||
if (other == null) {
|
||||
BBC.PLAYER_NOT_FOUND.send(player, user);
|
||||
player.print(TranslatableComponent.of("fawe.error.player.not.found" , user));
|
||||
return;
|
||||
}
|
||||
if (radius == 0) {
|
||||
BBC.COMMAND_SYNTAX.send(player, "/frb " + user + " <radius> <time>");
|
||||
player.print(TranslatableComponent.of("fawe.error.command.syntax" , "/frb " + user + " <radius> <time>"));
|
||||
return;
|
||||
}
|
||||
long timeDiff = MainUtil.timeToSec(time) * 1000;
|
||||
if (timeDiff == 0) {
|
||||
BBC.COMMAND_SYNTAX.send(player, "/frb " + user + " " + radius + " <time>");
|
||||
player.print(TranslatableComponent.of("fawe.error.command.syntax" , "/frb " + user + " " + radius + " <time>"));
|
||||
return;
|
||||
}
|
||||
radius = Math.max(Math.min(500, radius), 0);
|
||||
@ -187,7 +190,7 @@ public class HistoryCommands {
|
||||
|
||||
Region[] allowedRegions = player.getCurrentRegions(FaweMaskManager.MaskType.OWNER);
|
||||
if (allowedRegions == null) {
|
||||
player.printError(BBC.NO_REGION.s());
|
||||
player.printError(TranslatableComponent.of("fawe.error.no.region"));
|
||||
return;
|
||||
}
|
||||
// TODO mask the regions bot / top to the bottom and top coord in the allowedRegions
|
||||
@ -201,10 +204,10 @@ public class HistoryCommands {
|
||||
@Override
|
||||
public void run(DiskStorageHistory edit) {
|
||||
edit.undo(player, allowedRegions);
|
||||
BBC.ROLLBACK_ELEMENT.send(player, edit.getWorld().getName() + "/" + user + "-" + edit.getIndex());
|
||||
player.print(TranslatableComponent.of("fawe.worldedit.rollback.rollback.element" , edit.getWorld().getName() + "/" + user + "-" + edit.getIndex()));
|
||||
count.incrementAndGet();
|
||||
}
|
||||
}, () -> BBC.TOOL_INSPECT_INFO_FOOTER.send(player, count), true, restore);
|
||||
}, () -> player.print(TranslatableComponent.of("fawe.worldedit.tool.tool.inspect.info.footer" , count)), true, restore);
|
||||
}
|
||||
|
||||
@Command(
|
||||
@ -233,14 +236,14 @@ public class HistoryCommands {
|
||||
times = Math.max(1, times);
|
||||
LocalSession undoSession = session;
|
||||
if (session.hasFastMode()) {
|
||||
player.print(BBC.COMMAND_UNDO_DISABLED.s());
|
||||
player.print(TranslatableComponent.of("fawe.worldedit.history.command.undo.disabled"));
|
||||
return;
|
||||
}
|
||||
if (playerName != null) {
|
||||
player.checkPermission("worldedit.history.undo.other");
|
||||
undoSession = worldEdit.getSessionManager().findByName(playerName);
|
||||
if (undoSession == null) {
|
||||
player.printError("Unable to find session for " + playerName);
|
||||
player.printError(TranslatableComponent.of("worldedit.session.cant-find-session", TextComponent.of(playerName)));
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -255,9 +258,9 @@ public class HistoryCommands {
|
||||
}
|
||||
}
|
||||
if (timesUndone > 0) {
|
||||
player.print("Undid " + timesUndone + " available edits.");
|
||||
player.printInfo(TranslatableComponent.of("worldedit.undo.undone", TextComponent.of(timesUndone)));
|
||||
} else {
|
||||
player.printError("Nothing left to undo.");
|
||||
player.printError(TranslatableComponent.of("worldedit.undo.none"));
|
||||
}
|
||||
}
|
||||
|
||||
@ -278,7 +281,7 @@ public class HistoryCommands {
|
||||
player.checkPermission("worldedit.history.redo.other");
|
||||
redoSession = worldEdit.getSessionManager().findByName(playerName);
|
||||
if (redoSession == null) {
|
||||
BBC.COMMAND_HISTORY_OTHER_ERROR.send(player, playerName);
|
||||
player.printError(TranslatableComponent.of("worldedit.session.cant-find-session", TextComponent.of(playerName)));
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -293,9 +296,9 @@ public class HistoryCommands {
|
||||
}
|
||||
}
|
||||
if (timesRedone > 0) {
|
||||
BBC.COMMAND_REDO_SUCCESS.send(player, timesRedone == 1 ? "" : " x" + timesRedone);
|
||||
player.printInfo(TranslatableComponent.of("worldedit.redo.redid", TextComponent.of(timesRedone)));
|
||||
} else {
|
||||
player.printError(BBC.COMMAND_REDO_ERROR.s());
|
||||
player.printError(TranslatableComponent.of("worldedit.redo.none"));
|
||||
}
|
||||
}
|
||||
|
||||
@ -307,7 +310,7 @@ public class HistoryCommands {
|
||||
@CommandPermissions("worldedit.history.clear")
|
||||
public void clearHistory(Actor actor, LocalSession session) {
|
||||
session.clearHistory();
|
||||
actor.print("History cleared.");
|
||||
actor.printInfo(TranslatableComponent.of("worldedit.clearhistory.cleared"));
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -21,6 +21,7 @@ package com.sk89q.worldedit.command;
|
||||
import static com.sk89q.worldedit.command.util.Logging.LogMode.POSITION;
|
||||
|
||||
import com.boydti.fawe.config.BBC;
|
||||
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
|
||||
import com.sk89q.worldedit.LocalConfiguration;
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
@ -29,6 +30,8 @@ import com.sk89q.worldedit.command.util.CommandPermissionsConditionGenerator;
|
||||
import com.sk89q.worldedit.command.util.Logging;
|
||||
import com.sk89q.worldedit.entity.Player;
|
||||
import com.sk89q.worldedit.util.Location;
|
||||
import com.sk89q.worldedit.util.formatting.text.TextComponent;
|
||||
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
|
||||
import org.enginehub.piston.annotation.Command;
|
||||
import org.enginehub.piston.annotation.CommandContainer;
|
||||
import org.enginehub.piston.annotation.param.Arg;
|
||||
@ -62,7 +65,7 @@ public class NavigationCommands {
|
||||
@CommandPermissions("worldedit.navigation.unstuck")
|
||||
public void unstuck(Player player) throws WorldEditException {
|
||||
player.findFreePosition();
|
||||
player.print("There you go!");
|
||||
player.printInfo(TranslatableComponent.of("worldedit.unstuck.moved"));
|
||||
}
|
||||
|
||||
@Command(
|
||||
@ -82,9 +85,9 @@ public class NavigationCommands {
|
||||
}
|
||||
}
|
||||
if (ascentLevels == 0) {
|
||||
player.printError(BBC.ASCEND_FAIL.s());
|
||||
player.printError(TranslatableComponent.of("worldedit.ascend.obstructed"));
|
||||
} else {
|
||||
player.print((ascentLevels != 1) ? "Ascended " + ascentLevels + " levels." : "Ascended a level.");
|
||||
player.printInfo(TranslatableComponent.of("worldedit.ascend.moved", TextComponent.of(ascentLevels)));
|
||||
}
|
||||
}
|
||||
|
||||
@ -105,11 +108,9 @@ public class NavigationCommands {
|
||||
}
|
||||
}
|
||||
if (descentLevels == 0) {
|
||||
player.printError(BBC.DESCEND_FAIL.s());
|
||||
} else if (descentLevels == 1) {
|
||||
player.print(BBC.DESCEND_SINGULAR.s());
|
||||
player.printError(TranslatableComponent.of("worldedit.descend.obstructed"));
|
||||
} else {
|
||||
player.print((descentLevels != 1) ? "Descended " + descentLevels + " levels." : "Descended a level.");
|
||||
player.printInfo(TranslatableComponent.of("worldedit.descend.moved", TextComponent.of(descentLevels)));
|
||||
}
|
||||
}
|
||||
|
||||
@ -130,9 +131,9 @@ public class NavigationCommands {
|
||||
|
||||
boolean alwaysGlass = getAlwaysGlass(forceFlight, forceGlass);
|
||||
if (player.ascendToCeiling(clearance, alwaysGlass)) {
|
||||
player.print(BBC.WHOOSH.s());
|
||||
player.printInfo(TranslatableComponent.of("worldedit.ceil.moved"));
|
||||
} else {
|
||||
player.printError(BBC.ASCEND_FAIL.s());
|
||||
player.printError(TranslatableComponent.of("worldedit.ceil.obstructed"));
|
||||
}
|
||||
}
|
||||
|
||||
@ -143,9 +144,9 @@ public class NavigationCommands {
|
||||
@CommandPermissions("worldedit.navigation.thru.command")
|
||||
public void thru(Player player) throws WorldEditException {
|
||||
if (player.passThroughForwardWall(6)) {
|
||||
player.print(BBC.WHOOSH.s());
|
||||
player.printInfo(TranslatableComponent.of("worldedit.thru.moved"));
|
||||
} else {
|
||||
player.printError(BBC.THRU_FAIL.s());
|
||||
player.printError(TranslatableComponent.of("worldedit.thru.obstructed"));
|
||||
}
|
||||
}
|
||||
|
||||
@ -165,14 +166,10 @@ public class NavigationCommands {
|
||||
pos = player.getSolidBlockTrace(300);
|
||||
}
|
||||
if (pos != null) {
|
||||
if (force) {
|
||||
player.setPosition(pos);
|
||||
} else {
|
||||
player.findFreePosition(pos);
|
||||
}
|
||||
player.print(BBC.POOF.s());
|
||||
player.findFreePosition(pos);
|
||||
player.printInfo(TranslatableComponent.of("worldedit.jumpto.moved"));
|
||||
} else {
|
||||
player.printError(BBC.NO_BLOCK.s());
|
||||
player.printError(TranslatableComponent.of("worldedit.jumpto.none"));
|
||||
}
|
||||
}
|
||||
|
||||
@ -191,9 +188,9 @@ public class NavigationCommands {
|
||||
boolean forceGlass) throws WorldEditException {
|
||||
boolean alwaysGlass = getAlwaysGlass(forceFlight, forceGlass);
|
||||
if (player.ascendUpwards(distance, alwaysGlass)) {
|
||||
player.print(BBC.WHOOSH.s());
|
||||
player.printInfo(TranslatableComponent.of("worldedit.up.moved"));
|
||||
} else {
|
||||
player.printError(BBC.UP_FAIL.s());
|
||||
player.printError(TranslatableComponent.of("worldedit.up.obstructed"));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -62,24 +62,24 @@ import static org.enginehub.piston.part.CommandParts.arg;
|
||||
@CommandContainer(superTypes = CommandPermissionsConditionGenerator.Registration.class)
|
||||
public class PaintBrushCommands {
|
||||
|
||||
private static final CommandArgument REGION_FACTORY = arg(TranslatableComponent.of("shape"), TextComponent.of("The shape of the region"))
|
||||
private static final CommandArgument REGION_FACTORY = arg(TranslatableComponent.of("shape") , TranslatableComponent.of("worldedit.brush.paint.shape"))
|
||||
.defaultsTo(ImmutableList.of())
|
||||
.ofTypes(ImmutableList.of(Key.of(RegionFactory.class)))
|
||||
.build();
|
||||
|
||||
private static final CommandArgument RADIUS = arg(TranslatableComponent.of("radius"), TextComponent.of("The size of the brush"))
|
||||
private static final CommandArgument RADIUS = arg(TranslatableComponent.of("radius") , TranslatableComponent.of("worldedit.brush.paint.size"))
|
||||
.defaultsTo(ImmutableList.of("5"))
|
||||
.ofTypes(ImmutableList.of(Key.of(double.class)))
|
||||
.build();
|
||||
|
||||
private static final CommandArgument DENSITY = arg(TranslatableComponent.of("density"), TextComponent.of("The density of the brush"))
|
||||
private static final CommandArgument DENSITY = arg(TranslatableComponent.of("density") , TranslatableComponent.of("worldedit.brush.paint.density"))
|
||||
.defaultsTo(ImmutableList.of("20"))
|
||||
.ofTypes(ImmutableList.of(Key.of(double.class)))
|
||||
.build();
|
||||
|
||||
public static void register(CommandManagerService service, CommandManager commandManager, CommandRegistrationHandler registration) {
|
||||
commandManager.register("paint", builder -> {
|
||||
builder.description(TextComponent.of("Paint brush, apply a function to a surface"));
|
||||
builder.description(TranslatableComponent.of("worldedit.brush.paint.description"));
|
||||
builder.action(org.enginehub.piston.Command.Action.NULL_ACTION);
|
||||
|
||||
CommandManager manager = service.newCommandManager();
|
||||
@ -92,7 +92,7 @@ public class PaintBrushCommands {
|
||||
builder.condition(new PermissionCondition(ImmutableSet.of("worldedit.brush.paint")));
|
||||
|
||||
builder.addParts(REGION_FACTORY, RADIUS, DENSITY);
|
||||
builder.addPart(SubCommandPart.builder(TranslatableComponent.of("type"), TextComponent.of("Type of brush to use"))
|
||||
builder.addPart(SubCommandPart.builder(TranslatableComponent.of("type") , TranslatableComponent.of("worldedit.brush.paint.type"))
|
||||
.withCommands(manager.getAllCommands().collect(Collectors.toList()))
|
||||
.required()
|
||||
.build());
|
||||
@ -125,15 +125,14 @@ public class PaintBrushCommands {
|
||||
)
|
||||
@CommandPermissions("worldedit.brush.item")
|
||||
public void item(CommandParameters parameters,
|
||||
Player player, LocalSession localSession,
|
||||
@Arg(desc = "The type of item to use")
|
||||
BaseItem item,
|
||||
@Arg(desc = "The direction in which the item will be applied", def = "up")
|
||||
@Direction(includeDiagonals = true)
|
||||
com.sk89q.worldedit.util.Direction direction) throws WorldEditException {
|
||||
Player player, LocalSession localSession,
|
||||
@Arg(desc = "The type of item to use")
|
||||
BaseItem item,
|
||||
@Arg(desc = "The direction in which the item will be applied", def = "up")
|
||||
@Direction(includeDiagonals = true)
|
||||
com.sk89q.worldedit.util.Direction direction) throws WorldEditException {
|
||||
player.print(TextComponent.builder().append("WARNING: ", TextColor.RED, TextDecoration.BOLD)
|
||||
.append("This brush simulates item usages. Its effects may not work on all platforms, may not be undo-able," +
|
||||
" and may cause strange interactions with other mods/plugins. Use at your own risk.").build());
|
||||
.append(TranslatableComponent.of("worldedit.brush.paint.item.warning")).build());
|
||||
setPaintBrush(parameters, player, localSession, new ItemUseFactory(item, direction));
|
||||
}
|
||||
|
||||
|
@ -22,6 +22,7 @@ package com.sk89q.worldedit.command;
|
||||
import com.boydti.fawe.FaweAPI;
|
||||
import com.boydti.fawe.FaweCache;
|
||||
import com.boydti.fawe.config.BBC;
|
||||
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
|
||||
import com.boydti.fawe.object.FaweLimit;
|
||||
import com.sk89q.jnbt.CompoundTag;
|
||||
import com.sk89q.worldedit.EditSession;
|
||||
@ -62,11 +63,16 @@ import com.sk89q.worldedit.regions.Regions;
|
||||
import static com.sk89q.worldedit.command.util.Logging.LogMode.ALL;
|
||||
import com.sk89q.worldedit.util.Location;
|
||||
import com.sk89q.worldedit.util.TreeGenerator.TreeType;
|
||||
import com.sk89q.worldedit.util.formatting.text.serializer.legacy.LegacyComponentSerializer;
|
||||
import com.sk89q.worldedit.world.World;
|
||||
import com.sk89q.worldedit.world.biome.BiomeType;
|
||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||
import com.sk89q.worldedit.util.formatting.component.TextUtils;
|
||||
import com.sk89q.worldedit.util.formatting.text.Component;
|
||||
import com.sk89q.worldedit.util.formatting.text.TextComponent;
|
||||
import com.sk89q.worldedit.world.block.BlockTypes;
|
||||
import org.enginehub.piston.annotation.Command;
|
||||
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
|
||||
import org.enginehub.piston.annotation.CommandContainer;
|
||||
import org.enginehub.piston.annotation.param.Arg;
|
||||
import org.enginehub.piston.annotation.param.ArgFlag;
|
||||
@ -113,9 +119,10 @@ public class RegionCommands {
|
||||
Pattern pattern) {
|
||||
int affected = editSession.setBlocks(region, pattern);
|
||||
if (affected != 0) {
|
||||
BBC.OPERATION.send(actor, affected);
|
||||
actor.printInfo(TranslatableComponent.of("worldedit.set.done"));
|
||||
if (!actor.hasPermission("fawe.tips"))
|
||||
BBC.TIP_FAST.or(BBC.TIP_CANCEL, BBC.TIP_MASK, BBC.TIP_MASK_ANGLE, BBC.TIP_SET_LINEAR, BBC.TIP_SURFACE_SPREAD, BBC.TIP_SET_HAND).send(actor);
|
||||
System.out.println("TODO FIXME TIPS");
|
||||
// TranslatableComponent.of("fawe.tips.tip.fast").or(TranslatableComponent.of("fawe.tips.tip.cancel"), TranslatableComponent.of("fawe.tips.tip.mask"), TranslatableComponent.of("fawe.tips.tip.mask.angle"), TranslatableComponent.of("fawe.tips.tip.set.linear"), TranslatableComponent.of("fawe.tips.tip.surface.spread"), TranslatableComponent.of("fawe.tips.tip.set.hand")).send(actor);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@ -138,7 +145,6 @@ public class RegionCommands {
|
||||
@CommandPermissions("worldedit.region.test")
|
||||
@Logging(REGION)
|
||||
public void test(Player player, EditSession editSession, @Arg(desc = "test") @Confirm(RADIUS) BlockVector3 radius) throws WorldEditException {
|
||||
player.print("Run test " + radius);
|
||||
// editSession.addProcessor(new ChunkSendProcessor(editSession.getWorld(), () -> Collections.singleton(player)));
|
||||
// editSession.addProcessor(NullProcessor.INSTANCE);
|
||||
// FlatRegionFunction replace = new BiomeReplace(editSession, biome);
|
||||
@ -160,7 +166,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);
|
||||
BBC.LIGHTING_PROPAGATE_SELECTION.send(player, count);
|
||||
player.print(TranslatableComponent.of("fawe.info.lighting.propagate.selection" , count));
|
||||
}
|
||||
|
||||
@Command(
|
||||
@ -188,7 +194,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);
|
||||
BBC.UPDATED_LIGHTING_SELECTION.send(player, count);
|
||||
player.print(TranslatableComponent.of("fawe.info.updated.lighting.selection" , count));
|
||||
}
|
||||
|
||||
@Command(
|
||||
@ -200,14 +206,14 @@ public class RegionCommands {
|
||||
public void nbtinfo(Player player, EditSession editSession) {
|
||||
Location pos = player.getBlockTrace(128);
|
||||
if (pos == null) {
|
||||
player.printError(BBC.NO_BLOCK.s());
|
||||
player.printError(TranslatableComponent.of("fawe.navigation.no.block"));
|
||||
return;
|
||||
}
|
||||
CompoundTag nbt = editSession.getFullBlock(pos.toBlockPoint()).getNbtData();
|
||||
if (nbt != null) {
|
||||
player.print(nbt.getValue().toString());
|
||||
} else {
|
||||
player.printError(BBC.NO_BLOCK.s());
|
||||
player.printError(TranslatableComponent.of("fawe.navigation.no.block"));
|
||||
}
|
||||
}
|
||||
|
||||
@ -245,7 +251,7 @@ public class RegionCommands {
|
||||
@Switch(name = 'h', desc = "Generate only a shell")
|
||||
boolean shell) throws WorldEditException {
|
||||
if (!(region instanceof CuboidRegion)) {
|
||||
actor.printError("//line only works with cuboid selections");
|
||||
actor.printError(TranslatableComponent.of("worldedit.line.cuboid-only"));
|
||||
return 0;
|
||||
}
|
||||
checkCommandArgument(thickness >= 0, "Thickness must be >= 0");
|
||||
@ -255,7 +261,7 @@ public class RegionCommands {
|
||||
BlockVector3 pos2 = cuboidregion.getPos2();
|
||||
int blocksChanged = editSession.drawLine(pattern, pos1, pos2, thickness, !shell);
|
||||
|
||||
actor.print(blocksChanged + " block(s) have been changed.");
|
||||
actor.printInfo(TranslatableComponent.of("worldedit.line.changed", TextComponent.of(blocksChanged)));
|
||||
return blocksChanged;
|
||||
}
|
||||
|
||||
@ -276,7 +282,7 @@ public class RegionCommands {
|
||||
@Switch(name = 'h', desc = "Generate only a shell")
|
||||
boolean shell) throws WorldEditException {
|
||||
if (!(region instanceof ConvexPolyhedralRegion)) {
|
||||
actor.printError("//curve only works with convex polyhedral selections");
|
||||
actor.printError(TranslatableComponent.of("worldedit.curve.convex-only"));
|
||||
return;
|
||||
}
|
||||
checkCommandArgument(thickness >= 0, "Thickness must be >= 0");
|
||||
@ -286,7 +292,7 @@ public class RegionCommands {
|
||||
|
||||
int blocksChanged = editSession.drawSpline(pattern, vectors, 0, 0, 0, 10, thickness, !shell);
|
||||
|
||||
actor.print(blocksChanged + " block(s) have been changed.");
|
||||
actor.printInfo(TranslatableComponent.of("worldedit.curve.changed", TextComponent.of(blocksChanged)));
|
||||
}
|
||||
|
||||
@Command(
|
||||
@ -305,9 +311,8 @@ public class RegionCommands {
|
||||
if (from == null) {
|
||||
from = new ExistingBlockMask(editSession);
|
||||
}
|
||||
Mask finalFrom = from;
|
||||
int affected = editSession.replaceBlocks(region, finalFrom, to);
|
||||
actor.print(affected + " block(s) have been replaced.");
|
||||
int affected = editSession.replaceBlocks(region, from, to);
|
||||
actor.printInfo(TranslatableComponent.of("worldedit.replace.replaced", TextComponent.of(affected)));
|
||||
}
|
||||
|
||||
@Command(
|
||||
@ -321,7 +326,7 @@ public class RegionCommands {
|
||||
@Arg(desc = "The pattern of blocks to overlay")
|
||||
Pattern pattern) throws WorldEditException {
|
||||
int affected = editSession.overlayCuboidBlocks(region, pattern);
|
||||
actor.print(affected + " block(s) have been overlaid.");
|
||||
actor.printInfo(TranslatableComponent.of("worldedit.overlay.overlaid", TextComponent.of(affected)));
|
||||
}
|
||||
|
||||
@Command(
|
||||
@ -346,7 +351,7 @@ public class RegionCommands {
|
||||
editSession.setBlock(x, y, z, patternArg);
|
||||
affected++;
|
||||
}
|
||||
BBC.VISITOR_BLOCK.send(player, affected);
|
||||
player.print(TranslatableComponent.of("fawe.worldedit.visitor.visitor.block" , affected));
|
||||
}
|
||||
|
||||
@Command(
|
||||
@ -360,7 +365,7 @@ public class RegionCommands {
|
||||
@Arg(desc = "The pattern of blocks to set")
|
||||
Pattern pattern) throws WorldEditException {
|
||||
int affected = editSession.center(region, pattern);
|
||||
actor.print("Center set (" + affected + " block(s) changed)");
|
||||
actor.printInfo(TranslatableComponent.of("worldedit.center.changed", TextComponent.of(affected)));
|
||||
return affected;
|
||||
}
|
||||
|
||||
@ -373,7 +378,7 @@ public class RegionCommands {
|
||||
@Confirm(Confirm.Processor.REGION)
|
||||
public void naturalize(Actor actor, EditSession editSession, @Selection Region region) throws WorldEditException {
|
||||
int affected = editSession.naturalizeCuboidBlocks(region);
|
||||
actor.print(affected + " block(s) have been made to look more natural.");
|
||||
actor.printInfo(TranslatableComponent.of("worldedit.naturalize.naturalized", TextComponent.of(affected)));
|
||||
}
|
||||
|
||||
@Command(
|
||||
@ -387,7 +392,7 @@ public class RegionCommands {
|
||||
@Arg(desc = "The pattern of blocks to set")
|
||||
Pattern pattern) throws WorldEditException {
|
||||
int affected = editSession.makeWalls(region, pattern);
|
||||
actor.print(affected + " block(s) have been changed.");
|
||||
actor.printInfo(TranslatableComponent.of("worldedit.walls.changed", TextComponent.of(affected)));
|
||||
}
|
||||
|
||||
@Command(
|
||||
@ -402,7 +407,7 @@ public class RegionCommands {
|
||||
@Arg(desc = "The pattern of blocks to set")
|
||||
Pattern pattern) throws WorldEditException {
|
||||
int affected = editSession.makeCuboidFaces(region, pattern);
|
||||
actor.print(affected + " block(s) have been changed.");
|
||||
actor.printInfo(TranslatableComponent.of("worldedit.faces.changed", TextComponent.of(affected)));
|
||||
}
|
||||
|
||||
@Command(
|
||||
@ -428,12 +433,12 @@ public class RegionCommands {
|
||||
}
|
||||
try {
|
||||
HeightMap heightMap = new HeightMap(editSession, region, mask, snow);
|
||||
HeightMapFilter filter = new HeightMapFilter(new GaussianKernel(5, 1.0));
|
||||
int affected = heightMap.applyFilter(filter, iterations);
|
||||
actor.print("Terrain's height map smoothed. " + affected + " block(s) changed.");
|
||||
HeightMapFilter filter = new HeightMapFilter(new GaussianKernel(5, 1.0));
|
||||
int affected = heightMap.applyFilter(filter, iterations);
|
||||
actor.printInfo(TranslatableComponent.of("worldedit.smooth.changed", TextComponent.of(affected)));
|
||||
} catch (Throwable e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Command(
|
||||
@ -445,9 +450,9 @@ public class RegionCommands {
|
||||
@CommandPermissions("fawe.admin")
|
||||
public void wea(Actor actor) throws WorldEditException {
|
||||
if (actor.togglePermission("fawe.bypass")) {
|
||||
actor.print(BBC.WORLDEDIT_BYPASSED.s());
|
||||
actor.print(TranslatableComponent.of("fawe.info.worldedit.bypassed"));
|
||||
} else {
|
||||
actor.print(BBC.WORLDEDIT_RESTRICTED.s());
|
||||
actor.print(TranslatableComponent.of("fawe.info.worldedit.restricted"));
|
||||
}
|
||||
}
|
||||
|
||||
@ -461,10 +466,10 @@ public class RegionCommands {
|
||||
public void wer(Player player) throws WorldEditException {
|
||||
final Region region = player.getLargestRegion();
|
||||
if (region == null) {
|
||||
player.print(BBC.NO_REGION.s());
|
||||
player.print(TranslatableComponent.of("fawe.error.no.region"));
|
||||
} else {
|
||||
player.setSelection(region);
|
||||
player.print(BBC.SET_REGION.s());
|
||||
player.print(TranslatableComponent.of("fawe.info.set.region"));
|
||||
}
|
||||
}
|
||||
|
||||
@ -477,7 +482,7 @@ public class RegionCommands {
|
||||
@CommandPermissions("worldedit.region.move")
|
||||
@Logging(ORIENTATION_REGION)
|
||||
@Confirm(Confirm.Processor.REGION)
|
||||
public void move(Actor actor, World world, EditSession editSession, LocalSession session,
|
||||
public int move(Actor actor, World world, EditSession editSession, LocalSession session,
|
||||
@Selection Region region,
|
||||
@Arg(desc = "# of blocks to move", def = "1")
|
||||
int count,
|
||||
@ -518,11 +523,12 @@ public class RegionCommands {
|
||||
session.getRegionSelector(world).learnChanges();
|
||||
session.getRegionSelector(world).explainRegionAdjust(actor, session);
|
||||
} catch (RegionOperationException e) {
|
||||
actor.printError(e.getMessage());
|
||||
actor.printError(TextComponent.of(e.getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
BBC.VISITOR_BLOCK.send(actor, affected);
|
||||
actor.printInfo(TranslatableComponent.of("worldedit.move.moved", TextComponent.of(affected)));
|
||||
return affected;
|
||||
}
|
||||
|
||||
@Command(
|
||||
@ -539,7 +545,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);
|
||||
BBC.VISITOR_BLOCK.send(player, affected);
|
||||
player.print(TranslatableComponent.of("fawe.worldedit.visitor.visitor.block" , affected));
|
||||
}
|
||||
|
||||
@Command(
|
||||
@ -548,7 +554,7 @@ public class RegionCommands {
|
||||
)
|
||||
@CommandPermissions("worldedit.region.stack")
|
||||
@Logging(ORIENTATION_REGION)
|
||||
public void stack(Actor actor, World world, EditSession editSession, LocalSession session,
|
||||
public int stack(Actor actor, World world, EditSession editSession, LocalSession session,
|
||||
@Selection Region region,
|
||||
@Arg(desc = "# of copies to stack", def = "1")
|
||||
@Confirm(Confirm.Processor.REGION) int count,
|
||||
@ -589,11 +595,12 @@ public class RegionCommands {
|
||||
session.getRegionSelector(world).learnChanges();
|
||||
session.getRegionSelector(world).explainRegionAdjust(actor, session);
|
||||
} catch (RegionOperationException e) {
|
||||
actor.printError(e.getMessage());
|
||||
actor.printError(TextComponent.of(e.getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
BBC.VISITOR_BLOCK.send(actor, affected);
|
||||
actor.printInfo(TranslatableComponent.of("worldedit.stack.changed", TextComponent.of(affected)));
|
||||
return affected;
|
||||
}
|
||||
|
||||
@Command(
|
||||
@ -641,9 +648,9 @@ public class RegionCommands {
|
||||
if (actor instanceof Player) {
|
||||
((Player) actor).findFreePosition();
|
||||
}
|
||||
actor.print(affected + " block(s) have been deformed.");
|
||||
actor.printInfo(TranslatableComponent.of("worldedit.deform.deformed", TextComponent.of(affected)));
|
||||
} catch (ExpressionException e) {
|
||||
actor.printError(e.getMessage());
|
||||
actor.printError(TextComponent.of(e.getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
@ -658,7 +665,7 @@ public class RegionCommands {
|
||||
@CommandPermissions("worldedit.regen")
|
||||
@Logging(REGION)
|
||||
@Confirm(Confirm.Processor.REGION)
|
||||
public void regenerateChunk(Player player, LocalSession session, EditSession editSession, @Selection Region region,
|
||||
public void regenerateChunk(Actor actor, LocalSession session, EditSession editSession, @Selection Region region,
|
||||
@Arg(def = "", desc = "Regenerate with biome") BiomeType biome,
|
||||
@Arg(def = "", desc = "Regenerate with seed") Long seed) throws WorldEditException {
|
||||
Mask mask = session.getMask();
|
||||
@ -667,17 +674,7 @@ public class RegionCommands {
|
||||
editSession.regenerate(region, biome, seed);
|
||||
session.setMask(mask);
|
||||
session.setSourceMask(mask);
|
||||
if (!player.hasPermission("fawe.tips")) {
|
||||
player.print(BBC.COMMAND_REGEN_2.s());
|
||||
} else if (biome == null) {
|
||||
BBC.COMMAND_REGEN_0.send(player);
|
||||
if (!player.hasPermission("fawe.tips")) player.print(BBC.TIP_REGEN_0.s());
|
||||
} else if (seed == null) {
|
||||
player.print(BBC.COMMAND_REGEN_1.s());
|
||||
if (!player.hasPermission("fawe.tips")) BBC.TIP_REGEN_1.send(player);
|
||||
} else {
|
||||
player.print(BBC.COMMAND_REGEN_2.s());
|
||||
}
|
||||
actor.printInfo(TranslatableComponent.of("worldedit.regen.regenerated"));
|
||||
}
|
||||
|
||||
@Command(
|
||||
@ -701,7 +698,7 @@ public class RegionCommands {
|
||||
checkCommandArgument(thickness >= 0, "Thickness must be >= 0");
|
||||
Mask finalMask = mask == null ? new SolidBlockMask(editSession) : mask;
|
||||
int affected = editSession.hollowOutRegion(region, thickness, pattern, finalMask);
|
||||
actor.print(affected + " block(s) have been changed.");
|
||||
actor.printInfo(TranslatableComponent.of("worldedit.hollow.changed", TextComponent.of(affected)));
|
||||
}
|
||||
|
||||
@Command(
|
||||
@ -718,7 +715,7 @@ public class RegionCommands {
|
||||
double density) throws WorldEditException {
|
||||
checkCommandArgument(0 <= density && density <= 100, "Density must be in [0, 100]");
|
||||
int affected = editSession.makeForest(region, density / 100, type);
|
||||
actor.print(affected + " trees created.");
|
||||
actor.printInfo(TranslatableComponent.of("worldedit.forest.created", TextComponent.of(affected)));
|
||||
return affected;
|
||||
}
|
||||
|
||||
@ -740,7 +737,7 @@ public class RegionCommands {
|
||||
Operations.completeLegacy(visitor);
|
||||
|
||||
int affected = ground.getAffected();
|
||||
actor.print(affected + " flora created.");
|
||||
actor.printInfo(TranslatableComponent.of("worldedit.flora.created", TextComponent.of(affected)));
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -23,6 +23,7 @@ import static com.boydti.fawe.util.ReflectionUtils.as;
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import com.boydti.fawe.config.BBC;
|
||||
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
|
||||
import com.boydti.fawe.config.Settings;
|
||||
import com.boydti.fawe.object.clipboard.MultiClipboardHolder;
|
||||
import com.boydti.fawe.object.clipboard.URIClipboardHolder;
|
||||
@ -59,6 +60,7 @@ import com.sk89q.worldedit.util.formatting.component.TextComponentProducer;
|
||||
import com.sk89q.worldedit.util.formatting.text.Component;
|
||||
import com.sk89q.worldedit.util.formatting.text.TextComponent;
|
||||
import com.sk89q.worldedit.util.formatting.text.event.ClickEvent;
|
||||
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
|
||||
import com.sk89q.worldedit.util.formatting.text.event.HoverEvent;
|
||||
import com.sk89q.worldedit.util.formatting.component.CodeFormat;
|
||||
import com.sk89q.worldedit.util.formatting.text.format.TextColor;
|
||||
@ -133,14 +135,14 @@ public class SchematicCommands {
|
||||
boolean randomRotate) throws FilenameException {
|
||||
final ClipboardFormat format = ClipboardFormats.findByAlias(formatName);
|
||||
if (format == null) {
|
||||
BBC.CLIPBOARD_INVALID_FORMAT.send(player, formatName);
|
||||
player.print(TranslatableComponent.of("fawe.worldedit.clipboard.clipboard.invalid.format" , formatName));
|
||||
return;
|
||||
}
|
||||
try {
|
||||
MultiClipboardHolder all = ClipboardFormats.loadAllFromInput(player, filename, null, true);
|
||||
if (all != null) {
|
||||
session.addClipboard(all);
|
||||
BBC.SCHEMATIC_LOADED.send(player, filename);
|
||||
player.print(TranslatableComponent.of("fawe.worldedit.schematic.schematic.loaded" , filename));
|
||||
}
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
@ -154,7 +156,7 @@ public class SchematicCommands {
|
||||
@CommandPermissions({"worldedit.clipboard.clear", "worldedit.schematic.clear"})
|
||||
public void clear(Player player, LocalSession session) throws WorldEditException {
|
||||
session.setClipboard(null);
|
||||
player.print(BBC.CLIPBOARD_CLEARED.s());
|
||||
player.print(TranslatableComponent.of("fawe.worldedit.clipboard.clipboard.cleared"));
|
||||
}
|
||||
|
||||
@Command(
|
||||
@ -184,11 +186,11 @@ public class SchematicCommands {
|
||||
} else {
|
||||
session.setClipboard(null);
|
||||
}
|
||||
player.print(BBC.CLIPBOARD_CLEARED.s());
|
||||
player.print(TranslatableComponent.of("fawe.worldedit.clipboard.clipboard.cleared"));
|
||||
return;
|
||||
}
|
||||
}
|
||||
BBC.CLIPBOARD_URI_NOT_FOUND.send(player, fileName);
|
||||
player.print(TranslatableComponent.of("fawe.worldedit.clipboard.clipboard.uri.not.found" , fileName));
|
||||
}
|
||||
|
||||
@Command(
|
||||
@ -224,7 +226,7 @@ public class SchematicCommands {
|
||||
URI uri;
|
||||
if (filename.startsWith("url:")) {
|
||||
if (!actor.hasPermission("worldedit.schematic.load.web")) {
|
||||
BBC.NO_PERM.send(actor, "worldedit.schematic.load.web");
|
||||
actor.print(TranslatableComponent.of("fawe.error.no.perm", "worldedit.schematic.load.web"));
|
||||
return;
|
||||
}
|
||||
UUID uuid = UUID.fromString(filename.substring(4));
|
||||
@ -246,12 +248,12 @@ public class SchematicCommands {
|
||||
}
|
||||
file = actor.openFileOpenDialog(extensions);
|
||||
if (file == null || !file.exists()) {
|
||||
actor.printError("Schematic " + filename + " does not exist! (" + file + ")");
|
||||
actor.printError(TranslatableComponent.of("worldedit.schematic.load.does-not-exist", TextComponent.of(filename)));
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
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()) {
|
||||
BBC.NO_PERM.send(actor, "worldedit.schematic.load.other");
|
||||
actor.print(TranslatableComponent.of("fawe.error.no.perm", "worldedit.schematic.load.other"));
|
||||
return;
|
||||
}
|
||||
if (format == null && filename.matches(".*\\.[\\w].*")) {
|
||||
@ -273,7 +275,7 @@ public class SchematicCommands {
|
||||
if (format == null) {
|
||||
format = ClipboardFormats.findByFile(file);
|
||||
if (format == null) {
|
||||
BBC.CLIPBOARD_INVALID_FORMAT.send(actor, file.getName());
|
||||
actor.printError(TranslatableComponent.of("worldedit.schematic.unknown-format", TextComponent.of(formatName)));
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -281,7 +283,7 @@ public class SchematicCommands {
|
||||
uri = file.toURI();
|
||||
}
|
||||
format.hold(actor, uri, in);
|
||||
BBC.SCHEMATIC_LOADED.send(actor, filename);
|
||||
actor.print(TranslatableComponent.of("fawe.worldedit.schematic.schematic.loaded" , filename));
|
||||
} catch (IllegalArgumentException e) {
|
||||
actor.printError("Unknown filename: " + filename);
|
||||
} catch (URISyntaxException | IOException e) {
|
||||
@ -322,7 +324,7 @@ public class SchematicCommands {
|
||||
|
||||
ClipboardFormat format = ClipboardFormats.findByAlias(formatName);
|
||||
if (format == null) {
|
||||
actor.printError("Unknown schematic format: " + formatName);
|
||||
actor.printError(TranslatableComponent.of("worldedit.schematic.unknown-format", TextComponent.of(formatName)));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -330,7 +332,7 @@ public class SchematicCommands {
|
||||
if (filename.contains("../")) {
|
||||
other = true;
|
||||
if (!actor.hasPermission("worldedit.schematic.save.other")) {
|
||||
BBC.NO_PERM.send(actor, "worldedit.schematic.save.other");
|
||||
actor.print(TranslatableComponent.of("fawe.error.no.perm", "worldedit.schematic.save.other"));
|
||||
return;
|
||||
}
|
||||
if (filename.startsWith("../")) {
|
||||
@ -348,12 +350,12 @@ public class SchematicCommands {
|
||||
}
|
||||
if (other) {
|
||||
if (!actor.hasPermission("worldedit.schematic.delete.other")) {
|
||||
BBC.NO_PERM.send(actor, "worldedit.schematic.delete.other");
|
||||
actor.print(TranslatableComponent.of("fawe.error.no.perm", "worldedit.schematic.delete.other"));
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (!allowOverwrite) {
|
||||
actor.printError("That schematic already exists. Use the -f flag to overwrite it.");
|
||||
actor.printError(TranslatableComponent.of("worldedit.schematic.save.already-exists"));
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -362,8 +364,8 @@ public class SchematicCommands {
|
||||
File parent = f.getParentFile();
|
||||
if (parent != null && !parent.exists()) {
|
||||
if (!parent.mkdirs()) {
|
||||
throw new StopExecutionException(TextComponent.of(
|
||||
"Could not create folder for schematics!"));
|
||||
throw new StopExecutionException(TranslatableComponent.of(
|
||||
"worldedit.schematic.save.failed-directory"));
|
||||
}
|
||||
}
|
||||
|
||||
@ -372,7 +374,7 @@ public class SchematicCommands {
|
||||
SchematicSaveTask task = new SchematicSaveTask(actor, f, format, holder, overwrite);
|
||||
AsyncCommandBuilder.wrap(task, actor)
|
||||
.registerWithSupervisor(worldEdit.getSupervisor(), "Saving schematic " + filename)
|
||||
.sendMessageAfterDelay("(Please wait... saving schematic.)")
|
||||
.sendMessageAfterDelay(TranslatableComponent.of("worldedit.schematic.save.saving"))
|
||||
.onSuccess(filename + " saved" + (overwrite ? " (overwriting previous file)." : "."), null)
|
||||
.onFailure("Failed to load schematic", worldEdit.getPlatformManager().getPlatformCommandManager().getExceptionConverter())
|
||||
.buildAndExec(worldEdit.getExecutorService());
|
||||
@ -394,13 +396,13 @@ public class SchematicCommands {
|
||||
return;
|
||||
}
|
||||
if (Settings.IMP.PATHS.PER_PLAYER_SCHEMATICS && !MainUtil.isInSubDirectory(dir, destDir) && !player.hasPermission("worldedit.schematic.move.other")) {
|
||||
BBC.NO_PERM.send(player, "worldedit.schematic.move.other");
|
||||
player.print(TranslatableComponent.of("fawe.error.no.perm", "worldedit.schematic.move.other"));
|
||||
return;
|
||||
}
|
||||
ClipboardHolder clipboard = session.getClipboard();
|
||||
List<File> sources = getFiles(clipboard);
|
||||
if (sources.isEmpty()) {
|
||||
player.printError(BBC.SCHEMATIC_NONE.s());
|
||||
player.printError(TranslatableComponent.of("fawe.worldedit.schematic.schematic.none"));
|
||||
return;
|
||||
}
|
||||
if (!destDir.exists() && !destDir.mkdirs()) {
|
||||
@ -410,19 +412,19 @@ public class SchematicCommands {
|
||||
for (File source : sources) {
|
||||
File destFile = new File(destDir, source.getName());
|
||||
if (destFile.exists()) {
|
||||
BBC.SCHEMATIC_MOVE_EXISTS.send(player, destFile);
|
||||
player.print(TranslatableComponent.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")) {
|
||||
BBC.SCHEMATIC_MOVE_FAILED.send(player, destFile,
|
||||
BBC.NO_PERM.format("worldedit.schematic.move.other"));
|
||||
player.print(TranslatableComponent.of("fawe.worldedit.schematic.schematic.move.failed", destFile,
|
||||
TranslatableComponent.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());
|
||||
BBC.SCHEMATIC_MOVE_SUCCESS.send(player, source, destFile);
|
||||
player.print(TranslatableComponent.of("fawe.worldedit.schematic.schematic.move.success" , source, destFile));
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
@ -449,7 +451,7 @@ public class SchematicCommands {
|
||||
)
|
||||
@CommandPermissions("worldedit.schematic.formats")
|
||||
public void formats(Actor actor) {
|
||||
actor.print("Available clipboard formats (Name: Lookup names)");
|
||||
actor.printInfo(TranslatableComponent.of("worldedit.schematic.formats.title"));
|
||||
StringBuilder builder;
|
||||
boolean first = true;
|
||||
for (ClipboardFormat format : ClipboardFormats.getAll()) {
|
||||
@ -463,7 +465,7 @@ public class SchematicCommands {
|
||||
first = false;
|
||||
}
|
||||
first = true;
|
||||
actor.print(builder.toString());
|
||||
actor.printInfo(TextComponent.of(builder.toString()));
|
||||
}
|
||||
}
|
||||
|
||||
@ -481,7 +483,7 @@ public class SchematicCommands {
|
||||
if (args.argsLength() == 0) {
|
||||
if (fp.getSession().getVirtualWorld() != null) fp.setVirtualWorld(null);
|
||||
else {
|
||||
BBC.COMMAND_SYNTAX.send(player, "/" + Commands.getAlias(SchematicCommands.class, "schematic") + " " + getCommand().aliases()[0] + " " + getCommand().usage());
|
||||
player.print(TranslatableComponent.of("fawe.error.command.syntax" , "/" + Commands.getAlias(SchematicCommands.class, "schematic") + " " + getCommand().aliases()[0] + " " + getCommand().usage()));
|
||||
}
|
||||
return;
|
||||
}
|
||||
@ -503,11 +505,11 @@ public class SchematicCommands {
|
||||
long total = count.longValue();
|
||||
if (total == 0) {
|
||||
if (args.getJoinedStrings(0).toLowerCase().startsWith("all")) {
|
||||
BBC.SCHEMATIC_NONE.send(player);
|
||||
player.print(TranslatableComponent.of("fawe.worldedit.schematic.schematic.none"))
|
||||
} else {
|
||||
String joined = args.getJoinedStrings(0);
|
||||
String cmd = "/" + Commands.getAlias(SchematicCommands.class, "schematic") + " " + getCommand().aliases()[0] + " all " + joined;
|
||||
BBC.HELP_SUGGEST.send(player, joined, cmd);
|
||||
player.print(TranslatableComponent.of("fawe.worldedit.help.help.suggest" , joined, cmd));
|
||||
}
|
||||
return;
|
||||
}
|
||||
@ -516,11 +518,11 @@ public class SchematicCommands {
|
||||
|
||||
String cmdPrefix = "/" + (config.noDoubleSlash ? "" : "/");
|
||||
String cmdShow = Commands.getAlias(ClipboardCommands.class, "schematic") + " " + Commands.getAlias(ClipboardCommands.class, "show");
|
||||
BBC.SCHEMATIC_SHOW.send(fp, count.longValue(), args.getJoinedStrings(0), cmdShow);
|
||||
fp.print(TranslatableComponent.of("fawe.worldedit.schematic.schematic.show" , count.longValue(), args.getJoinedStrings(0), cmdShow));
|
||||
|
||||
if (fp.getSession().getExistingClipboard() != null) {
|
||||
String cmd = cmdPrefix + Commands.getAlias(ClipboardCommands.class, "clearclipboard");
|
||||
BBC.SCHEMATIC_PROMPT_CLEAR.send(fp, cmd);
|
||||
fp.print(TranslatableComponent.of("fawe.worldedit.schematic.schematic.prompt.clear" , cmd));
|
||||
}
|
||||
|
||||
} catch (Throwable e) {
|
||||
@ -719,9 +721,9 @@ public class SchematicCommands {
|
||||
writer.write(target);
|
||||
}
|
||||
log.info(actor.getName() + " saved " + file.getCanonicalPath());
|
||||
BBC.SCHEMATIC_SAVED.send(actor, file.getName());
|
||||
actor.print(TranslatableComponent.of("fawe.worldedit.schematic.schematic.saved" , file.getName()));
|
||||
} else {
|
||||
actor.printError(BBC.WORLDEDIT_CANCEL_REASON_MANUAL.s());
|
||||
actor.printError(TranslatableComponent.of("fawe.cancel.worldedit.cancel.reason.manual"));
|
||||
}
|
||||
}
|
||||
return null;
|
||||
@ -826,28 +828,27 @@ public class SchematicCommands {
|
||||
}
|
||||
|
||||
if (files.isEmpty()) {
|
||||
actor.printError(BBC.SCHEMATIC_NONE.s());
|
||||
actor.printError(TranslatableComponent.of("worldedit.schematic.delete.does-not-exist", TextComponent.of(filename)));
|
||||
return;
|
||||
}
|
||||
for (File f : files) {
|
||||
if (!MainUtil.isInSubDirectory(working, f) || !f.exists()) {
|
||||
actor.printError("Schematic " + filename + " does not exist! (" + f.exists() + "|" + f + "|" + !MainUtil.isInSubDirectory(working, f)
|
||||
+ ")");
|
||||
actor.printError(TranslatableComponent.of("worldedit.schematic.delete.does-not-exist", TextComponent.of(filename)));
|
||||
continue;
|
||||
}
|
||||
if (Settings.IMP.PATHS.PER_PLAYER_SCHEMATICS && !MainUtil.isInSubDirectory(dir, f) && !actor.hasPermission("worldedit.schematic.delete.other")) {
|
||||
BBC.NO_PERM.send(actor, "worldedit.schematic.delete.other");
|
||||
actor.print(TranslatableComponent.of("fawe.error.no.perm", "worldedit.schematic.delete.other"));
|
||||
continue;
|
||||
}
|
||||
if (!delete(f)) {
|
||||
actor.printError("Deletion of " + filename + " failed! Maybe it is read-only.");
|
||||
if (!deleteFile(f)) {
|
||||
actor.printError(TranslatableComponent.of("worldedit.schematic.delete.failed", TextComponent.of(filename)));
|
||||
continue;
|
||||
}
|
||||
BBC.FILE_DELETED.send(actor, filename);
|
||||
actor.print(TranslatableComponent.of("fawe.info.file.deleted" , filename));
|
||||
}
|
||||
}
|
||||
|
||||
private boolean delete(File file) {
|
||||
private boolean deleteFile(File file) {
|
||||
if (file.delete()) {
|
||||
new File(file.getParentFile(), "." + file.getName() + ".cached").delete();
|
||||
return true;
|
||||
|
@ -21,6 +21,7 @@ package com.sk89q.worldedit.command;
|
||||
import static com.sk89q.worldedit.command.util.Logging.LogMode.ALL;
|
||||
|
||||
import com.boydti.fawe.config.BBC;
|
||||
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
|
||||
import com.sk89q.worldedit.LocalSession;
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
@ -28,6 +29,7 @@ import com.sk89q.worldedit.command.util.CommandPermissions;
|
||||
import com.sk89q.worldedit.command.util.CommandPermissionsConditionGenerator;
|
||||
import com.sk89q.worldedit.command.util.Logging;
|
||||
import com.sk89q.worldedit.entity.Player;
|
||||
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
|
||||
import com.sk89q.worldedit.extension.platform.PlatformCommandManager;
|
||||
import java.io.File;
|
||||
import java.util.List;
|
||||
@ -70,7 +72,7 @@ public class ScriptingCommands {
|
||||
@Arg(desc = "Arguments to the CraftScript", def = "", variable = true)
|
||||
List<String> args) throws WorldEditException {
|
||||
if (!player.hasPermission("worldedit.scripting.execute." + filename)) {
|
||||
player.printError("You don't have permission to use that script.");
|
||||
player.printError(TranslatableComponent.of("worldedit.execute.script-permissions"));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -96,12 +98,12 @@ public class ScriptingCommands {
|
||||
String lastScript = session.getLastScript();
|
||||
|
||||
if (!player.hasPermission("worldedit.scripting.execute." + lastScript)) {
|
||||
player.printError(BBC.SCRIPTING_NO_PERM.s());
|
||||
player.printError(TranslatableComponent.of("worldedit.execute.script-permissions"));
|
||||
return;
|
||||
}
|
||||
|
||||
if (lastScript == null) {
|
||||
player.printError(BBC.SCRIPTING_CS.s());
|
||||
player.printError(TranslatableComponent.of("worldedit.executelast.no-script"));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -25,6 +25,7 @@ import static com.sk89q.worldedit.command.util.Logging.LogMode.POSITION;
|
||||
import static com.sk89q.worldedit.command.util.Logging.LogMode.REGION;
|
||||
|
||||
import com.boydti.fawe.config.BBC;
|
||||
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
|
||||
import com.boydti.fawe.object.clipboard.URIClipboardHolder;
|
||||
import com.boydti.fawe.object.mask.IdMask;
|
||||
import com.boydti.fawe.object.regions.selector.FuzzyRegionSelector;
|
||||
@ -46,7 +47,6 @@ import com.sk89q.worldedit.extension.platform.Actor;
|
||||
import com.sk89q.worldedit.extension.platform.Locatable;
|
||||
import com.sk89q.worldedit.extension.platform.permission.ActorSelectorLimits;
|
||||
import com.sk89q.worldedit.extent.AbstractDelegateExtent;
|
||||
import com.sk89q.worldedit.command.util.WorldEditAsyncCommandBuilder;
|
||||
import com.sk89q.worldedit.extent.clipboard.Clipboard;
|
||||
import com.sk89q.worldedit.function.mask.Mask;
|
||||
import com.sk89q.worldedit.internal.annotation.Direction;
|
||||
@ -71,6 +71,7 @@ import com.sk89q.worldedit.util.formatting.component.CommandListBox;
|
||||
import com.sk89q.worldedit.util.formatting.component.SubtleFormat;
|
||||
import com.sk89q.worldedit.util.formatting.component.TextComponentProducer;
|
||||
import com.sk89q.worldedit.util.formatting.text.TextComponent;
|
||||
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
|
||||
import com.sk89q.worldedit.util.formatting.text.event.ClickEvent;
|
||||
import com.sk89q.worldedit.util.formatting.text.format.TextColor;
|
||||
import com.sk89q.worldedit.world.World;
|
||||
@ -123,12 +124,12 @@ public class SelectionCommands {
|
||||
} else if (actor instanceof Locatable) {
|
||||
pos = ((Locatable) actor).getBlockLocation();
|
||||
} else {
|
||||
actor.printError("You must provide coordinates as console.");
|
||||
actor.printError(TranslatableComponent.of("worldedit.pos.console-require-coords"));
|
||||
return;
|
||||
}
|
||||
|
||||
if (!session.getRegionSelector(world).selectPrimary(pos.toVector().toBlockPoint(), ActorSelectorLimits.forActor(actor))) {
|
||||
actor.printError("Position already set.");
|
||||
actor.printError(TranslatableComponent.of("worldedit.pos.already-set"));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -152,12 +153,12 @@ public class SelectionCommands {
|
||||
} else if (actor instanceof Locatable) {
|
||||
pos = ((Locatable) actor).getBlockLocation();
|
||||
} else {
|
||||
actor.printError("You must provide coordinates as console.");
|
||||
actor.printError(TranslatableComponent.of("worldedit.pos.console-require-coords"));
|
||||
return;
|
||||
}
|
||||
|
||||
if (!session.getRegionSelector(world).selectSecondary(pos.toVector().toBlockPoint(), ActorSelectorLimits.forActor(actor))) {
|
||||
actor.printError("Position already set.");
|
||||
actor.printError(TranslatableComponent.of("worldedit.pos.already-set"));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -175,15 +176,15 @@ public class SelectionCommands {
|
||||
Location pos = player.getBlockTrace(300);
|
||||
|
||||
if (pos != null) {
|
||||
if (!session.getRegionSelector(player.getWorld()).selectPrimary(pos.toBlockPoint(), ActorSelectorLimits.forActor(player))) {
|
||||
player.printError(BBC.SELECTOR_ALREADY_SET.s());
|
||||
if (!session.getRegionSelector(player.getWorld()).selectPrimary(pos.toVector().toBlockPoint(), ActorSelectorLimits.forActor(player))) {
|
||||
player.printError(TranslatableComponent.of("worldedit.hpos.already-set"));
|
||||
return;
|
||||
}
|
||||
|
||||
session.getRegionSelector(player.getWorld())
|
||||
.explainPrimarySelection(player, session, pos.toBlockPoint());
|
||||
} else {
|
||||
player.printError(BBC.NO_BLOCK.s());
|
||||
player.printError(TranslatableComponent.of("worldedit.hpos.no-block"));
|
||||
}
|
||||
}
|
||||
|
||||
@ -197,15 +198,15 @@ public class SelectionCommands {
|
||||
Location pos = player.getBlockTrace(300);
|
||||
|
||||
if (pos != null) {
|
||||
if (!session.getRegionSelector(player.getWorld()).selectSecondary(pos.toBlockPoint(), ActorSelectorLimits.forActor(player))) {
|
||||
player.printError(BBC.SELECTOR_ALREADY_SET.s());
|
||||
if (!session.getRegionSelector(player.getWorld()).selectSecondary(pos.toVector().toBlockPoint(), ActorSelectorLimits.forActor(player))) {
|
||||
player.printError(TranslatableComponent.of("worldedit.hpos.already-set"));
|
||||
return;
|
||||
}
|
||||
|
||||
session.getRegionSelector(player.getWorld())
|
||||
.explainSecondarySelection(player, session, pos.toBlockPoint());
|
||||
} else {
|
||||
player.printError(BBC.NO_BLOCK.s());
|
||||
player.printError(TranslatableComponent.of("worldedit.hpos.no-block"));
|
||||
}
|
||||
}
|
||||
|
||||
@ -233,9 +234,13 @@ public class SelectionCommands {
|
||||
min = BlockVector3.at(min2D.getBlockX() * 16, 0, min2D.getBlockZ() * 16);
|
||||
max = BlockVector3.at(max2D.getBlockX() * 16 + 15, world.getMaxY(), max2D.getBlockZ() * 16 + 15);
|
||||
|
||||
actor.print("Chunks selected: ("
|
||||
+ min2D.getBlockX() + ", " + min2D.getBlockZ() + ") - ("
|
||||
+ max2D.getBlockX() + ", " + max2D.getBlockZ() + ")");
|
||||
actor.printInfo(TranslatableComponent.of(
|
||||
"worldedit.chunk.selected-multiple",
|
||||
TextComponent.of(min2D.getBlockX()),
|
||||
TextComponent.of(min2D.getBlockZ()),
|
||||
TextComponent.of(max2D.getBlockX()),
|
||||
TextComponent.of(max2D.getBlockZ())
|
||||
));
|
||||
} else {
|
||||
final BlockVector2 min2D;
|
||||
if (coordinates != null) {
|
||||
@ -255,8 +260,8 @@ public class SelectionCommands {
|
||||
min = BlockVector3.at(min2D.getBlockX() * 16, 0, min2D.getBlockZ() * 16);
|
||||
max = min.add(15, world.getMaxY(), 15);
|
||||
|
||||
actor.print("Chunk selected: "
|
||||
+ min2D.getBlockX() + ", " + min2D.getBlockZ());
|
||||
actor.printInfo(TranslatableComponent.of("worldedit.chunk.selected", TextComponent.of(min2D.getBlockX()),
|
||||
TextComponent.of(min2D.getBlockZ())));
|
||||
}
|
||||
|
||||
final CuboidRegionSelector selector;
|
||||
@ -287,19 +292,20 @@ public class SelectionCommands {
|
||||
}
|
||||
ItemType itemType = ItemTypes.parse(wandId);
|
||||
if (itemType == null) {
|
||||
player.printError("Wand item is mis-configured or disabled.");
|
||||
player.printError(TranslatableComponent.of("worldedit.wand.invalid"));
|
||||
return;
|
||||
}
|
||||
player.giveItem(new BaseItemStack(itemType, 1));
|
||||
if (navWand) {
|
||||
session.setTool(itemType, NavigationWand.INSTANCE);
|
||||
player.print("Left click: jump to location; Right click: pass through walls");
|
||||
player.printInfo(TranslatableComponent.of("worldedit.wand.navwand.info"));
|
||||
} else {
|
||||
session.setTool(itemType, SelectionWand.INSTANCE);
|
||||
player.print(BBC.SELECTION_WAND.s());
|
||||
player.printInfo(TranslatableComponent.of("worldedit.wand.selwand.info"));
|
||||
}
|
||||
if (!player.hasPermission("fawe.tips"))
|
||||
BBC.TIP_SEL_LIST.or(BBC.TIP_SELECT_CONNECTED, BBC.TIP_SET_POS1, BBC.TIP_FARWAND, BBC.TIP_DISCORD).send(player);
|
||||
System.out.println("TODO FIXME tips");
|
||||
// TranslatableComponent.of("fawe.tips.tip.sel.list").or(TranslatableComponent.of("fawe.tips.tip.select.connected"), TranslatableComponent.of("fawe.tips.tip.set.pos1"), TranslatableComponent.of("fawe.tips.tip.farwand"), TranslatableComponent.of("fawe.tips.tip.discord")).send(player);
|
||||
}
|
||||
|
||||
@Command(
|
||||
@ -350,9 +356,9 @@ public class SelectionCommands {
|
||||
|
||||
session.getRegionSelector(world).explainRegionAdjust(actor, session);
|
||||
|
||||
actor.print("Region contracted " + (oldSize - newSize) + " blocks.");
|
||||
actor.printInfo(TranslatableComponent.of("worldedit.contract.contracted", TextComponent.of(oldSize - newSize)));
|
||||
} catch (RegionOperationException e) {
|
||||
actor.printError(e.getMessage());
|
||||
actor.printError(TextComponent.of(e.getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
@ -379,9 +385,9 @@ public class SelectionCommands {
|
||||
|
||||
session.getRegionSelector(world).explainRegionAdjust(actor, session);
|
||||
|
||||
actor.print("Region shifted.");
|
||||
actor.print(TranslatableComponent.of("worldedit.shift.shifted"));
|
||||
} catch (RegionOperationException e) {
|
||||
actor.printError(e.getMessage());
|
||||
actor.printError(TextComponent.of(e.getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
@ -402,7 +408,7 @@ public class SelectionCommands {
|
||||
region.expand(getChangesForEachDir(amount, onlyHorizontal, onlyVertical));
|
||||
session.getRegionSelector(world).learnChanges();
|
||||
session.getRegionSelector(world).explainRegionAdjust(actor, session);
|
||||
actor.print("Region outset.");
|
||||
actor.print(TranslatableComponent.of("worldedit.outset.outset"));
|
||||
}
|
||||
|
||||
@Command(
|
||||
@ -422,7 +428,7 @@ public class SelectionCommands {
|
||||
region.contract(getChangesForEachDir(amount, onlyHorizontal, onlyVertical));
|
||||
session.getRegionSelector(world).learnChanges();
|
||||
session.getRegionSelector(world).explainRegionAdjust(actor, session);
|
||||
actor.print("Region inset.");
|
||||
actor.print(TranslatableComponent.of("worldedit.inset.inset"));
|
||||
}
|
||||
|
||||
private BlockVector3[] getChangesForEachDir(int amount, boolean onlyHorizontal, boolean onlyVertical) {
|
||||
@ -448,7 +454,7 @@ public class SelectionCommands {
|
||||
desc = "Get information about the selection"
|
||||
)
|
||||
@CommandPermissions("worldedit.selection.size")
|
||||
public void size(Player player, LocalSession session,
|
||||
public void size(Actor actor, World world, LocalSession session,
|
||||
@Switch(name = 'c', desc = "Get clipboard info instead")
|
||||
boolean clipboardInfo) throws WorldEditException {
|
||||
Region region;
|
||||
@ -472,28 +478,24 @@ public class SelectionCommands {
|
||||
region = clipboard.getRegion();
|
||||
BlockVector3 size = region.getMaximumPoint()
|
||||
.subtract(region.getMinimumPoint()).
|
||||
add(1, 1, 1);
|
||||
add(1, 1, 1);
|
||||
BlockVector3 origin = clipboard.getOrigin();
|
||||
|
||||
String sizeStr = size.getBlockX() + "*" + size.getBlockY() + "*" + size.getBlockZ();
|
||||
String originStr = origin.getBlockX() + "," + origin.getBlockY() + "," + origin.getBlockZ();
|
||||
|
||||
long numBlocks = ((long) size.getBlockX() * size.getBlockY() * size.getBlockZ());
|
||||
|
||||
String msg = String.format("%1$s: %2$s @ %3$s (%4$d blocks)", name, sizeStr, originStr, numBlocks);
|
||||
player.print(msg);
|
||||
|
||||
actor.printInfo(TranslatableComponent.of("worldedit.size.offset", TextComponent.of(name), TextComponent.of(sizeStr), TextComponent.of(originStr), TextComponent.of(numBlocks)));
|
||||
index++;
|
||||
}
|
||||
return;
|
||||
} else {
|
||||
region = session.getSelection(world);
|
||||
|
||||
region = session.getSelection(player.getWorld());
|
||||
actor.printInfo(TranslatableComponent.of("worldedit.size.type", TextComponent.of(session.getRegionSelector(world).getTypeName())));
|
||||
|
||||
player.print("Type: " + session.getRegionSelector(player.getWorld()).getTypeName());
|
||||
|
||||
for (String line : session.getRegionSelector(player.getWorld()).getInformationLines()) {
|
||||
player.print(line);
|
||||
for (Component line : session.getRegionSelector(world).getSelectionInfoLines()) {
|
||||
actor.print(line);
|
||||
}
|
||||
|
||||
}
|
||||
@ -501,22 +503,22 @@ public class SelectionCommands {
|
||||
.subtract(region.getMinimumPoint())
|
||||
.add(1, 1, 1);
|
||||
|
||||
player.print("Size: " + size);
|
||||
player.print("Cuboid distance: " + region.getMaximumPoint().distance(region.getMinimumPoint()));
|
||||
player.print("# of blocks: " + region.getArea());
|
||||
actor.printInfo(TranslatableComponent.of("worldedit.size.size", TextComponent.of(size.toString())));
|
||||
actor.printInfo(TranslatableComponent.of("worldedit.size.distance", TextComponent.of(region.getMaximumPoint().distance(region.getMinimumPoint()))));
|
||||
actor.printInfo(TranslatableComponent.of("worldedit.size.blocks", TextComponent.of(region.getArea())));
|
||||
}
|
||||
|
||||
|
||||
@Command(
|
||||
name = "/count",
|
||||
desc = "Counts the number of blocks matching a mask"
|
||||
)
|
||||
@CommandPermissions("worldedit.analysis.count")
|
||||
public void count(Actor actor, World world, LocalSession session, EditSession editSession,
|
||||
public int count(Actor actor, World world, LocalSession session, EditSession editSession,
|
||||
@Arg(desc = "The mask of blocks to match")
|
||||
Mask mask) throws WorldEditException {
|
||||
int count = editSession.countBlocks(session.getSelection(world), mask);
|
||||
actor.print("Counted: " + count);
|
||||
actor.printInfo(TranslatableComponent.of("worldedit.count.counted", TextComponent.of(count)));
|
||||
return count;
|
||||
}
|
||||
|
||||
@Command(
|
||||
@ -524,11 +526,13 @@ public class SelectionCommands {
|
||||
desc = "Get the distribution of blocks in the selection"
|
||||
)
|
||||
@CommandPermissions("worldedit.analysis.distr")
|
||||
public void distr(Player player, LocalSession session, EditSession editSession,
|
||||
public void distr(Actor actor, World world, LocalSession session, EditSession editSession,
|
||||
@Switch(name = 'c', desc = "Get the distribution of the clipboard instead")
|
||||
boolean clipboardDistr,
|
||||
boolean clipboardDistr,
|
||||
@Switch(name = 'd', desc = "Separate blocks by state")
|
||||
boolean separateStates) throws WorldEditException {
|
||||
boolean separateStates,
|
||||
@ArgFlag(name = 'p', desc = "Gets page from a previous distribution.", def = "")
|
||||
Integer page) throws WorldEditException {
|
||||
List<Countable> distribution;
|
||||
|
||||
Region region;
|
||||
@ -538,7 +542,7 @@ public class SelectionCommands {
|
||||
region = clipboard.getRegion();
|
||||
new ExtentTraverser<AbstractDelegateExtent>(editSession).setNext(new AbstractDelegateExtent(clipboard));
|
||||
} else {
|
||||
region = session.getSelection(player.getWorld());
|
||||
region = session.getSelection(world);
|
||||
}
|
||||
if (separateStates)
|
||||
distribution = (List) editSession.getBlockDistributionWithData(region);
|
||||
@ -547,31 +551,22 @@ public class SelectionCommands {
|
||||
|
||||
|
||||
if (distribution.isEmpty()) { // *Should* always be false
|
||||
player.printError("No blocks counted.");
|
||||
actor.printError(TranslatableComponent.of("worldedit.distr.no-blocks"));
|
||||
return;
|
||||
}
|
||||
|
||||
// note: doing things like region.getArea is inaccurate for non-cuboids.
|
||||
int size = session.getSelection(player.getWorld()).getArea();
|
||||
BBC.SELECTION_DISTR.send(player, size);
|
||||
|
||||
for (Countable c : distribution) {
|
||||
String name = c.getID().toString();
|
||||
String str = String.format("%-7s (%.3f%%) %s",
|
||||
String.valueOf(c.getAmount()),
|
||||
c.getAmount() / (double) size * 100,
|
||||
name);
|
||||
player.print(str);
|
||||
}
|
||||
BlockDistributionResult res = new BlockDistributionResult(distribution, separateStates);
|
||||
if (!actor.isPlayer()) res.formatForConsole();
|
||||
actor.print(res.create(page));
|
||||
}
|
||||
|
||||
private static class BlockDistributionResult extends PaginationBox {
|
||||
|
||||
private final List<Countable<BlockState>> distribution;
|
||||
private final List<Countable> distribution;
|
||||
private final int totalBlocks;
|
||||
private final boolean separateStates;
|
||||
|
||||
BlockDistributionResult(List<Countable<BlockState>> distribution, boolean separateStates) {
|
||||
BlockDistributionResult(List<Countable> distribution, boolean separateStates) {
|
||||
super("Block Distribution", "//distr -p %page%" + (separateStates ? " -d" : ""));
|
||||
this.distribution = distribution;
|
||||
// note: doing things like region.getArea is inaccurate for non-cuboids.
|
||||
@ -597,11 +592,11 @@ public class SelectionCommands {
|
||||
|
||||
final BlockState state = c.getID();
|
||||
final BlockType blockType = state.getBlockType();
|
||||
TextComponent blockName = TextComponent.of(blockType.getName(), TextColor.LIGHT_PURPLE);
|
||||
TextComponent blockName = TextComponent.of(blockType.getName(), TextColor.GRAY);
|
||||
TextComponent toolTip;
|
||||
if (separateStates && state != blockType.getDefaultState()) {
|
||||
toolTip = TextComponent.of(state.getAsString(), TextColor.GRAY);
|
||||
blockName = blockName.append(TextComponent.of("*", TextColor.LIGHT_PURPLE));
|
||||
blockName = blockName.append(TextComponent.of("*", TextColor.GRAY));
|
||||
} else {
|
||||
toolTip = TextComponent.of(blockType.getId(), TextColor.GRAY);
|
||||
}
|
||||
@ -618,7 +613,7 @@ public class SelectionCommands {
|
||||
|
||||
@Override
|
||||
public Component create(int page) throws InvalidComponentException {
|
||||
super.getContents().append(TextComponent.of("Total Block Count: " + totalBlocks, TextColor.GRAY))
|
||||
super.getContents().append(TranslatableComponent.of("worldedit.distr.total", TextColor.GRAY, TextComponent.of(totalBlocks)))
|
||||
.append(TextComponent.newline());
|
||||
return super.create(page);
|
||||
}
|
||||
@ -638,7 +633,7 @@ public class SelectionCommands {
|
||||
if (selector == null) {
|
||||
session.getRegionSelector(world).clear();
|
||||
session.dispatchCUISelection(actor);
|
||||
actor.print(BBC.SELECTION_CLEARED.s());
|
||||
actor.printInfo(TranslatableComponent.of("worldedit.select.cleared"));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -648,46 +643,46 @@ public class SelectionCommands {
|
||||
switch (selector) {
|
||||
case CUBOID:
|
||||
newSelector = new CuboidRegionSelector(oldSelector);
|
||||
actor.print(BBC.SEL_CUBOID.s());
|
||||
actor.printInfo(TranslatableComponent.of("worldedit.select.cuboid.message"));
|
||||
break;
|
||||
case EXTEND:
|
||||
newSelector = new ExtendingCuboidRegionSelector(oldSelector);
|
||||
actor.print(BBC.SEL_CUBOID_EXTEND.s());
|
||||
actor.printInfo(TranslatableComponent.of("worldedit.select.extend.message"));
|
||||
break;
|
||||
case POLY: {
|
||||
newSelector = new Polygonal2DRegionSelector(oldSelector);
|
||||
actor.print(BBC.SEL_2D_POLYGON.s());
|
||||
actor.printInfo(TranslatableComponent.of("worldedit.select.poly.message"));
|
||||
Optional<Integer> limit = ActorSelectorLimits.forActor(actor).getPolygonVertexLimit();
|
||||
limit.ifPresent(integer -> actor.print(BBC.SEL_MAX.format(integer)));
|
||||
limit.ifPresent(integer -> actor.printInfo(TranslatableComponent.of("worldedit.select.poly.limit-message", TextComponent.of(integer))));
|
||||
break;
|
||||
}
|
||||
case ELLIPSOID:
|
||||
newSelector = new EllipsoidRegionSelector(oldSelector);
|
||||
actor.print(BBC.SAL_ELLIPSOID.s());
|
||||
actor.printInfo(TranslatableComponent.of("worldedit.select.ellipsoid.message"));
|
||||
break;
|
||||
case SPHERE:
|
||||
newSelector = new SphereRegionSelector(oldSelector);
|
||||
actor.print(BBC.SEL_SPHERE.s());
|
||||
actor.printInfo(TranslatableComponent.of("worldedit.select.sphere.message"));
|
||||
break;
|
||||
case CYL:
|
||||
newSelector = new CylinderRegionSelector(oldSelector);
|
||||
actor.print(BBC.SEL_CYLINDRICAL.s());
|
||||
actor.printInfo(TranslatableComponent.of("worldedit.select.cyl.message"));
|
||||
break;
|
||||
case CONVEX:
|
||||
case HULL:
|
||||
case POLYHEDRON: {
|
||||
newSelector = new ConvexPolyhedralRegionSelector(oldSelector);
|
||||
actor.print(BBC.SEL_CONVEX_POLYHEDRAL.s());
|
||||
actor.printInfo(TranslatableComponent.of("worldedit.select.convex.message"));
|
||||
Optional<Integer> limit = ActorSelectorLimits.forActor(actor).getPolyhedronVertexLimit();
|
||||
limit.ifPresent(integer -> actor.print(BBC.SEL_MAX.format(integer)));
|
||||
limit.ifPresent(integer -> actor.printInfo(TranslatableComponent.of("worldedit.select.convex.limit-message", TextComponent.of(integer))));
|
||||
break;
|
||||
}
|
||||
case POLYHEDRAL:
|
||||
newSelector = new PolyhedralRegionSelector(world);
|
||||
actor.print(BBC.SEL_CONVEX_POLYHEDRAL.s());
|
||||
actor.print(TranslatableComponent.of("fawe.selection.sel.convex.polyhedral"));
|
||||
Optional<Integer> limit = ActorSelectorLimits.forActor(actor).getPolyhedronVertexLimit();
|
||||
limit.ifPresent(integer -> actor.print(BBC.SEL_MAX.format(integer)));
|
||||
actor.print(BBC.SEL_LIST.s());
|
||||
limit.ifPresent(integer -> actor.print(TranslatableComponent.of("fawe.selection.sel.max", (integer))));
|
||||
actor.print(TranslatableComponent.of("fawe.selection.sel.list"));
|
||||
break;
|
||||
case FUZZY:
|
||||
case MAGIC:
|
||||
@ -696,8 +691,8 @@ public class SelectionCommands {
|
||||
}
|
||||
//TODO Make FuzzyRegionSelector accept actors
|
||||
newSelector = new FuzzyRegionSelector((Player) actor, world, maskOpt);
|
||||
actor.print(BBC.SEL_FUZZY.s());
|
||||
actor.print(BBC.SEL_LIST.s());
|
||||
actor.print(TranslatableComponent.of("fawe.selection.sel.fuzzy"));
|
||||
actor.print(TranslatableComponent.of("fawe.selection.sel.list"));
|
||||
break;
|
||||
case LIST:
|
||||
default:
|
||||
@ -706,14 +701,14 @@ public class SelectionCommands {
|
||||
TextComponentProducer contents = box.getContents();
|
||||
contents.append(SubtleFormat.wrap("Select one of the modes below:")).newline();
|
||||
|
||||
box.appendCommand("cuboid", "Select two corners of a cuboid", "//sel cuboid");
|
||||
box.appendCommand("extend", "Fast cuboid selection mode", "//sel extend");
|
||||
box.appendCommand("poly", "Select a 2D polygon with height", "//sel poly");
|
||||
box.appendCommand("ellipsoid", "Select an ellipsoid", "//sel ellipsoid");
|
||||
box.appendCommand("sphere", "Select a sphere", "//sel sphere");
|
||||
box.appendCommand("cyl", "Select a cylinder", "//sel cyl");
|
||||
box.appendCommand("convex", "Select a convex polyhedral", "//sel convex");
|
||||
box.appendCommand("polyhedral", "Select a hollow polyhedral", "//sel polyhedral");
|
||||
box.appendCommand("cuboid", TranslatableComponent.of("worldedit.select.cuboid.description"), "//sel cuboid");
|
||||
box.appendCommand("extend", TranslatableComponent.of("worldedit.select.extend.description"), "//sel extend");
|
||||
box.appendCommand("poly", TranslatableComponent.of("worldedit.select.poly.description"), "//sel poly");
|
||||
box.appendCommand("ellipsoid", TranslatableComponent.of("worldedit.select.ellipsoid.description"), "//sel ellipsoid");
|
||||
box.appendCommand("sphere", TranslatableComponent.of("worldedit.select.sphere.description"), "//sel sphere");
|
||||
box.appendCommand("cyl", TranslatableComponent.of("worldedit.select.cyl.description"), "//sel cyl");
|
||||
box.appendCommand("convex", TranslatableComponent.of("worldedit.select.convex.description"), "//sel convex");
|
||||
box.appendCommand("polyhedral", "Select a hollow polyhedral", "//sel polyhedral");
|
||||
box.appendCommand("fuzzy[=<mask>]", "Select all connected blocks (magic wand)", "//sel fuzzy[=<mask>]");
|
||||
|
||||
actor.print(box.create(1));
|
||||
@ -731,7 +726,7 @@ public class SelectionCommands {
|
||||
|
||||
if (found != null) {
|
||||
session.setDefaultRegionSelector(found);
|
||||
BBC.SELECTOR_SET_DEFAULT.send(actor, found.name());
|
||||
actor.printInfo(TranslatableComponent.of("worldedit.select.default-set", TextComponent.of(found.name())));
|
||||
} else {
|
||||
throw new RuntimeException("Something unexpected happened. Please report this.");
|
||||
}
|
||||
|
@ -22,17 +22,18 @@
|
||||
package com.sk89q.worldedit.command;
|
||||
|
||||
import com.boydti.fawe.config.BBC;
|
||||
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
|
||||
import com.sk89q.worldedit.LocalConfiguration;
|
||||
import com.sk89q.worldedit.LocalSession;
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
import com.sk89q.worldedit.command.util.CommandPermissions;
|
||||
import com.sk89q.worldedit.command.util.CommandPermissionsConditionGenerator;
|
||||
import com.sk89q.worldedit.entity.Player;
|
||||
import com.sk89q.worldedit.extension.platform.Actor;
|
||||
import com.sk89q.worldedit.util.formatting.component.PaginationBox;
|
||||
import com.sk89q.worldedit.util.formatting.text.Component;
|
||||
import com.sk89q.worldedit.util.formatting.text.TextComponent;
|
||||
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
|
||||
import com.sk89q.worldedit.util.formatting.text.event.ClickEvent;
|
||||
import com.sk89q.worldedit.util.formatting.text.event.HoverEvent;
|
||||
import com.sk89q.worldedit.util.formatting.text.format.TextColor;
|
||||
@ -76,7 +77,7 @@ public class SnapshotCommands {
|
||||
LocalConfiguration config = we.getConfiguration();
|
||||
|
||||
if (config.snapshotRepo == null) {
|
||||
actor.printError("Snapshot/backup restore is not configured.");
|
||||
actor.printError(TranslatableComponent.of("worldedit.restore.not-configured"));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -86,7 +87,7 @@ public class SnapshotCommands {
|
||||
if (!snapshots.isEmpty()) {
|
||||
actor.print(new SnapshotListBox(world.getName(), snapshots).create(page));
|
||||
} else {
|
||||
actor.printError("No snapshots are available. See console for details.");
|
||||
actor.printError(TranslatableComponent.of("worldedit.restore.none-found-console"));
|
||||
|
||||
// Okay, let's toss some debugging information!
|
||||
File dir = config.snapshotRepo.getDirectory();
|
||||
@ -101,7 +102,7 @@ public class SnapshotCommands {
|
||||
}
|
||||
}
|
||||
} catch (MissingWorldException ex) {
|
||||
actor.printError("No snapshots were found for this world.");
|
||||
actor.printError(TranslatableComponent.of("worldedit.restore.none-for-world"));
|
||||
}
|
||||
}
|
||||
|
||||
@ -117,7 +118,7 @@ public class SnapshotCommands {
|
||||
LocalConfiguration config = we.getConfiguration();
|
||||
|
||||
if (config.snapshotRepo == null) {
|
||||
actor.printError("Snapshot/backup restore is not configured.");
|
||||
actor.printError(TranslatableComponent.of("worldedit.restore.not-configured"));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -128,19 +129,19 @@ public class SnapshotCommands {
|
||||
|
||||
if (snapshot != null) {
|
||||
session.setSnapshot(null);
|
||||
actor.print("Now using newest snapshot.");
|
||||
actor.printInfo(TranslatableComponent.of("worldedit.snapshot.use.newest"));
|
||||
} else {
|
||||
actor.printError("No snapshots were found.");
|
||||
actor.printError(TranslatableComponent.of("worldedit.restore.none-found"));
|
||||
}
|
||||
} catch (MissingWorldException ex) {
|
||||
actor.printError("No snapshots were found for this world.");
|
||||
actor.printError(TranslatableComponent.of("worldedit.restore.none-for-world"));
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
session.setSnapshot(config.snapshotRepo.getSnapshot(name));
|
||||
actor.print("Snapshot set to: " + name);
|
||||
actor.printInfo(TranslatableComponent.of("worldedit.snapshot.use", TextComponent.of(name)));
|
||||
} catch (InvalidSnapshotException e) {
|
||||
actor.printError("That snapshot does not exist or is not available.");
|
||||
actor.printError(TranslatableComponent.of("worldedit.restore.not-available"));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -156,30 +157,30 @@ public class SnapshotCommands {
|
||||
LocalConfiguration config = we.getConfiguration();
|
||||
|
||||
if (config.snapshotRepo == null) {
|
||||
actor.printError("Snapshot/backup restore is not configured.");
|
||||
actor.printError(TranslatableComponent.of("worldedit.restore.not-configured"));
|
||||
return;
|
||||
}
|
||||
|
||||
if (index < 1) {
|
||||
actor.printError("Invalid index, must be equal or higher then 1.");
|
||||
actor.printError(TranslatableComponent.of("worldedit.snapshot.index-above-0"));
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
List<Snapshot> snapshots = config.snapshotRepo.getSnapshots(true, world.getName());
|
||||
if (snapshots.size() < index) {
|
||||
actor.printError("Invalid index, must be between 1 and " + snapshots.size() + ".");
|
||||
actor.printError(TranslatableComponent.of("worldedit.snapshot.index-oob", TextComponent.of(snapshots.size())));
|
||||
return;
|
||||
}
|
||||
Snapshot snapshot = snapshots.get(index - 1);
|
||||
if (snapshot == null) {
|
||||
actor.printError("That snapshot does not exist or is not available.");
|
||||
actor.printError(TranslatableComponent.of("worldedit.restore.not-available"));
|
||||
return;
|
||||
}
|
||||
session.setSnapshot(snapshot);
|
||||
actor.print("Snapshot set to: " + snapshot.getName());
|
||||
actor.printInfo(TranslatableComponent.of("worldedit.snapshot.use", TextComponent.of(snapshot.getName())));
|
||||
} catch (MissingWorldException e) {
|
||||
actor.printError("No snapshots were found for this world.");
|
||||
actor.printError(TranslatableComponent.of("worldedit.restore.none-for-world"));
|
||||
}
|
||||
}
|
||||
|
||||
@ -195,7 +196,7 @@ public class SnapshotCommands {
|
||||
LocalConfiguration config = we.getConfiguration();
|
||||
|
||||
if (config.snapshotRepo == null) {
|
||||
actor.printError("Snapshot/backup restore is not configured.");
|
||||
actor.printError(TranslatableComponent.of("worldedit.restore.not-configured"));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -203,14 +204,16 @@ public class SnapshotCommands {
|
||||
Snapshot snapshot = config.snapshotRepo.getSnapshotBefore(date, world.getName());
|
||||
|
||||
if (snapshot == null) {
|
||||
actor.printError("Couldn't find a snapshot before "
|
||||
+ dateFormat.withZone(session.getTimeZone()).format(date) + ".");
|
||||
actor.printError(TranslatableComponent.of(
|
||||
"worldedit.snapshot.none-before",
|
||||
TextComponent.of(dateFormat.withZone(session.getTimeZone()).format(date)))
|
||||
);
|
||||
} else {
|
||||
session.setSnapshot(snapshot);
|
||||
actor.print("Snapshot set to: " + snapshot.getName());
|
||||
actor.printInfo(TranslatableComponent.of("worldedit.snapshot.use", TextComponent.of(snapshot.getName())));
|
||||
}
|
||||
} catch (MissingWorldException ex) {
|
||||
actor.printError("No snapshots were found for this world.");
|
||||
actor.printError(TranslatableComponent.of("worldedit.restore.none-for-world"));
|
||||
}
|
||||
}
|
||||
|
||||
@ -226,21 +229,23 @@ public class SnapshotCommands {
|
||||
LocalConfiguration config = we.getConfiguration();
|
||||
|
||||
if (config.snapshotRepo == null) {
|
||||
actor.printError("Snapshot/backup restore is not configured.");
|
||||
actor.printError(TranslatableComponent.of("worldedit.restore.not-configured"));
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
Snapshot snapshot = config.snapshotRepo.getSnapshotAfter(date, world.getName());
|
||||
if (snapshot == null) {
|
||||
actor.printError("Couldn't find a snapshot after "
|
||||
+ dateFormat.withZone(session.getTimeZone()).format(date) + ".");
|
||||
actor.printError(TranslatableComponent.of(
|
||||
"worldedit.snapshot.none-after",
|
||||
TextComponent.of(dateFormat.withZone(session.getTimeZone()).format(date)))
|
||||
);
|
||||
} else {
|
||||
session.setSnapshot(snapshot);
|
||||
actor.print("Snapshot set to: " + snapshot.getName());
|
||||
actor.printInfo(TranslatableComponent.of("worldedit.snapshot.use", TextComponent.of(snapshot.getName())));
|
||||
}
|
||||
} catch (MissingWorldException ex) {
|
||||
actor.printError("No snapshots were found for this world.");
|
||||
actor.printError(TranslatableComponent.of("worldedit.restore.none-for-world"));
|
||||
}
|
||||
}
|
||||
|
||||
@ -256,7 +261,7 @@ public class SnapshotCommands {
|
||||
public Component getComponent(int number) {
|
||||
final Snapshot snapshot = snapshots.get(number);
|
||||
return TextComponent.of(number + 1 + ". ", TextColor.GOLD)
|
||||
.append(TextComponent.of(snapshot.getName(), TextColor.LIGHT_PURPLE)
|
||||
.append(TextComponent.of(snapshot.getName(), TextColor.GRAY)
|
||||
.hoverEvent(HoverEvent.of(HoverEvent.Action.SHOW_TEXT, TextComponent.of("Click to use")))
|
||||
.clickEvent(ClickEvent.of(ClickEvent.Action.RUN_COMMAND, "/snap use " + snapshot.getName())));
|
||||
}
|
||||
|
@ -29,6 +29,8 @@ import com.sk89q.worldedit.command.util.CommandPermissionsConditionGenerator;
|
||||
import com.sk89q.worldedit.command.util.Logging;
|
||||
import com.sk89q.worldedit.extension.platform.Actor;
|
||||
import com.sk89q.worldedit.regions.Region;
|
||||
import com.sk89q.worldedit.util.formatting.text.TextComponent;
|
||||
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
|
||||
import com.sk89q.worldedit.world.DataException;
|
||||
import com.sk89q.worldedit.world.World;
|
||||
import com.sk89q.worldedit.world.snapshot.InvalidSnapshotException;
|
||||
@ -55,20 +57,20 @@ public class SnapshotUtilCommands {
|
||||
}
|
||||
|
||||
@Command(
|
||||
name = "restore",
|
||||
aliases = { "/restore" },
|
||||
desc = "Restore the selection from a snapshot"
|
||||
name = "restore",
|
||||
aliases = { "/restore" },
|
||||
desc = "Restore the selection from a snapshot"
|
||||
)
|
||||
@Logging(REGION)
|
||||
@CommandPermissions("worldedit.snapshots.restore")
|
||||
public void restore(Actor actor, World world, LocalSession session, EditSession editSession,
|
||||
@Arg(name = "snapshot", desc = "The snapshot to restore", def = "")
|
||||
String snapshotName) throws WorldEditException {
|
||||
String snapshotName) throws WorldEditException {
|
||||
|
||||
LocalConfiguration config = we.getConfiguration();
|
||||
|
||||
if (config.snapshotRepo == null) {
|
||||
actor.printError("Snapshot/backup restore is not configured.");
|
||||
actor.printError(TranslatableComponent.of("worldedit.restore.not-configured"));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -79,7 +81,7 @@ public class SnapshotUtilCommands {
|
||||
try {
|
||||
snapshot = config.snapshotRepo.getSnapshot(snapshotName);
|
||||
} catch (InvalidSnapshotException e) {
|
||||
actor.printError("That snapshot does not exist or is not available.");
|
||||
actor.printError(TranslatableComponent.of("worldedit.restore.not-available"));
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
@ -92,7 +94,7 @@ public class SnapshotUtilCommands {
|
||||
snapshot = config.snapshotRepo.getDefaultSnapshot(world.getName());
|
||||
|
||||
if (snapshot == null) {
|
||||
actor.printError("No snapshots were found. See console for details.");
|
||||
actor.printError(TranslatableComponent.of("worldedit.restore.none-found-console"));
|
||||
|
||||
// Okay, let's toss some debugging information!
|
||||
File dir = config.snapshotRepo.getDirectory();
|
||||
@ -109,7 +111,7 @@ public class SnapshotUtilCommands {
|
||||
return;
|
||||
}
|
||||
} catch (MissingWorldException ex) {
|
||||
actor.printError("No snapshots were found for this world.");
|
||||
actor.printError(TranslatableComponent.of("worldedit.restore.none-for-world"));
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -119,9 +121,9 @@ public class SnapshotUtilCommands {
|
||||
// Load chunk store
|
||||
try {
|
||||
chunkStore = snapshot.getChunkStore();
|
||||
actor.print("Snapshot '" + snapshot.getName() + "' loaded; now restoring...");
|
||||
actor.printInfo(TranslatableComponent.of("worldedit.restore.loaded", TextComponent.of(snapshot.getName())));
|
||||
} catch (DataException | IOException e) {
|
||||
actor.printError("Failed to load snapshot: " + e.getMessage());
|
||||
actor.printError(TranslatableComponent.of("worldedit.restore.failed", TextComponent.of(e.getMessage())));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -135,18 +137,17 @@ public class SnapshotUtilCommands {
|
||||
if (restore.hadTotalFailure()) {
|
||||
String error = restore.getLastErrorMessage();
|
||||
if (!restore.getMissingChunks().isEmpty()) {
|
||||
actor.printError("Chunks were not present in snapshot.");
|
||||
actor.printError(TranslatableComponent.of("worldedit.restore.chunk-not-present"));
|
||||
} else if (error != null) {
|
||||
actor.printError("Errors prevented any blocks from being restored.");
|
||||
actor.printError("Last error: " + error);
|
||||
actor.printError(TranslatableComponent.of("worldedit.restore.block-place-failed"));
|
||||
actor.printError(TranslatableComponent.of("worldedit.restore.block-place-error", TextComponent.of(error)));
|
||||
} else {
|
||||
actor.printError("No chunks could be loaded. (Bad archive?)");
|
||||
actor.printError(TranslatableComponent.of("worldedit.restore.chunk-load-failed"));
|
||||
}
|
||||
} else {
|
||||
actor.print(String.format("Restored; %d "
|
||||
+ "missing chunks and %d other errors.",
|
||||
restore.getMissingChunks().size(),
|
||||
restore.getErrorChunks().size()));
|
||||
actor.printInfo(TranslatableComponent.of("worldedit.restore.restored",
|
||||
TextComponent.of(restore.getMissingChunks().size()),
|
||||
TextComponent.of(restore.getErrorChunks().size())));
|
||||
}
|
||||
} finally {
|
||||
try {
|
||||
|
@ -20,6 +20,7 @@
|
||||
package com.sk89q.worldedit.command;
|
||||
|
||||
import com.boydti.fawe.config.BBC;
|
||||
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
|
||||
import com.sk89q.worldedit.LocalConfiguration;
|
||||
import com.sk89q.worldedit.LocalSession;
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
@ -30,6 +31,8 @@ import com.sk89q.worldedit.command.tool.SinglePickaxe;
|
||||
import com.sk89q.worldedit.command.util.CommandPermissions;
|
||||
import com.sk89q.worldedit.command.util.CommandPermissionsConditionGenerator;
|
||||
import com.sk89q.worldedit.entity.Player;
|
||||
import com.sk89q.worldedit.util.formatting.text.TextComponent;
|
||||
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
|
||||
import org.enginehub.piston.annotation.Command;
|
||||
import org.enginehub.piston.annotation.CommandContainer;
|
||||
import org.enginehub.piston.annotation.param.Arg;
|
||||
@ -50,7 +53,7 @@ public class SuperPickaxeCommands {
|
||||
public void single(Player player, LocalSession session) throws WorldEditException {
|
||||
session.setSuperPickaxe(new SinglePickaxe());
|
||||
session.enableSuperPickAxe();
|
||||
player.print(BBC.SUPERPICKAXE_AREA_ENABLED.s());
|
||||
player.printInfo(TranslatableComponent.of("worldedit.tool.superpickaxe.mode.single"));
|
||||
}
|
||||
|
||||
@Command(
|
||||
@ -65,13 +68,13 @@ public class SuperPickaxeCommands {
|
||||
LocalConfiguration config = we.getConfiguration();
|
||||
|
||||
if (range > config.maxSuperPickaxeSize) {
|
||||
BBC.TOOL_RANGE_ERROR.send(player, config.maxSuperPickaxeSize);
|
||||
player.printError(TranslatableComponent.of("worldedit.superpickaxe.max-range", TextComponent.of(config.maxSuperPickaxeSize)));
|
||||
return;
|
||||
}
|
||||
|
||||
session.setSuperPickaxe(new AreaPickaxe(range));
|
||||
session.enableSuperPickAxe();
|
||||
player.print(BBC.SUPERPICKAXE_AREA_ENABLED.s());
|
||||
player.printInfo(TranslatableComponent.of("worldedit.tool.superpickaxe.mode.area"));
|
||||
}
|
||||
|
||||
@Command(
|
||||
@ -87,12 +90,12 @@ public class SuperPickaxeCommands {
|
||||
LocalConfiguration config = we.getConfiguration();
|
||||
|
||||
if (range > config.maxSuperPickaxeSize) {
|
||||
BBC.TOOL_RANGE_ERROR.send(player, config.maxSuperPickaxeSize);
|
||||
player.printError(TranslatableComponent.of("worldedit.superpickaxe.max-range", TextComponent.of(config.maxSuperPickaxeSize)));
|
||||
return;
|
||||
}
|
||||
|
||||
session.setSuperPickaxe(new RecursivePickaxe(range));
|
||||
session.enableSuperPickAxe();
|
||||
player.print(BBC.SUPERPICKAXE_AREA_ENABLED.s());
|
||||
player.printInfo(TranslatableComponent.of("worldedit.tool.superpickaxe.mode.recursive"));
|
||||
}
|
||||
}
|
||||
|
@ -22,6 +22,7 @@ package com.sk89q.worldedit.command;
|
||||
import com.google.common.collect.Collections2;
|
||||
|
||||
import com.boydti.fawe.config.BBC;
|
||||
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
|
||||
import com.boydti.fawe.object.brush.InspectBrush;
|
||||
import com.sk89q.worldedit.LocalConfiguration;
|
||||
import com.sk89q.worldedit.LocalSession;
|
||||
@ -125,10 +126,10 @@ public class ToolCommands {
|
||||
return "/tool " + name;
|
||||
}
|
||||
|
||||
static void setToolNone(Player player, LocalSession session, String type)
|
||||
static void setToolNone(Player player, LocalSession session, boolean isBrush)
|
||||
throws InvalidToolBindException {
|
||||
session.setTool(player.getItemInHand(HandSide.MAIN_HAND).getType(), null);
|
||||
player.print(type + " unbound from your current item.");
|
||||
session.setTool(player, null);
|
||||
player.printInfo(TranslatableComponent.of(isBrush ? "worldedit.brush.none.equip" : "worldedit.tool.none.equip"));
|
||||
}
|
||||
private final WorldEdit we;
|
||||
|
||||
@ -143,10 +144,9 @@ public class ToolCommands {
|
||||
)
|
||||
@CommandPermissions("worldedit.setwand")
|
||||
public void selwand(Player player, LocalSession session) throws WorldEditException {
|
||||
|
||||
final ItemType itemType = player.getItemInHand(HandSide.MAIN_HAND).getType();
|
||||
session.setTool(itemType, SelectionWand.INSTANCE);
|
||||
player.print("Selection wand bound to " + itemType.getName() + ".");
|
||||
session.setTool(player, SelectionWand.INSTANCE);
|
||||
player.printInfo(TranslatableComponent.of("worldedit.tool.selwand.equip", TextComponent.of(itemType.getName())));
|
||||
}
|
||||
|
||||
@Command(
|
||||
@ -157,9 +157,9 @@ public class ToolCommands {
|
||||
@CommandPermissions("worldedit.setwand")
|
||||
public void navwand(Player player, LocalSession session) throws WorldEditException {
|
||||
|
||||
BaseItemStack itemStack = player.getItemInHand(HandSide.MAIN_HAND);
|
||||
final ItemType itemType = player.getItemInHand(HandSide.MAIN_HAND).getType();
|
||||
session.setTool(player, NavigationWand.INSTANCE);
|
||||
player.print("Navigation wand bound to " + itemStack.getType().getName() + ".");
|
||||
player.printInfo(TranslatableComponent.of("worldedit.tool.navWand.equip", TextComponent.of(itemType.getName())));
|
||||
}
|
||||
|
||||
@Command(
|
||||
@ -169,9 +169,9 @@ public class ToolCommands {
|
||||
@CommandPermissions("worldedit.tool.info")
|
||||
public void info(Player player, LocalSession session) throws WorldEditException {
|
||||
|
||||
BaseItemStack itemStack = player.getItemInHand(HandSide.MAIN_HAND);
|
||||
final ItemType itemType = player.getItemInHand(HandSide.MAIN_HAND).getType();
|
||||
session.setTool(player, new QueryTool());
|
||||
BBC.TOOL_INFO.send(player, itemStack.getType().getName());
|
||||
player.printInfo(TranslatableComponent.of("worldedit.tool.info.equip", TextComponent.of(itemType.getName())));
|
||||
}
|
||||
|
||||
@Command(
|
||||
@ -180,9 +180,9 @@ public class ToolCommands {
|
||||
)
|
||||
@CommandPermissions("worldedit.tool.inspect")
|
||||
public void inspectBrush(Player player, LocalSession session) throws WorldEditException {
|
||||
BaseItemStack itemStack = player.getItemInHand(HandSide.MAIN_HAND);
|
||||
final ItemType itemType = player.getItemInHand(HandSide.MAIN_HAND).getType();
|
||||
session.setTool(player, new InspectBrush());
|
||||
BBC.TOOL_INSPECT.send(player, itemStack.getType().getName());
|
||||
player.printInfo(TranslatableComponent.of("worldedit.tool.inspect.equip", TextComponent.of(itemType.getName())));
|
||||
}
|
||||
|
||||
@Command(
|
||||
@ -194,9 +194,9 @@ public class ToolCommands {
|
||||
@Arg(desc = "Type of tree to generate", def = "tree")
|
||||
TreeGenerator.TreeType type) throws WorldEditException {
|
||||
|
||||
BaseItemStack itemStack = player.getItemInHand(HandSide.MAIN_HAND);
|
||||
final ItemType itemType = player.getItemInHand(HandSide.MAIN_HAND).getType();
|
||||
session.setTool(player, new TreePlanter(type));
|
||||
BBC.TOOL_TREE.send(player, itemStack.getType().getName());
|
||||
player.printInfo(TranslatableComponent.of("worldedit.tool.tree.equip", TextComponent.of(itemType.getName())));
|
||||
}
|
||||
|
||||
@Command(
|
||||
@ -208,9 +208,9 @@ public class ToolCommands {
|
||||
@Arg(desc = "The pattern of blocks to place")
|
||||
Pattern pattern) throws WorldEditException {
|
||||
|
||||
BaseItemStack itemStack = player.getItemInHand(HandSide.MAIN_HAND);
|
||||
final ItemType itemType = player.getItemInHand(HandSide.MAIN_HAND).getType();
|
||||
session.setTool(player, new BlockReplacer(pattern));
|
||||
BBC.TOOL_REPL.send(player, itemStack.getType().getName());
|
||||
player.printInfo(TranslatableComponent.of("worldedit.tool.repl.equip", TextComponent.of(itemType.getName())));
|
||||
}
|
||||
|
||||
@Command(
|
||||
@ -220,9 +220,9 @@ public class ToolCommands {
|
||||
@CommandPermissions("worldedit.tool.data-cycler")
|
||||
public void cycler(Player player, LocalSession session) throws WorldEditException {
|
||||
|
||||
BaseItemStack itemStack = player.getItemInHand(HandSide.MAIN_HAND);
|
||||
final ItemType itemType = player.getItemInHand(HandSide.MAIN_HAND).getType();
|
||||
session.setTool(player, new BlockDataCyler());
|
||||
BBC.TOOL_CYCLER.send(player, itemStack.getType().getName());
|
||||
player.printInfo(TranslatableComponent.of("worldedit.tool.data-cycler.equip", TextComponent.of(itemType.getName())));
|
||||
}
|
||||
|
||||
@Command(
|
||||
@ -240,13 +240,13 @@ public class ToolCommands {
|
||||
LocalConfiguration config = we.getConfiguration();
|
||||
|
||||
if (range > config.maxSuperPickaxeSize) {
|
||||
BBC.TOOL_RANGE_ERROR.send(player, config.maxSuperPickaxeSize);
|
||||
player.printError(TranslatableComponent.of("worldedit.superpickaxe.max-range", TextComponent.of(config.maxSuperPickaxeSize)));
|
||||
return;
|
||||
}
|
||||
|
||||
BaseItemStack itemStack = player.getItemInHand(HandSide.MAIN_HAND);
|
||||
final ItemType itemType = player.getItemInHand(HandSide.MAIN_HAND).getType();
|
||||
session.setTool(player, new FloodFillTool(range, pattern));
|
||||
BBC.TOOL_FLOOD_FILL.send(player, itemStack.getType().getName());
|
||||
player.printInfo(TranslatableComponent.of("worldedit.tool.floodfill.equip", TextComponent.of(itemType.getName())));
|
||||
}
|
||||
|
||||
@Command(
|
||||
@ -256,9 +256,9 @@ public class ToolCommands {
|
||||
@CommandPermissions("worldedit.tool.deltree")
|
||||
public void deltree(Player player, LocalSession session) throws WorldEditException {
|
||||
|
||||
BaseItemStack itemStack = player.getItemInHand(HandSide.MAIN_HAND);
|
||||
final ItemType itemType = player.getItemInHand(HandSide.MAIN_HAND).getType();
|
||||
session.setTool(player, new FloatingTreeRemover());
|
||||
BBC.TOOL_DELTREE.send(player, itemStack.getType().getName());
|
||||
player.printInfo(TranslatableComponent.of("worldedit.tool.deltree.equip", TextComponent.of(itemType.getName())));
|
||||
}
|
||||
|
||||
@Command(
|
||||
@ -267,10 +267,9 @@ public class ToolCommands {
|
||||
)
|
||||
@CommandPermissions("worldedit.tool.farwand")
|
||||
public void farwand(Player player, LocalSession session) throws WorldEditException {
|
||||
|
||||
BaseItemStack itemStack = player.getItemInHand(HandSide.MAIN_HAND);
|
||||
final ItemType itemType = player.getItemInHand(HandSide.MAIN_HAND).getType();
|
||||
session.setTool(player, new DistanceWand());
|
||||
BBC.TOOL_FARWAND.send(player, itemStack.getType().getName());
|
||||
player.printInfo(TranslatableComponent.of("worldedit.tool.farwand.equip", TextComponent.of(itemType.getName())));
|
||||
}
|
||||
|
||||
@Command(
|
||||
@ -284,10 +283,10 @@ public class ToolCommands {
|
||||
Pattern primary,
|
||||
@Arg(desc = "Pattern to set on right-click")
|
||||
Pattern secondary) throws WorldEditException {
|
||||
BaseItemStack itemStack = player.getItemInHand(HandSide.MAIN_HAND);
|
||||
|
||||
session.setTool(itemStack.getType(), new LongRangeBuildTool(primary, secondary));
|
||||
player.print("Long-range building tool bound to " + itemStack.getType().getName() + ".");
|
||||
final ItemType itemType = player.getItemInHand(HandSide.MAIN_HAND).getType();
|
||||
session.setTool(player, new LongRangeBuildTool(primary, secondary));
|
||||
player.printInfo(TranslatableComponent.of("worldedit.tool.lrbuild.equip", TextComponent.of(itemType.getName())));
|
||||
String primaryName = "pattern";
|
||||
String secondaryName = "pattern";
|
||||
if (primary instanceof BlockStateHolder) {
|
||||
@ -296,7 +295,6 @@ public class ToolCommands {
|
||||
if (secondary instanceof BlockStateHolder) {
|
||||
secondaryName = ((BlockStateHolder<?>) secondary).getBlockType().getName();
|
||||
}
|
||||
player.print("Left-click set to " + primaryName + "; right-click set to "
|
||||
+ secondaryName + ".");
|
||||
player.printInfo(TranslatableComponent.of("worldedit.tool.lrbuild.set", TextComponent.of(primaryName), TextComponent.of(secondaryName)));
|
||||
}
|
||||
}
|
||||
|
@ -20,6 +20,7 @@
|
||||
package com.sk89q.worldedit.command;
|
||||
|
||||
import com.boydti.fawe.config.BBC;
|
||||
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
|
||||
import com.boydti.fawe.object.brush.BrushSettings;
|
||||
import com.boydti.fawe.object.brush.TargetMode;
|
||||
import com.boydti.fawe.object.brush.scroll.Scroll;
|
||||
@ -44,6 +45,7 @@ import com.sk89q.worldedit.function.mask.Mask;
|
||||
import com.sk89q.worldedit.function.pattern.Pattern;
|
||||
import com.sk89q.worldedit.internal.command.CommandArgParser;
|
||||
import com.sk89q.worldedit.util.HandSide;
|
||||
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
|
||||
import org.enginehub.piston.annotation.Command;
|
||||
import org.enginehub.piston.annotation.CommandContainer;
|
||||
import org.enginehub.piston.annotation.param.Arg;
|
||||
@ -78,11 +80,11 @@ public class ToolUtilCommands {
|
||||
throws WorldEditException {
|
||||
BrushTool tool = session.getBrushTool(player, false);
|
||||
if (tool == null) {
|
||||
player.print(BBC.BRUSH_NONE.s());
|
||||
player.print(TranslatableComponent.of("fawe.worldedit.brush.brush.none"));
|
||||
return;
|
||||
}
|
||||
if (maskOpt == null) {
|
||||
player.print("Brush mask disabled.");
|
||||
player.print(TranslatableComponent.of("worldedit.tool.mask.disabled"));
|
||||
tool.setMask(null);
|
||||
return;
|
||||
}
|
||||
@ -91,7 +93,7 @@ public class ToolUtilCommands {
|
||||
settings.addSetting(BrushSettings.SettingType.MASK, lastArg);
|
||||
settings.setMask(maskOpt);
|
||||
tool.update();
|
||||
player.print("Brush mask set.");
|
||||
player.print(TranslatableComponent.of("worldedit.tool.mask.set"));
|
||||
}
|
||||
|
||||
@Command(
|
||||
@ -108,20 +110,19 @@ public class ToolUtilCommands {
|
||||
Arguments arguments) throws WorldEditException {
|
||||
BrushTool tool = session.getBrushTool(player, false);
|
||||
if (tool == null) {
|
||||
player.print(BBC.BRUSH_NONE.s());
|
||||
player.print(TranslatableComponent.of("fawe.worldedit.brush.brush.none"));
|
||||
return;
|
||||
}
|
||||
if (pattern == null) {
|
||||
player.print(BBC.BRUSH_MATERIAL.s());
|
||||
tool.setFill(null);
|
||||
return;
|
||||
}
|
||||
BrushSettings settings = offHand ? tool.getOffHand() : tool.getContext();
|
||||
settings.setFill(pattern);
|
||||
String lastArg = Iterables.getLast(CommandArgParser.spaceSplit(arguments.get())).getSubstring();
|
||||
settings.addSetting(BrushSettings.SettingType.FILL, lastArg);
|
||||
tool.update();
|
||||
player.print(BBC.BRUSH_MATERIAL.s());
|
||||
} else {
|
||||
BrushSettings settings = offHand ? tool.getOffHand() : tool.getContext();
|
||||
settings.setFill(pattern);
|
||||
String lastArg = Iterables.getLast(CommandArgParser.spaceSplit(arguments.get())).getSubstring();
|
||||
settings.addSetting(BrushSettings.SettingType.FILL, lastArg);
|
||||
tool.update();
|
||||
}
|
||||
player.print(TranslatableComponent.of("worldedit.tool.material.set"));
|
||||
}
|
||||
|
||||
@Command(
|
||||
@ -133,7 +134,7 @@ public class ToolUtilCommands {
|
||||
@Arg(desc = "The range of the brush")
|
||||
int range) throws WorldEditException {
|
||||
session.getBrushTool(player, false).setRange(range);
|
||||
player.print("Brush range set.");
|
||||
player.printInfo(TranslatableComponent.of("worldedit.tool.range.set"));
|
||||
}
|
||||
|
||||
@Command(
|
||||
@ -147,7 +148,7 @@ public class ToolUtilCommands {
|
||||
we.checkMaxBrushRadius(size);
|
||||
|
||||
session.getBrushTool(player, false).setSize(size);
|
||||
player.print("Brush size set.");
|
||||
player.printInfo(TranslatableComponent.of("worldedit.tool.size.set"));
|
||||
}
|
||||
|
||||
//todo none should be moved to the same class where it is in upstream
|
||||
@ -158,7 +159,7 @@ public class ToolUtilCommands {
|
||||
)
|
||||
public void none(Player player, LocalSession session) throws WorldEditException {
|
||||
session.setTool(player, null);
|
||||
player.print(BBC.TOOL_NONE.s());
|
||||
player.print(TranslatableComponent.of("fawe.worldedit.tool.tool.none"));
|
||||
}
|
||||
|
||||
@Command(
|
||||
@ -172,9 +173,9 @@ public class ToolUtilCommands {
|
||||
Mask maskOpt) throws WorldEditException {
|
||||
session.getBrushTool(player, false).setTraceMask(maskOpt);
|
||||
if (maskOpt == null) {
|
||||
player.print("Trace mask disabled.");
|
||||
player.printInfo(TranslatableComponent.of("worldedit.tool.tracemask.disabled"));
|
||||
} else {
|
||||
player.print("Trace mask set.");
|
||||
player.printInfo(TranslatableComponent.of("worldedit.tool.tracemask.set"));
|
||||
}
|
||||
}
|
||||
|
||||
@ -189,15 +190,15 @@ public class ToolUtilCommands {
|
||||
Boolean superPickaxe) {
|
||||
boolean hasSuperPickAxe = session.hasSuperPickAxe();
|
||||
if (superPickaxe != null && superPickaxe == hasSuperPickAxe) {
|
||||
player.printError("Super pickaxe already " + (superPickaxe ? "enabled" : "disabled") + ".");
|
||||
player.printError(TranslatableComponent.of(superPickaxe ? "worldedit.tool.superpickaxe.enabled.already" : "worldedit.tool.superpickaxe.disabled.already"));
|
||||
return;
|
||||
}
|
||||
if (hasSuperPickAxe) {
|
||||
session.disableSuperPickAxe();
|
||||
player.print("Super pickaxe disabled.");
|
||||
player.printInfo(TranslatableComponent.of("worldedit.tool.superpickaxe.disabled"));
|
||||
} else {
|
||||
session.enableSuperPickAxe();
|
||||
player.print("Super pickaxe enabled.");
|
||||
player.printInfo(TranslatableComponent.of("worldedit.tool.superpickaxe.enabled"));
|
||||
}
|
||||
}
|
||||
|
||||
@ -258,13 +259,13 @@ public class ToolUtilCommands {
|
||||
throws WorldEditException {
|
||||
BrushTool tool = session.getBrushTool(player, false);
|
||||
if (tool == null) {
|
||||
player.print(BBC.BRUSH_NONE.s());
|
||||
player.print(TranslatableComponent.of("fawe.worldedit.brush.brush.none"));
|
||||
return;
|
||||
}
|
||||
VisualMode[] modes = VisualMode.values();
|
||||
VisualMode newMode = modes[MathMan.wrap(mode, 0, modes.length - 1)];
|
||||
tool.setVisualMode(player, newMode);
|
||||
BBC.BRUSH_VISUAL_MODE_SET.send(player, newMode);
|
||||
player.print(TranslatableComponent.of("fawe.worldedit.brush.brush.visual.mode.set" , newMode));
|
||||
}
|
||||
|
||||
@Command(
|
||||
@ -277,13 +278,13 @@ public class ToolUtilCommands {
|
||||
@Arg(name = "mode", desc = "int", def = "0") int mode) throws WorldEditException {
|
||||
BrushTool tool = session.getBrushTool(player, false);
|
||||
if (tool == null) {
|
||||
player.print(BBC.BRUSH_NONE.s());
|
||||
player.print(TranslatableComponent.of("fawe.worldedit.brush.brush.none"));
|
||||
return;
|
||||
}
|
||||
TargetMode[] modes = TargetMode.values();
|
||||
TargetMode newMode = modes[MathMan.wrap(mode, 0, modes.length - 1)];
|
||||
tool.setTargetMode(newMode);
|
||||
BBC.BRUSH_TARGET_MODE_SET.send(player, newMode);
|
||||
player.print(TranslatableComponent.of("fawe.worldedit.brush.brush.target.mode.set" , newMode));
|
||||
}
|
||||
|
||||
@Command(
|
||||
@ -296,11 +297,11 @@ public class ToolUtilCommands {
|
||||
int offset) throws WorldEditException {
|
||||
BrushTool tool = session.getBrushTool(player, false);
|
||||
if (tool == null) {
|
||||
player.print(BBC.BRUSH_NONE.s());
|
||||
player.print(TranslatableComponent.of("fawe.worldedit.brush.brush.none"));
|
||||
return;
|
||||
}
|
||||
tool.setTargetOffset(offset);
|
||||
BBC.BRUSH_TARGET_OFFSET_SET.send(player, offset);
|
||||
player.print(TranslatableComponent.of("fawe.worldedit.brush.brush.target.offset.set" , offset));
|
||||
}
|
||||
|
||||
@Command(
|
||||
@ -317,7 +318,7 @@ public class ToolUtilCommands {
|
||||
List<String> commandStr) throws WorldEditException {
|
||||
BrushTool bt = session.getBrushTool(player, false);
|
||||
if (bt == null) {
|
||||
player.print(BBC.BRUSH_NONE.s());
|
||||
player.print(TranslatableComponent.of("fawe.worldedit.brush.brush.none"));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -325,11 +326,11 @@ public class ToolUtilCommands {
|
||||
Scroll action = Scroll.fromArguments(bt, player, session, mode, commandStr, true);
|
||||
settings.setScrollAction(action);
|
||||
if (mode == Scroll.Action.NONE) {
|
||||
BBC.BRUSH_SCROLL_ACTION_UNSET.send(player);
|
||||
player.print(TranslatableComponent.of("fawe.worldedit.brush.brush.scroll.action.unset"));
|
||||
} else if (action != null) {
|
||||
String full = (mode.name().toLowerCase() + " " + StringMan.join(commandStr, " ")).trim();
|
||||
settings.addSetting(BrushSettings.SettingType.SCROLL_ACTION, full);
|
||||
BBC.BRUSH_SCROLL_ACTION_SET.send(player, mode);
|
||||
player.print(TranslatableComponent.of("fawe.worldedit.brush.brush.scroll.action.set" , mode));
|
||||
}
|
||||
bt.update();
|
||||
}
|
||||
@ -351,11 +352,11 @@ public class ToolUtilCommands {
|
||||
Arguments arguments) throws WorldEditException {
|
||||
BrushTool tool = session.getBrushTool(player, false);
|
||||
if (tool == null) {
|
||||
player.print(BBC.BRUSH_NONE.s());
|
||||
player.print(TranslatableComponent.of("fawe.worldedit.brush.brush.none"));
|
||||
return;
|
||||
}
|
||||
if (maskArg == null) {
|
||||
player.print(BBC.BRUSH_SOURCE_MASK_DISABLED.s());
|
||||
player.print(TranslatableComponent.of("fawe.worldedit.brush.brush.source.mask.disabled"));
|
||||
tool.setSourceMask(null);
|
||||
return;
|
||||
}
|
||||
@ -364,7 +365,7 @@ public class ToolUtilCommands {
|
||||
settings.addSetting(BrushSettings.SettingType.SOURCE_MASK, lastArg);
|
||||
settings.setSourceMask(maskArg);
|
||||
tool.update();
|
||||
player.print(BBC.BRUSH_SOURCE_MASK.s());
|
||||
player.print(TranslatableComponent.of("fawe.worldedit.brush.brush.source.mask"));
|
||||
}
|
||||
|
||||
@Command(
|
||||
@ -379,11 +380,11 @@ public class ToolUtilCommands {
|
||||
Arguments arguments) throws WorldEditException {
|
||||
BrushTool tool = session.getBrushTool(player, false);
|
||||
if (tool == null) {
|
||||
player.print(BBC.BRUSH_NONE.s());
|
||||
player.print(TranslatableComponent.of("fawe.worldedit.brush.brush.none"));
|
||||
return;
|
||||
}
|
||||
if (transform == null) {
|
||||
player.print(BBC.BRUSH_TRANSFORM_DISABLED.s());
|
||||
player.print(TranslatableComponent.of("fawe.worldedit.brush.brush.transform.disabled"));
|
||||
tool.setTransform(null);
|
||||
return;
|
||||
}
|
||||
@ -392,6 +393,6 @@ public class ToolUtilCommands {
|
||||
settings.addSetting(BrushSettings.SettingType.TRANSFORM, lastArg);
|
||||
settings.setTransform(transform);
|
||||
tool.update();
|
||||
player.print(BBC.BRUSH_TRANSFORM.s());
|
||||
player.print(TranslatableComponent.of("fawe.worldedit.brush.brush.transform"));
|
||||
}
|
||||
}
|
||||
|
@ -23,6 +23,7 @@ import static com.sk89q.worldedit.command.util.Logging.LogMode.PLACEMENT;
|
||||
|
||||
import com.boydti.fawe.Fawe;
|
||||
import com.boydti.fawe.config.BBC;
|
||||
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
|
||||
import com.boydti.fawe.config.Settings;
|
||||
import com.boydti.fawe.object.DelegateConsumer;
|
||||
import com.boydti.fawe.object.function.QuadFunction;
|
||||
@ -72,6 +73,7 @@ import com.sk89q.worldedit.util.formatting.component.SubtleFormat;
|
||||
import com.sk89q.worldedit.util.formatting.text.Component;
|
||||
import com.sk89q.worldedit.util.formatting.text.TextComponent;
|
||||
import com.sk89q.worldedit.util.formatting.text.format.TextColor;
|
||||
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
|
||||
import com.sk89q.worldedit.world.World;
|
||||
import com.sk89q.worldedit.world.block.BlockTypes;
|
||||
import java.awt.RenderingHints;
|
||||
@ -188,7 +190,7 @@ public class UtilityCommands {
|
||||
@SkipQueue
|
||||
public void cancel(Player player) {
|
||||
int cancelled = player.cancel(false);
|
||||
BBC.WORLDEDIT_CANCEL_COUNT.send(player, cancelled);
|
||||
player.print(TranslatableComponent.of("fawe.cancel.worldedit.cancel.count" , cancelled));
|
||||
}
|
||||
|
||||
@Command(
|
||||
@ -214,7 +216,7 @@ public class UtilityCommands {
|
||||
|
||||
BlockVector3 pos = session.getPlacementPosition(actor);
|
||||
int affected = editSession.fillDirection(pos, pattern, radius, depth, direction);
|
||||
actor.print(affected + " block(s) have been created.");
|
||||
actor.printInfo(TranslatableComponent.of("worldedit.fill.created", TextComponent.of(affected)));
|
||||
return affected;
|
||||
}
|
||||
|
||||
@ -312,7 +314,7 @@ public class UtilityCommands {
|
||||
|
||||
BlockVector3 pos = session.getPlacementPosition(actor);
|
||||
int affected = editSession.fillXZ(pos, pattern, radius, depth, true);
|
||||
actor.print(affected + " block(s) have been created.");
|
||||
actor.printInfo(TranslatableComponent.of("worldedit.fillr.created", TextComponent.of(affected)));
|
||||
return affected;
|
||||
}
|
||||
|
||||
@ -330,9 +332,8 @@ public class UtilityCommands {
|
||||
double radius = radiusExp.evaluate();
|
||||
radius = Math.max(0, radius);
|
||||
we.checkMaxRadius(radius);
|
||||
int affected = editSession.drainArea(
|
||||
session.getPlacementPosition(actor), radius, waterlogged);
|
||||
actor.print(affected + " block(s) have been changed.");
|
||||
int affected = editSession.drainArea(session.getPlacementPosition(actor), radius, waterlogged);
|
||||
actor.printInfo(TranslatableComponent.of("worldedit.drain.drained", TextComponent.of(affected)));
|
||||
return affected;
|
||||
}
|
||||
|
||||
@ -349,7 +350,7 @@ public class UtilityCommands {
|
||||
radius = Math.max(0, radius);
|
||||
we.checkMaxRadius(radius);
|
||||
int affected = editSession.fixLiquid(session.getPlacementPosition(actor), radius, BlockTypes.LAVA);
|
||||
actor.print(affected + " block(s) have been changed.");
|
||||
actor.printInfo(TranslatableComponent.of("worldedit.fixlava.fixed", TextComponent.of(affected)));
|
||||
return affected;
|
||||
}
|
||||
|
||||
@ -366,7 +367,7 @@ public class UtilityCommands {
|
||||
radius = Math.max(0, radius);
|
||||
we.checkMaxRadius(radius);
|
||||
int affected = editSession.fixLiquid(session.getPlacementPosition(actor), radius, BlockTypes.WATER);
|
||||
actor.print(affected + " block(s) have been changed.");
|
||||
actor.printInfo(TranslatableComponent.of("worldedit.fixwater.fixed", TextComponent.of(affected)));
|
||||
return affected;
|
||||
}
|
||||
|
||||
@ -387,7 +388,7 @@ public class UtilityCommands {
|
||||
height = height != null ? Math.min((world.getMaxY() + 1), height + 1) : (world.getMaxY() + 1);
|
||||
|
||||
int affected = editSession.removeAbove(session.getPlacementPosition(actor), size, height);
|
||||
actor.print(affected + " block(s) have been removed.");
|
||||
actor.printInfo(TranslatableComponent.of("worldedit.removeabove.removed", TextComponent.of(affected)));
|
||||
return affected;
|
||||
}
|
||||
|
||||
@ -408,7 +409,7 @@ public class UtilityCommands {
|
||||
height = height != null ? Math.min((world.getMaxY() + 1), height + 1) : (world.getMaxY() + 1);
|
||||
|
||||
int affected = editSession.removeBelow(session.getPlacementPosition(actor), size, height);
|
||||
actor.print(affected + " block(s) have been removed.");
|
||||
actor.printInfo(TranslatableComponent.of("worldedit.removebelow.removed", TextComponent.of(affected)));
|
||||
return affected;
|
||||
}
|
||||
|
||||
@ -428,7 +429,7 @@ public class UtilityCommands {
|
||||
we.checkMaxRadius(radius);
|
||||
|
||||
int affected = editSession.removeNear(session.getPlacementPosition(actor), mask, radius);
|
||||
actor.print(affected + " block(s) have been removed.");
|
||||
actor.printInfo(TranslatableComponent.of("worldedit.removenear.removed", TextComponent.of(affected)));
|
||||
return affected;
|
||||
}
|
||||
|
||||
@ -459,7 +460,7 @@ public class UtilityCommands {
|
||||
}
|
||||
|
||||
int affected = editSession.replaceBlocks(region, from, to);
|
||||
actor.print(affected + " block(s) have been replaced.");
|
||||
actor.printInfo(TranslatableComponent.of("worldedit.replacenear.replaced", TextComponent.of(affected)));
|
||||
return affected;
|
||||
}
|
||||
|
||||
@ -477,7 +478,7 @@ public class UtilityCommands {
|
||||
we.checkMaxRadius(size);
|
||||
|
||||
int affected = editSession.simulateSnow(session.getPlacementPosition(actor), size);
|
||||
actor.print(affected + " surface(s) covered. Let it snow~");
|
||||
actor.printInfo(TranslatableComponent.of("worldedit.snow.created", TextComponent.of(affected)));
|
||||
return affected;
|
||||
}
|
||||
|
||||
@ -495,7 +496,7 @@ public class UtilityCommands {
|
||||
we.checkMaxRadius(size);
|
||||
|
||||
int affected = editSession.thaw(session.getPlacementPosition(actor), size);
|
||||
actor.print(affected + " surface(s) thawed.");
|
||||
actor.printInfo(TranslatableComponent.of("worldedit.thaw.removed", TextComponent.of(affected)));
|
||||
return affected;
|
||||
}
|
||||
|
||||
@ -516,7 +517,7 @@ public class UtilityCommands {
|
||||
final boolean onlyNormalDirt = !convertCoarse;
|
||||
|
||||
final int affected = editSession.green(session.getPlacementPosition(actor), size, onlyNormalDirt);
|
||||
actor.print(affected + " surface(s) greened.");
|
||||
actor.printInfo(TranslatableComponent.of("worldedit.green.changed", TextComponent.of(affected)));
|
||||
return affected;
|
||||
}
|
||||
|
||||
@ -554,7 +555,7 @@ public class UtilityCommands {
|
||||
)
|
||||
@CommandPermissions("worldedit.extinguish")
|
||||
@Logging(PLACEMENT)
|
||||
public void extinguish(Actor actor, LocalSession session, EditSession editSession,
|
||||
public int extinguish(Actor actor, LocalSession session, EditSession editSession,
|
||||
@Arg(desc = "The radius of the square to remove in", def = "")
|
||||
Integer radius) throws WorldEditException {
|
||||
|
||||
@ -566,7 +567,8 @@ public class UtilityCommands {
|
||||
|
||||
Mask mask = new BlockTypeMask(editSession, BlockTypes.FIRE);
|
||||
int affected = editSession.removeNear(session.getPlacementPosition(actor), mask, size);
|
||||
actor.print(affected + " block(s) have been removed.");
|
||||
actor.printInfo(TranslatableComponent.of("worldedit.extinguish.removed", TextComponent.of(affected)));
|
||||
return affected;
|
||||
}
|
||||
|
||||
@Command(
|
||||
@ -599,7 +601,7 @@ public class UtilityCommands {
|
||||
if (radius == null) {
|
||||
radius = config.butcherDefaultRadius;
|
||||
} else if (radius < -1) {
|
||||
actor.printError("Use -1 to remove all mobs in loaded chunks");
|
||||
actor.printError(TranslatableComponent.of("worldedit.butcher.explain-all"));
|
||||
return 0;
|
||||
} else if (radius == -1) {
|
||||
if (config.butcherMaxRadius != -1) {
|
||||
@ -622,7 +624,11 @@ public class UtilityCommands {
|
||||
|
||||
int killed = killMatchingEntities(radius, actor, flags::createFunction);
|
||||
|
||||
actor.print("Killed " + killed + (killed != 1 ? " mobs" : " mob") + (radius < 0 ? "" : " in a radius of " + radius) + ".");
|
||||
actor.printInfo(TranslatableComponent.of(
|
||||
"worldedit.butcher.killed",
|
||||
TextComponent.of(killed),
|
||||
TextComponent.of(radius)
|
||||
));
|
||||
|
||||
return killed;
|
||||
}
|
||||
@ -656,20 +662,19 @@ public class UtilityCommands {
|
||||
@Arg(desc = "The radius of the cuboid to remove from")
|
||||
int radius) throws WorldEditException {
|
||||
if (radius < -1) {
|
||||
actor.printError("Use -1 to remove all entities in loaded chunks");
|
||||
actor.printError(TranslatableComponent.of("worldedit.remove.explain-all"));
|
||||
return 0;
|
||||
}
|
||||
|
||||
int removed = killMatchingEntities(radius, actor, remover::createFunction);
|
||||
|
||||
actor.print("Marked " + removed + (removed != 1 ? " entities" : " entity") + " for removal.");
|
||||
actor.printInfo(TranslatableComponent.of("worldedit.remove.removed", TextComponent.of(removed)));
|
||||
return removed;
|
||||
}
|
||||
|
||||
// get the formatter with the system locale. in the future, if we can get a local from a player, we can use that
|
||||
private static final DecimalFormat formatter = (DecimalFormat) NumberFormat.getInstance(Locale.getDefault());
|
||||
static {
|
||||
formatter.applyPattern("#,##0.#####"); // pattern is locale-insensitive. this can translate to "1.234,56789"
|
||||
private DecimalFormat formatForLocale(Locale locale) {
|
||||
DecimalFormat format = (DecimalFormat) NumberFormat.getInstance(locale);
|
||||
format.applyPattern("#,##0.#####");
|
||||
return format;
|
||||
}
|
||||
|
||||
@Command(
|
||||
@ -685,16 +690,15 @@ public class UtilityCommands {
|
||||
try {
|
||||
expression = Expression.compile(String.join(" ", input));
|
||||
} catch (ExpressionException e) {
|
||||
actor.printError(String.format(
|
||||
"'%s' could not be parsed as a valid expression", input));
|
||||
actor.printError(TranslatableComponent.of("worldedit.calc.invalid", TextComponent.of(String.join(" ", input))));
|
||||
return;
|
||||
}
|
||||
WorldEditAsyncCommandBuilder.createAndSendMessage(actor, () -> {
|
||||
double result = expression.evaluate(
|
||||
new double[]{}, WorldEdit.getInstance().getSessionManager().get(actor).getTimeout());
|
||||
String formatted = Double.isNaN(result) ? "NaN" : formatter.format(result);
|
||||
return SubtleFormat.wrap(input + " = ").append(TextComponent.of(formatted, TextColor.LIGHT_PURPLE));
|
||||
}, null);
|
||||
String formatted = Double.isNaN(result) ? "NaN" : formatForLocale(actor.getLocale()).format(result);
|
||||
return SubtleFormat.wrap(input + " = ").append(TextComponent.of(formatted, TextColor.GRAY));
|
||||
}, (Component) null);
|
||||
}
|
||||
|
||||
@Command(
|
||||
@ -705,7 +709,7 @@ public class UtilityCommands {
|
||||
@CommandPermissions("fawe.confirm")
|
||||
public void confirm(Player fp) throws WorldEditException {
|
||||
if (!fp.confirm()) {
|
||||
BBC.NOTHING_CONFIRMED.send(fp);
|
||||
fp.print(TranslatableComponent.of("fawe.worldedit.utility.nothing.confirmed"));
|
||||
}
|
||||
}
|
||||
|
||||
@ -765,7 +769,7 @@ public class UtilityCommands {
|
||||
getFiles(dir, actor, args, formatName, playerFolder, fileList::add);
|
||||
|
||||
if (fileList.isEmpty()) {
|
||||
BBC.SCHEMATIC_NONE.send(actor);
|
||||
actor.print(TranslatableComponent.of("fawe.worldedit.schematic.schematic.none"));
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
|
@ -22,6 +22,7 @@ package com.sk89q.worldedit.command;
|
||||
import com.boydti.fawe.Fawe;
|
||||
import com.boydti.fawe.FaweVersion;
|
||||
import com.boydti.fawe.config.BBC;
|
||||
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
|
||||
import com.boydti.fawe.config.Settings;
|
||||
import com.boydti.fawe.util.IncendoPaster;
|
||||
import com.sk89q.worldedit.LocalSession;
|
||||
@ -36,9 +37,13 @@ import com.sk89q.worldedit.entity.Player;
|
||||
import com.sk89q.worldedit.event.platform.ConfigurationLoadEvent;
|
||||
import com.sk89q.worldedit.extension.platform.Actor;
|
||||
import com.sk89q.worldedit.extension.platform.Capability;
|
||||
import com.sk89q.worldedit.extension.platform.NoCapablePlatformException;
|
||||
import com.sk89q.worldedit.extension.platform.Platform;
|
||||
import com.sk89q.worldedit.extension.platform.PlatformManager;
|
||||
import com.sk89q.worldedit.util.formatting.text.format.TextColor;
|
||||
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
|
||||
import com.sk89q.worldedit.util.formatting.text.TextComponent;
|
||||
import com.sk89q.worldedit.util.formatting.component.TextComponentProducer;
|
||||
import com.sk89q.worldedit.util.formatting.component.MessageBox;
|
||||
import java.io.IOException;
|
||||
import java.time.ZoneId;
|
||||
import java.time.ZonedDateTime;
|
||||
@ -47,8 +52,8 @@ import java.time.format.TextStyle;
|
||||
import java.time.zone.ZoneRulesException;
|
||||
import java.util.Date;
|
||||
import java.util.GregorianCalendar;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import org.enginehub.piston.annotation.Command;
|
||||
import org.enginehub.piston.annotation.CommandContainer;
|
||||
@ -78,35 +83,43 @@ public class WorldEditCommands {
|
||||
actor.print("FastAsyncWorldEdit" + fVerStr + " created by Empire92");
|
||||
|
||||
if (fVer != null) {
|
||||
actor.printDebug("----------- Platforms -----------");
|
||||
FaweVersion version = Fawe.get().getVersion();
|
||||
Date date = new GregorianCalendar(2000 + version.year, version.month - 1, version.day)
|
||||
.getTime();
|
||||
actor.printDebug(" - DATE: " + date.toLocaleString());
|
||||
actor.printDebug(" - COMMIT: " + Integer.toHexString(version.hash));
|
||||
actor.printDebug(" - BUILD: " + version.build);
|
||||
actor.printDebug(" - PLATFORM: " + Settings.IMP.PLATFORM);
|
||||
actor.printDebug("------------------------------------");
|
||||
|
||||
TextComponent dateArg = TextComponent.of(date.toLocaleString());
|
||||
TextComponent commitArg = TextComponent.of(Integer.toHexString(version.hash));
|
||||
TextComponent buildArg = TextComponent.of(version.build);
|
||||
TextComponent platformArg = TextComponent.of(Settings.IMP.PLATFORM);
|
||||
|
||||
actor.printInfo(TranslatableComponent.of("worldedit.version.version", dateArg, commitArg, buildArg, platformArg));
|
||||
}
|
||||
|
||||
actor.printInfo(TextComponent.of("Wiki: https://github.com/IntellectualSites/FastAsyncWorldEdit-1.13/wiki"));
|
||||
|
||||
PlatformManager pm = we.getPlatformManager();
|
||||
|
||||
actor.printDebug("----------- Platforms -----------");
|
||||
TextComponentProducer producer = new TextComponentProducer();
|
||||
for (Platform platform : pm.getPlatforms()) {
|
||||
actor.printDebug(String.format("* %s (%s)", platform.getPlatformName(), platform.getPlatformVersion()));
|
||||
producer.append(
|
||||
TextComponent.of("* ", TextColor.GRAY)
|
||||
.append(TextComponent.of(platform.getPlatformName()))
|
||||
.append(TextComponent.of("(" + platform.getPlatformVersion() + ")"))
|
||||
).newline();
|
||||
}
|
||||
actor.print(new MessageBox("Platforms", producer, TextColor.GRAY).create());
|
||||
|
||||
actor.printDebug("----------- Capabilities -----------");
|
||||
for (Capability capability : Capability.values()) {
|
||||
try {
|
||||
Platform platform = pm.queryCapability(capability);
|
||||
actor.printDebug(String.format("%s: %s", capability.name(),
|
||||
platform != null ? platform.getPlatformName() : "NONE"));
|
||||
} catch (NoCapablePlatformException e) {
|
||||
actor.printDebug(String.format("%s: %s", capability.name(), "NONE"));
|
||||
}
|
||||
producer.reset();
|
||||
for (Capability capability : Capability.values()) {
|
||||
Platform platform = pm.queryCapability(capability);
|
||||
producer.append(
|
||||
TextComponent.of(capability.name(), TextColor.GRAY)
|
||||
.append(TextComponent.of(": ")
|
||||
.append(TextComponent.of(platform != null ? platform.getPlatformName() : "NONE")))
|
||||
).newline();
|
||||
}
|
||||
actor.printDebug("");
|
||||
actor.printDebug("Wiki: https://github.com/IntellectualSites/FastAsyncWorldEdit-1.13/wiki");
|
||||
actor.print(new MessageBox("Capabilities", producer, TextColor.GRAY).create());
|
||||
|
||||
}
|
||||
|
||||
@Command(
|
||||
@ -118,7 +131,7 @@ public class WorldEditCommands {
|
||||
we.getPlatformManager().queryCapability(Capability.CONFIGURATION).reload();
|
||||
we.getEventBus().post(new ConfigurationLoadEvent(we.getPlatformManager().queryCapability(Capability.CONFIGURATION).getConfiguration()));
|
||||
Fawe.get().setupConfigs();
|
||||
actor.print("Configuration and translations reloaded!");
|
||||
actor.printInfo(TranslatableComponent.of("worldedit.reload.config"));
|
||||
}
|
||||
|
||||
@Command(
|
||||
@ -129,7 +142,8 @@ public class WorldEditCommands {
|
||||
@SkipQueue
|
||||
@CommandPermissions({"worldedit.report", "worldedit.debugpaste"})
|
||||
public void report(Actor actor) throws WorldEditException, IOException {
|
||||
BBC.DOWNLOAD_LINK.send(actor, IncendoPaster.debugPaste());
|
||||
String dest = IncendoPaster.debugPaste();
|
||||
actor.printInfo(TranslatableComponent.of("worldedit.report.written", TextComponent.of(dest)));
|
||||
}
|
||||
|
||||
@Command(
|
||||
@ -172,12 +186,13 @@ public class WorldEditCommands {
|
||||
try {
|
||||
ZoneId tz = ZoneId.of(timezone);
|
||||
session.setTimezone(tz);
|
||||
actor.print("Timezone set for this session to: " + tz.getDisplayName(
|
||||
TextStyle.FULL, Locale.ENGLISH
|
||||
));
|
||||
actor.print("The current time in that timezone is: " + dateFormat.format(ZonedDateTime.now(tz)));
|
||||
actor.printInfo(TranslatableComponent.of("worldedit.timezone.set", TextComponent.of(tz.getDisplayName(
|
||||
TextStyle.FULL, actor.getLocale()
|
||||
))));
|
||||
actor.print(TranslatableComponent.of("worldedit.timezone.current",
|
||||
TextComponent.of(dateFormat.withLocale(actor.getLocale()).format(ZonedDateTime.now(tz)))));
|
||||
} catch (ZoneRulesException e) {
|
||||
actor.printError("Invalid timezone");
|
||||
actor.printError(TranslatableComponent.of("worldedit.timezone.invalid"));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -27,6 +27,7 @@ import com.sk89q.worldedit.entity.Player;
|
||||
import com.sk89q.worldedit.extension.platform.Actor;
|
||||
import com.sk89q.worldedit.extension.platform.Platform;
|
||||
import com.sk89q.worldedit.util.Location;
|
||||
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
|
||||
import com.sk89q.worldedit.world.block.BlockType;
|
||||
import com.sk89q.worldedit.world.block.BlockTypes;
|
||||
|
||||
@ -79,7 +80,7 @@ public class AreaPickaxe implements BlockTool {
|
||||
}
|
||||
editSession.flushQueue();
|
||||
} catch (MaxChangedBlocksException e) {
|
||||
player.printError("Max blocks change limit reached.");
|
||||
player.printError(TranslatableComponent.of("worldedit.tool.max-block-changes"));
|
||||
} finally {
|
||||
session.remember(editSession);
|
||||
}
|
||||
|
@ -20,6 +20,7 @@
|
||||
package com.sk89q.worldedit.command.tool;
|
||||
|
||||
import com.boydti.fawe.config.BBC;
|
||||
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.sk89q.worldedit.EditSession;
|
||||
import com.sk89q.worldedit.LocalConfiguration;
|
||||
@ -31,6 +32,8 @@ import com.sk89q.worldedit.extension.platform.Platform;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.registry.state.Property;
|
||||
import com.sk89q.worldedit.util.Location;
|
||||
import com.sk89q.worldedit.util.formatting.text.TextComponent;
|
||||
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
|
||||
import com.sk89q.worldedit.world.World;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
|
||||
@ -62,12 +65,12 @@ public class BlockDataCyler implements DoubleActionBlockTool {
|
||||
if (!config.allowedDataCycleBlocks.isEmpty()
|
||||
&& !player.hasPermission("worldedit.override.data-cycler")
|
||||
&& !config.allowedDataCycleBlocks.contains(block.getBlockType().getId())) {
|
||||
player.printError(BBC.BLOCK_CYCLER_NO_PERM.s());
|
||||
player.printError(TranslatableComponent.of("worldedit.tool.data-cycler.block-not-permitted"));
|
||||
return true;
|
||||
}
|
||||
|
||||
if (block.getStates().keySet().isEmpty()) {
|
||||
player.printError(BBC.BLOCK_CYCLER_CANNOT_CYCLE.s());
|
||||
player.printError(TranslatableComponent.of("worldedit.tool.data-cycler.cant-cycle"));
|
||||
} else {
|
||||
Property<?> currentProperty = selectedProperties.get(player.getUniqueId());
|
||||
|
||||
@ -89,9 +92,13 @@ public class BlockDataCyler implements DoubleActionBlockTool {
|
||||
|
||||
try {
|
||||
editSession.setBlock(blockPoint, newBlock);
|
||||
player.print("Value of " + currentProperty.getName() + " is now " + currentProperty.getValues().get(index));
|
||||
player.printInfo(TranslatableComponent.of(
|
||||
"worldedit.tool.data-cycler.new-value",
|
||||
TextComponent.of(currentProperty.getName()),
|
||||
TextComponent.of(String.valueOf(currentProperty.getValues().get(index)))
|
||||
));
|
||||
} catch (MaxChangedBlocksException e) {
|
||||
player.printError(BBC.BLOCK_CYCLER_LIMIT.s());
|
||||
player.printError(TranslatableComponent.of("worldedit.tool.max-block-changes"));
|
||||
} finally {
|
||||
session.remember(editSession);
|
||||
}
|
||||
@ -102,7 +109,7 @@ public class BlockDataCyler implements DoubleActionBlockTool {
|
||||
index = (index + 1) % properties.size();
|
||||
currentProperty = properties.get(index);
|
||||
selectedProperties.put(player.getUniqueId(), currentProperty);
|
||||
player.print("Now cycling " + currentProperty.getName());
|
||||
player.printInfo(TranslatableComponent.of("worldedit.tool.data-cycler.cycling", TextComponent.of(currentProperty.getName())));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -30,6 +30,8 @@ import com.sk89q.worldedit.extent.inventory.BlockBag;
|
||||
import com.sk89q.worldedit.function.pattern.Pattern;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.util.Location;
|
||||
import com.sk89q.worldedit.util.formatting.text.TextComponent;
|
||||
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
|
||||
import com.sk89q.worldedit.world.block.BaseBlock;
|
||||
|
||||
/**
|
||||
@ -76,7 +78,7 @@ public class BlockReplacer implements DoubleActionBlockTool {
|
||||
|
||||
if (targetBlock != null) {
|
||||
pattern = targetBlock;
|
||||
player.print("Replacer tool switched to: " + targetBlock.getBlockType().getName());
|
||||
player.printInfo(TranslatableComponent.of("worldedit.tool.repl.switched", TextComponent.of(targetBlock.getBlockType().getName())));
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -28,6 +28,7 @@ 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.BBC;
|
||||
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
|
||||
import com.boydti.fawe.object.RunnableVal;
|
||||
import com.boydti.fawe.object.brush.BrushSettings;
|
||||
import com.boydti.fawe.object.brush.MovableTool;
|
||||
@ -86,6 +87,7 @@ import java.util.concurrent.locks.Lock;
|
||||
import java.util.concurrent.locks.ReentrantLock;
|
||||
import java.util.function.Supplier;
|
||||
import java.util.stream.Stream;
|
||||
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
/**
|
||||
@ -499,7 +501,7 @@ public class BrushTool implements DoubleActionTraceTool, ScrollTool, MovableTool
|
||||
if (brush == null) return false;
|
||||
|
||||
if (current.setWorld(player.getWorld().getName()) && !current.canUse(player)) {
|
||||
BBC.NO_PERM.send(player, StringMan.join(current.getPermissions(), ","));
|
||||
player.print(TranslatableComponent.of("fawe.error.no.perm" , StringMan.join(current.getPermissions(), ",")));
|
||||
return false;
|
||||
}
|
||||
try (EditSession editSession = session.createEditSession(player)) {
|
||||
@ -507,7 +509,7 @@ public class BrushTool implements DoubleActionTraceTool, ScrollTool, MovableTool
|
||||
|
||||
if (target == null) {
|
||||
editSession.cancel();
|
||||
player.print(BBC.NO_BLOCK.s());
|
||||
player.printError(TranslatableComponent.of("worldedit.tool.no-block"));
|
||||
return true;
|
||||
}
|
||||
BlockBag bag = session.getBlockBag(player);
|
||||
@ -542,7 +544,7 @@ public class BrushTool implements DoubleActionTraceTool, ScrollTool, MovableTool
|
||||
WorldEdit.getInstance().checkMaxBrushRadius(size);
|
||||
brush.build(editSession, target.toBlockPoint(), current.getMaterial(), size);
|
||||
} catch (MaxChangedBlocksException e) {
|
||||
player.printError("Max blocks change limit reached.");
|
||||
player.printError(TranslatableComponent.of("worldedit.tool.max-block-changes"));
|
||||
} finally {
|
||||
session.remember(editSession);
|
||||
if (bag != null) {
|
||||
|
@ -20,6 +20,7 @@
|
||||
package com.sk89q.worldedit.command.tool;
|
||||
|
||||
import com.boydti.fawe.config.BBC;
|
||||
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
|
||||
import com.sk89q.worldedit.LocalConfiguration;
|
||||
import com.sk89q.worldedit.LocalSession;
|
||||
import com.sk89q.worldedit.entity.Player;
|
||||
@ -29,6 +30,7 @@ import com.sk89q.worldedit.function.mask.Mask;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.regions.RegionSelector;
|
||||
import com.sk89q.worldedit.util.Location;
|
||||
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
|
||||
|
||||
/**
|
||||
* A wand that can be used at a distance.
|
||||
@ -75,7 +77,7 @@ public class DistanceWand extends BrushTool implements DoubleActionTraceTool {
|
||||
}
|
||||
|
||||
if (target == null) {
|
||||
player.printError(BBC.NO_BLOCK.s());
|
||||
player.printError(TranslatableComponent.of("worldedit.tool.no-block"));
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -20,6 +20,7 @@
|
||||
package com.sk89q.worldedit.command.tool;
|
||||
|
||||
import com.boydti.fawe.config.BBC;
|
||||
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
|
||||
import com.boydti.fawe.object.collection.LocalBlockVectorSet;
|
||||
|
||||
import com.sk89q.worldedit.EditSession;
|
||||
@ -32,6 +33,7 @@ import com.sk89q.worldedit.extension.platform.Platform;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.util.Direction;
|
||||
import com.sk89q.worldedit.util.Location;
|
||||
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
|
||||
import com.sk89q.worldedit.world.World;
|
||||
import com.sk89q.worldedit.world.block.BlockCategories;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
@ -74,7 +76,7 @@ public class FloatingTreeRemover implements BlockTool {
|
||||
final BlockState state = world.getBlock(clicked.toVector().toBlockPoint());
|
||||
|
||||
if (!isTreeBlock(state.getBlockType())) {
|
||||
player.printError(BBC.TOOL_DELTREE_ERROR.s());
|
||||
player.printError(TranslatableComponent.of("worldedit.tool.deltree.not-tree"));
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -82,7 +84,7 @@ public class FloatingTreeRemover implements BlockTool {
|
||||
try {
|
||||
final Set<BlockVector3> blockSet = bfs(world, clicked.toVector().toBlockPoint());
|
||||
if (blockSet == null) {
|
||||
player.printError(BBC.TOOL_DELTREE_FLOATING_ERROR.s());
|
||||
player.printError(TranslatableComponent.of("worldedit.tool.deltree.not-floating"));
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -93,7 +95,7 @@ public class FloatingTreeRemover implements BlockTool {
|
||||
}
|
||||
}
|
||||
} catch (MaxChangedBlocksException e) {
|
||||
player.printError("Max blocks change limit reached.");
|
||||
player.printError(TranslatableComponent.of("worldedit.tool.max-block-changes"));
|
||||
} finally {
|
||||
session.remember(editSession);
|
||||
}
|
||||
|
@ -33,6 +33,7 @@ import com.sk89q.worldedit.function.pattern.Pattern;
|
||||
import com.sk89q.worldedit.function.visitor.RecursiveVisitor;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.util.Location;
|
||||
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
|
||||
import com.sk89q.worldedit.world.World;
|
||||
import com.sk89q.worldedit.world.block.BlockType;
|
||||
import com.sk89q.worldedit.world.block.BlockTypes;
|
||||
@ -80,7 +81,7 @@ public class FloodFillTool implements BlockTool {
|
||||
visitor.visit(origin);
|
||||
Operations.completeLegacy(visitor);
|
||||
} catch (MaxChangedBlocksException e) {
|
||||
player.printError("Max blocks change limit reached.");
|
||||
player.printError(TranslatableComponent.of("worldedit.tool.max-block-changes"));
|
||||
} finally {
|
||||
session.remember(editSession);
|
||||
}
|
||||
|
@ -20,6 +20,7 @@
|
||||
package com.sk89q.worldedit.command.tool;
|
||||
|
||||
import com.boydti.fawe.config.BBC;
|
||||
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
|
||||
import com.sk89q.worldedit.EditSession;
|
||||
import com.sk89q.worldedit.LocalConfiguration;
|
||||
import com.sk89q.worldedit.LocalSession;
|
||||
@ -32,6 +33,7 @@ import com.sk89q.worldedit.function.mask.Mask;
|
||||
import com.sk89q.worldedit.function.pattern.Pattern;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.util.Location;
|
||||
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
|
||||
import com.sk89q.worldedit.world.block.BaseBlock;
|
||||
|
||||
/**
|
||||
@ -119,7 +121,7 @@ public class LongRangeBuildTool extends BrushTool implements DoubleActionTraceTo
|
||||
}
|
||||
|
||||
if (target == null) {
|
||||
player.printError(BBC.NO_BLOCK.s());
|
||||
player.printError(TranslatableComponent.of("worldedit.tool.no-block"));
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -25,6 +25,7 @@ import com.sk89q.worldedit.entity.Player;
|
||||
import com.sk89q.worldedit.extension.platform.Actor;
|
||||
import com.sk89q.worldedit.extension.platform.Platform;
|
||||
import com.sk89q.worldedit.util.Location;
|
||||
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
|
||||
|
||||
public enum NavigationWand implements DoubleActionTraceTool {
|
||||
INSTANCE;
|
||||
@ -39,7 +40,7 @@ public enum NavigationWand implements DoubleActionTraceTool {
|
||||
if (pos != null) {
|
||||
player.findFreePosition(pos);
|
||||
} else {
|
||||
player.printError("No block in sight (or too far)!");
|
||||
player.printError(TranslatableComponent.of("worldedit.jumpto.none"));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@ -52,7 +53,7 @@ public enum NavigationWand implements DoubleActionTraceTool {
|
||||
}
|
||||
|
||||
if (!player.passThroughForwardWall(Math.max(1, maxDist - 10))) {
|
||||
player.printError("Nothing to pass through (or too far)!");
|
||||
player.printError(TranslatableComponent.of("worldedit.thru.obstructed"));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -29,6 +29,7 @@ import com.sk89q.worldedit.extension.platform.Platform;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.util.Location;
|
||||
import com.sk89q.worldedit.util.formatting.text.TextComponent;
|
||||
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
|
||||
import com.sk89q.worldedit.util.formatting.text.event.HoverEvent;
|
||||
import com.sk89q.worldedit.util.formatting.text.format.TextColor;
|
||||
import com.sk89q.worldedit.world.World;
|
||||
@ -58,15 +59,15 @@ public class QueryTool implements BlockTool {
|
||||
builder.append(TextComponent.of("@" + clicked.toVector().toBlockPoint() + ": ", TextColor.BLUE));
|
||||
builder.append(TextComponent.of(block.getBlockType().getName(), TextColor.YELLOW));
|
||||
builder.append(TextComponent.of(" (" + block + ") ", TextColor.GRAY)
|
||||
.hoverEvent(HoverEvent.of(HoverEvent.Action.SHOW_TEXT, TextComponent.of("Block state"))));
|
||||
.hoverEvent(HoverEvent.of(HoverEvent.Action.SHOW_TEXT, TranslatableComponent.of("worldedit.tool.info.blockstate.hover"))));
|
||||
final OptionalInt internalId = BlockStateIdAccess.getBlockStateId(block.toImmutableState());
|
||||
if (internalId.isPresent()) {
|
||||
builder.append(TextComponent.of(" (" + internalId.getAsInt() + ") ", TextColor.DARK_GRAY)
|
||||
.hoverEvent(HoverEvent.of(HoverEvent.Action.SHOW_TEXT, TextComponent.of("Internal ID"))));
|
||||
.hoverEvent(HoverEvent.of(HoverEvent.Action.SHOW_TEXT, TranslatableComponent.of("worldedit.tool.info.internalid.hover"))));
|
||||
}
|
||||
builder.append(TextComponent.of(" (" + world.getBlockLightLevel(blockPoint) + "/"
|
||||
+ world.getBlockLightLevel(blockPoint.add(0, 1, 0)) + ")", TextColor.WHITE)
|
||||
.hoverEvent(HoverEvent.of(HoverEvent.Action.SHOW_TEXT, TextComponent.of("Block Light/Light Above"))));
|
||||
.hoverEvent(HoverEvent.of(HoverEvent.Action.SHOW_TEXT, TranslatableComponent.of("worldedit.tool.info.light.hover"))));
|
||||
|
||||
player.print(builder.build());
|
||||
|
||||
|
@ -32,6 +32,7 @@ import com.sk89q.worldedit.function.operation.Operations;
|
||||
import com.sk89q.worldedit.function.visitor.RecursiveVisitor;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.util.Location;
|
||||
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
|
||||
import com.sk89q.worldedit.world.World;
|
||||
import com.sk89q.worldedit.world.block.BlockType;
|
||||
import com.sk89q.worldedit.world.block.BlockTypes;
|
||||
|
@ -28,6 +28,7 @@ import com.sk89q.worldedit.extension.platform.Actor;
|
||||
import com.sk89q.worldedit.extension.platform.Platform;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.util.Location;
|
||||
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
|
||||
import com.sk89q.worldedit.world.World;
|
||||
import com.sk89q.worldedit.world.block.BlockType;
|
||||
import com.sk89q.worldedit.world.block.BlockTypes;
|
||||
@ -56,7 +57,7 @@ public class SinglePickaxe implements BlockTool {
|
||||
editSession.setBlock(blockPoint, BlockTypes.AIR.getDefaultState());
|
||||
session.remember(editSession);
|
||||
} catch (MaxChangedBlocksException e) {
|
||||
player.printError("Max blocks change limit reached.");
|
||||
player.printError(TranslatableComponent.of("worldedit.tool.max-block-changes"));
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -20,6 +20,7 @@
|
||||
package com.sk89q.worldedit.command.tool;
|
||||
|
||||
import com.boydti.fawe.config.BBC;
|
||||
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
|
||||
|
||||
import com.sk89q.worldedit.EditSession;
|
||||
import com.sk89q.worldedit.LocalConfiguration;
|
||||
@ -31,6 +32,7 @@ import com.sk89q.worldedit.extension.platform.Platform;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.util.Location;
|
||||
import com.sk89q.worldedit.util.TreeGenerator;
|
||||
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
|
||||
|
||||
/**
|
||||
* Plants a tree.
|
||||
@ -64,10 +66,10 @@ public class TreePlanter implements BlockTool {
|
||||
}
|
||||
|
||||
if (!successful) {
|
||||
player.printError(BBC.TOOL_TREE_ERROR_BLOCK.s());
|
||||
player.printError(TranslatableComponent.of("worldedit.tool.tree.obstructed"));
|
||||
}
|
||||
} catch (MaxChangedBlocksException e) {
|
||||
player.printError(BBC.WORLDEDIT_CANCEL_REASON_MAX_CHANGES.s());
|
||||
player.printError(TranslatableComponent.of("worldedit.tool.max-block-changes"));
|
||||
} finally {
|
||||
session.remember(editSession);
|
||||
}
|
||||
|
@ -55,7 +55,7 @@ public final class AsyncCommandBuilder<T> {
|
||||
@Nullable
|
||||
private String description;
|
||||
@Nullable
|
||||
private String delayMessage;
|
||||
private Component delayMessage;
|
||||
|
||||
@Nullable
|
||||
private Component successMessage;
|
||||
@ -84,7 +84,12 @@ public final class AsyncCommandBuilder<T> {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public AsyncCommandBuilder<T> sendMessageAfterDelay(String message) {
|
||||
return sendMessageAfterDelay(TextComponent.of(checkNotNull(message)));
|
||||
}
|
||||
|
||||
public AsyncCommandBuilder<T> sendMessageAfterDelay(Component message) {
|
||||
this.delayMessage = checkNotNull(message);
|
||||
return this;
|
||||
}
|
||||
@ -98,7 +103,7 @@ public final class AsyncCommandBuilder<T> {
|
||||
|
||||
public AsyncCommandBuilder<T> onSuccess(@Nullable String message, @Nullable Consumer<T> consumer) {
|
||||
checkArgument(message != null || consumer != null, "Can't have null message AND consumer");
|
||||
this.successMessage = message == null ? null : TextComponent.of(message, TextColor.LIGHT_PURPLE);
|
||||
this.successMessage = message == null ? null : TextComponent.of(message, TextColor.GRAY);
|
||||
this.consumer = consumer;
|
||||
return this;
|
||||
}
|
||||
|
@ -24,6 +24,8 @@ import static com.google.common.base.Preconditions.checkNotNull;
|
||||
import com.google.common.util.concurrent.ListenableFuture;
|
||||
import com.google.common.util.concurrent.MoreExecutors;
|
||||
import com.sk89q.worldedit.extension.platform.Actor;
|
||||
import com.sk89q.worldedit.util.formatting.text.Component;
|
||||
import com.sk89q.worldedit.util.formatting.text.TextComponent;
|
||||
|
||||
import java.util.Timer;
|
||||
|
||||
@ -34,7 +36,12 @@ public class FutureProgressListener implements Runnable {
|
||||
|
||||
private final MessageTimerTask task;
|
||||
|
||||
@Deprecated
|
||||
public FutureProgressListener(Actor sender, String message) {
|
||||
this(sender, TextComponent.of(message));
|
||||
}
|
||||
|
||||
public FutureProgressListener(Actor sender, Component message) {
|
||||
checkNotNull(sender);
|
||||
checkNotNull(message);
|
||||
|
||||
@ -47,8 +54,13 @@ public class FutureProgressListener implements Runnable {
|
||||
task.cancel();
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public static void addProgressListener(ListenableFuture<?> future, Actor sender, String message) {
|
||||
future.addListener(new FutureProgressListener(sender, message), MoreExecutors.directExecutor());
|
||||
}
|
||||
|
||||
public static void addProgressListener(ListenableFuture<?> future, Actor sender, Component message) {
|
||||
future.addListener(new FutureProgressListener(sender, message), MoreExecutors.directExecutor());
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -22,15 +22,22 @@ package com.sk89q.worldedit.command.util;
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import com.sk89q.worldedit.extension.platform.Actor;
|
||||
import com.sk89q.worldedit.util.formatting.text.Component;
|
||||
import com.sk89q.worldedit.util.formatting.text.TextComponent;
|
||||
|
||||
import java.util.TimerTask;
|
||||
|
||||
public class MessageTimerTask extends TimerTask {
|
||||
|
||||
private final Actor sender;
|
||||
private final String message;
|
||||
private final Component message;
|
||||
|
||||
@Deprecated
|
||||
MessageTimerTask(Actor sender, String message) {
|
||||
this(sender, TextComponent.of(message));
|
||||
}
|
||||
|
||||
MessageTimerTask(Actor sender, Component message) {
|
||||
checkNotNull(sender);
|
||||
checkNotNull(message);
|
||||
|
||||
|
@ -30,6 +30,8 @@ import com.sk89q.worldedit.extension.platform.Actor;
|
||||
import com.sk89q.worldedit.util.formatting.component.CommandListBox;
|
||||
import com.sk89q.worldedit.util.formatting.component.CommandUsageBox;
|
||||
import com.sk89q.worldedit.util.formatting.component.InvalidComponentException;
|
||||
import com.sk89q.worldedit.util.formatting.text.TextComponent;
|
||||
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@ -76,7 +78,7 @@ public class PrintCommandHelp {
|
||||
List<Command> visited = new ArrayList<>();
|
||||
Command currentCommand = detectCommand(manager, commandPath.get(0));
|
||||
if (currentCommand == null) {
|
||||
actor.printError(String.format("The command '%s' could not be found.", commandPath.get(0)));
|
||||
actor.printError(TranslatableComponent.of("worldedit.help.command-not-found", TextComponent.of(commandPath.get(0))));
|
||||
return;
|
||||
}
|
||||
visited.add(currentCommand);
|
||||
@ -87,8 +89,8 @@ public class PrintCommandHelp {
|
||||
Map<String, Command> subCommands = getSubCommands(currentCommand);
|
||||
|
||||
if (subCommands.isEmpty()) {
|
||||
actor.printError(String.format("'%s' has no sub-commands. (Maybe '%s' is for a parameter?)",
|
||||
toCommandString(visited), subCommand));
|
||||
actor.printError(TranslatableComponent.of("worldedit.help.no-subcommands",
|
||||
TextComponent.of(toCommandString(visited)), TextComponent.of(subCommand)));
|
||||
// full help for single command
|
||||
CommandUsageBox box = new CommandUsageBox(visited, visited.stream()
|
||||
.map(Command::getName).collect(Collectors.joining(" ")), helpRootCommand);
|
||||
@ -100,8 +102,8 @@ public class PrintCommandHelp {
|
||||
currentCommand = subCommands.get(subCommand);
|
||||
visited.add(currentCommand);
|
||||
} else {
|
||||
actor.printError(String.format("The sub-command '%s' under '%s' could not be found.",
|
||||
subCommand, toCommandString(visited)));
|
||||
actor.printError(TranslatableComponent.of("worldedit.help.subcommand-not-found",
|
||||
TextComponent.of(subCommand), TextComponent.of(toCommandString(visited))));
|
||||
// list subcommands for currentCommand
|
||||
printCommands(page, getSubCommands(Iterables.getLast(visited)).values().stream(), actor, visited, helpRootCommand);
|
||||
return;
|
||||
|
@ -22,6 +22,7 @@ package com.sk89q.worldedit.command.util;
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
import com.sk89q.worldedit.extension.platform.Actor;
|
||||
import com.sk89q.worldedit.util.formatting.text.Component;
|
||||
import com.sk89q.worldedit.util.formatting.text.TextComponent;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.concurrent.Callable;
|
||||
@ -33,13 +34,18 @@ public final class WorldEditAsyncCommandBuilder {
|
||||
private WorldEditAsyncCommandBuilder() {
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public static void createAndSendMessage(Actor actor, Callable<Component> task, @Nullable String desc) {
|
||||
createAndSendMessage(actor, task, desc != null ? TextComponent.of(desc) : null);
|
||||
}
|
||||
|
||||
public static void createAndSendMessage(Actor actor, Callable<Component> task, @Nullable Component desc) {
|
||||
final AsyncCommandBuilder<Component> builder = AsyncCommandBuilder.wrap(task, actor);
|
||||
if (desc != null) {
|
||||
builder.sendMessageAfterDelay(desc);
|
||||
}
|
||||
builder
|
||||
.onSuccess((String) null, actor::print)
|
||||
.onSuccess((String) null, actor::printInfo)
|
||||
.onFailure((String) null, WorldEdit.getInstance().getPlatformManager().getPlatformCommandManager().getExceptionConverter())
|
||||
.buildAndExec(WorldEdit.getInstance().getExecutorService());
|
||||
}
|
||||
|
@ -2,6 +2,7 @@ package com.sk89q.worldedit.command.util.annotation;
|
||||
|
||||
import com.boydti.fawe.Fawe;
|
||||
import com.boydti.fawe.config.BBC;
|
||||
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
|
||||
import com.boydti.fawe.util.task.InterruptableCondition;
|
||||
import com.sk89q.worldedit.IncompleteRegionException;
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
@ -47,7 +48,7 @@ public @interface Confirm {
|
||||
BlockVector3 max = region.getMaximumPoint();
|
||||
long area = (max.getX() - min.getX()) * (max.getZ() - min.getZ() + 1) * (int) value;
|
||||
if (area > 2 << 18) {
|
||||
BBC.WORLDEDIT_CANCEL_REASON_CONFIRM_REGION.send(actor, min, max, getArgs(context));
|
||||
actor.print(TranslatableComponent.of("fawe.cancel.worldedit.cancel.reason.confirm.region" , min, max, 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 (value > max) {
|
||||
BBC.WORLDEDIT_CANCEL_REASON_CONFIRM_REGION.send(actor, value, max, getArgs(context));
|
||||
actor.print(TranslatableComponent.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 (value > max) {
|
||||
BBC.WORLDEDIT_CANCEL_REASON_CONFIRM_REGION.send(actor, value, max, getArgs(context));
|
||||
actor.print(TranslatableComponent.of("fawe.cancel.worldedit.cancel.reason.confirm.region" , value, max, getArgs(context)));
|
||||
return Processor.confirm(actor, context);
|
||||
}
|
||||
return true;
|
||||
@ -78,7 +79,7 @@ public @interface Confirm {
|
||||
ALWAYS {
|
||||
@Override
|
||||
public boolean passes(Actor actor, InjectedValueAccess context, double value) {
|
||||
BBC.WORLDEDIT_CANCEL_REASON_CONFIRM.send(actor);
|
||||
actor.print(TranslatableComponent.of("fawe.cancel.worldedit.cancel.reason.confirm"));
|
||||
return confirm(actor, context);
|
||||
}
|
||||
}
|
||||
|
@ -45,6 +45,7 @@ import com.sk89q.worldedit.session.request.Request;
|
||||
import com.sk89q.worldedit.util.Direction;
|
||||
import com.sk89q.worldedit.util.HandSide;
|
||||
import com.sk89q.worldedit.util.Location;
|
||||
import com.sk89q.worldedit.util.formatting.text.Component;
|
||||
import com.sk89q.worldedit.world.World;
|
||||
import com.sk89q.worldedit.world.block.BaseBlock;
|
||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||
@ -375,7 +376,7 @@ public interface Player extends Entity, Actor {
|
||||
}
|
||||
}
|
||||
|
||||
void sendTitle(String title, String sub);
|
||||
void sendTitle(Component title, Component sub);
|
||||
|
||||
/**
|
||||
* Loads any history items from disk: - Should already be called if history on disk is enabled
|
||||
|
@ -23,6 +23,7 @@ import com.google.common.collect.Maps;
|
||||
|
||||
import com.boydti.fawe.command.SuggestInputParseException;
|
||||
import com.boydti.fawe.config.BBC;
|
||||
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;
|
||||
@ -424,7 +425,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(BBC.BLOCK_NOT_ALLOWED + " '" + holder + "'");
|
||||
throw new DisallowedUsageException(TranslatableComponent.of("fawe.error.block.not.allowed") + " '" + holder + "'");
|
||||
}
|
||||
CompoundTag nbt = holder.getNbtData();
|
||||
if (nbt != null) {
|
||||
|
@ -22,6 +22,7 @@ package com.sk89q.worldedit.extension.factory.parser.mask;
|
||||
import com.boydti.fawe.command.FaweParser;
|
||||
import com.boydti.fawe.command.SuggestInputParseException;
|
||||
import com.boydti.fawe.config.BBC;
|
||||
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
|
||||
import com.boydti.fawe.util.StringMan;
|
||||
import com.google.common.collect.Iterables;
|
||||
import com.sk89q.minecraft.util.commands.CommandException;
|
||||
@ -149,7 +150,7 @@ public class DefaultMaskParser extends FaweParser<Mask> {
|
||||
input = input.substring(input.indexOf(char0) + 1);
|
||||
mask = parseFromInput(char0 + "[" + input + "]", context);
|
||||
if (actor != null) {
|
||||
BBC.COMMAND_CLARIFYING_BRACKET.send(actor, char0 + "[" + input + "]");
|
||||
actor.print(TranslatableComponent.of("fawe.worldedit.help.command.clarifying.bracket" , char0 + "[" + input + "]"));
|
||||
}
|
||||
return mask;
|
||||
}
|
||||
|
@ -75,7 +75,7 @@ public abstract class AbstractNonPlayerActor implements Actor {
|
||||
} else {
|
||||
FaweException fe = FaweException.get(throwable);
|
||||
if (fe != null) {
|
||||
printError(fe.getMessage());
|
||||
printError(fe.getComponent());
|
||||
} else {
|
||||
throwable.printStackTrace();
|
||||
}
|
||||
|
@ -22,6 +22,7 @@ package com.sk89q.worldedit.extension.platform;
|
||||
import com.sk89q.worldedit.EditSession;
|
||||
|
||||
import com.boydti.fawe.config.BBC;
|
||||
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
|
||||
import com.boydti.fawe.object.exception.FaweException;
|
||||
import com.boydti.fawe.object.task.SimpleAsyncNotifyQueue;
|
||||
import com.boydti.fawe.regions.FaweMaskManager;
|
||||
@ -56,6 +57,7 @@ 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.BlockState;
|
||||
@ -110,7 +112,7 @@ public abstract class AbstractPlayerActor implements Actor, Player, Cloneable {
|
||||
} else {
|
||||
FaweException fe = FaweException.get(throwable);
|
||||
if (fe != null) {
|
||||
printError(fe.getMessage());
|
||||
printError(fe.getComponent());
|
||||
} else {
|
||||
throwable.printStackTrace();
|
||||
}
|
||||
@ -358,10 +360,8 @@ public abstract class AbstractPlayerActor implements Actor, Player, Cloneable {
|
||||
.isMovementBlocker()) {
|
||||
int platformY = Math.max(initialY, y - 3 - clearance);
|
||||
if (platformY < initialY) { // if ==, they already have the given clearance, if <, clearance is too large
|
||||
printError("Not enough space above you!");
|
||||
return false;
|
||||
} else if (platformY == initialY) {
|
||||
printError("You're already at the ceiling.");
|
||||
return false;
|
||||
}
|
||||
floatAt(x, platformY + 1, z, alwaysGlass);
|
||||
@ -590,13 +590,13 @@ public abstract class AbstractPlayerActor implements Actor, Player, Cloneable {
|
||||
|
||||
@Override
|
||||
public File openFileOpenDialog(String[] extensions) {
|
||||
printError("File dialogs are not supported in your environment.");
|
||||
printError(TranslatableComponent.of("worldedit.platform.no-file-dialog"));
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public File openFileSaveDialog(String[] extensions) {
|
||||
printError("File dialogs are not supported in your environment.");
|
||||
printError(TranslatableComponent.of("worldedit.platform.no-file-dialog"));
|
||||
return null;
|
||||
}
|
||||
|
||||
@ -645,7 +645,6 @@ public abstract class AbstractPlayerActor implements Actor, Player, Cloneable {
|
||||
|
||||
}
|
||||
|
||||
@SuppressWarnings("CloneDoesntCallSuperClone")
|
||||
@Override
|
||||
public Object clone() throws CloneNotSupportedException {
|
||||
throw new CloneNotSupportedException("Not supported");
|
||||
|
@ -21,6 +21,7 @@ package com.sk89q.worldedit.extension.platform;
|
||||
|
||||
import com.boydti.fawe.Fawe;
|
||||
import com.boydti.fawe.config.BBC;
|
||||
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
|
||||
import com.boydti.fawe.config.Settings;
|
||||
import com.boydti.fawe.object.FaweLimit;
|
||||
import com.boydti.fawe.object.brush.visualization.VirtualWorld;
|
||||
@ -38,6 +39,7 @@ import com.sk89q.worldedit.session.request.Request;
|
||||
import com.sk89q.worldedit.util.Identifiable;
|
||||
import com.sk89q.worldedit.util.auth.Subject;
|
||||
import com.sk89q.worldedit.util.formatting.text.Component;
|
||||
import com.sk89q.worldedit.util.formatting.text.format.TextColor;
|
||||
import org.enginehub.piston.inject.InjectedValueAccess;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@ -45,6 +47,7 @@ import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.text.NumberFormat;
|
||||
import java.util.concurrent.locks.Condition;
|
||||
import java.util.Locale;
|
||||
|
||||
/**
|
||||
* An object that can perform actions in WorldEdit.
|
||||
@ -71,30 +74,56 @@ public interface Actor extends Identifiable, SessionOwner, Subject, MapMetadatab
|
||||
* Print a message.
|
||||
*
|
||||
* @param msg The message text
|
||||
* @deprecated Use component-based functions (print)
|
||||
*/
|
||||
@Deprecated
|
||||
void printRaw(String msg);
|
||||
|
||||
/**
|
||||
* Print a WorldEdit message.
|
||||
*
|
||||
* @param msg The message text
|
||||
* @deprecated Use component-based functions (printDebug)
|
||||
*/
|
||||
@Deprecated
|
||||
void printDebug(String msg);
|
||||
|
||||
/**
|
||||
* Print a WorldEdit message.
|
||||
*
|
||||
* @param msg The message text
|
||||
* @deprecated Use component-based functions (printInfo)
|
||||
*/
|
||||
@Deprecated
|
||||
void print(String msg);
|
||||
|
||||
/**
|
||||
* Print a WorldEdit error.
|
||||
*
|
||||
* @param msg The error message text
|
||||
* @deprecated Use component-based functions (printError)
|
||||
*/
|
||||
@Deprecated
|
||||
void printError(String msg);
|
||||
|
||||
/**
|
||||
* Print a WorldEdit error.
|
||||
*
|
||||
* @param component The component to print
|
||||
*/
|
||||
default void printError(Component component) {
|
||||
print(component.color(TextColor.RED));
|
||||
}
|
||||
|
||||
/**
|
||||
* Print a WorldEdit message.
|
||||
*
|
||||
* @param component The component to print
|
||||
*/
|
||||
default void printInfo(Component component) {
|
||||
print(component.color(TextColor.GRAY));
|
||||
}
|
||||
|
||||
/**
|
||||
* Print a {@link Component}.
|
||||
*
|
||||
@ -109,6 +138,15 @@ public interface Actor extends Identifiable, SessionOwner, Subject, MapMetadatab
|
||||
*/
|
||||
boolean canDestroyBedrock();
|
||||
|
||||
/**
|
||||
* Print a WorldEdit message.
|
||||
*
|
||||
* @param component The component to print
|
||||
*/
|
||||
default void printDebug(Component component) {
|
||||
print(component.color(TextColor.GRAY));
|
||||
}
|
||||
|
||||
/**
|
||||
* Return whether this actor is a player.
|
||||
*
|
||||
@ -232,4 +270,11 @@ public interface Actor extends Identifiable, SessionOwner, Subject, MapMetadatab
|
||||
}
|
||||
return cancelled;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the locale of this actor.
|
||||
*
|
||||
* @return The locale
|
||||
*/
|
||||
Locale getLocale();
|
||||
}
|
||||
|
@ -25,6 +25,7 @@ import com.boydti.fawe.command.AnvilCommandsRegistration;
|
||||
import com.boydti.fawe.command.CFICommands;
|
||||
import com.boydti.fawe.command.CFICommandsRegistration;
|
||||
import com.boydti.fawe.config.BBC;
|
||||
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
|
||||
import com.boydti.fawe.config.Settings;
|
||||
import com.boydti.fawe.object.brush.visualization.cfi.HeightMapMCAGenerator;
|
||||
import com.boydti.fawe.object.changeset.CFIChangeSet;
|
||||
@ -736,7 +737,7 @@ public final class PlatformCommandManager {
|
||||
actor.print(e.getRichMessage());
|
||||
}
|
||||
} catch (FaweException e) {
|
||||
actor.printError("Edit cancelled: " + e.getMessage());
|
||||
actor.printError(TextComponent.builder().append("Edit cancelled: ").append(e.getComponent()).build());
|
||||
} catch (UsageException e) {
|
||||
ImmutableList<Command> cmd = e.getCommands();
|
||||
if (!cmd.isEmpty()) {
|
||||
@ -774,9 +775,14 @@ public final class PlatformCommandManager {
|
||||
editSession.flushQueue();
|
||||
session.remember(editSession);
|
||||
|
||||
long time = System.currentTimeMillis() - start;
|
||||
if (time > 1000) {
|
||||
BBC.ACTION_COMPLETE.send(actor, time / 1000D);
|
||||
long timems = System.currentTimeMillis() - start;
|
||||
if (timems > 1000) {
|
||||
actor.printDebug(TranslatableComponent.of(
|
||||
"worldedit.command.time-elapsed",
|
||||
TextComponent.of(timems + "m"),
|
||||
TextComponent.of(-1),
|
||||
TextComponent.of(Math.round(-1))
|
||||
));
|
||||
}
|
||||
|
||||
worldEdit.flushBlockBag(actor, editSession);
|
||||
@ -813,7 +819,7 @@ public final class PlatformCommandManager {
|
||||
store.injectValue(Key.of(Player.class), ValueProvider.constant((Player) actor));
|
||||
} else {
|
||||
store.injectValue(Key.of(Player.class), context -> {
|
||||
throw new CommandException(TextComponent.of("This command must be used with a player."), ImmutableList.of());
|
||||
throw new CommandException(TranslatableComponent.of("worldedit.command.player-only"), ImmutableList.of());
|
||||
});
|
||||
}
|
||||
store.injectValue(Key.of(Arguments.class), ValueProvider.constant(arguments));
|
||||
@ -831,8 +837,8 @@ public final class PlatformCommandManager {
|
||||
}
|
||||
|
||||
private void handleUnknownException(Actor actor, Throwable t) {
|
||||
actor.printError("Please report this error: [See console]");
|
||||
actor.printRaw(t.getClass().getName() + ": " + t.getMessage());
|
||||
actor.printError(TranslatableComponent.of("worldedit.command.error.report"));
|
||||
actor.print(TextComponent.of(t.getClass().getName() + ": " + t.getMessage()));
|
||||
log.error("An unexpected error while handling a WorldEdit command", t);
|
||||
}
|
||||
|
||||
|
@ -22,6 +22,7 @@ package com.sk89q.worldedit.extension.platform;
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import com.boydti.fawe.config.BBC;
|
||||
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
|
||||
import com.boydti.fawe.object.brush.visualization.VirtualWorld;
|
||||
import com.boydti.fawe.object.exception.FaweException;
|
||||
import com.boydti.fawe.object.pattern.PatternTraverser;
|
||||
@ -385,7 +386,7 @@ public class PlatformManager {
|
||||
public void handleThrowable(Throwable e, Actor actor) {
|
||||
FaweException faweException = FaweException.get(e);
|
||||
if (faweException != null) {
|
||||
BBC.WORLDEDIT_CANCEL_REASON.send(actor, faweException.getMessage());
|
||||
actor.print(TranslatableComponent.of("fawe.cancel.worldedit.cancel.reason" , faweException.getComponent()));
|
||||
} else {
|
||||
actor.printError("Please report this error: [See console]");
|
||||
actor.printRaw(e.getClass().getName() + ": " + e.getMessage());
|
||||
@ -437,7 +438,7 @@ public class PlatformManager {
|
||||
} catch (Throwable e) {
|
||||
FaweException faweException = FaweException.get(e);
|
||||
if (faweException != null) {
|
||||
BBC.WORLDEDIT_CANCEL_REASON.send(player, faweException.getMessage());
|
||||
player.print(TranslatableComponent.of("fawe.cancel.worldedit.cancel.reason" , faweException.getComponent()));
|
||||
} else {
|
||||
player.printError("Please report this error: [See console]");
|
||||
player.printRaw(e.getClass().getName() + ": " + e.getMessage());
|
||||
|
@ -34,9 +34,12 @@ import com.sk89q.worldedit.session.SessionKey;
|
||||
import com.sk89q.worldedit.util.HandSide;
|
||||
import com.sk89q.worldedit.util.Location;
|
||||
import com.sk89q.worldedit.util.formatting.text.Component;
|
||||
import com.sk89q.worldedit.util.formatting.text.TextComponent;
|
||||
import com.sk89q.worldedit.world.World;
|
||||
import com.sk89q.worldedit.world.block.BaseBlock;
|
||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||
|
||||
import java.util.Locale;
|
||||
import com.sk89q.worldedit.world.gamemode.GameMode;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
@ -141,22 +144,22 @@ public class PlayerProxy extends AbstractPlayerActor {
|
||||
|
||||
@Override
|
||||
public void printRaw(String msg) {
|
||||
basePlayer.printRaw(msg);
|
||||
basePlayer.print(TextComponent.of(msg));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void printDebug(String msg) {
|
||||
basePlayer.printDebug(msg);
|
||||
basePlayer.printDebug(TextComponent.of(msg));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void print(String msg) {
|
||||
basePlayer.print(msg);
|
||||
basePlayer.printInfo(TextComponent.of(msg));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void printError(String msg) {
|
||||
basePlayer.printError(msg);
|
||||
basePlayer.printError(TextComponent.of(msg));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -214,7 +217,7 @@ public class PlayerProxy extends AbstractPlayerActor {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendTitle(String title, String sub) {
|
||||
public void sendTitle(Component title, Component sub) {
|
||||
basePlayer.sendTitle(title, sub);
|
||||
}
|
||||
|
||||
@ -226,4 +229,9 @@ public class PlayerProxy extends AbstractPlayerActor {
|
||||
public void floatAt(int x, int y, int z, boolean alwaysGlass) {
|
||||
basePlayer.floatAt(x, y, z, alwaysGlass);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Locale getLocale() {
|
||||
return basePlayer.getLocale();
|
||||
}
|
||||
}
|
||||
|
@ -22,6 +22,7 @@ package com.sk89q.worldedit.extent.clipboard.io;
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import com.boydti.fawe.config.BBC;
|
||||
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
|
||||
import com.boydti.fawe.config.Settings;
|
||||
import com.boydti.fawe.object.clipboard.LazyClipboardHolder;
|
||||
import com.boydti.fawe.object.clipboard.MultiClipboardHolder;
|
||||
@ -170,7 +171,7 @@ public class ClipboardFormats {
|
||||
LocalConfiguration config = worldEdit.getConfiguration();
|
||||
if (input.startsWith("url:")) {
|
||||
if (!player.hasPermission("worldedit.schematic.load.web")) {
|
||||
if (message) BBC.NO_PERM.send(player, "worldedit.schematic.load.web");
|
||||
if (message) player.print(TranslatableComponent.of("fawe.error.no.perm", "worldedit.schematic.load.web"));
|
||||
return null;
|
||||
}
|
||||
URL base = new URL(Settings.IMP.WEB.URL);
|
||||
@ -178,19 +179,19 @@ public class ClipboardFormats {
|
||||
}
|
||||
if (input.startsWith("http")) {
|
||||
if (!player.hasPermission("worldedit.schematic.load.asset")) {
|
||||
if (message) BBC.NO_PERM.send(player, "worldedit.schematic.load.asset");
|
||||
if (message) player.print(TranslatableComponent.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) BBC.WEB_UNAUTHORIZED.send(player, url);
|
||||
if (message) player.print(TranslatableComponent.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")) {
|
||||
BBC.NO_PERM.send(player, "worldedit.schematic.load.other");
|
||||
player.print(TranslatableComponent.of("fawe.error.no.perm", "worldedit.schematic.load.other"));
|
||||
return null;
|
||||
}
|
||||
File working = worldEdit.getWorkingDirectoryFile(config.saveDir);
|
||||
@ -210,7 +211,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) BBC.NO_PERM.send(player, "worldedit.schematic.load.other");
|
||||
if (message) player.print(TranslatableComponent.of("fawe.error.no.perm", "worldedit.schematic.load.other"));
|
||||
return null;
|
||||
}
|
||||
if (format == null && input.matches(".*\\.[\\w].*")) {
|
||||
@ -232,12 +233,12 @@ public class ClipboardFormats {
|
||||
if (format == null && f.isFile()) {
|
||||
format = findByFile(f);
|
||||
if (format == null) {
|
||||
BBC.CLIPBOARD_INVALID_FORMAT.send(player, f.getName());
|
||||
player.print(TranslatableComponent.of("fawe.worldedit.clipboard.clipboard.invalid.format" , f.getName()));
|
||||
return null;
|
||||
}
|
||||
}
|
||||
if (!f.exists()) {
|
||||
if (message) BBC.SCHEMATIC_NOT_FOUND.send(player, input);
|
||||
if (message) player.print(TranslatableComponent.of("fawe.error.schematic.not.found" , input));
|
||||
return null;
|
||||
}
|
||||
if (!f.isDirectory()) {
|
||||
@ -247,7 +248,7 @@ public class ClipboardFormats {
|
||||
}
|
||||
URIClipboardHolder[] clipboards = loadAllFromDirectory(f);
|
||||
if (clipboards.length < 1) {
|
||||
if (message) BBC.SCHEMATIC_NOT_FOUND.send(player, input);
|
||||
if (message) player.print(TranslatableComponent.of("fawe.error.schematic.not.found" , input));
|
||||
return null;
|
||||
}
|
||||
return new MultiClipboardHolder(f.toURI(), clipboards);
|
||||
|
@ -109,10 +109,6 @@ public class ChunkBatchingExtent extends AbstractBufferingExtent {
|
||||
@Override
|
||||
public void cancel() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addStatusMessages(List<String> messages) {
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -149,10 +149,6 @@ public class FastModeExtent extends AbstractDelegateExtent {
|
||||
@Override
|
||||
public void cancel() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addStatusMessages(List<String> messages) {
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -22,6 +22,7 @@ package com.sk89q.worldedit.function.factory;
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
import static com.sk89q.worldedit.util.GuavaUtil.firstNonNull;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import com.sk89q.worldedit.EditSession;
|
||||
import com.sk89q.worldedit.LocalSession;
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
@ -36,7 +37,12 @@ import com.sk89q.worldedit.internal.expression.ExpressionException;
|
||||
import com.sk89q.worldedit.math.Vector3;
|
||||
import com.sk89q.worldedit.regions.NullRegion;
|
||||
import com.sk89q.worldedit.regions.Region;
|
||||
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.Collection;
|
||||
import java.util.List;
|
||||
|
||||
public class Deform implements Contextual<Operation> {
|
||||
@ -186,9 +192,11 @@ public class Deform implements Contextual<Operation> {
|
||||
public void cancel() {
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void addStatusMessages(List<String> messages) {
|
||||
messages.add("deformed using " + expression);
|
||||
public Iterable<Component> getStatusMessages() {
|
||||
return Lists.newArrayList(TranslatableComponent.of("worldedit.operation.deform.expression",
|
||||
TextComponent.of(expression).color(TextColor.GRAY)));
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -162,14 +162,12 @@ public class GardenPatchGenerator implements RegionFunction {
|
||||
position = position.add(0, 1, 0);
|
||||
}
|
||||
|
||||
if (editSession.getBlock(position.add(0, -1, 0)).getBlockType() != BlockTypes.GRASS_BLOCK) {
|
||||
if (!editSession.getBlock(position.add(0, -1, 0)).getBlockType().equals(BlockTypes.GRASS_BLOCK)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
if (editSession.getBlock(position).getBlockType().getMaterial().isAir()) {
|
||||
editSession.setBlock(position, leafPattern);
|
||||
}
|
||||
setBlockIfAir(editSession, position, leafPattern);
|
||||
|
||||
placeVine(position, position.add(0, 0, 1));
|
||||
placeVine(position, position.add(0, 0, -1));
|
||||
|
@ -93,10 +93,6 @@ public class ChangeSetExecutor implements Operation {
|
||||
public void cancel() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addStatusMessages(List<String> messages) {
|
||||
}
|
||||
|
||||
public static ChangeSetExecutor create(ChangeSet changeSet, UndoContext context, Type type, BlockBag blockBag, int inventory) {
|
||||
return new ChangeSetExecutor(changeSet, type, context, blockBag, inventory);
|
||||
}
|
||||
|
@ -21,8 +21,11 @@ package com.sk89q.worldedit.function.operation;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import com.google.common.collect.Iterables;
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
import com.sk89q.worldedit.util.formatting.text.Component;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@ -60,9 +63,8 @@ public class DelegateOperation implements Operation {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addStatusMessages(List<String> messages) {
|
||||
original.addStatusMessages(messages);
|
||||
delegate.addStatusMessages(messages);
|
||||
public Iterable<Component> getStatusMessages() {
|
||||
return Iterables.concat(original.getStatusMessages(), delegate.getStatusMessages());
|
||||
}
|
||||
|
||||
}
|
||||
|
Einige Dateien werden nicht angezeigt, da zu viele Dateien in diesem Diff geändert wurden Mehr anzeigen
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren