Skip to content

Commit

Permalink
Initial work on compiling against 1.20.6
Browse files Browse the repository at this point in the history
  • Loading branch information
md5sha256 committed Jun 21, 2024
1 parent 7ef50fb commit 49a4b14
Show file tree
Hide file tree
Showing 7 changed files with 67 additions and 42 deletions.
14 changes: 7 additions & 7 deletions AreaShop/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
plugins {
id("com.github.johnrengelman.shadow") version "8.1.1"
id("xyz.jpenilla.run-paper") version "2.2.3"
id("io.github.goooler.shadow") version "8.1.7"
id("xyz.jpenilla.run-paper") version "2.3.0"
}

idea {
Expand Down Expand Up @@ -132,15 +132,15 @@ tasks {
// Configure the Minecraft version for our task.
// This is the only required configuration besides applying the plugin.
// Your plugin's jar (or shadowJar if present) will be used automatically.
minecraftVersion("1.18.2")
minecraftVersion("1.20.4")

downloadPlugins {
github("EssentialsX", "essentials", "2.20.1", "EssentialsX-2.20.1.jar")
github("MilkBowl", "Vault", "1.7.3", "Vault.jar")
// WorldEdit 7.2.19
url("https://mediafilez.forgecdn.net/files/5077/477/worldedit-bukkit-7.2.19.jar")
// WorldGuard 7.0.7
url("https://mediafilez.forgecdn.net/files/3677/516/worldguard-bukkit-7.0.7-dist.jar")
// WorldEdit 7.3.0
url("https://mediafilez.forgecdn.net/files/5168/643/worldedit-bukkit-7.3.0.jar")
// WorldGuard 7.0.9
url("https://mediafilez.forgecdn.net/files/4675/318/worldguard-bukkit-7.0.9-dist.jar")
}
}
}
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package me.wiefferink.areashop.adapters.platform.paper;

import com.destroystokyo.paper.profile.PlayerProfile;
import me.wiefferink.areashop.adapters.platform.OfflinePlayerHelper;
import org.bukkit.OfflinePlayer;
import org.bukkit.Server;
import org.bukkit.plugin.Plugin;
import org.bukkit.profile.PlayerProfile;

