forked from Upstream/mmocore
Load chunks async when regenning blocks closes #75
This commit is contained in:
parent
47e145d384
commit
fff574c0dd
37
pom.xml
37
pom.xml
@ -51,6 +51,27 @@
|
||||
<argLine>-ea -Dfile.encoding=UTF-8</argLine>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-shade-plugin</artifactId>
|
||||
<version>3.2.4</version>
|
||||
<configuration>
|
||||
<relocations>
|
||||
<relocation>
|
||||
<pattern>io.papermc.lib</pattern>
|
||||
<shadedPattern>net.indyuce.mmocore.shaded.paperlib</shadedPattern>
|
||||
</relocation>
|
||||
</relocations>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>shade</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
<repositories>
|
||||
@ -66,6 +87,10 @@
|
||||
<id>sk89q-repo</id>
|
||||
<url>https://maven.enginehub.org/repo/</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>papermc</id>
|
||||
<url>https://papermc.io/repo/repository/maven-public/</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
<dependencies>
|
||||
|
||||
@ -93,19 +118,27 @@
|
||||
<scope>system</scope>
|
||||
<systemPath>${basedir}/lib/spigot.jar</systemPath>
|
||||
</dependency>
|
||||
|
||||
|
||||
<!-- APIs -->
|
||||
<dependency>
|
||||
<groupId>org.jetbrains</groupId>
|
||||
<artifactId>annotations</artifactId>
|
||||
<version>19.0.0</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>mysql</groupId>
|
||||
<artifactId>mysql-connector-java</artifactId>
|
||||
<version>5.1.41</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.papermc</groupId>
|
||||
<artifactId>paperlib</artifactId>
|
||||
<version>1.0.5</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- Other Plugins -->
|
||||
<dependency>
|
||||
<groupId>com.bekvon.bukkit</groupId>
|
||||
|
@ -16,6 +16,7 @@ import org.bukkit.block.Block;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.entity.Entity;
|
||||
|
||||
import io.papermc.lib.PaperLib;
|
||||
import net.Indyuce.mmocore.MMOCore;
|
||||
import net.Indyuce.mmocore.api.block.BlockInfo;
|
||||
import net.Indyuce.mmocore.api.block.BlockInfo.RegeneratingBlock;
|
||||
@ -91,9 +92,13 @@ public class CustomBlockManager extends MMOManager {
|
||||
}
|
||||
|
||||
private void regen(RegeneratingBlock info, boolean shutdown) {
|
||||
info.getRegeneratingBlock().getBlock().place(info.getLocation(), info);
|
||||
info.getLocation().getBlock().getState().update();
|
||||
if(!shutdown) active.remove(info);
|
||||
Location infoLocation = info.getLocation();
|
||||
// Get the chunk and load it async if needed.
|
||||
PaperLib.getChunkAtAsync(infoLocation).whenComplete((chunk, ex) -> {
|
||||
info.getRegeneratingBlock().getBlock().place(infoLocation, info);
|
||||
info.getLocation().getBlock().getState().update();
|
||||
if(!shutdown) active.remove(info);
|
||||
});
|
||||
}
|
||||
|
||||
/*
|
||||
|
Loading…
Reference in New Issue
Block a user