Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removed PaperLib #2577

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 22 additions & 21 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>21</java.version>
<maven.compiler.source>21</maven.compiler.source>
<maven.compiler.target>21</maven.compiler.target>
<!-- Non-minecraft related dependencies -->
<powermock.version>2.0.9</powermock.version>
<!-- Database related dependencies -->
Expand Down Expand Up @@ -145,6 +147,10 @@
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
<repository>
<id>papermc</id>
<url>https://repo.papermc.io/repository/maven-public/</url>
</repository>
<repository>
<id>spigot-repo</id>
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots</url>
Expand All @@ -158,8 +164,14 @@
<url>https://repo.mikeprimm.com/</url>
</repository>
<repository>
<id>papermc</id>
<url>https://repo.papermc.io/repository/maven-public/</url>
<!-- This is a temporary reference as the Maven Shade plugin
that supports Java 16 is not released yet -->
<id>maven-snapshots</id>
<url>https://repository.apache.org/content/repositories/snapshots/</url>

<id>papermc</id>
<url>https://repo.papermc.io/repository/maven-public/</url>

</repository>
<repository>
<id>minecraft-repo</id>
Expand Down Expand Up @@ -233,6 +245,13 @@
<version>4.2.2</version>
<scope>test</scope>
</dependency>
<!-- Paper API -->
<dependency>
<groupId>io.papermc.paper</groupId>
<artifactId>paper-api</artifactId>
<version>${paper.version}</version>
<scope>provided</scope>
</dependency>
<!-- Spigot API -->
<dependency>
<groupId>org.spigotmc</groupId>
Expand Down Expand Up @@ -269,20 +288,13 @@
<artifactId>spigot</artifactId>
<version>1.20.2-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
</dependency>
<dependency>
<groupId>org.spigotmc...</groupId>
<artifactId>spigot</artifactId>
<version>1.20.1-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<!-- Paper API -->
<dependency>
<groupId>io.papermc.paper</groupId>
<artifactId>paper-api</artifactId>
<version>${paper.version}</version>
<scope>provided</scope>
</dependency>
<!-- Metrics -->
<dependency>
<groupId>org.bstats</groupId>
Expand Down Expand Up @@ -357,13 +369,6 @@
<artifactId>org.eclipse.jdt.annotation</artifactId>
<version>2.2.600</version>
</dependency>
<!-- PaperLib -->
<dependency>
<groupId>io.papermc</groupId>
<artifactId>paperlib</artifactId>
<version>1.0.6</version>
<scope>compile</scope>
</dependency>
<!-- LangUtils -->
<dependency>
<groupId>com.github.apachezy</groupId>
Expand Down Expand Up @@ -460,10 +465,6 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<release>${java.version}</release>
<!-- <source>${java.version}</source> <target>${java.version}</target> -->
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
import org.bukkit.util.Vector;
import org.eclipse.jdt.annotation.NonNull;

import io.papermc.lib.PaperLib;
import world.bentobox.bentobox.BentoBox;
import world.bentobox.bentobox.api.flags.FlagListener;
import world.bentobox.bentobox.api.user.User;
Expand Down Expand Up @@ -164,7 +163,7 @@ private void eject(Player player) {
// We'll try to teleport him to the spawn...
Location l = player.getWorld().getSpawnLocation();
if (l != null) {
PaperLib.teleportAsync(player, l);
player.teleportAsync(l);
}

// Switch him back to the default gamemode. He may die, sorry :(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;

import io.papermc.lib.PaperLib;
import world.bentobox.bentobox.BentoBox;
import world.bentobox.bentobox.api.events.IslandBaseEvent;
import world.bentobox.bentobox.api.events.island.IslandEvent;
Expand Down Expand Up @@ -1080,7 +1079,7 @@ private CompletableFuture<Boolean> homeTeleportAsync(@NonNull World world, @NonN
.ifFail(() -> goingHome.remove(user.getUniqueId())).buildFuture().thenAccept(result::complete);
return;
}
PaperLib.teleportAsync(Objects.requireNonNull(player), home).thenAccept(b -> {
Objects.requireNonNull(player).teleportAsync(home).thenAccept(b -> {
// Only run the commands if the player is successfully teleported
if (Boolean.TRUE.equals(b)) {
teleported(world, user, name, newIsland, island);
Expand Down Expand Up @@ -1469,7 +1468,7 @@ public void removePlayersFromIsland(Island island) {
} else {
// Move player to spawn
getSpawn(w).map(i -> i.getSpawnPoint(w.getEnvironment())).filter(Objects::nonNull)
.ifPresentOrElse(sp -> PaperLib.teleportAsync(p, sp),
.ifPresentOrElse(p::teleportAsync,
() -> plugin.logWarning("Spawn exists but its location is null!"));

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.jdt.annotation.Nullable;

import io.papermc.lib.PaperLib;
import world.bentobox.bentobox.BentoBox;
import world.bentobox.bentobox.api.addons.GameModeAddon;
import world.bentobox.bentobox.api.hooks.Hook;
Expand Down Expand Up @@ -148,7 +147,7 @@ private CompletableFuture<Void> regenerateChunk(@Nullable IslandDeletion di, @No
CompletableFuture<Chunk> seedWorldFuture = getSeedWorldChunk(world, chunkX, chunkZ);

// Set up a future to get the chunk requests using Paper's Lib. If Paper is used, this should be done async
CompletableFuture<Chunk> chunkFuture = PaperLib.getChunkAtAsync(world, chunkX, chunkZ);
CompletableFuture<Chunk> chunkFuture = world.getChunkAtAsync(chunkX, chunkZ);

// If there is no island, do not clean chunk
CompletableFuture<Void> cleanFuture = di != null ? cleanChunk(chunkFuture, di) : CompletableFuture.completedFuture(null);
Expand All @@ -172,7 +171,7 @@ private CompletableFuture<Void> regenerateChunk(@Nullable IslandDeletion di, @No
private CompletableFuture<Chunk> getSeedWorldChunk(World world, int chunkX, int chunkZ) {
World seed = Bukkit.getWorld(world.getName() + "/bentobox");
if (seed == null) return CompletableFuture.completedFuture(null);
return PaperLib.getChunkAtAsync(seed, chunkX, chunkZ);
return seed.getChunkAtAsync(chunkX, chunkZ);
}

/**
Expand Down Expand Up @@ -374,7 +373,7 @@ private boolean isEnded(int chunkX) {
@SuppressWarnings("deprecation")
private CompletableFuture<Void> regenerateChunk(GameModeAddon gm, IslandDeletion di, @Nonnull World world,
int chunkX, int chunkZ) {
CompletableFuture<Chunk> chunkFuture = PaperLib.getChunkAtAsync(world, chunkX, chunkZ);
CompletableFuture<Chunk> chunkFuture = world.getChunkAtAsync(chunkX, chunkZ);
CompletableFuture<Void> invFuture = chunkFuture.thenAccept(chunk ->
Arrays.stream(chunk.getTileEntities()).filter(InventoryHolder.class::isInstance)
.filter(te -> di.inBounds(te.getLocation().getBlockX(), te.getLocation().getBlockZ()))
Expand Down
Loading