diff --git a/.whitesource b/.whitesource new file mode 100644 index 000000000..fec7e1e09 --- /dev/null +++ b/.whitesource @@ -0,0 +1,13 @@ +{ + "scanSettings": { + "baseBranches": ["main"] + }, + "checkRunSettings": { + "vulnerableCheckRunConclusionLevel": "failure", + "displayMode": "diff" + }, + "issueSettings": { + "minSeverityLevel": "LOW" + }, + "enableRenovate": "true" +} \ No newline at end of file diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 000000000..466a35458 --- /dev/null +++ b/Jenkinsfile @@ -0,0 +1,10 @@ +pipeline { + agent any + stages { + stage('Build pull request') { + steps { + sh './gradlew clean build' + } + } + } +} diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts index 89890f675..564784f81 100644 --- a/buildSrc/build.gradle.kts +++ b/buildSrc/build.gradle.kts @@ -29,8 +29,8 @@ val properties = Properties().also { props -> dependencies { implementation(gradleApi()) - implementation("org.ajoberstar.grgit:grgit-gradle:4.1.0") - implementation("gradle.plugin.com.github.johnrengelman:shadow:7.1.0") + implementation("org.ajoberstar.grgit:grgit-gradle:4.1.1") + implementation("gradle.plugin.com.github.johnrengelman:shadow:7.1.1") implementation("io.papermc.paperweight.userdev:io.papermc.paperweight.userdev.gradle.plugin:1.3.0-SNAPSHOT") } diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 601d7d6bf..8396e75dd 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,7 +1,7 @@ [versions] # Minecraft expectations fastutil = "8.5.6" -log4j = "2.14.1" +log4j = "2.17.0" guava = "31.0.1-jre" gson = "2.8.8" @@ -17,9 +17,9 @@ griefprevention = "16.17.1" griefdefender = "920a610" mcore = "7.0.1" residence = "4.5._13.1" -towny = "0.97.2.15" +towny = "0.97.5.0" protocollib = "4.7.0" -plotsquaredV6 = "6.1.4" +plotsquaredV6 = "6.2.0" plotsquaredV4 = "4.514" redprotect = "1.9.6" @@ -33,7 +33,7 @@ sparsebitset = "1.2" parallelgzip = "1.0.5" adventure = "4.9.3" truezip = "6.8.4" -auto-value = "1.8.2" +auto-value = "1.9" findbugs = "3.0.2" rhino-runtime = "1.7.13" zstd-jni = "1.4.8-1" # Not latest as it can be difficult to obtain latest ZSTD libs @@ -50,11 +50,11 @@ text = "3.0.4" piston = "0.5.7" # Tests -mockito = "4.1.0" -checker-qual = "3.19.0" +mockito = "4.2.0" +checker-qual = "3.21.0" # Gradle plugins -pluginyml = "0.5.0" +pluginyml = "0.5.1" [libraries] # Minecraft expectations diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index fbce071a3..ac0b842f1 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.3-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.2-all.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/worldedit-bukkit/adapters/adapter-1_17_1/src/main/java/com/sk89q/worldedit/bukkit/adapter/ext/fawe/PaperweightAdapter.java b/worldedit-bukkit/adapters/adapter-1_17_1/src/main/java/com/sk89q/worldedit/bukkit/adapter/ext/fawe/PaperweightAdapter.java index 9de853cdd..3cc940eb7 100644 --- a/worldedit-bukkit/adapters/adapter-1_17_1/src/main/java/com/sk89q/worldedit/bukkit/adapter/ext/fawe/PaperweightAdapter.java +++ b/worldedit-bukkit/adapters/adapter-1_17_1/src/main/java/com/sk89q/worldedit/bukkit/adapter/ext/fawe/PaperweightAdapter.java @@ -658,7 +658,9 @@ public final class PaperweightAdapter implements BukkitImplAdapter public static + public static WorldGenSettings replaceSeed(ServerLevel originalWorld, long seed, WorldGenSettings originalOpts) { + // FAWE end RegistryWriteOps nbtReadRegOps = RegistryWriteOps.create( NbtOps.INSTANCE, originalWorld.getServer().registryAccess() @@ -685,8 +687,10 @@ public final class PaperweightAdapter implements BukkitImplAdapter private static @SuppressWarnings("unchecked") - private Dynamic recursivelySetSeed( + private static Dynamic recursivelySetSeed( + // FAWE end Dynamic dynamic, long seed, Set> seen diff --git a/worldedit-bukkit/adapters/adapter-1_17_1/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_17_R1_2/regen/PaperweightRegen.java b/worldedit-bukkit/adapters/adapter-1_17_1/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_17_R1_2/regen/PaperweightRegen.java index b48678167..2e16b9f28 100644 --- a/worldedit-bukkit/adapters/adapter-1_17_1/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_17_R1_2/regen/PaperweightRegen.java +++ b/worldedit-bukkit/adapters/adapter-1_17_1/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_17_R1_2/regen/PaperweightRegen.java @@ -9,9 +9,9 @@ import com.fastasyncworldedit.core.util.TaskManager; import com.google.common.collect.ImmutableList; import com.mojang.datafixers.util.Either; import com.mojang.serialization.Codec; -import com.mojang.serialization.Dynamic; import com.mojang.serialization.Lifecycle; import com.sk89q.worldedit.bukkit.adapter.Refraction; +import com.sk89q.worldedit.bukkit.adapter.ext.fawe.PaperweightAdapter; import com.sk89q.worldedit.bukkit.adapter.impl.fawe.v1_17_R1_2.PaperweightGetBlocks; import com.sk89q.worldedit.extent.Extent; import com.sk89q.worldedit.internal.util.LogManagerCompat; @@ -21,12 +21,9 @@ import com.sk89q.worldedit.world.RegenOptions; import io.papermc.lib.PaperLib; import net.minecraft.core.MappedRegistry; import net.minecraft.core.Registry; -import net.minecraft.core.RegistryAccess; import net.minecraft.data.BuiltinRegistries; import net.minecraft.data.worldgen.biome.Biomes; import net.minecraft.nbt.CompoundTag; -import net.minecraft.nbt.NbtOps; -import net.minecraft.resources.RegistryReadOps; import net.minecraft.resources.ResourceKey; import net.minecraft.resources.ResourceLocation; import net.minecraft.server.MinecraftServer; @@ -78,12 +75,10 @@ import java.lang.reflect.Field; import java.lang.reflect.Method; import java.nio.file.Path; import java.util.Collections; -import java.util.HashSet; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; import java.util.Random; -import java.util.Set; import java.util.concurrent.CompletableFuture; import java.util.concurrent.ConcurrentHashMap; import java.util.function.BooleanSupplier; @@ -220,19 +215,11 @@ public class PaperweightRegen extends Regenerator nbtRegOps = RegistryReadOps.createAndLoad( - NbtOps.INSTANCE, server.resources.getResourceManager(), - RegistryAccess.builtin() - ); - WorldGenSettings newOpts = WorldGenSettings.CODEC - .encodeStart(nbtRegOps, levelProperties.worldGenSettings()) - .flatMap(tag -> WorldGenSettings.CODEC.parse(this.recursivelySetSeed( - new Dynamic<>(nbtRegOps, tag), - seed, - new HashSet<>() - ))) - .result() - .orElseThrow(() -> new IllegalStateException("Unable to map GeneratorOptions")); + WorldGenSettings originalOpts = levelProperties.worldGenSettings(); + + WorldGenSettings newOpts = options.getSeed().isPresent() + ? PaperweightAdapter.replaceSeed(originalServerWorld, seed, originalOpts) + : originalOpts; LevelSettings newWorldSettings = new LevelSettings( "worldeditregentempworld", originalWorldData.settings.gameType(), @@ -438,23 +425,6 @@ public class PaperweightRegen extends Regenerator recursivelySetSeed( - Dynamic dynamic, - long seed, - Set> dynamicSet - ) { - return !dynamicSet.add(dynamic) ? dynamic : dynamic.updateMapValues((pair) -> { - if (pair.getFirst().asString("").equals("seed")) { - return pair.mapSecond((v) -> v.createLong(seed)); - } else { - return ((Dynamic) pair.getSecond()).getValue() instanceof CompoundTag - ? pair.mapSecond((v) -> this.recursivelySetSeed((Dynamic) v, seed, dynamicSet)) - : pair; - - } - }); - } - private BiomeSource fastOverworldBiomeSource(BiomeSource biomeSource) throws Exception { Field legacyBiomeInitLayerField = OverworldBiomeSource.class.getDeclaredField( Refraction.pickName("legacyBiomeInitLayer", "i")); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/LocalSession.java b/worldedit-core/src/main/java/com/sk89q/worldedit/LocalSession.java index 55a899bab..f0a079e67 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/LocalSession.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/LocalSession.java @@ -398,9 +398,20 @@ public class LocalSession implements TextureHolder { * Clear history. */ public void clearHistory() { - history.clear(); //FAWE start + historyWriteLock.lock(); + try { + // Ensure that changesets are properly removed + for (Object item : history) { + getChangeSet(item).delete(); + } + history.clear(); + } finally { + historyWriteLock.unlock(); + } + historyNegativeIndex = 0; + save(); historySize = 0; currentWorld = null; //FAWE end diff --git a/worldedit-sponge/build.gradle.kts b/worldedit-sponge/build.gradle.kts index b209fd03e..dba06d1c5 100644 --- a/worldedit-sponge/build.gradle.kts +++ b/worldedit-sponge/build.gradle.kts @@ -28,7 +28,7 @@ dependencies { }) api("org.apache.logging.log4j:log4j-api") api("org.bstats:bstats-sponge:1.7") - testImplementation("org.mockito:mockito-core:4.1.0") + testImplementation("org.mockito:mockito-core:4.2.0") } <<<<<<< HEAD