mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2025-06-11 20:13:55 +00:00
Add and apply .editorconfig from P2 (#1195)
* Consistenty use javax annotations. - Unfortunately jetbrains annotations seem to be exposed transitively via core somewhere, but with the correct IDE settings, annotations can be defaulted to javax - Cleaning up of import order in #1195 - Must be merged before #1195 * Add and apply .editorconfig from P2 - Does not rearrange entries * Address some comments * add back some javadoc comments * Address final comments Co-authored-by: NotMyFault <mc.cache@web.de>
This commit is contained in:
@ -1,5 +1,4 @@
|
||||
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
|
||||
import net.minecrell.pluginyml.bukkit.BukkitPluginDescription
|
||||
|
||||
plugins {
|
||||
`java-library`
|
||||
|
@ -5,4 +5,5 @@ package com.sk89q.worldedit.cli;
|
||||
* annoying, if you try to use the CLI as plugin.
|
||||
*/
|
||||
public class AccessPoint {
|
||||
|
||||
}
|
||||
|
@ -30,8 +30,11 @@ public class CLIBlockCategoryRegistry implements BlockCategoryRegistry {
|
||||
|
||||
@Override
|
||||
public Set<BlockType> getCategorisedByName(String category) {
|
||||
return CLIWorldEdit.inst.getFileRegistries().getDataFile().blocktags.getOrDefault(category, Collections.emptyList()).stream()
|
||||
return CLIWorldEdit.inst.getFileRegistries().getDataFile().blocktags
|
||||
.getOrDefault(category, Collections.emptyList())
|
||||
.stream()
|
||||
.map(BlockType.REGISTRY::get)
|
||||
.collect(Collectors.toSet());
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -31,10 +31,10 @@ import com.sk89q.worldedit.util.Direction;
|
||||
import com.sk89q.worldedit.world.block.BlockType;
|
||||
import com.sk89q.worldedit.world.registry.BundledBlockRegistry;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public class CLIBlockRegistry extends BundledBlockRegistry {
|
||||
|
||||
@ -52,7 +52,11 @@ public class CLIBlockRegistry extends BundledBlockRegistry {
|
||||
return new EnumProperty(key, values);
|
||||
}
|
||||
case "direction": {
|
||||
List<Direction> fixedValues = values.stream().map(String::toUpperCase).map(Direction::valueOf).collect(Collectors.toList());
|
||||
List<Direction> fixedValues = values
|
||||
.stream()
|
||||
.map(String::toUpperCase)
|
||||
.map(Direction::valueOf)
|
||||
.collect(Collectors.toList());
|
||||
return new DirectionalProperty(key, fixedValues);
|
||||
}
|
||||
default:
|
||||
@ -69,4 +73,5 @@ public class CLIBlockRegistry extends BundledBlockRegistry {
|
||||
(key, value) -> createProperty(value.type, key, value.values);
|
||||
return ImmutableMap.copyOf(Maps.transformEntries(properties, entryTransform));
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -29,6 +29,7 @@ import com.sk89q.worldedit.util.formatting.WorldEditText;
|
||||
import com.sk89q.worldedit.util.formatting.text.Component;
|
||||
import com.sk89q.worldedit.util.formatting.text.serializer.plain.PlainComponentSerializer;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
@ -188,4 +189,5 @@ public class CLICommandSender implements Actor {
|
||||
public Map<String, Object> getRawMeta() {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -37,4 +37,5 @@ public class CLIConfiguration extends PropertiesConfiguration {
|
||||
public Path getWorkingDirectoryPath() {
|
||||
return CLIWorldEdit.inst.getWorkingDir();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -33,6 +33,7 @@ import java.util.concurrent.ExecutionException;
|
||||
|
||||
@CommandContainer
|
||||
public class CLIExtraCommands {
|
||||
|
||||
@Command(
|
||||
name = "selectworld",
|
||||
desc = "Select the entire world"
|
||||
@ -59,4 +60,5 @@ public class CLIExtraCommands {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -33,4 +33,5 @@ public class CLIItemCategoryRegistry implements ItemCategoryRegistry {
|
||||
.map(ItemType.REGISTRY::get)
|
||||
.collect(Collectors.toSet());
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -34,6 +34,7 @@ import com.sk89q.worldedit.world.registry.Registries;
|
||||
import org.enginehub.piston.CommandManager;
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.EnumMap;
|
||||
import java.util.List;
|
||||
@ -41,7 +42,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 {
|
||||
|
||||
@ -171,4 +171,5 @@ class CLIPlatform extends AbstractPlatform {
|
||||
public void addWorld(World world) {
|
||||
worlds.add(world);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -41,4 +41,5 @@ public interface CLIWorld {
|
||||
* @param dirty if dirty
|
||||
*/
|
||||
void setDirty(boolean dirty);
|
||||
|
||||
}
|
||||
|
@ -301,7 +301,10 @@ public class CLIWorldEdit {
|
||||
String fileArg = cmd.getOptionValue('f');
|
||||
File file;
|
||||
if (fileArg == null) {
|
||||
String[] formats = Arrays.copyOf(ClipboardFormats.getFileExtensionArray(), ClipboardFormats.getFileExtensionArray().length + 1);
|
||||
String[] formats = Arrays.copyOf(
|
||||
ClipboardFormats.getFileExtensionArray(),
|
||||
ClipboardFormats.getFileExtensionArray().length + 1
|
||||
);
|
||||
formats[formats.length - 1] = "dat";
|
||||
file = app.commandSender.openFileOpenDialog(formats);
|
||||
} else {
|
||||
@ -322,7 +325,8 @@ public class CLIWorldEdit {
|
||||
Files.newInputStream(file.toPath(), StandardOpenOption.READ)
|
||||
)) {
|
||||
dataVersion = dataVersionReader.getDataVersion()
|
||||
.orElseThrow(() -> new IllegalArgumentException("Failed to obtain data version from schematic."));
|
||||
.orElseThrow(() -> new IllegalArgumentException(
|
||||
"Failed to obtain data version from schematic."));
|
||||
}
|
||||
} else {
|
||||
dataVersion = Constants.DATA_VERSION_MC_1_13_2;
|
||||
@ -330,7 +334,10 @@ public class CLIWorldEdit {
|
||||
app.platform.setDataVersion(dataVersion);
|
||||
app.onStarted();
|
||||
ClipboardWorld world;
|
||||
try (ClipboardReader clipboardReader = format.getReader(Files.newInputStream(file.toPath(), StandardOpenOption.READ))) {
|
||||
try (ClipboardReader clipboardReader = format.getReader(Files.newInputStream(
|
||||
file.toPath(),
|
||||
StandardOpenOption.READ
|
||||
))) {
|
||||
world = new ClipboardWorld(
|
||||
file,
|
||||
clipboardReader.read(),
|
||||
@ -372,4 +379,5 @@ public class CLIWorldEdit {
|
||||
|
||||
System.exit(exitCode);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -45,12 +45,17 @@ public class FileRegistries {
|
||||
}
|
||||
|
||||
public void loadDataFiles() {
|
||||
ResourceLoader resourceLoader = WorldEdit.getInstance().getPlatformManager().queryCapability(Capability.CONFIGURATION).getResourceLoader();
|
||||
ResourceLoader resourceLoader = WorldEdit
|
||||
.getInstance()
|
||||
.getPlatformManager()
|
||||
.queryCapability(Capability.CONFIGURATION)
|
||||
.getResourceLoader();
|
||||
try {
|
||||
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.");
|
||||
throw new RuntimeException(
|
||||
"The provided file is not compatible with this version of WorldEdit-CLI. Please update or report this.");
|
||||
}
|
||||
}
|
||||
|
||||
@ -59,16 +64,21 @@ public class FileRegistries {
|
||||
}
|
||||
|
||||
public static class BlockManifest {
|
||||
|
||||
public String defaultstate;
|
||||
public Map<String, BlockProperty> properties;
|
||||
|
||||
}
|
||||
|
||||
public static class BlockProperty {
|
||||
|
||||
public List<String> values;
|
||||
public String type;
|
||||
|
||||
}
|
||||
|
||||
public static class DataFile {
|
||||
|
||||
public Map<String, List<String>> itemtags;
|
||||
public Map<String, List<String>> blocktags;
|
||||
public Map<String, List<String>> entitytags;
|
||||
@ -76,5 +86,7 @@ public class FileRegistries {
|
||||
public List<String> entities;
|
||||
public List<String> biomes;
|
||||
public Map<String, BlockManifest> blocks;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -49,13 +49,13 @@ import com.sk89q.worldedit.world.block.BaseBlock;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
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 {
|
||||
|
||||
@ -97,13 +97,15 @@ public class ClipboardWorld extends AbstractWorld implements Clipboard, CLIWorld
|
||||
}
|
||||
|
||||
@Override
|
||||
public <B extends BlockStateHolder<B>> boolean setBlock(BlockVector3 position, B block, SideEffectSet sideEffects) throws WorldEditException {
|
||||
public <B extends BlockStateHolder<B>> boolean setBlock(BlockVector3 position, B block, SideEffectSet sideEffects) throws
|
||||
WorldEditException {
|
||||
dirty = true;
|
||||
return clipboard.setBlock(position, block);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<SideEffect> applySideEffects(BlockVector3 position, BlockState previousType, SideEffectSet sideEffectSet) throws WorldEditException {
|
||||
public Set<SideEffect> applySideEffects(BlockVector3 position, BlockState previousType, SideEffectSet sideEffectSet) throws
|
||||
WorldEditException {
|
||||
return ImmutableSet.of();
|
||||
}
|
||||
|
||||
@ -251,4 +253,5 @@ public class ClipboardWorld extends AbstractWorld implements Clipboard, CLIWorld
|
||||
public void setDirty(boolean dirty) {
|
||||
this.dirty = dirty;
|
||||
}
|
||||
|
||||
}
|
||||
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -2,13 +2,13 @@
|
||||
<Configuration status="WARN" packages="com.sk89q,org.enginehub">
|
||||
<Appenders>
|
||||
<Console name="SysOut" target="SYSTEM_OUT">
|
||||
<PatternLayout pattern="[%d{HH:mm:ss}] [%t/%level]: %msg%n" />
|
||||
<PatternLayout pattern="[%d{HH:mm:ss}] [%t/%level]: %msg%n"/>
|
||||
</Console>
|
||||
<RollingRandomAccessFile name="File" fileName="logs/latest.log" filePattern="logs/%d{yyyy-MM-dd}-%i.log.gz">
|
||||
<PatternLayout pattern="[%d{HH:mm:ss}] [%t/%level]: %msg%n" />
|
||||
<PatternLayout pattern="[%d{HH:mm:ss}] [%t/%level]: %msg%n"/>
|
||||
<Policies>
|
||||
<TimeBasedTriggeringPolicy />
|
||||
<OnStartupTriggeringPolicy />
|
||||
<TimeBasedTriggeringPolicy/>
|
||||
<OnStartupTriggeringPolicy/>
|
||||
</Policies>
|
||||
</RollingRandomAccessFile>
|
||||
</Appenders>
|
||||
|
Reference in New Issue
Block a user