Shrinks the jar size since we no longer must bundle the Kotlin library. The downside is that some classes grew in size compared to their Kotlin versions.
Many contributors didn't care for Kotlin either.
Dieser Commit ist enthalten in:
Matt 2020-09-17 16:31:55 -04:00 committet von GitHub
Ursprung 4f6c904615
Commit 2e73746abe
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 4AEE18F83AFDEB23
22 geänderte Dateien mit 487 neuen und 414 gelöschten Zeilen

Datei anzeigen

@ -2,12 +2,10 @@ import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
import org.gradle.api.JavaVersion import org.gradle.api.JavaVersion
import org.gradle.api.Project import org.gradle.api.Project
import org.gradle.api.plugins.JavaPluginConvention import org.gradle.api.plugins.JavaPluginConvention
import org.gradle.api.plugins.quality.CheckstyleExtension
import org.gradle.api.tasks.bundling.Jar import org.gradle.api.tasks.bundling.Jar
import org.gradle.api.tasks.compile.JavaCompile import org.gradle.api.tasks.compile.JavaCompile
import org.gradle.api.tasks.javadoc.Javadoc import org.gradle.api.tasks.javadoc.Javadoc
import org.gradle.api.tasks.testing.Test import org.gradle.api.tasks.testing.Test
import org.gradle.external.javadoc.CoreJavadocOptions
import org.gradle.external.javadoc.StandardJavadocDocletOptions import org.gradle.external.javadoc.StandardJavadocDocletOptions
import org.gradle.kotlin.dsl.apply import org.gradle.kotlin.dsl.apply
import org.gradle.kotlin.dsl.configure import org.gradle.kotlin.dsl.configure
@ -55,7 +53,7 @@ fun Project.applyPlatformAndCoreConfiguration() {
} }
dependencies { dependencies {
"compileOnly"("org.jetbrains:annotations:19.0.0") "compileOnly"("org.jetbrains:annotations:20.1.0")
"testImplementation"("org.junit.jupiter:junit-jupiter-api:${Versions.JUNIT}") "testImplementation"("org.junit.jupiter:junit-jupiter-api:${Versions.JUNIT}")
"testImplementation"("org.junit.jupiter:junit-jupiter-params:${Versions.JUNIT}") "testImplementation"("org.junit.jupiter:junit-jupiter-params:${Versions.JUNIT}")
"testImplementation"("org.mockito:mockito-core:${Versions.MOCKITO}") "testImplementation"("org.mockito:mockito-core:${Versions.MOCKITO}")

Datei anzeigen

@ -46,7 +46,8 @@ dependencies {
exclude("junit", "junit") exclude("junit", "junit")
isTransitive = false isTransitive = false
} }
"compileOnly"("org.jetbrains:annotations:20.0.0") "compileOnly"("org.jetbrains:annotations:20.1.0")
"testCompileOnly"("org.jetbrains:annotations:20.1.0")
"compileOnly"("org.spigotmc:spigot:1.16.2-R0.1-SNAPSHOT") "compileOnly"("org.spigotmc:spigot:1.16.2-R0.1-SNAPSHOT")
"implementation"("io.papermc:paperlib:1.0.4") "implementation"("io.papermc:paperlib:1.0.4")
"compileOnly"("com.sk89q:dummypermscompat:1.10") { "compileOnly"("com.sk89q:dummypermscompat:1.10") {

Datei anzeigen

@ -2,7 +2,6 @@ import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
import com.mendhak.gradlecrowdin.DownloadTranslationsTask import com.mendhak.gradlecrowdin.DownloadTranslationsTask
import com.mendhak.gradlecrowdin.UploadSourceFileTask import com.mendhak.gradlecrowdin.UploadSourceFileTask
import org.gradle.plugins.ide.idea.model.IdeaModel import org.gradle.plugins.ide.idea.model.IdeaModel
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins { plugins {
id("java-library") id("java-library")
@ -10,7 +9,6 @@ plugins {
id("net.ltgt.apt-idea") id("net.ltgt.apt-idea")
id("antlr") id("antlr")
id("com.mendhak.gradlecrowdin") id("com.mendhak.gradlecrowdin")
kotlin("jvm") version "1.4.0"
} }
repositories { repositories {
@ -61,7 +59,6 @@ dependencies {
"compile"("com.plotsquared:PlotSquared-Core:5.12.2") { "compile"("com.plotsquared:PlotSquared-Core:5.12.2") {
isTransitive = false isTransitive = false
} }
implementation(kotlin("stdlib-jdk8", "1.4.0"))
} }
tasks.named<Test>("test") { tasks.named<Test>("test") {
@ -148,11 +145,3 @@ if (project.hasProperty(crowdinApiKey) && !gradle.startParameter.isOffline) {
dependsOn("crowdinDownload") dependsOn("crowdinDownload")
} }
} }
val compileKotlin: KotlinCompile by tasks
compileKotlin.kotlinOptions {
jvmTarget = "1.8"
}
val compileTestKotlin: KotlinCompile by tasks
compileTestKotlin.kotlinOptions {
jvmTarget = "1.8"
}

Datei anzeigen

@ -125,7 +125,7 @@ public interface IBatchProcessor {
*/ */
default <T extends IBatchProcessor> IBatchProcessor remove(Class<T> clazz) { default <T extends IBatchProcessor> IBatchProcessor remove(Class<T> clazz) {
if (clazz.isInstance(this)) { if (clazz.isInstance(this)) {
return EmptyBatchProcessor.INSTANCE; return EmptyBatchProcessor.getInstance();
} }
return this; return this;
} }

Datei anzeigen

@ -0,0 +1,109 @@
package com.boydti.fawe.beta.implementation.blocks;
import com.boydti.fawe.FaweCache;
import com.boydti.fawe.beta.IBlocks;
import com.boydti.fawe.beta.IChunkGet;
import com.boydti.fawe.beta.IChunkSet;
import com.boydti.fawe.beta.implementation.lighting.HeightMapType;
import com.sk89q.jnbt.CompoundTag;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.world.biome.BiomeType;
import com.sk89q.worldedit.world.biome.BiomeTypes;
import com.sk89q.worldedit.world.block.BaseBlock;
import com.sk89q.worldedit.world.block.BlockState;
import com.sk89q.worldedit.world.block.BlockTypes;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.Collections;
import java.util.Map;
import java.util.Set;
import java.util.UUID;
import java.util.concurrent.Future;
public final class NullChunkGet implements IChunkGet {
private static final NullChunkGet instance = new NullChunkGet();
public static NullChunkGet getInstance() {
return instance;
}
@NotNull
public BaseBlock getFullBlock(int x, int y, int z) {
return BlockTypes.AIR.getDefaultState().toBaseBlock();
}
@Nullable
public BiomeType getBiomeType(int x, int y, int z) {
return BiomeTypes.FOREST;
}
@NotNull
public BlockState getBlock(int x, int y, int z) {
return BlockTypes.AIR.getDefaultState();
}
@NotNull
public Map<BlockVector3, CompoundTag> getTiles() {
return Collections.emptyMap();
}
@Nullable
public CompoundTag getTile(int x, int y, int z) {
return null;
}
@Nullable
public Set<CompoundTag> getEntities() {
return null;
}
@Nullable
public CompoundTag getEntity(@NotNull UUID uuid) {
return null;
}
public boolean trim(boolean aggressive) {
return true;
}
public boolean trim(boolean aggressive, int layer) {
return true;
}
@Nullable
public <T extends Future<T>> T call(@NotNull IChunkSet set, @NotNull Runnable finalize) {
return null;
}
@NotNull
public char[] load(int layer) {
return FaweCache.IMP.EMPTY_CHAR_4096;
}
public boolean hasSection(int layer) {
return false;
}
public int getEmmittedLight(int x, int y, int z) {
return 15;
}
public int getSkyLight(int x, int y, int z) {
return 15;
}
@NotNull
public int[] getHeightMap(@Nullable HeightMapType type) {
return new int[256];
}
@Nullable
public IBlocks reset() {
return null;
}
private NullChunkGet() {
}
}

Datei anzeigen

@ -1,83 +0,0 @@
package com.boydti.fawe.beta.implementation.blocks
import com.boydti.fawe.FaweCache
import com.boydti.fawe.beta.IBlocks
import com.boydti.fawe.beta.IChunkGet
import com.boydti.fawe.beta.IChunkSet
import com.boydti.fawe.beta.implementation.lighting.HeightMapType
import com.sk89q.jnbt.CompoundTag
import com.sk89q.worldedit.math.BlockVector3
import com.sk89q.worldedit.world.biome.BiomeType
import com.sk89q.worldedit.world.biome.BiomeTypes
import com.sk89q.worldedit.world.block.BaseBlock
import com.sk89q.worldedit.world.block.BlockState
import com.sk89q.worldedit.world.block.BlockTypes
import java.util.*
import java.util.concurrent.Future
object NullChunkGet : IChunkGet {
override fun getFullBlock(x: Int, y: Int, z: Int): BaseBlock {
return BlockTypes.AIR!!.defaultState.toBaseBlock()
}
override fun getBiomeType(x: Int, y: Int, z: Int): BiomeType? {
return BiomeTypes.FOREST
}
override fun getBlock(x: Int, y: Int, z: Int): BlockState {
return BlockTypes.AIR!!.defaultState
}
override fun getTiles(): Map<BlockVector3, CompoundTag> {
return emptyMap()
}
override fun getTile(x: Int, y: Int, z: Int): CompoundTag? {
return null
}
override fun getEntities(): Set<CompoundTag>? {
return null
}
override fun getEntity(uuid: UUID): CompoundTag? {
return null
}
override fun trim(aggressive: Boolean): Boolean {
return true
}
override fun trim(aggressive: Boolean, layer: Int): Boolean {
return true
}
override fun <T : Future<T>> call(set: IChunkSet, finalize: Runnable): T? {
return null
}
override fun load(layer: Int): CharArray {
return FaweCache.IMP.EMPTY_CHAR_4096
}
override fun hasSection(layer: Int): Boolean {
return false
}
override fun getEmmittedLight(x: Int, y: Int, z: Int): Int {
return 15
}
override fun getSkyLight(x: Int, y: Int, z: Int): Int {
return 15
}
override fun getHeightMap(type: HeightMapType?): IntArray {
return IntArray(256)
}
override fun reset(): IBlocks? {
return null
}
}

Datei anzeigen

@ -0,0 +1,189 @@
package com.boydti.fawe.beta.implementation.chunk;
import com.boydti.fawe.beta.Filter;
import com.boydti.fawe.beta.IChunkSet;
import com.boydti.fawe.beta.IQueueChunk;
import com.boydti.fawe.beta.implementation.filter.block.ChunkFilterBlock;
import com.boydti.fawe.beta.implementation.lighting.HeightMapType;
import com.sk89q.jnbt.CompoundTag;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.regions.Region;
import com.sk89q.worldedit.world.biome.BiomeType;
import com.sk89q.worldedit.world.block.BaseBlock;
import com.sk89q.worldedit.world.block.BlockState;
import com.sk89q.worldedit.world.block.BlockStateHolder;
import com.sk89q.worldedit.world.block.BlockTypes;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.Collections;
import java.util.Map;
import java.util.Set;
import java.util.UUID;
import java.util.concurrent.Future;
public final class NullChunk implements IQueueChunk {
private static final NullChunk instance = new NullChunk();
public static NullChunk getInstance() {
return instance;
}
public int getX() {
return 0;
}
public int getZ() {
return 0;
}
public boolean isEmpty() {
return true;
}
public Future call() {
return null;
}
public void filterBlocks(@NotNull Filter filter, @NotNull ChunkFilterBlock block, @Nullable Region region, boolean full) {
}
public boolean setBiome(int x, int y, int z, @NotNull BiomeType biome) {
return false;
}
public boolean setTile(int x, int y, int z, @NotNull CompoundTag tag) {
return false;
}
public void setEntity(@NotNull CompoundTag tag) {
}
public void removeEntity(@NotNull UUID uuid) {
}
@Nullable
public Set<UUID> getEntityRemoves() {
return null;
}
public int getSkyLight(int x, int y, int z) {
return 15;
}
@NotNull
public char[][] getLight() {
return new char[0][];
}
@NotNull
public char[][] getSkyLight() {
return new char[0][];
}
@NotNull
public int[] getHeightMap(@Nullable HeightMapType type) {
return new int[256];
}
public int getEmmittedLight(int x, int y, int z) {
return 15;
}
public void setSkyLight(int x, int y, int z, int value) {
}
public void setHeightMap(@Nullable HeightMapType type, @Nullable int[] heightMap) {
}
public boolean fullySupports3DBiomes() {
return false;
}
public void setBlockLight(int x, int y, int z, int value) {
}
public void setFullBright(int layer) {
}
public void removeSectionLighting(int layer, boolean sky) {
}
public void setSkyLightLayer(int layer, @Nullable char[] toSet) {
}
public void setLightLayer(int layer, @Nullable char[] toSet) {
}
@Nullable
public BiomeType[] getBiomes() {
return null;
}
public <T extends BlockStateHolder<T>> boolean setBlock(int x, int y, int z, T holder) {
return false;
}
public void setBlocks(int layer, @NotNull char[] data) {
}
@Nullable
public BiomeType getBiomeType(int x, int y, int z) {
return null;
}
public boolean hasSection(int layer) {
return false;
}
@NotNull
public BlockState getBlock(int x, int y, int z) {
return BlockTypes.__RESERVED__.getDefaultState();
}
@NotNull
public BaseBlock getFullBlock(int x, int y, int z) {
return BlockTypes.__RESERVED__.getDefaultState().toBaseBlock();
}
@NotNull
public Map<BlockVector3, CompoundTag> getTiles() {
return Collections.emptyMap();
}
@Nullable
public CompoundTag getTile(int x, int y, int z) {
return null;
}
@NotNull
public Set<CompoundTag> getEntities() {
return Collections.emptySet();
}
@Nullable
public char[] load(int layer) {
return null;
}
@Nullable
public CompoundTag getEntity(@NotNull UUID uuid) {
return null;
}
@Nullable
public <T extends Future<T>> T call(@Nullable IChunkSet set, @Nullable Runnable finalize) {
return null;
}
public boolean trim(boolean aggressive) {
return true;
}
public boolean trim(boolean aggressive, int layer) {
return true;
}
private NullChunk() {
}
}

Datei anzeigen

@ -1,178 +0,0 @@
package com.boydti.fawe.beta.implementation.chunk
import com.boydti.fawe.beta.Filter
import com.boydti.fawe.beta.IChunkSet
import com.boydti.fawe.beta.IQueueChunk
import com.boydti.fawe.beta.implementation.filter.block.ChunkFilterBlock
import com.boydti.fawe.beta.implementation.lighting.HeightMapType
import com.sk89q.jnbt.CompoundTag
import com.sk89q.worldedit.math.BlockVector3
import com.sk89q.worldedit.regions.Region
import com.sk89q.worldedit.world.biome.BiomeType
import com.sk89q.worldedit.world.block.BaseBlock
import com.sk89q.worldedit.world.block.BlockState
import com.sk89q.worldedit.world.block.BlockStateHolder
import com.sk89q.worldedit.world.block.BlockTypes
import java.util.*
import java.util.concurrent.Future
object NullChunk : IQueueChunk<Nothing> {
override fun getX(): Int {
return 0
}
override fun getZ(): Int {
return 0
}
override fun isEmpty(): Boolean {
return true
}
override fun call(): Nothing? {
return null
}
override fun filterBlocks(filter: Filter, block: ChunkFilterBlock, region: Region?, full: Boolean) {
}
// @Override
// public void flood(Flood flood, FilterBlockMask mask, ChunkFilterBlock block) {
//
// }
override fun setBiome(x: Int, y: Int, z: Int, biome: BiomeType): Boolean {
return false
}
override fun setTile(x: Int, y: Int, z: Int, tag: CompoundTag): Boolean {
return false
}
override fun setEntity(tag: CompoundTag) {
}
override fun removeEntity(uuid: UUID) {
}
override fun getEntityRemoves(): Set<UUID>? {
return null
}
override fun getSkyLight(x: Int, y: Int, z: Int): Int {
return 15
}
override fun getLight(): Array<CharArray> {
return emptyArray()
}
override fun getSkyLight(): Array<CharArray> {
return emptyArray()
}
override fun getHeightMap(type: HeightMapType?): IntArray {
return IntArray(256)
}
override fun getEmmittedLight(x: Int, y: Int, z: Int): Int {
return 15
}
override fun setSkyLight(x: Int, y: Int, z: Int, value: Int) {
}
override fun setHeightMap(type: HeightMapType?, heightMap: IntArray?) {
}
override fun fullySupports3DBiomes(): Boolean {
return false
}
override fun setBlockLight(x: Int, y: Int, z: Int, value: Int) {
}
override fun setFullBright(layer: Int) {
}
override fun removeSectionLighting(layer: Int, sky: Boolean) {
}
override fun setSkyLightLayer(layer: Int, toSet: CharArray?) {
}
override fun setLightLayer(layer: Int, toSet: CharArray?) {
}
override fun getBiomes(): Array<BiomeType>? {
return null
}
override fun <B : BlockStateHolder<B>> setBlock(x: Int, y: Int, z: Int, block: B): Boolean {
return false
}
override fun setBlocks(layer: Int, data: CharArray) {
}
override fun getBiomeType(x: Int, y: Int, z: Int): BiomeType? {
return null
}
override fun hasSection(layer: Int): Boolean {
return false
}
override fun getBlock(x: Int, y: Int, z: Int): BlockState {
return BlockTypes.__RESERVED__!!.defaultState
}
override fun getFullBlock(x: Int, y: Int, z: Int): BaseBlock {
return BlockTypes.__RESERVED__!!.defaultState.toBaseBlock()
}
override fun getTiles(): Map<BlockVector3, CompoundTag> {
return emptyMap()
}
override fun getTile(x: Int, y: Int, z: Int): CompoundTag? {
return null
}
override fun getEntities(): Set<CompoundTag> {
return emptySet()
}
override fun load(layer: Int): CharArray? {
return null
}
override fun getEntity(uuid: UUID): CompoundTag? {
return null
}
override fun <T : Future<T>?> call(set: IChunkSet?, finalize: Runnable?): T? {
return null
}
override fun trim(aggressive: Boolean): Boolean {
return true
}
override fun trim(aggressive: Boolean, layer: Int): Boolean {
return true
}
}

Datei anzeigen

@ -6,7 +6,7 @@ import com.boydti.fawe.beta.IChunkGet;
import com.boydti.fawe.beta.IChunkSet; import com.boydti.fawe.beta.IChunkSet;
public class BatchProcessorHolder implements IBatchProcessorHolder { public class BatchProcessorHolder implements IBatchProcessorHolder {
private IBatchProcessor processor = EmptyBatchProcessor.INSTANCE; private IBatchProcessor processor = EmptyBatchProcessor.getInstance();
@Override @Override
public IBatchProcessor getProcessor() { public IBatchProcessor getProcessor() {

Datei anzeigen

@ -0,0 +1,37 @@
package com.boydti.fawe.beta.implementation.processors;
import com.boydti.fawe.beta.IBatchProcessor;
import com.boydti.fawe.beta.IChunk;
import com.boydti.fawe.beta.IChunkGet;
import com.boydti.fawe.beta.IChunkSet;
import com.sk89q.worldedit.extent.Extent;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
public final class EmptyBatchProcessor implements IBatchProcessor {
private static final EmptyBatchProcessor instance = new EmptyBatchProcessor();
public static EmptyBatchProcessor getInstance() {
return instance;
}
@NotNull
public Extent construct(@Nullable Extent child) {
return child;
}
@NotNull
public IChunkSet processSet(@Nullable IChunk chunk, @Nullable IChunkGet get, @Nullable IChunkSet set) {
return set;
}
@NotNull
public IBatchProcessor join(@Nullable IBatchProcessor other) {
return other;
}
private EmptyBatchProcessor() {
}
}

Datei anzeigen

@ -1,22 +0,0 @@
package com.boydti.fawe.beta.implementation.processors
import com.boydti.fawe.beta.IBatchProcessor
import com.boydti.fawe.beta.IChunk
import com.boydti.fawe.beta.IChunkGet
import com.boydti.fawe.beta.IChunkSet
import com.sk89q.worldedit.extent.Extent
object EmptyBatchProcessor : IBatchProcessor {
override fun construct(child: Extent?): Extent {
return child!!
}
override fun processSet(chunk: IChunk?, get: IChunkGet?, set: IChunkSet?): IChunkSet {
return set!!
}
override fun join(other: IBatchProcessor?): IBatchProcessor {
return other!!
}
}

Datei anzeigen

@ -29,7 +29,7 @@ public class MultiBatchProcessor implements IBatchProcessor {
} }
switch (list.size()) { switch (list.size()) {
case 0: case 0:
return EmptyBatchProcessor.INSTANCE; return EmptyBatchProcessor.getInstance();
case 1: case 1:
return list.get(0); return list.get(0);
default: default:

Datei anzeigen

@ -0,0 +1,32 @@
package com.boydti.fawe.beta.implementation.processors;
import com.boydti.fawe.beta.IBatchProcessor;
import com.boydti.fawe.beta.IChunk;
import com.boydti.fawe.beta.IChunkGet;
import com.boydti.fawe.beta.IChunkSet;
import com.sk89q.worldedit.extent.Extent;
import com.sk89q.worldedit.extent.NullExtent;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
public final class NullProcessor implements IBatchProcessor {
private static final NullProcessor instance = new NullProcessor();
public static NullProcessor getInstance() {
return instance;
}
@Nullable
public IChunkSet processSet(@NotNull IChunk chunk, @NotNull IChunkGet get, @NotNull IChunkSet set) {
return null;
}
@NotNull
public Extent construct(@NotNull Extent child) {
return new NullExtent();
}
private NullProcessor() {
}
}

Datei anzeigen

@ -1,19 +0,0 @@
package com.boydti.fawe.beta.implementation.processors
import com.boydti.fawe.beta.IBatchProcessor
import com.boydti.fawe.beta.IChunk
import com.boydti.fawe.beta.IChunkGet
import com.boydti.fawe.beta.IChunkSet
import com.sk89q.worldedit.extent.Extent
import com.sk89q.worldedit.extent.NullExtent
object NullProcessor : IBatchProcessor {
override fun processSet(chunk: IChunk, get: IChunkGet, set: IChunkSet): IChunkSet? {
return null
}
override fun construct(child: Extent): Extent {
return NullExtent()
}
}

Datei anzeigen

@ -109,7 +109,7 @@ public class SingleThreadQueueExtent extends ExtentBatchProcessorHolder implemen
this.lastPair = Long.MAX_VALUE; this.lastPair = Long.MAX_VALUE;
this.currentThread = null; this.currentThread = null;
this.initialized = false; this.initialized = false;
this.setProcessor(EmptyBatchProcessor.INSTANCE); this.setProcessor(EmptyBatchProcessor.getInstance());
} }
/** /**
@ -128,7 +128,7 @@ public class SingleThreadQueueExtent extends ExtentBatchProcessorHolder implemen
} }
this.cacheGet = get; this.cacheGet = get;
this.cacheSet = set; this.cacheSet = set;
this.setProcessor(EmptyBatchProcessor.INSTANCE); this.setProcessor(EmptyBatchProcessor.getInstance());
initialized = true; initialized = true;
} }
@ -223,8 +223,8 @@ public class SingleThreadQueueExtent extends ExtentBatchProcessorHolder implemen
} }
if (!processGet(x, z)) { if (!processGet(x, z)) {
lastPair = pair; lastPair = pair;
lastChunk = NullChunk.INSTANCE; lastChunk = NullChunk.getInstance();
return NullChunk.INSTANCE; return NullChunk.getInstance();
} }
IQueueChunk chunk = chunks.get(pair); IQueueChunk chunk = chunks.get(pair);
if (chunk != null) { if (chunk != null) {

Datei anzeigen

@ -0,0 +1,104 @@
package com.boydti.fawe.object.clipboard;
import com.boydti.fawe.beta.implementation.lighting.HeightMapType;
import com.sk89q.jnbt.CompoundTag;
import com.sk89q.worldedit.WorldEditException;
import com.sk89q.worldedit.entity.Entity;
import com.sk89q.worldedit.extent.clipboard.Clipboard;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.regions.CuboidRegion;
import com.sk89q.worldedit.regions.Region;
import com.sk89q.worldedit.world.biome.BiomeType;
import com.sk89q.worldedit.world.block.BaseBlock;
import com.sk89q.worldedit.world.block.BlockState;
import com.sk89q.worldedit.world.block.BlockStateHolder;
import com.sk89q.worldedit.world.block.BlockTypes;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
public final class EmptyClipboard implements Clipboard {
private static final EmptyClipboard instance = new EmptyClipboard();
public static EmptyClipboard getInstance() {
return instance;
}
@NotNull
public Region getRegion() {
return new CuboidRegion(BlockVector3.ZERO, BlockVector3.ZERO);
}
@NotNull
public BlockVector3 getDimensions() {
return BlockVector3.ZERO;
}
@NotNull
public BlockVector3 getOrigin() {
return BlockVector3.ZERO;
}
public void setOrigin(@NotNull BlockVector3 origin) {
}
public void removeEntity(@NotNull Entity entity) {
}
@NotNull
public BlockVector3 getMinimumPoint() {
return BlockVector3.ZERO;
}
@NotNull
public BlockVector3 getMaximumPoint() {
return BlockVector3.ZERO;
}
@NotNull
public BaseBlock getFullBlock(@NotNull BlockVector3 position) {
return BlockTypes.AIR.getDefaultState().toBaseBlock();
}
@NotNull
public BlockState getBlock(@NotNull BlockVector3 position) {
return BlockTypes.AIR.getDefaultState();
}
@Nullable
public BiomeType getBiome(@NotNull BlockVector3 position) {
return null;
}
@NotNull
public int[] getHeightMap(@Nullable HeightMapType type) {
return new int[256];
}
public boolean setBlock(@NotNull BlockVector3 position, BlockStateHolder block) throws WorldEditException {
return false;
}
public boolean setBlock(int x, int y, int z, BlockStateHolder block) throws WorldEditException {
return false;
}
public boolean setTile(int x, int y, int z, @NotNull CompoundTag tile) throws WorldEditException {
return false;
}
public boolean setBiome(@NotNull BlockVector3 position, @NotNull BiomeType biome) {
return false;
}
public boolean fullySupports3DBiomes() {
return false;
}
public boolean setBiome(int x, int y, int z, @NotNull BiomeType biome) {
return false;
}
private EmptyClipboard() {
}
}

Datei anzeigen

@ -1,83 +0,0 @@
package com.boydti.fawe.`object`.clipboard
import com.boydti.fawe.beta.implementation.lighting.HeightMapType
import com.sk89q.jnbt.CompoundTag
import com.sk89q.worldedit.WorldEditException
import com.sk89q.worldedit.entity.Entity
import com.sk89q.worldedit.extent.clipboard.Clipboard
import com.sk89q.worldedit.math.BlockVector2
import com.sk89q.worldedit.math.BlockVector3
import com.sk89q.worldedit.regions.CuboidRegion
import com.sk89q.worldedit.regions.Region
import com.sk89q.worldedit.world.biome.BiomeType
import com.sk89q.worldedit.world.block.BaseBlock
import com.sk89q.worldedit.world.block.BlockState
import com.sk89q.worldedit.world.block.BlockStateHolder
import com.sk89q.worldedit.world.block.BlockTypes
object EmptyClipboard : Clipboard {
override fun getRegion(): Region {
return CuboidRegion(BlockVector3.ZERO, BlockVector3.ZERO)
}
override fun getDimensions(): BlockVector3 {
return BlockVector3.ZERO
}
override fun getOrigin(): BlockVector3 {
return BlockVector3.ZERO
}
override fun setOrigin(origin: BlockVector3) {}
override fun removeEntity(entity: Entity) {}
override fun getMinimumPoint(): BlockVector3 {
return BlockVector3.ZERO
}
override fun getMaximumPoint(): BlockVector3 {
return BlockVector3.ZERO
}
override fun getFullBlock(position: BlockVector3): BaseBlock {
return BlockTypes.AIR!!.defaultState.toBaseBlock()
}
override fun getBlock(position: BlockVector3): BlockState {
return BlockTypes.AIR!!.defaultState
}
override fun getBiome(position: BlockVector3): BiomeType? {
return null
}
override fun getHeightMap(type: HeightMapType?): IntArray {
return IntArray(256)
}
@Throws(WorldEditException::class)
override fun <T : BlockStateHolder<T>?> setBlock(position: BlockVector3, block: T): Boolean {
return false
}
@Throws(WorldEditException::class)
override fun <T : BlockStateHolder<T>?> setBlock(x: Int, y: Int, z: Int, block: T): Boolean {
return false
}
@Throws(WorldEditException::class)
override fun setTile(x: Int, y: Int, z: Int, tile: CompoundTag): Boolean {
return false
}
override fun setBiome(position: BlockVector3, biome: BiomeType): Boolean {
return false
}
override fun fullySupports3DBiomes(): Boolean {
return false
}
override fun setBiome(x: Int, y: Int, z: Int, biome: BiomeType): Boolean {
return false
}
}

Datei anzeigen

@ -21,7 +21,7 @@ public class LazyClipboardHolder extends URIClipboardHolder {
* *
*/ */
public LazyClipboardHolder(URI uri, ByteSource source, ClipboardFormat format, UUID uuid) { public LazyClipboardHolder(URI uri, ByteSource source, ClipboardFormat format, UUID uuid) {
super(uri, EmptyClipboard.INSTANCE); super(uri, EmptyClipboard.getInstance());
this.source = source; this.source = source;
this.format = format; this.format = format;
this.uuid = uuid != null ? uuid : UUID.randomUUID(); this.uuid = uuid != null ? uuid : UUID.randomUUID();

Datei anzeigen

@ -22,7 +22,7 @@ public class MultiClipboardHolder extends URIClipboardHolder {
} }
public MultiClipboardHolder(URI uri) { public MultiClipboardHolder(URI uri) {
super(uri, EmptyClipboard.INSTANCE); super(uri, EmptyClipboard.getInstance());
holders = new ArrayList<>(); holders = new ArrayList<>();
} }
@ -32,7 +32,7 @@ public class MultiClipboardHolder extends URIClipboardHolder {
} }
public MultiClipboardHolder(Clipboard clipboard) { public MultiClipboardHolder(Clipboard clipboard) {
super(URI.create(""), EmptyClipboard.INSTANCE); super(URI.create(""), EmptyClipboard.getInstance());
holders = new ArrayList<>(); holders = new ArrayList<>();
URI uri = URI.create(""); URI uri = URI.create("");
if (clipboard.getURI() != null) { if (clipboard.getURI() != null) {
@ -140,7 +140,7 @@ public class MultiClipboardHolder extends URIClipboardHolder {
cached = available = getClipboards().toArray(new Clipboard[0]); cached = available = getClipboards().toArray(new Clipboard[0]);
} }
switch (available.length) { switch (available.length) {
case 0: return EmptyClipboard.INSTANCE; case 0: return EmptyClipboard.getInstance();
case 1: return available[0]; case 1: return available[0];
} }

Datei anzeigen

@ -614,7 +614,7 @@ public class BrushTool
newVisualExtent.init(chunkExtent); newVisualExtent.init(chunkExtent);
editSession.addProcessor(newVisualExtent); editSession.addProcessor(newVisualExtent);
editSession.addProcessor(NullProcessor.INSTANCE); editSession.addProcessor(NullProcessor.getInstance());
BlockVector3 position = getPosition(editSession, player); BlockVector3 position = getPosition(editSession, player);
if (position != null) { if (position != null) {

Datei anzeigen

@ -166,7 +166,7 @@ public class NullWorld extends AbstractWorld {
@Override @Override
public IChunkGet get(int x, int z) { public IChunkGet get(int x, int z) {
return NullChunkGet.INSTANCE; return NullChunkGet.getInstance();
} }
@Override @Override

Datei anzeigen

@ -14,5 +14,4 @@ dependencies {
"shade"("org.enginehub.piston:core:${Versions.PISTON}") "shade"("org.enginehub.piston:core:${Versions.PISTON}")
"shade"("org.enginehub.piston.core-ap:runtime:${Versions.PISTON}") "shade"("org.enginehub.piston.core-ap:runtime:${Versions.PISTON}")
"shade"("org.enginehub.piston:default-impl:${Versions.PISTON}") "shade"("org.enginehub.piston:default-impl:${Versions.PISTON}")
"shade"("org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.4.0")
} }