Merge branch 'development'

This commit is contained in:
Brianna 2020-11-11 15:20:39 -06:00
commit 5edec0520a
7 changed files with 46 additions and 32 deletions

View File

@ -5,7 +5,7 @@
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>com.songoda</groupId> <groupId>com.songoda</groupId>
<artifactId>skyblock</artifactId> <artifactId>skyblock</artifactId>
<version>2.3.16</version> <version>2.3.17</version>
<packaging>jar</packaging> <packaging>jar</packaging>
<properties> <properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
@ -142,7 +142,7 @@
<dependency> <dependency>
<groupId>io.papermc</groupId> <groupId>io.papermc</groupId>
<artifactId>paperlib</artifactId> <artifactId>paperlib</artifactId>
<version>1.0.4</version> <version>LATEST</version>
<scope>compile</scope> <scope>compile</scope>
</dependency> </dependency>
<dependency> <dependency>

View File

@ -57,30 +57,32 @@ public class BiomeManager {
AtomicInteger progress = new AtomicInteger(); AtomicInteger progress = new AtomicInteger();
ChunkLoader.startChunkLoadingPerChunk(island, world, plugin.isPaperAsync(), (cachedChunk) -> { ChunkLoader.startChunkLoadingPerChunk(island, world, plugin.isPaperAsync(), (cachedChunk) -> {
Chunk chunk = cachedChunk.getChunk(); // I don't like this. But CompletableFuture#join causes a crash on some setups.
try { cachedChunk.getChunk().thenAccept(chunk -> {
if (chunk != null) try {
biome.setBiome(chunk); if (chunk != null)
} catch (IllegalAccessException | InvocationTargetException e) { biome.setBiome(chunk);
e.printStackTrace(); } catch (IllegalAccessException | InvocationTargetException e) {
} e.printStackTrace();
progress.getAndIncrement();
if(language.getBoolean("Command.Island.Biome.Progress.Should-Display-Message") &&
progress.get() == 1 || progress.get() == chunkAmount || progress.get() % runEveryX == 0){
final double percent = ((double) progress.get() / (double) chunkAmount) * 100;
String message = language.getString("Command.Island.Biome.Progress.Message");
message = message.replace("%current_updated_chunks%", String.valueOf(progress.get()));
message = message.replace("%max_chunks%", String.valueOf(chunkAmount));
message = message.replace("%percent_whole%", String.valueOf((int) percent));
message = message.replace("%percent%", NumberFormat.getInstance().format(percent));
for (Player player : SkyBlock.getInstance().getIslandManager().getPlayersAtIsland(island)) {
plugin.getMessageManager().sendMessage(player, message);
} }
}
progress.getAndIncrement();
if (language.getBoolean("Command.Island.Biome.Progress.Should-Display-Message") &&
progress.get() == 1 || progress.get() == chunkAmount || progress.get() % runEveryX == 0) {
final double percent = ((double) progress.get() / (double) chunkAmount) * 100;
String message = language.getString("Command.Island.Biome.Progress.Message");
message = message.replace("%current_updated_chunks%", String.valueOf(progress.get()));
message = message.replace("%max_chunks%", String.valueOf(chunkAmount));
message = message.replace("%percent_whole%", String.valueOf((int) percent));
message = message.replace("%percent%", NumberFormat.getInstance().format(percent));
for (Player player : SkyBlock.getInstance().getIslandManager().getPlayersAtIsland(island)) {
plugin.getMessageManager().sendMessage(player, message);
}
}
});
}, (island1 -> { }, (island1 -> {
removeUpdatingIsland(island1); removeUpdatingIsland(island1);
if(task != null) { if(task != null) {

View File

@ -7,6 +7,7 @@ import org.bukkit.ChunkSnapshot;
import org.bukkit.World; import org.bukkit.World;
import java.util.Objects; import java.util.Objects;
import java.util.concurrent.CompletableFuture;
public class CachedChunk { public class CachedChunk {
@ -41,11 +42,11 @@ public class CachedChunk {
return this.z; return this.z;
} }
public Chunk getChunk() { public CompletableFuture<Chunk> getChunk() {
World world = Bukkit.getWorld(this.world); World world = Bukkit.getWorld(this.world);
if (world == null) if (world == null)
return null; return null;
return PaperLib.getChunkAtAsync(world, this.x, this.z).join(); return PaperLib.getChunkAtAsync(world, this.x, this.z);
} }
public ChunkSnapshot getSnapshot() { public ChunkSnapshot getSnapshot() {
@ -55,7 +56,7 @@ public class CachedChunk {
} }
public ChunkSnapshot takeSnapshot() { public ChunkSnapshot takeSnapshot() {
return this.latestSnapshot = getChunk().getChunkSnapshot(); return this.latestSnapshot = getChunk().join().getChunkSnapshot();
} }
@Override @Override

View File

@ -43,6 +43,12 @@ public class TeleportCommand extends SubCommand {
messageManager.sendMessage(player, configLoad.getString("Command.Island.Teleport.Island.None.Message", "Command.Island.Teleport.Island.None.Message")); messageManager.sendMessage(player, configLoad.getString("Command.Island.Teleport.Island.None.Message", "Command.Island.Teleport.Island.None.Message"));
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F); soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
if (plugin.getIslandManager().getIsland(player) == null) {
String commandToExecute = configLoad.getString("Command.IslandTeleport.Aliases.NoIsland", "");
if (!commandToExecute.equals(""))
Bukkit.dispatchCommand(player, commandToExecute);
}
return; return;
} }
UUID islandOwnerUUID = island.getOwnerUUID(); UUID islandOwnerUUID = island.getOwnerUUID();

View File

@ -718,7 +718,8 @@ public class BlockListeners implements Listener {
org.bukkit.block.Block placeLocation = event.getBlock().getRelative(dispenserDirection); org.bukkit.block.Block placeLocation = event.getBlock().getRelative(dispenserDirection);
if (this.plugin.getConfiguration().getBoolean("Island.Nether.AllowNetherWater", false)) if (CompatibleMaterial.getMaterial(event.getItem()) == CompatibleMaterial.WATER_BUCKET
&& this.plugin.getConfiguration().getBoolean("Island.Nether.AllowNetherWater", false))
placeLocation.setType(Material.WATER); placeLocation.setType(Material.WATER);
Island island = islandManager.getIslandAtLocation(placeLocation.getLocation()); Island island = islandManager.getIslandAtLocation(placeLocation.getLocation());

View File

@ -10,6 +10,10 @@ Command:
Aliases: Aliases:
IslandOwned: "island controlpanel" IslandOwned: "island controlpanel"
NoIsland: "island create" NoIsland: "island create"
IslandTeleport:
# What command should be executed on /island teleport
Aliases:
NoIsland: "island create"
Sound: Sound:
# When disabled all sounds will be disabled. # When disabled all sounds will be disabled.
Enable: true Enable: true

View File

@ -6,11 +6,11 @@ description: A unique SkyBlock plugin
author: Songoda author: Songoda
authors: [ Fabrimat ] authors: [ Fabrimat ]
softdepend: [ HolographicDisplays, Holograms, CMI, PlaceholderAPI, MVdWPlaceholderAPI, Vault, Reserve, PlayerPoints, softdepend: [ HolographicDisplays, Holograms, CMI, PlaceholderAPI, MVdWPlaceholderAPI, Vault, Reserve, PlayerPoints,
LeaderHeads, EpicSpawners, UltimateStacker, WorldEdit, Residence, CoreProtect, CMIEInjector ] LeaderHeads, EpicSpawners, UltimateStacker, WorldEdit, Residence, CoreProtect, CMIEInjector,
loadbefore: [ Multiverse-Core, ProtocolLib ] Multiverse-Core, ProtocolLib ]
commands: commands:
island: island:
description: Island command description: Island command
aliases: [ is ] aliases: [ is ]
skyblock: skyblock:
description: Skyblock info command. description: Skyblock info command.