mirror of
https://github.com/EngineHub/WorldEdit.git
synced 2025-03-07 13:48:00 +08:00
Merge branch 'version/7.2.x'
This commit is contained in:
commit
964614bd48
@ -138,8 +138,10 @@
|
||||
|
||||
fun Project.addJarManifest(includeClasspath: Boolean = false) {
|
||||
tasks.named<Jar>("jar") {
|
||||
val version = project(":worldedit-core").version
|
||||
inputs.property("version", version)
|
||||
val attributes = mutableMapOf(
|
||||
"WorldEdit-Version" to project(":worldedit-core").version
|
||||
"WorldEdit-Version" to version
|
||||
)
|
||||
if (includeClasspath) {
|
||||
attributes["Class-Path"] = CLASSPATH
|
||||
|
@ -2,7 +2,7 @@
|
||||
set -e
|
||||
|
||||
# For snapshots, please specify the full version (with date and time)
|
||||
cdist_version="0.1.0-20201020.212757-5"
|
||||
cdist_version="0.1.0-20201128.225038-7"
|
||||
cdist_path_version="$cdist_version"
|
||||
|
||||
if [ -n "${cdist_version#*-}" ]; then
|
||||
@ -17,6 +17,8 @@ curl "$url" >./build/cdist.zip
|
||||
export CROWDIN_DISTRIBUTOR_ON_CHANGE="true"
|
||||
export CROWDIN_DISTRIBUTOR_PROJECT_ID="360697"
|
||||
export CROWDIN_DISTRIBUTOR_MODULE="worldedit-lang"
|
||||
## Full path to the source file, will be uploaded to crowdin, must already have uploaded at least once (will not create a new file)
|
||||
export CROWDIN_DISTRIBUTOR_SOURCE_FILE="./worldedit-core/src/main/resources/lang/strings.json"
|
||||
# Artifactory & Build Number is set by CI
|
||||
export CROWDIN_DISTRIBUTOR_OPTS="--enable-preview"
|
||||
"./build/crowdin-distributor-$cdist_path_version/bin/crowdin-distributor"
|
||||
|
@ -36,8 +36,10 @@
|
||||
}
|
||||
|
||||
tasks.named<Copy>("processResources") {
|
||||
val internalVersion = project.ext["internalVersion"]
|
||||
inputs.property("internalVersion", internalVersion)
|
||||
filesMatching("plugin.yml") {
|
||||
expand("internalVersion" to project.ext["internalVersion"])
|
||||
expand("internalVersion" to internalVersion)
|
||||
}
|
||||
// exclude adapters entirely from this JAR, they should only be in the shadow JAR
|
||||
exclude("**/worldedit-adapters.jar")
|
||||
|
@ -54,7 +54,7 @@
|
||||
"compileOnly"("com.google.auto.value:auto-value-annotations:${Versions.AUTO_VALUE}")
|
||||
"annotationProcessor"("com.google.auto.value:auto-value:${Versions.AUTO_VALUE}")
|
||||
|
||||
"languageFiles"("${project.group}:worldedit-lang:7.2.0:26@zip")
|
||||
"languageFiles"("${project.group}:worldedit-lang:7.2.1:68@zip")
|
||||
|
||||
"testImplementation"("ch.qos.logback:logback-core:${Versions.LOGBACK}")
|
||||
"testImplementation"("ch.qos.logback:logback-classic:${Versions.LOGBACK}")
|
||||
|
@ -135,6 +135,7 @@
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.stream.Collectors;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
@ -2640,23 +2641,21 @@ private void recurseHollow(Region region, BlockVector3 origin, Set<BlockVector3>
|
||||
}
|
||||
|
||||
public int makeBiomeShape(final Region region, final Vector3 zero, final Vector3 unit, final BiomeType biomeType,
|
||||
final String expressionString, final boolean hollow)
|
||||
throws ExpressionException, MaxChangedBlocksException {
|
||||
final String expressionString, final boolean hollow) throws ExpressionException {
|
||||
return makeBiomeShape(region, zero, unit, biomeType, expressionString, hollow, WorldEdit.getInstance().getConfiguration().calculationTimeout);
|
||||
}
|
||||
|
||||
public int makeBiomeShape(final Region region, final Vector3 zero, final Vector3 unit, final BiomeType biomeType,
|
||||
final String expressionString, final boolean hollow, final int timeout)
|
||||
throws ExpressionException, MaxChangedBlocksException {
|
||||
final String expressionString, final boolean hollow, final int timeout) throws ExpressionException {
|
||||
|
||||
final Expression expression = Expression.compile(expressionString, "x", "z");
|
||||
final Expression expression = Expression.compile(expressionString, "x", "y", "z");
|
||||
expression.optimize();
|
||||
|
||||
final EditSession editSession = this;
|
||||
final WorldEditExpressionEnvironment environment = new WorldEditExpressionEnvironment(editSession, unit, zero);
|
||||
expression.setEnvironment(environment);
|
||||
|
||||
final int[] timedOut = {0};
|
||||
AtomicInteger timedOut = new AtomicInteger();
|
||||
final ArbitraryBiomeShape shape = new ArbitraryBiomeShape(region) {
|
||||
@Override
|
||||
protected BiomeType getBiome(int x, int y, int z, BiomeType defaultBiomeType) {
|
||||
@ -2672,7 +2671,7 @@ protected BiomeType getBiome(int x, int y, int z, BiomeType defaultBiomeType) {
|
||||
// TODO: Allow biome setting via a script variable (needs BiomeType<->int mapping)
|
||||
return defaultBiomeType;
|
||||
} catch (ExpressionTimeoutException e) {
|
||||
timedOut[0] = timedOut[0] + 1;
|
||||
timedOut.getAndIncrement();
|
||||
return null;
|
||||
} catch (Exception e) {
|
||||
log.warn("Failed to create shape", e);
|
||||
@ -2681,10 +2680,10 @@ protected BiomeType getBiome(int x, int y, int z, BiomeType defaultBiomeType) {
|
||||
}
|
||||
};
|
||||
int changed = shape.generate(this, biomeType, hollow);
|
||||
if (timedOut[0] > 0) {
|
||||
if (timedOut.get() > 0) {
|
||||
throw new ExpressionTimeoutException(
|
||||
String.format("%d blocks changed. %d blocks took too long to evaluate (increase time with //timeout)",
|
||||
changed, timedOut[0]));
|
||||
String.format("%d biomes changed. %d biomes took too long to evaluate (increase time with //timeout)",
|
||||
changed, timedOut.get()));
|
||||
}
|
||||
return changed;
|
||||
}
|
||||
|
@ -66,8 +66,11 @@
|
||||
import com.sk89q.worldedit.util.asset.AssetLoadTask;
|
||||
import com.sk89q.worldedit.util.asset.AssetLoader;
|
||||
import com.sk89q.worldedit.util.asset.holder.ImageHeightmap;
|
||||
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.biome.BiomeType;
|
||||
import com.sk89q.worldedit.world.block.BlockTypes;
|
||||
import org.enginehub.piston.annotation.Command;
|
||||
@ -88,6 +91,10 @@ public class BrushCommands {
|
||||
|
||||
private final WorldEdit worldEdit;
|
||||
|
||||
private static final Component UNBIND_COMMAND_COMPONENT = TextComponent.builder("/brush unbind", TextColor.AQUA)
|
||||
.clickEvent(ClickEvent.suggestCommand("/brush unbind"))
|
||||
.build();
|
||||
|
||||
/**
|
||||
* Create a new instance.
|
||||
*
|
||||
@ -133,6 +140,7 @@ public void sphereBrush(Player player, LocalSession session,
|
||||
}
|
||||
|
||||
player.printInfo(TranslatableComponent.of("worldedit.brush.sphere.equip", TextComponent.of(String.format("%.0f", radius))));
|
||||
ToolCommands.sendUnbindInstruction(player, UNBIND_COMMAND_COMPONENT);
|
||||
}
|
||||
|
||||
@Command(
|
||||
@ -164,6 +172,7 @@ public void cylinderBrush(Player player, LocalSession session,
|
||||
}
|
||||
|
||||
player.printInfo(TranslatableComponent.of("worldedit.brush.cylinder.equip", TextComponent.of((int) radius), TextComponent.of(height)));
|
||||
ToolCommands.sendUnbindInstruction(player, UNBIND_COMMAND_COMPONENT);
|
||||
}
|
||||
|
||||
@Command(
|
||||
@ -200,6 +209,7 @@ public void clipboardBrush(Player player, LocalSession session,
|
||||
tool.setBrush(new ClipboardBrush(newHolder, ignoreAir, usingOrigin, pasteEntities, pasteBiomes, sourceMask), "worldedit.brush.clipboard");
|
||||
|
||||
player.printInfo(TranslatableComponent.of("worldedit.brush.clipboard.equip"));
|
||||
ToolCommands.sendUnbindInstruction(player, UNBIND_COMMAND_COMPONENT);
|
||||
}
|
||||
|
||||
@Command(
|
||||
@ -227,6 +237,7 @@ public void smoothBrush(Player player, LocalSession session,
|
||||
TextComponent.of(iterations),
|
||||
TextComponent.of(mask == null ? "any block" : "filter")
|
||||
));
|
||||
ToolCommands.sendUnbindInstruction(player, UNBIND_COMMAND_COMPONENT);
|
||||
}
|
||||
|
||||
@Command(
|
||||
@ -247,6 +258,7 @@ public void extinguishBrush(Player player, LocalSession session,
|
||||
tool.setBrush(new SphereBrush(), "worldedit.brush.ex");
|
||||
|
||||
player.printInfo(TranslatableComponent.of("worldedit.brush.extinguish.equip", TextComponent.of((int) radius)));
|
||||
ToolCommands.sendUnbindInstruction(player, UNBIND_COMMAND_COMPONENT);
|
||||
}
|
||||
|
||||
@Command(
|
||||
@ -274,6 +286,7 @@ public void gravityBrush(Player player, LocalSession session,
|
||||
tool.setBrush(new GravityBrush(height), "worldedit.brush.gravity");
|
||||
|
||||
player.printInfo(TranslatableComponent.of("worldedit.brush.gravity.equip", TextComponent.of((int) radius)));
|
||||
ToolCommands.sendUnbindInstruction(player, UNBIND_COMMAND_COMPONENT);
|
||||
}
|
||||
|
||||
@Command(
|
||||
@ -333,6 +346,7 @@ public void butcherBrush(Player player, LocalSession session,
|
||||
tool.setBrush(new ButcherBrush(flags), "worldedit.brush.butcher");
|
||||
|
||||
player.printInfo(TranslatableComponent.of("worldedit.brush.butcher.equip", TextComponent.of((int) radius)));
|
||||
ToolCommands.sendUnbindInstruction(player, UNBIND_COMMAND_COMPONENT);
|
||||
}
|
||||
|
||||
@Command(
|
||||
@ -367,6 +381,7 @@ void heightmapBrush(Player player, LocalSession session,
|
||||
.onSuccess(TranslatableComponent.of("worldedit.brush.heightmap.equip", TextComponent.of((int) radius)), heightmap -> {
|
||||
tool.setSize(radius);
|
||||
tool.setBrush(new ImageHeightmapBrush(heightmap, intensity, erase, flatten, randomize), "worldedit.brush.heightmap");
|
||||
ToolCommands.sendUnbindInstruction(player, UNBIND_COMMAND_COMPONENT);
|
||||
})
|
||||
.onFailure(TranslatableComponent.of("worldedit.asset.load.failed"), worldEdit.getPlatformManager().getPlatformCommandManager().getExceptionConverter())
|
||||
.buildAndExec(worldEdit.getExecutorService());
|
||||
@ -514,5 +529,6 @@ static void setOperationBasedBrush(Player player, LocalSession session, double r
|
||||
tool.setBrush(new OperationFactoryBrush(factory, shape, session), permission);
|
||||
|
||||
player.printInfo(TranslatableComponent.of("worldedit.brush.operation.equip", TextComponent.of(factory.toString())));
|
||||
ToolCommands.sendUnbindInstruction(player, UNBIND_COMMAND_COMPONENT);
|
||||
}
|
||||
}
|
||||
|
@ -51,6 +51,8 @@
|
||||
import com.sk89q.worldedit.util.formatting.text.Component;
|
||||
import com.sk89q.worldedit.util.formatting.text.TextComponent;
|
||||
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
|
||||
import com.sk89q.worldedit.util.formatting.text.event.ClickEvent;
|
||||
import com.sk89q.worldedit.util.formatting.text.format.TextColor;
|
||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||
import com.sk89q.worldedit.world.item.ItemType;
|
||||
import org.enginehub.piston.CommandManager;
|
||||
@ -69,6 +71,10 @@
|
||||
@CommandContainer(superTypes = CommandPermissionsConditionGenerator.Registration.class)
|
||||
public class ToolCommands {
|
||||
|
||||
private static final Component UNBIND_COMMAND_COMPONENT = TextComponent.builder("/tool unbind", TextColor.AQUA)
|
||||
.clickEvent(ClickEvent.suggestCommand("/tool unbind"))
|
||||
.build();
|
||||
|
||||
public static void register(CommandRegistrationHandler registration,
|
||||
CommandManager commandManager,
|
||||
CommandManagerService commandManagerService,
|
||||
@ -148,11 +154,16 @@ static void setToolNone(Player player, LocalSession session, boolean isBrush)
|
||||
}
|
||||
}
|
||||
|
||||
static void sendUnbindInstruction(Player sender, Component commandComponent) {
|
||||
sender.printDebug(TranslatableComponent.of("worldedit.tool.unbind-instruction", commandComponent));
|
||||
}
|
||||
|
||||
private static void setTool(Player player, LocalSession session, Tool tool,
|
||||
String translationKey) throws InvalidToolBindException {
|
||||
BaseItemStack itemStack = player.getItemInHand(HandSide.MAIN_HAND);
|
||||
session.setTool(itemStack.getType(), tool);
|
||||
player.printInfo(TranslatableComponent.of(translationKey, itemStack.getRichName()));
|
||||
sendUnbindInstruction(player, UNBIND_COMMAND_COMPONENT);
|
||||
}
|
||||
|
||||
private final WorldEdit we;
|
||||
|
@ -39,6 +39,7 @@
|
||||
import java.nio.file.Path;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.Locale;
|
||||
import java.util.Properties;
|
||||
import java.util.Set;
|
||||
|
||||
@ -104,7 +105,7 @@ public void load() {
|
||||
logFile = getString("log-file", logFile);
|
||||
logFormat = getString("log-format", logFormat);
|
||||
registerHelp = getBool("register-help", registerHelp);
|
||||
wandItem = getString("wand-item", wandItem);
|
||||
wandItem = getString("wand-item", wandItem).toLowerCase(Locale.ROOT);
|
||||
try {
|
||||
wandItem = LegacyMapper.getInstance().getItemFromLegacy(Integer.parseInt(wandItem)).getId();
|
||||
} catch (Throwable ignored) {
|
||||
@ -114,7 +115,7 @@ public void load() {
|
||||
useInventory = getBool("use-inventory", useInventory);
|
||||
useInventoryOverride = getBool("use-inventory-override", useInventoryOverride);
|
||||
useInventoryCreativeOverride = getBool("use-inventory-creative-override", useInventoryCreativeOverride);
|
||||
navigationWand = getString("nav-wand-item", navigationWand);
|
||||
navigationWand = getString("nav-wand-item", navigationWand).toLowerCase(Locale.ROOT);
|
||||
try {
|
||||
navigationWand = LegacyMapper.getInstance().getItemFromLegacy(Integer.parseInt(navigationWand)).getId();
|
||||
} catch (Throwable ignored) {
|
||||
|
@ -29,6 +29,7 @@
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.HashSet;
|
||||
import java.util.Locale;
|
||||
|
||||
/**
|
||||
* A less simple implementation of {@link LocalConfiguration}
|
||||
@ -54,7 +55,7 @@ public void load() {
|
||||
|
||||
profile = config.getBoolean("debug", profile);
|
||||
traceUnflushedSessions = config.getBoolean("debugging.trace-unflushed-sessions", traceUnflushedSessions);
|
||||
wandItem = convertLegacyItem(config.getString("wand-item", wandItem));
|
||||
wandItem = convertLegacyItem(config.getString("wand-item", wandItem)).toLowerCase(Locale.ROOT);
|
||||
|
||||
defaultChangeLimit = Math.max(-1, config.getInt(
|
||||
"limits.max-blocks-changed.default", defaultChangeLimit));
|
||||
@ -99,7 +100,7 @@ public void load() {
|
||||
useInventoryCreativeOverride = config.getBoolean("use-inventory.creative-mode-overrides",
|
||||
useInventoryCreativeOverride);
|
||||
|
||||
navigationWand = convertLegacyItem(config.getString("navigation-wand.item", navigationWand));
|
||||
navigationWand = convertLegacyItem(config.getString("navigation-wand.item", navigationWand)).toLowerCase(Locale.ROOT);
|
||||
navigationWandMaxDistance = config.getInt("navigation-wand.max-distance", navigationWandMaxDistance);
|
||||
navigationUseGlass = config.getBoolean("navigation.use-glass", navigationUseGlass);
|
||||
|
||||
|
@ -206,7 +206,7 @@ private void loadTranslations(Locale locale) throws IOException {
|
||||
// In dev, reading lang/strings.json from either i18n.zip or the config folder
|
||||
// WILL NOT OCCUR!
|
||||
URL devStrings;
|
||||
if (locale == defaultLocale
|
||||
if (defaultLocale.equals(locale)
|
||||
&& (devStrings = resourceLoader.getRootResource("lang/strings.json")) != null) {
|
||||
try (InputStream in = devStrings.openStream()) {
|
||||
putTranslationData(entries, in);
|
||||
|
@ -231,7 +231,7 @@
|
||||
"worldedit.pumpkins.created": "{0} pumpkin patches created.",
|
||||
"worldedit.pyramid.created": "{0} blocks have been created.",
|
||||
"worldedit.generate.created": "{0} blocks have been created.",
|
||||
"worldedit.generate.changed": "{0} columns affected.",
|
||||
"worldedit.generatebiome.changed": "{0} biomes affected.",
|
||||
|
||||
"worldedit.reload.config": "Configuration reloaded!",
|
||||
"worldedit.report.written": "WorldEdit report written to {0}",
|
||||
@ -291,6 +291,8 @@
|
||||
"worldedit.tool.lrbuild.set": "Left-click set to {0}; right-click set to {1}.",
|
||||
"worldedit.tool.stack.equip": "Stack tool bound to {0}.",
|
||||
|
||||
"worldedit.tool.unbind-instruction": "Run {0} while holding the item to unbind it.",
|
||||
|
||||
"worldedit.tool.superpickaxe.mode.single": "Mode is now single. Left click with a pickaxe. // to disable.",
|
||||
"worldedit.tool.superpickaxe.mode.area": "Mode is now area. Left click with a pickaxe. // to disable.",
|
||||
"worldedit.tool.superpickaxe.mode.recursive": "Mode is now recursive. Left click with a pickaxe. // to disable.",
|
||||
|
@ -33,6 +33,7 @@
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.HashSet;
|
||||
import java.util.Locale;
|
||||
|
||||
public class ConfigurateConfiguration extends LocalConfiguration {
|
||||
|
||||
@ -59,7 +60,7 @@ public void load() {
|
||||
|
||||
profile = node.getNode("debug").getBoolean(profile);
|
||||
traceUnflushedSessions = node.getNode("debugging", "trace-unflushed-sessions").getBoolean(traceUnflushedSessions);
|
||||
wandItem = node.getNode("wand-item").getString(wandItem);
|
||||
wandItem = node.getNode("wand-item").getString(wandItem).toLowerCase(Locale.ROOT);
|
||||
try {
|
||||
wandItem = LegacyMapper.getInstance().getItemFromLegacy(Integer.parseInt(wandItem)).getId();
|
||||
} catch (Throwable ignored) {
|
||||
@ -103,7 +104,7 @@ public void load() {
|
||||
useInventoryOverride = node.getNode("use-inventory", "allow-override").getBoolean(useInventoryOverride);
|
||||
useInventoryCreativeOverride = node.getNode("use-inventory", "creative-mode-overrides").getBoolean(useInventoryCreativeOverride);
|
||||
|
||||
navigationWand = node.getNode("navigation-wand", "item").getString(navigationWand);
|
||||
navigationWand = node.getNode("navigation-wand", "item").getString(navigationWand).toLowerCase(Locale.ROOT);
|
||||
try {
|
||||
navigationWand = LegacyMapper.getInstance().getItemFromLegacy(Integer.parseInt(navigationWand)).getId();
|
||||
} catch (Throwable ignored) {
|
||||
|
Loading…
Reference in New Issue
Block a user