3
0
Mirror von https://github.com/IntellectualSites/FastAsyncWorldEdit.git synchronisiert 2024-12-25 18:40:05 +01:00
Fixes #566
Dieser Commit ist enthalten in:
NotMyFault 2021-03-26 14:24:26 +01:00
Ursprung c689b4e5d2
Commit 2ffb7316a4
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 158F5701A6AAD00C
13 geänderte Dateien mit 102 neuen und 49 gelöschten Zeilen

Datei anzeigen

@ -2,7 +2,7 @@ rootProject.name = "FastAsyncWorldEdit"
include("worldedit-libs")
listOf("bukkit", "core").forEach {
listOf("bukkit", "core", "cli").forEach {
include("worldedit-libs:$it")
include("worldedit-$it")
}

Datei anzeigen

@ -34,7 +34,6 @@ import com.sk89q.worldedit.world.registry.BundledBlockRegistry;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import javax.annotation.Nullable;
public class CLIBlockRegistry extends BundledBlockRegistry {
@ -66,8 +65,8 @@ public class CLIBlockRegistry extends BundledBlockRegistry {
public Map<String, ? extends Property<?>> getProperties(BlockType blockType) {
Map<String, FileRegistries.BlockProperty> properties =
CLIWorldEdit.inst.getFileRegistries().getDataFile().blocks.get(blockType.getId()).properties;
return ImmutableMap.copyOf(Maps.transformEntries(properties,
(Maps.EntryTransformer<String, FileRegistries.BlockProperty, Property<?>>)
(key, value) -> createProperty(value.type, key, value.values)));
Maps.EntryTransformer<String, FileRegistries.BlockProperty, Property<?>> entryTransform =
(key, value) -> createProperty(value.type, key, value.values);
return ImmutableMap.copyOf(Maps.transformEntries(properties, entryTransform));
}
}

Datei anzeigen

@ -19,8 +19,6 @@
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;
@ -34,8 +32,11 @@ import org.slf4j.Logger;
import java.io.File;
import java.util.Locale;
import java.util.Map;
import java.util.UUID;
import static com.google.common.base.Preconditions.checkNotNull;
public class CLICommandSender implements Actor {
/**
@ -65,6 +66,7 @@ public class CLICommandSender implements Actor {
}
@Override
@Deprecated
public void printRaw(String msg) {
for (String part : msg.split("\n")) {
sender.info(part);
@ -77,6 +79,7 @@ public class CLICommandSender implements Actor {
private static final String ANSI_RESET = "\u001B[0m";
@Override
@Deprecated
public void print(String msg) {
for (String part : msg.split("\n")) {
sender.info(ANSI_PURPLE + part + ANSI_RESET);
@ -84,6 +87,7 @@ public class CLICommandSender implements Actor {
}
@Override
@Deprecated
public void printDebug(String msg) {
for (String part : msg.split("\n")) {
sender.debug(ANSI_GREEN + part + ANSI_RESET);
@ -91,6 +95,7 @@ public class CLICommandSender implements Actor {
}
@Override
@Deprecated
public void printError(String msg) {
for (String part : msg.split("\n")) {
sender.error(ANSI_RED + part + ANSI_RESET);
@ -117,6 +122,11 @@ public class CLICommandSender implements Actor {
return true;
}
@Override
public void setPermission(String permission, boolean value) {
}
@Override
public void checkPermission(String permission) throws AuthorizationException {
}
@ -140,6 +150,11 @@ public class CLICommandSender implements Actor {
public void dispatchCUIEvent(CUIEvent event) {
}
@Override
public boolean runAction(Runnable ifFree, boolean checkFree, boolean async) {
return false;
}
@Override
public Locale getLocale() {
return WorldEdit.getInstance().getConfiguration().defaultLocale;
@ -169,4 +184,9 @@ public class CLICommandSender implements Actor {
}
};
}
@Override
public Map<String, Object> getRawMeta() {
return null;
}
}

Datei anzeigen

@ -21,12 +21,12 @@ package com.sk89q.worldedit.cli;
import com.sk89q.worldedit.util.PropertiesConfiguration;
import java.io.File;
import java.nio.file.Path;
public class CLIConfiguration extends PropertiesConfiguration {
public CLIConfiguration(CLIWorldEdit app) {
super(app.getWorkingDir().resolve("worldedit.properties").toFile());
super(app.getWorkingDir().resolve("worldedit.properties"));
}
@Override
@ -34,7 +34,7 @@ public class CLIConfiguration extends PropertiesConfiguration {
}
@Override
public File getWorkingDirectory() {
return CLIWorldEdit.inst.getWorkingDir().toFile();
public Path getWorkingDirectoryPath() {
return CLIWorldEdit.inst.getWorkingDir();
}
}

Datei anzeigen

@ -38,7 +38,6 @@ import java.util.Map;
import java.util.Set;
import java.util.Timer;
import java.util.TimerTask;
import javax.annotation.Nullable;
class CLIPlatform extends AbstractPlatform {
@ -145,13 +144,6 @@ class CLIPlatform extends AbstractPlatform {
return app.getInternalVersion();
}
// FAWE start
@Override
public String getId() {
return "intellectualsites:cli";
}
// FAWE end
@Override
public Map<Capability, Preference> getCapabilities() {
Map<Capability, Preference> capabilities = new EnumMap<>(Capability.class);

Datei anzeigen

@ -36,7 +36,7 @@ public interface CLIWorld {
boolean isDirty();
/**
* Set the world's dirty status
* Set the world's dirty status.
*
* @param dirty if dirty
*/

Datei anzeigen

@ -86,6 +86,7 @@ public class CLIWorldEdit {
private void setupPlatform() {
WorldEdit.getInstance().getPlatformManager().register(platform);
this.fileRegistries = new FileRegistries(this);
this.fileRegistries.loadDataFiles();
}
@ -95,27 +96,27 @@ public class CLIWorldEdit {
for (Map.Entry<String, FileRegistries.BlockManifest> manifestEntry : fileRegistries.getDataFile().blocks.entrySet()) {
if (BlockType.REGISTRY.get(manifestEntry.getKey()) == null) {
BlockType.REGISTRY.register(manifestEntry.getKey(), new BlockType(manifestEntry.getKey(), input -> {
ParserContext context = new ParserContext();
context.setPreferringWildcard(true);
context.setTryLegacy(false);
context.setRestricted(false);
try {
FuzzyBlockState state = (FuzzyBlockState) WorldEdit.getInstance().getBlockFactory().parseFromInput(
manifestEntry.getValue().defaultstate,
context
).toImmutableState();
BlockState defaultState = input.getBlockType().getAllStates().get(0);
for (Map.Entry<Property<?>, Object> propertyObjectEntry : state.getStates().entrySet()) {
@SuppressWarnings("unchecked")
Property<Object> prop = (Property<Object>) propertyObjectEntry.getKey();
defaultState = defaultState.with(prop, propertyObjectEntry.getValue());
}
return defaultState;
} catch (InputParseException e) {
LOGGER.warn("Error loading block state for " + manifestEntry.getKey(), e);
return input;
}
}));
ParserContext context = new ParserContext();
context.setPreferringWildcard(true);
context.setTryLegacy(false);
context.setRestricted(false);
try {
FuzzyBlockState state = (FuzzyBlockState) WorldEdit.getInstance().getBlockFactory().parseFromInput(
manifestEntry.getValue().defaultstate,
context
).toImmutableState();
BlockState defaultState = input.getBlockType().getAllStates().get(0);
for (Map.Entry<Property<?>, Object> propertyObjectEntry : state.getStates().entrySet()) {
@SuppressWarnings("unchecked")
Property<Object> prop = (Property<Object>) propertyObjectEntry.getKey();
defaultState = defaultState.with(prop, propertyObjectEntry.getValue());
}
return defaultState;
} catch (InputParseException e) {
LOGGER.warn("Error loading block state for " + manifestEntry.getKey(), e);
return input;
}
}));
}
}
// Items

Datei anzeigen

@ -22,7 +22,9 @@ package com.sk89q.worldedit.cli.data;
import com.google.common.io.Resources;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.sk89q.worldedit.WorldEdit;
import com.sk89q.worldedit.cli.CLIWorldEdit;
import com.sk89q.worldedit.extension.platform.Capability;
import com.sk89q.worldedit.util.io.ResourceLoader;
import java.io.IOException;
@ -33,8 +35,8 @@ import java.util.Map;
public class FileRegistries {
private CLIWorldEdit app;
private Gson gson = new GsonBuilder().create();
private final CLIWorldEdit app;
private final Gson gson = new GsonBuilder().create();
private DataFile dataFile;
@ -43,8 +45,9 @@ public class FileRegistries {
}
public void loadDataFiles() {
ResourceLoader resourceLoader = WorldEdit.getInstance().getPlatformManager().queryCapability(Capability.CONFIGURATION).getResourceLoader();
try {
URL url = ResourceLoader.getResource(FileRegistries.class, app.getPlatform().getDataVersion() + ".json");
URL url = resourceLoader.getResource(FileRegistries.class, app.getPlatform().getDataVersion() + ".json");
this.dataFile = gson.fromJson(Resources.toString(url, StandardCharsets.UTF_8), DataFile.class);
} catch (IOException e) {
throw new RuntimeException("The provided file is not compatible with this version of WorldEdit-CLI. Please update or report this.");

Datei anzeigen

@ -19,7 +19,10 @@
package com.sk89q.worldedit.cli.schematic;
import com.boydti.fawe.beta.IChunkGet;
import com.boydti.fawe.beta.implementation.packet.ChunkPacket;
import com.google.common.collect.ImmutableSet;
import com.sk89q.jnbt.CompoundTag;
import com.sk89q.worldedit.EditSession;
import com.sk89q.worldedit.MaxChangedBlocksException;
import com.sk89q.worldedit.WorldEditException;
@ -27,10 +30,11 @@ import com.sk89q.worldedit.blocks.BaseItemStack;
import com.sk89q.worldedit.cli.CLIWorld;
import com.sk89q.worldedit.entity.BaseEntity;
import com.sk89q.worldedit.entity.Entity;
import com.sk89q.worldedit.entity.Player;
import com.sk89q.worldedit.extent.Extent;
import com.sk89q.worldedit.extent.clipboard.Clipboard;
import com.sk89q.worldedit.extent.clipboard.io.ClipboardFormats;
import com.sk89q.worldedit.extent.clipboard.io.ClipboardWriter;
import com.sk89q.worldedit.math.BlockVector2;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.math.Vector3;
import com.sk89q.worldedit.regions.Region;
@ -39,6 +43,7 @@ import com.sk89q.worldedit.util.SideEffect;
import com.sk89q.worldedit.util.SideEffectSet;
import com.sk89q.worldedit.util.TreeGenerator;
import com.sk89q.worldedit.world.AbstractWorld;
import com.sk89q.worldedit.world.RegenOptions;
import com.sk89q.worldedit.world.biome.BiomeType;
import com.sk89q.worldedit.world.block.BaseBlock;
import com.sk89q.worldedit.world.block.BlockState;
@ -50,7 +55,6 @@ import java.io.IOException;
import java.util.List;
import java.util.Locale;
import java.util.Set;
import javax.annotation.Nullable;
public class ClipboardWorld extends AbstractWorld implements Clipboard, CLIWorld {
@ -77,6 +81,21 @@ public class ClipboardWorld extends AbstractWorld implements Clipboard, CLIWorld
return getName().replace(" ", "_").toLowerCase(Locale.ROOT);
}
@Override
public void refreshChunk(int chunkX, int chunkZ) {
}
@Override
public IChunkGet get(int x, int z) {
return null;
}
@Override
public void sendFakeChunk(@org.jetbrains.annotations.Nullable Player player, ChunkPacket packet) {
}
@Override
public <B extends BlockStateHolder<B>> boolean setBlock(BlockVector3 position, B block, SideEffectSet sideEffects) throws WorldEditException {
dirty = true;
@ -107,7 +126,7 @@ public class ClipboardWorld extends AbstractWorld implements Clipboard, CLIWorld
}
@Override
public boolean regenerate(Region region, EditSession editSession) {
public boolean regenerate(Region region, Extent extent, RegenOptions options) {
return false;
}
@ -150,16 +169,26 @@ public class ClipboardWorld extends AbstractWorld implements Clipboard, CLIWorld
}
@Override
public BiomeType getBiome(BlockVector2 position) {
public BiomeType getBiome(BlockVector3 position) {
return clipboard.getBiome(position);
}
@Override
public boolean setBiome(BlockVector2 position, BiomeType biome) {
public boolean setTile(int x, int y, int z, CompoundTag tile) throws WorldEditException {
return false;
}
@Override
public boolean setBiome(BlockVector3 position, BiomeType biome) {
dirty = true;
return clipboard.setBiome(position, biome);
}
@Override
public void flush() {
}
@Override
public Region getRegion() {
return clipboard.getRegion();
@ -186,6 +215,11 @@ public class ClipboardWorld extends AbstractWorld implements Clipboard, CLIWorld
return clipboard.hasBiomes();
}
@Override
public void removeEntity(Entity entity) {
}
@Override
public BlockVector3 getMaximumPoint() {
return clipboard.getMaximumPoint();

Dateidiff unterdrückt, weil mindestens eine Zeile zu lang ist

Dateidiff unterdrückt, weil mindestens eine Zeile zu lang ist

Dateidiff unterdrückt, weil mindestens eine Zeile zu lang ist

Dateidiff unterdrückt, weil mindestens eine Zeile zu lang ist