import java.util.Optional;
import java.util.UUID;
Expand All @@ -22,13 +22,8 @@ public PaperOfflinePlayerHelper(Plugin plugin) {

@Override
public CompletableFuture<Optional<UUID>> lookupUuidAsync(String username) {
final PlayerProfile profile = this.server.createProfile(username);
final CompletableFuture<Optional<UUID>> future = new CompletableFuture<>();
this.server.getScheduler().runTaskAsynchronously(this.plugin, () -> {
profile.complete(false);
future.complete(Optional.ofNullable(profile.getId()));
});
return future;
final PlayerProfile profile = this.server.createPlayerProfile(username);
return profile.update().thenApply(PlayerProfile::getUniqueId).thenApply(Optional::ofNullable);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,11 @@
import com.sk89q.worldedit.world.entity.EntityTypes;
import com.sk89q.worldguard.protection.regions.ProtectedRegion;
import me.wiefferink.areashop.interfaces.AreaShopInterface;
import me.wiefferink.areashop.interfaces.ExceptionUtil;
import me.wiefferink.areashop.interfaces.GeneralRegionInterface;
import me.wiefferink.areashop.interfaces.WorldEditInterface;
import me.wiefferink.areashop.interfaces.WorldEditSelection;
import org.apache.commons.lang.exception.ExceptionUtils;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Hanging;
import org.bukkit.entity.Player;

import java.io.File;
Expand Down Expand Up @@ -113,12 +110,12 @@ public CompletableFuture<Boolean> restoreRegionBlocksAsync(File rawFile, General
}
} catch (IOException ex) {
pluginInterface.getLogger().warning("An error occurred while restoring schematic of " + regionInterface.getName() + ", enable debug to see the complete stacktrace");
pluginInterface.debugI(() -> ExceptionUtils.getStackTrace(ex));
pluginInterface.debugI(() -> ExceptionUtil.getStackTrace(ex));
future.complete(false);
return;
} catch (Exception ex) {
pluginInterface.getLogger().warning(() -> "crashed during restore of " + regionInterface.getName());
pluginInterface.debugI(() -> ExceptionUtils.getStackTrace(ex));
pluginInterface.debugI(() -> ExceptionUtil.getStackTrace(ex));
future.complete(false);
return;
}
Expand All @@ -135,7 +132,7 @@ public CompletableFuture<Boolean> restoreRegionBlocksAsync(File rawFile, General
future.complete(true);
} catch (WorldEditException ex) {
pluginInterface.getLogger().warning(() -> "An error occurred while restoring schematic of " + regionInterface.getName() + ", enable debug to see the complete stacktrace");
pluginInterface.debugI(() -> ExceptionUtils.getStackTrace(ex));
pluginInterface.debugI(() -> ExceptionUtil.getStackTrace(ex));
future.complete(false);
}
});
Expand Down Expand Up @@ -179,10 +176,10 @@ public CompletableFuture<Boolean> saveRegionBlocksAsync(File file, GeneralRegion
return;
} catch (IOException | WorldEditException ex) {
pluginInterface.getLogger().warning(() -> "An error occurred while saving schematic of " + regionInterface.getName() + ", enable debug to see the complete stacktrace");
pluginInterface.debugI(() -> ExceptionUtils.getStackTrace(ex));
pluginInterface.debugI(() -> ExceptionUtil.getStackTrace(ex));
} catch (Exception ex) {
pluginInterface.getLogger().warning(() -> "crashed during save of " + regionInterface.getName());
pluginInterface.debugI(() -> ExceptionUtils.getStackTrace(ex));
pluginInterface.debugI(() -> ExceptionUtil.getStackTrace(ex));
}
future.complete(false);
});
Expand Down Expand Up @@ -250,10 +247,10 @@ public boolean restoreRegionBlocks(File rawFile, GeneralRegionInterface regionIn
return true;
} catch (IOException | WorldEditException ex) {
pluginInterface.getLogger().warning(() -> "An error occurred while restoring schematic of " + regionInterface.getName() + ", enable debug to see the complete stacktrace");
pluginInterface.debugI(() -> ExceptionUtils.getStackTrace(ex));
pluginInterface.debugI(() -> ExceptionUtil.getStackTrace(ex));
} catch (Exception ex) {
pluginInterface.getLogger().warning(() -> "crashed during restore of " + regionInterface.getName());
pluginInterface.debugI(() -> ExceptionUtils.getStackTrace(ex));
pluginInterface.debugI(() -> ExceptionUtil.getStackTrace(ex));
}
return false;
}
Expand Down Expand Up @@ -290,10 +287,10 @@ public boolean saveRegionBlocks(File file, GeneralRegionInterface regionInterfac
return true;
} catch (IOException | WorldEditException ex) {
pluginInterface.getLogger().warning(() -> "An error occurred while saving schematic of " + regionInterface.getName() + ", enable debug to see the complete stacktrace");
pluginInterface.debugI(() -> ExceptionUtils.getStackTrace(ex));
pluginInterface.debugI(() -> ExceptionUtil.getStackTrace(ex));
} catch (Exception ex) {
pluginInterface.getLogger().warning("crashed during save of " + regionInterface.getName());
pluginInterface.debugI(() -> ExceptionUtils.getStackTrace(ex));
pluginInterface.debugI(() -> ExceptionUtil.getStackTrace(ex));
}
return false;
}
Expand Down Expand Up @@ -329,7 +326,7 @@ private boolean failedClearEntities(World world, Region region, GeneralRegionInt
return false;
} catch (WorldEditException ex) {
pluginInterface.getLogger().warning("crashed during save of " + regionInterface.getName());
pluginInterface.debugI(ExceptionUtils.getStackTrace(ex));
pluginInterface.debugI(ExceptionUtil.getStackTrace(ex));
return true;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@
import com.sk89q.worldedit.world.entity.EntityTypes;
import com.sk89q.worldguard.protection.regions.ProtectedRegion;
import me.wiefferink.areashop.interfaces.AreaShopInterface;
import me.wiefferink.areashop.interfaces.ExceptionUtil;
import me.wiefferink.areashop.interfaces.GeneralRegionInterface;
import me.wiefferink.areashop.interfaces.WorldEditInterface;
import me.wiefferink.areashop.interfaces.WorldEditSelection;
import org.apache.commons.lang.exception.ExceptionUtils;
import org.bukkit.entity.Player;

import java.io.File;
Expand All @@ -38,7 +38,6 @@
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.Objects;

public class WorldEditHandler extends WorldEditInterface {

Expand Down Expand Up @@ -119,11 +118,13 @@ public boolean restoreRegionBlocks(File rawFile, GeneralRegionInterface regionIn
Operations.complete(operation);
return true;
} catch (IOException | WorldEditException ex) {

pluginInterface.getLogger().warning(() ->"An error occurred while restoring schematic of " + regionInterface.getName() + ", enable debug to see the complete stacktrace");
pluginInterface.debugI(() -> ExceptionUtils.getStackTrace(ex));

pluginInterface.debugI(() -> ExceptionUtil.getStackTrace(ex));
} catch (Exception ex) {
pluginInterface.getLogger().warning(() -> "crashed during restore of " + regionInterface.getName());
pluginInterface.debugI(() -> ExceptionUtils.getStackTrace(ex));
pluginInterface.debugI(() -> ExceptionUtil.getStackTrace(ex));
}
return false;
}
Expand Down Expand Up @@ -153,18 +154,18 @@ public boolean saveRegionBlocks(File file, GeneralRegionInterface regionInterfac
Operations.complete(copy);
} catch (WorldEditException ex) {
pluginInterface.getLogger().warning(() -> "An error occurred while saving schematic of " + regionInterface.getName() + ", enable debug to see the complete stacktrace");
pluginInterface.debugI(() -> ExceptionUtils.getStackTrace(ex));
pluginInterface.debugI(() -> ExceptionUtil.getStackTrace(ex));
}
try (OutputStream os = new FileOutputStream(targetFile);
ClipboardWriter writer = format.getWriter(os)) {
writer.write(clipboard);
return true;
} catch (IOException ex) {
pluginInterface.getLogger().warning(() -> "An error occurred while saving schematic of " + regionInterface.getName() + ", enable debug to see the complete stacktrace");
pluginInterface.debugI(() -> ExceptionUtils.getStackTrace(ex));
pluginInterface.debugI(() -> ExceptionUtil.getStackTrace(ex));
} catch (Exception ex) {
pluginInterface.getLogger().warning(() -> "crashed during save of " + regionInterface.getName());
pluginInterface.debugI(() -> ExceptionUtils.getStackTrace(ex));
pluginInterface.debugI(() -> ExceptionUtil.getStackTrace(ex));
}
return false;
}
Expand Down Expand Up @@ -192,7 +193,7 @@ private boolean failedClearEntities(World world, Region region, GeneralRegionInt
return false;
} catch (WorldEditException ex) {
pluginInterface.getLogger().warning("crashed during save of " + regionInterface.getName());
pluginInterface.debugI(ExceptionUtils.getStackTrace(ex));
pluginInterface.debugI(ExceptionUtil.getStackTrace(ex));
return true;
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package me.wiefferink.areashop.interfaces;

import javax.annotation.Nonnull;
import java.io.PrintWriter;
import java.io.StringWriter;

public class ExceptionUtil {

private ExceptionUtil() {
throw new IllegalStateException("Cannot instantiate static utility class");
}

@Nonnull
public static String getStackTrace(@Nonnull Throwable throwable) {
// Taken from Commons lang 3
final StringWriter writer = new StringWriter();
throwable.printStackTrace(new PrintWriter(writer, true));
return writer.toString();
}

@Nonnull
public static String dumpCurrentStack() {
return getStackTrace(new Exception());
}

}
10 changes: 8 additions & 2 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ plugins {
java
`java-library`
`maven-publish`
id("io.papermc.paperweight.userdev") version "1.5.11" apply false
id("io.papermc.paperweight.userdev") version "1.7.0" apply false
id("com.github.spotbugs") version "5.1.3"
idea
eclipse
Expand All @@ -14,7 +14,7 @@ plugins {
group = "me.wiefferink"
version = "2.8.0"

val targetJavaVersion = 17
val targetJavaVersion = 21
val encoding = Charsets.UTF_8
val encodingName: String = encoding.name()

Expand All @@ -37,6 +37,12 @@ subprojects {
repositories {
mavenCentral()
maven("https://oss.sonatype.org/content/groups/public/")
maven(url = "https://s01.oss.sonatype.org/content/repositories/snapshots/") {
name = "sonatype-oss-snapshots"
mavenContent {
snapshotsOnly()
}
}
maven("https://repo.papermc.io/repository/maven-public/")
maven("https://hub.spigotmc.org/nexus/content/repositories/snapshots/")
maven {
Expand Down
6 changes: 3 additions & 3 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
[versions]
# Platforms
minecraft = "1.17.1-R0.1-SNAPSHOT"
minecraft = "1.20.6-R0.1-SNAPSHOT"

# Minecraft Plugins
worldedit = "7.2.18"
worldedit = "7.3.0"
worldguard = "7.0.9"
fawe = "2.8.4"
fawe = "2.9.2"

[libraries]
# Platform
Expand Down

0 comments on commit 49a4b14

Please sign in to comment.