Update PlotSquared integration to v7 (#2075)

Co-authored-by: dordsor21 <dordsor21@gmail.com>
This commit is contained in:
Alexander Brandes 2023-07-22 12:01:33 +02:00 committed by GitHub
parent 4bdcf9a510
commit c91b477e29
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 43 additions and 38 deletions

View File

@ -19,8 +19,6 @@
"net.fabricmc:fabric-loader", "net.fabricmc:fabric-loader",
"net.fabricmc.fabric-api:fabric-api", "net.fabricmc.fabric-api:fabric-api",
"com.github.luben:zstd-jni", "com.github.luben:zstd-jni",
"net.kyori",
"net.kyori:adventure-nbt",
"org.jetbrains.kotlin.jvm", "org.jetbrains.kotlin.jvm",
"log4j" "log4j"
], ],

View File

@ -15,7 +15,7 @@ fun Project.applyPaperweightAdapterConfiguration() {
dependencies { dependencies {
"implementation"(project(":worldedit-bukkit")) "implementation"(project(":worldedit-bukkit"))
"implementation"(platform("com.intellectualsites.bom:bom-1.18.x:1.31")) "implementation"(platform("com.intellectualsites.bom:bom-newest:1.33"))
} }
tasks.named("assemble") { tasks.named("assemble") {

View File

@ -45,7 +45,7 @@ fun Project.applyCommonJavaConfiguration(sourcesJar: Boolean, banSlf4j: Boolean
"testImplementation"("org.mockito:mockito-core:5.1.1") "testImplementation"("org.mockito:mockito-core:5.1.1")
"testImplementation"("org.mockito:mockito-junit-jupiter:5.1.1") "testImplementation"("org.mockito:mockito-junit-jupiter:5.1.1")
"testRuntimeOnly"("org.junit.jupiter:junit-jupiter-engine:5.9.2") "testRuntimeOnly"("org.junit.jupiter:junit-jupiter-engine:5.9.2")
"implementation"(platform("com.intellectualsites.bom:bom-1.18.x:1.31")) "implementation"(platform("com.intellectualsites.bom:bom-newest:1.33"))
} }
// Java 8 turns on doclint which we fail // Java 8 turns on doclint which we fail

View File

@ -17,7 +17,7 @@ towny = "0.99.5.4"
bstats = "3.0.2" bstats = "3.0.2"
sparsebitset = "1.2" sparsebitset = "1.2"
parallelgzip = "1.0.5" parallelgzip = "1.0.5"
adventure = "4.9.3" adventure = "4.14.0"
truezip = "6.8.4" truezip = "6.8.4"
auto-value = "1.10.2" auto-value = "1.10.2"
findbugs = "3.0.2" findbugs = "3.0.2"
@ -30,7 +30,6 @@ jchronic = "0.2.4a"
lz4-java = "1.8.0" lz4-java = "1.8.0"
lz4-stream = "1.0.0" lz4-stream = "1.0.0"
## Internal ## Internal
adventure-text-minimessage = "4.2.0-SNAPSHOT"
text-adapter = "3.0.6" text-adapter = "3.0.6"
text = "3.0.4" text = "3.0.4"
piston = "0.5.7" piston = "0.5.7"

View File

@ -101,8 +101,8 @@ dependencies {
compileOnly(libs.griefdefender) { isTransitive = false } compileOnly(libs.griefdefender) { isTransitive = false }
compileOnly(libs.residence) { isTransitive = false } compileOnly(libs.residence) { isTransitive = false }
compileOnly(libs.towny) { isTransitive = false } compileOnly(libs.towny) { isTransitive = false }
compileOnly("com.plotsquared:PlotSquared-Bukkit") { isTransitive = false } compileOnly("com.intellectualsites.plotsquared:plotsquared-bukkit") { isTransitive = false }
compileOnly("com.plotsquared:PlotSquared-Core") { isTransitive = false } compileOnly("com.intellectualsites.plotsquared:plotsquared-core") { isTransitive = false }
// Third party // Third party
implementation("io.papermc:paperlib") implementation("io.papermc:paperlib")
@ -183,7 +183,7 @@ tasks.named<ShadowJar>("shadowJar") {
include(dependency("org.lz4:lz4-java:1.8.0")) include(dependency("org.lz4:lz4-java:1.8.0"))
} }
relocate("net.kyori", "com.fastasyncworldedit.core.adventure") { relocate("net.kyori", "com.fastasyncworldedit.core.adventure") {
include(dependency("net.kyori:adventure-nbt:4.9.3")) include(dependency("net.kyori:adventure-nbt:4.14.0"))
} }
relocate("com.zaxxer", "com.fastasyncworldedit.core.math") { relocate("com.zaxxer", "com.fastasyncworldedit.core.math") {
include(dependency("com.zaxxer:SparseBitSet:1.2")) include(dependency("com.zaxxer:SparseBitSet:1.2"))

View File

@ -325,18 +325,9 @@ public class FaweBukkit implements IFawe, Listener {
if (plotSquared == null) { if (plotSquared == null) {
return; return;
} }
if (PlotSquared.get().getVersion().version[0] == 6) { if (PlotSquared.get().getVersion().version[0] == 7) {
WEManager.weManager().addManager(new com.fastasyncworldedit.bukkit.regions.plotsquared.PlotSquaredFeature()); WEManager.weManager().addManager(new com.fastasyncworldedit.bukkit.regions.plotsquared.PlotSquaredFeature());
LOGGER.info("Plugin 'PlotSquared' v6 found. Using it now."); LOGGER.info("Plugin 'PlotSquared' v7 found. Using it now.");
} else if (PlotSquared.get().getVersion().version[0] == 7) {
WEManager.weManager().addManager(new com.fastasyncworldedit.bukkit.regions.plotsquared.PlotSquaredFeature());
LOGGER.error("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
LOGGER.error("!! !!");
LOGGER.error("!! ERROR: PlotSquared v7 found. This FAWE version does not support PlotSquared V7 !!");
LOGGER.error("!! Follow the instructions when notified of v7 release candidates and use FAWE from !!");
LOGGER.error("!! https://ci.athion.net/job/FastAsyncWorldEdit-Pull-Requests/view/change-requests/job/PR-2075/ !!");
LOGGER.error("!! !!");
LOGGER.error("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
} else { } else {
LOGGER.error("Incompatible version of PlotSquared found. Please use PlotSquared v6."); LOGGER.error("Incompatible version of PlotSquared found. Please use PlotSquared v6.");
LOGGER.info("https://www.spigotmc.org/resources/77506/"); LOGGER.info("https://www.spigotmc.org/resources/77506/");

View File

@ -171,13 +171,11 @@ public class FaweDelegateRegionManager {
.limitUnlimited() .limitUnlimited()
.changeSetNull() .changeSetNull()
.build(); .build();
File schematicFile = new File(hybridPlotWorld.getRoot(), "plot.schem"); File schematicFile = new File(hybridPlotWorld.getSchematicRoot(), "plot.schem");
if (!schematicFile.exists()) { if (!schematicFile.exists()) {
schematicFile = new File(hybridPlotWorld.getRoot(), "plot.schematic"); schematicFile = new File(hybridPlotWorld.getSchematicRoot(), "plot.schematic");
} }
BlockVector3 to = plot.getBottomAbs().getBlockVector3().withY(Settings.Schematics.PASTE_ON_TOP BlockVector3 to = plot.getBottomAbs().getBlockVector3().withY(hybridPlotWorld.getPlotYStart());
? hybridPlotWorld.SCHEM_Y
: hybridPlotWorld.getMinBuildHeight());
try { try {
Clipboard clip = ClipboardFormats Clipboard clip = ClipboardFormats
.findByFile(schematicFile) .findByFile(schematicFile)
@ -215,7 +213,7 @@ public class FaweDelegateRegionManager {
) { ) {
TaskManager.taskManager().async(() -> { TaskManager.taskManager().async(() -> {
synchronized (FaweDelegateRegionManager.class) { synchronized (FaweDelegateRegionManager.class) {
//todo because of the following code this should proably be in the Bukkit module //todo because of the following code this should probably be in the Bukkit module
World pos1World = BukkitAdapter.adapt(getWorld(pos1.getWorldName())); World pos1World = BukkitAdapter.adapt(getWorld(pos1.getWorldName()));
World pos3World = BukkitAdapter.adapt(getWorld(swapPos.getWorldName())); World pos3World = BukkitAdapter.adapt(getWorld(swapPos.getWorldName()));
EditSession sessionA = WorldEdit.getInstance().newEditSessionBuilder().world(pos1World) EditSession sessionA = WorldEdit.getInstance().newEditSessionBuilder().world(pos1World)

View File

@ -1,13 +1,15 @@
package com.fastasyncworldedit.bukkit.regions.plotsquared; package com.fastasyncworldedit.bukkit.regions.plotsquared;
import com.fastasyncworldedit.core.util.TaskManager; import com.fastasyncworldedit.core.util.TaskManager;
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.minimessage.tag.Tag;
import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
import com.plotsquared.core.PlotSquared; import com.plotsquared.core.PlotSquared;
import com.plotsquared.core.command.CommandCategory; import com.plotsquared.core.command.CommandCategory;
import com.plotsquared.core.command.CommandDeclaration; import com.plotsquared.core.command.CommandDeclaration;
import com.plotsquared.core.command.RequiredType; import com.plotsquared.core.command.RequiredType;
import com.plotsquared.core.command.SubCommand; import com.plotsquared.core.command.SubCommand;
import com.plotsquared.core.configuration.caption.StaticCaption; import com.plotsquared.core.configuration.caption.StaticCaption;
import com.plotsquared.core.configuration.caption.Templates;
import com.plotsquared.core.configuration.caption.TranslatableCaption; import com.plotsquared.core.configuration.caption.TranslatableCaption;
import com.plotsquared.core.player.PlotPlayer; import com.plotsquared.core.player.PlotPlayer;
@ -33,7 +35,7 @@ public class FaweTrim extends SubCommand {
return false; return false;
} }
if (!PlotSquared.platform().worldUtil().isWorld(strings[0])) { if (!PlotSquared.platform().worldUtil().isWorld(strings[0])) {
plotPlayer.sendMessage(TranslatableCaption.of("errors.not_valid_plot_world"), Templates.of("value", strings[0])); plotPlayer.sendMessage(TranslatableCaption.of("errors.not_valid_plot_world"), TagResolver.resolver("value", Tag.inserting(Component.text(strings[0]))));
return false; return false;
} }
ran = true; ran = true;

View File

@ -6,11 +6,9 @@ import com.plotsquared.core.command.CommandCategory;
import com.plotsquared.core.command.CommandDeclaration; import com.plotsquared.core.command.CommandDeclaration;
import com.plotsquared.core.command.MainCommand; import com.plotsquared.core.command.MainCommand;
import com.plotsquared.core.command.RequiredType; import com.plotsquared.core.command.RequiredType;
import com.plotsquared.core.configuration.caption.Templates;
import com.plotsquared.core.configuration.caption.TranslatableCaption; import com.plotsquared.core.configuration.caption.TranslatableCaption;
import com.plotsquared.core.player.PlotPlayer; import com.plotsquared.core.player.PlotPlayer;
import com.plotsquared.core.plot.Plot; import com.plotsquared.core.plot.Plot;
import com.plotsquared.core.util.Permissions;
import com.plotsquared.core.util.StringMan; import com.plotsquared.core.util.StringMan;
import com.plotsquared.core.util.task.RunnableVal2; import com.plotsquared.core.util.task.RunnableVal2;
import com.plotsquared.core.util.task.RunnableVal3; import com.plotsquared.core.util.task.RunnableVal3;
@ -24,6 +22,9 @@ import com.sk89q.worldedit.world.biome.BiomeType;
import com.sk89q.worldedit.world.biome.BiomeTypes; import com.sk89q.worldedit.world.biome.BiomeTypes;
import com.sk89q.worldedit.world.biome.Biomes; import com.sk89q.worldedit.world.biome.Biomes;
import com.sk89q.worldedit.world.registry.BiomeRegistry; import com.sk89q.worldedit.world.registry.BiomeRegistry;
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.minimessage.tag.Tag;
import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import java.util.Collection; import java.util.Collection;
@ -56,7 +57,7 @@ public class PlotSetBiome extends Command {
) throws CommandException { ) throws CommandException {
final Plot plot = check(player.getCurrentPlot(), TranslatableCaption.of("errors.not_in_plot")); final Plot plot = check(player.getCurrentPlot(), TranslatableCaption.of("errors.not_in_plot"));
checkTrue( checkTrue(
plot.isOwner(player.getUUID()) || Permissions.hasPermission(player, "plots.admin.command.generatebiome"), plot.isOwner(player.getUUID()) || player.hasPermission("plots.admin.command.generatebiome"),
TranslatableCaption.of("permission.no_plot_perms") TranslatableCaption.of("permission.no_plot_perms")
); );
if (plot.getRunning() != 0) { if (plot.getRunning() != 0) {
@ -64,7 +65,7 @@ public class PlotSetBiome extends Command {
return null; return null;
} }
checkTrue(args.length == 1, TranslatableCaption.of("commandconfig.command_syntax"), checkTrue(args.length == 1, TranslatableCaption.of("commandconfig.command_syntax"),
Templates.of("value", getUsage()) TagResolver.resolver("value", Tag.inserting(Component.text(getUsage())))
); );
final Set<CuboidRegion> regions = plot.getRegions(); final Set<CuboidRegion> regions = plot.getRegions();
BiomeRegistry biomeRegistry = BiomeRegistry biomeRegistry =
@ -80,7 +81,7 @@ public class PlotSetBiome extends Command {
player.sendMessage(TranslatableCaption.of("biome.need_biome")); player.sendMessage(TranslatableCaption.of("biome.need_biome"));
player.sendMessage( player.sendMessage(
TranslatableCaption.of("commandconfig.subcommand_set_options_header"), TranslatableCaption.of("commandconfig.subcommand_set_options_header"),
Templates.of("values", biomes) TagResolver.resolver("value", Tag.inserting(Component.text(biomes)))
); );
return CompletableFuture.completedFuture(false); return CompletableFuture.completedFuture(false);
} }

View File

@ -42,7 +42,7 @@ public class PlotSquaredFeature extends FaweMaskManager {
if (Settings.FAWE_Components.FAWE_HOOK) { if (Settings.FAWE_Components.FAWE_HOOK) {
Settings.Enabled_Components.WORLDEDIT_RESTRICTIONS = false; Settings.Enabled_Components.WORLDEDIT_RESTRICTIONS = false;
if (Settings.PLATFORM.toLowerCase(Locale.ROOT).startsWith("bukkit")) { if (Settings.PLATFORM.toLowerCase(Locale.ROOT).startsWith("bukkit")) {
new FaweTrim(); // new FaweTrim();
} }
// TODO: revisit this later on // TODO: revisit this later on
/* /*

View File

@ -19,6 +19,8 @@
package com.sk89q.wepif; package com.sk89q.wepif;
import com.destroystokyo.paper.profile.PlayerProfile;
import org.bukkit.BanEntry;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.OfflinePlayer; import org.bukkit.OfflinePlayer;
@ -30,10 +32,11 @@ import org.bukkit.permissions.Permission;
import org.bukkit.permissions.PermissionAttachment; import org.bukkit.permissions.PermissionAttachment;
import org.bukkit.permissions.PermissionAttachmentInfo; import org.bukkit.permissions.PermissionAttachmentInfo;
import org.bukkit.plugin.Plugin; import org.bukkit.plugin.Plugin;
import org.bukkit.profile.PlayerProfile;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import javax.annotation.Nonnull; import javax.annotation.Nonnull;
import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
import java.util.Locale; import java.util.Locale;
@ -158,6 +161,15 @@ public class TestOfflinePermissible implements OfflinePlayer, Permissible {
throw new UnsupportedOperationException("Not supported yet."); throw new UnsupportedOperationException("Not supported yet.");
} }
@Override
public @Nullable BanEntry<org.bukkit.profile.PlayerProfile> ban(
@Nullable final String reason,
@Nullable final Date expires,
@Nullable final String source
) {
return null;
}
@Override @Override
public boolean isWhitelisted() { public boolean isWhitelisted() {
throw new UnsupportedOperationException("Not supported yet."); throw new UnsupportedOperationException("Not supported yet.");
@ -323,4 +335,9 @@ public class TestOfflinePermissible implements OfflinePlayer, Permissible {
} }
@Override
public @Nullable Location getLastDeathLocation() {
return null;
}
} }

View File

@ -28,14 +28,13 @@ dependencies {
implementation("com.google.code.gson:gson") implementation("com.google.code.gson:gson")
// Platform expectations // Platform expectations
// TODO update bom-newest implementation("org.yaml:snakeyaml")
implementation("org.yaml:snakeyaml:2.0")
// Logging // Logging
implementation("org.apache.logging.log4j:log4j-api") implementation("org.apache.logging.log4j:log4j-api")
// Plugins // Plugins
compileOnly("com.plotsquared:PlotSquared-Core") { isTransitive = false } compileOnly("com.intellectualsites.plotsquared:plotsquared-core") { isTransitive = false }
// ensure this is on the classpath for the AP // ensure this is on the classpath for the AP
annotationProcessor(libs.guava) annotationProcessor(libs.guava)