mirror of
https://github.com/songoda/FabledSkyBlock.git
synced 2024-11-29 05:35:13 +01:00
Merge branch 'development'
This commit is contained in:
commit
5edec0520a
4
pom.xml
4
pom.xml
@ -5,7 +5,7 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>com.songoda</groupId>
|
||||
<artifactId>skyblock</artifactId>
|
||||
<version>2.3.16</version>
|
||||
<version>2.3.17</version>
|
||||
<packaging>jar</packaging>
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
@ -142,7 +142,7 @@
|
||||
<dependency>
|
||||
<groupId>io.papermc</groupId>
|
||||
<artifactId>paperlib</artifactId>
|
||||
<version>1.0.4</version>
|
||||
<version>LATEST</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
|
@ -57,30 +57,32 @@ public class BiomeManager {
|
||||
AtomicInteger progress = new AtomicInteger();
|
||||
|
||||
ChunkLoader.startChunkLoadingPerChunk(island, world, plugin.isPaperAsync(), (cachedChunk) -> {
|
||||
Chunk chunk = cachedChunk.getChunk();
|
||||
try {
|
||||
if (chunk != null)
|
||||
biome.setBiome(chunk);
|
||||
} 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);
|
||||
// I don't like this. But CompletableFuture#join causes a crash on some setups.
|
||||
cachedChunk.getChunk().thenAccept(chunk -> {
|
||||
try {
|
||||
if (chunk != null)
|
||||
biome.setBiome(chunk);
|
||||
} 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);
|
||||
}
|
||||
}
|
||||
});
|
||||
}, (island1 -> {
|
||||
removeUpdatingIsland(island1);
|
||||
if(task != null) {
|
||||
|
@ -7,6 +7,7 @@ import org.bukkit.ChunkSnapshot;
|
||||
import org.bukkit.World;
|
||||
|
||||
import java.util.Objects;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
|
||||
public class CachedChunk {
|
||||
|
||||
@ -41,11 +42,11 @@ public class CachedChunk {
|
||||
return this.z;
|
||||
}
|
||||
|
||||
public Chunk getChunk() {
|
||||
public CompletableFuture<Chunk> getChunk() {
|
||||
World world = Bukkit.getWorld(this.world);
|
||||
if (world == null)
|
||||
return null;
|
||||
return PaperLib.getChunkAtAsync(world, this.x, this.z).join();
|
||||
return PaperLib.getChunkAtAsync(world, this.x, this.z);
|
||||
}
|
||||
|
||||
public ChunkSnapshot getSnapshot() {
|
||||
@ -55,7 +56,7 @@ public class CachedChunk {
|
||||
}
|
||||
|
||||
public ChunkSnapshot takeSnapshot() {
|
||||
return this.latestSnapshot = getChunk().getChunkSnapshot();
|
||||
return this.latestSnapshot = getChunk().join().getChunkSnapshot();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -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"));
|
||||
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;
|
||||
}
|
||||
UUID islandOwnerUUID = island.getOwnerUUID();
|
||||
|
@ -718,7 +718,8 @@ public class BlockListeners implements Listener {
|
||||
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);
|
||||
|
||||
Island island = islandManager.getIslandAtLocation(placeLocation.getLocation());
|
||||
|
@ -10,6 +10,10 @@ Command:
|
||||
Aliases:
|
||||
IslandOwned: "island controlpanel"
|
||||
NoIsland: "island create"
|
||||
IslandTeleport:
|
||||
# What command should be executed on /island teleport
|
||||
Aliases:
|
||||
NoIsland: "island create"
|
||||
Sound:
|
||||
# When disabled all sounds will be disabled.
|
||||
Enable: true
|
||||
|
@ -6,11 +6,11 @@ description: A unique SkyBlock plugin
|
||||
author: Songoda
|
||||
authors: [ Fabrimat ]
|
||||
softdepend: [ HolographicDisplays, Holograms, CMI, PlaceholderAPI, MVdWPlaceholderAPI, Vault, Reserve, PlayerPoints,
|
||||
LeaderHeads, EpicSpawners, UltimateStacker, WorldEdit, Residence, CoreProtect, CMIEInjector ]
|
||||
loadbefore: [ Multiverse-Core, ProtocolLib ]
|
||||
LeaderHeads, EpicSpawners, UltimateStacker, WorldEdit, Residence, CoreProtect, CMIEInjector,
|
||||
Multiverse-Core, ProtocolLib ]
|
||||
commands:
|
||||
island:
|
||||
description: Island command
|
||||
aliases: [ is ]
|
||||
skyblock:
|
||||
description: Skyblock info command.
|
||||
description: Skyblock info command.
|
Loading…
Reference in New Issue
Block a user