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-api:fabric-api",
"com.github.luben:zstd-jni",
"net.kyori",
"net.kyori:adventure-nbt",
"org.jetbrains.kotlin.jvm",
"log4j"
],

View File

@ -15,7 +15,7 @@ fun Project.applyPaperweightAdapterConfiguration() {
dependencies {
"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") {

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-junit-jupiter:5.1.1")
"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

View File

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

View File

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

View File

@ -325,18 +325,9 @@ public class FaweBukkit implements IFawe, Listener {
if (plotSquared == null) {
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());
LOGGER.info("Plugin 'PlotSquared' v6 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("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
LOGGER.info("Plugin 'PlotSquared' v7 found. Using it now.");
} else {
LOGGER.error("Incompatible version of PlotSquared found. Please use PlotSquared v6.");
LOGGER.info("https://www.spigotmc.org/resources/77506/");

View File

@ -171,13 +171,11 @@ public class FaweDelegateRegionManager {
.limitUnlimited()
.changeSetNull()
.build();
File schematicFile = new File(hybridPlotWorld.getRoot(), "plot.schem");
File schematicFile = new File(hybridPlotWorld.getSchematicRoot(), "plot.schem");
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
? hybridPlotWorld.SCHEM_Y
: hybridPlotWorld.getMinBuildHeight());
BlockVector3 to = plot.getBottomAbs().getBlockVector3().withY(hybridPlotWorld.getPlotYStart());
try {
Clipboard clip = ClipboardFormats
.findByFile(schematicFile)
@ -215,7 +213,7 @@ public class FaweDelegateRegionManager {
) {
TaskManager.taskManager().async(() -> {
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 pos3World = BukkitAdapter.adapt(getWorld(swapPos.getWorldName()));
EditSession sessionA = WorldEdit.getInstance().newEditSessionBuilder().world(pos1World)

View File

@ -1,13 +1,15 @@
package com.fastasyncworldedit.bukkit.regions.plotsquared;
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.command.CommandCategory;
import com.plotsquared.core.command.CommandDeclaration;
import com.plotsquared.core.command.RequiredType;
import com.plotsquared.core.command.SubCommand;
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.player.PlotPlayer;
@ -33,7 +35,7 @@ public class FaweTrim extends SubCommand {
return false;
}
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;
}
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.MainCommand;
import com.plotsquared.core.command.RequiredType;
import com.plotsquared.core.configuration.caption.Templates;
import com.plotsquared.core.configuration.caption.TranslatableCaption;
import com.plotsquared.core.player.PlotPlayer;
import com.plotsquared.core.plot.Plot;
import com.plotsquared.core.util.Permissions;
import com.plotsquared.core.util.StringMan;
import com.plotsquared.core.util.task.RunnableVal2;
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.Biomes;
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 java.util.Collection;
@ -56,7 +57,7 @@ public class PlotSetBiome extends Command {
) throws CommandException {
final Plot plot = check(player.getCurrentPlot(), TranslatableCaption.of("errors.not_in_plot"));
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")
);
if (plot.getRunning() != 0) {
@ -64,7 +65,7 @@ public class PlotSetBiome extends Command {
return null;
}
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();
BiomeRegistry biomeRegistry =
@ -80,7 +81,7 @@ public class PlotSetBiome extends Command {
player.sendMessage(TranslatableCaption.of("biome.need_biome"));
player.sendMessage(
TranslatableCaption.of("commandconfig.subcommand_set_options_header"),
Templates.of("values", biomes)
TagResolver.resolver("value", Tag.inserting(Component.text(biomes)))
);
return CompletableFuture.completedFuture(false);
}

View File

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

View File

@ -19,6 +19,8 @@
package com.sk89q.wepif;
import com.destroystokyo.paper.profile.PlayerProfile;
import org.bukkit.BanEntry;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.OfflinePlayer;
@ -30,10 +32,11 @@ import org.bukkit.permissions.Permission;
import org.bukkit.permissions.PermissionAttachment;
import org.bukkit.permissions.PermissionAttachmentInfo;
import org.bukkit.plugin.Plugin;
import org.bukkit.profile.PlayerProfile;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import javax.annotation.Nonnull;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Locale;
@ -158,6 +161,15 @@ public class TestOfflinePermissible implements OfflinePlayer, Permissible {
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
public boolean isWhitelisted() {
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")
// Platform expectations
// TODO update bom-newest
implementation("org.yaml:snakeyaml:2.0")
implementation("org.yaml:snakeyaml")
// Logging
implementation("org.apache.logging.log4j:log4j-api")
// 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
annotationProcessor(libs.guava)