Update PaperLib usage

This commit is contained in:
Fabrizio La Rosa 2020-06-22 19:06:25 +02:00
parent c099cab081
commit 5eda67adcd
3 changed files with 41 additions and 4 deletions

28
pom.xml
View File

@ -60,12 +60,14 @@
<goal>shade</goal>
</goals>
<configuration>
<dependencyReducedPomLocation>${project.build.directory}/dependency-reduced-pom.xml</dependencyReducedPomLocation>
<shadedArtifactAttached>false</shadedArtifactAttached>
<createDependencyReducedPom>false</createDependencyReducedPom>
<minimizeJar>true</minimizeJar>
<artifactSet>
<includes>
<include>com.songoda:SongodaCore</include>
<include>io.papermc:paperlib</include>
</includes>
</artifactSet>
<filters>
@ -83,6 +85,10 @@
<pattern>com.songoda.core</pattern>
<shadedPattern>${project.groupId}.skyblock.core</shadedPattern>
</relocation>
<relocation>
<pattern>io.papermc.lib</pattern>
<shadedPattern>${project.groupId}.paperlib</shadedPattern>
</relocation>
</relocations>
</configuration>
</execution>
@ -100,6 +106,10 @@
<id>spigot-repo</id>
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
</repository>
<repository>
<id>papermc</id>
<url>https://papermc.io/repo/repository/maven-public/</url>
</repository>
<repository>
<id>minecraft-repo</id>
<url>https://libraries.minecraft.net/</url>
@ -126,11 +136,29 @@
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>io.papermc</groupId>
<artifactId>paperlib</artifactId>
<version>1.0.3</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.destroystokyo.papermc</groupId>
<artifactId>paper</artifactId>
<version>1.15.2</version>
<scope>provided</scope>
<exclusions>
<exclusion>
<groupId>io.papermc</groupId>
<artifactId>paperlib</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot</artifactId>
<version>1.15</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.github.MilkBowl</groupId>

View File

@ -45,6 +45,7 @@ import com.songoda.skyblock.visit.VisitManager;
import com.songoda.skyblock.visit.VisitTask;
import com.songoda.skyblock.world.WorldManager;
import com.songoda.skyblock.world.generator.VoidGenerator;
import io.papermc.lib.PaperLib;
import net.coreprotect.CoreProtect;
import net.coreprotect.CoreProtectAPI;
import org.bukkit.Bukkit;
@ -94,6 +95,7 @@ public class SkyBlock extends SongodaPlugin {
private CoreProtectAPI coreProtectAPI;
private boolean paper;
private boolean paperAsync;
private final GuiManager guiManager = new GuiManager(this);
@ -110,11 +112,14 @@ public class SkyBlock extends SongodaPlugin {
public void onPluginEnable() {
paper = false;
/*try {
try {
Class.forName("com.destroystokyo.paper.PaperConfig");
paper = true;
Bukkit.getLogger().info("Enabling Paper hooks");
} catch (ClassNotFoundException ignored) {}*/
paperAsync = Bukkit.spigot().getPaperConfig().getBoolean("settings.async-chunks.enable", false);
this.getLogger().info("Enabling Paper hooks");
} catch (ClassNotFoundException ignored) {
PaperLib.suggestPaper(this);
}
// Run Songoda Updater
SongodaCore.registerPlugin(this, 17, CompatibleMaterial.GRASS_BLOCK);
@ -429,4 +434,8 @@ public class SkyBlock extends SongodaPlugin {
public boolean isPaper() {
return paper;
}
public boolean isPaperAsync() {
return paperAsync;
}
}

View File

@ -63,7 +63,7 @@ public final class IslandScan extends BukkitRunnable {
final Map<World, List<ChunkSnapshot>> snapshots = new HashMap<>(3);
if (skyblock.isPaper() && Bukkit.spigot().getPaperConfig().getBoolean("settings.async-chunks.enable", false)) {
if (skyblock.isPaperAsync()) {
Bukkit.getScheduler().runTaskAsynchronously(plugin, () -> {
populate(snapshots, IslandWorld.Normal, true);
if (hasNether) populate(snapshots, IslandWorld.Nether, true);