diff --git a/Bukkit/build.gradle b/Bukkit/build.gradle
index 821174878..8e32904c5 100644
--- a/Bukkit/build.gradle
+++ b/Bukkit/build.gradle
@@ -28,7 +28,7 @@ dependencies {
exclude(module: "bukkit")
}
- compile("io.papermc:paperlib:1.0.2")
+ compile("io.papermc:paperlib:1.0.4")
implementation("net.kyori:text-adapter-bukkit:3.0.3")
compile("com.github.MilkBowl:VaultAPI:1.7") {
exclude(module: "bukkit")
@@ -96,7 +96,7 @@ task copyFiles {
shadowJar {
dependencies {
include(dependency(":PlotSquared-Core"))
- include(dependency("io.papermc:paperlib:1.0.2"))
+ include(dependency("io.papermc:paperlib:1.0.4"))
include(dependency("net.kyori:text-adapter-bukkit:3.0.3"))
include(dependency("org.bstats:bstats-bukkit:1.7"))
include(dependency("org.khelekore:prtree:1.7.0-SNAPSHOT"))
diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/BukkitPlatform.java b/Bukkit/src/main/java/com/plotsquared/bukkit/BukkitPlatform.java
index 1027ea88d..e40b6698e 100644
--- a/Bukkit/src/main/java/com/plotsquared/bukkit/BukkitPlatform.java
+++ b/Bukkit/src/main/java/com/plotsquared/bukkit/BukkitPlatform.java
@@ -389,9 +389,11 @@ import static com.plotsquared.core.util.ReflectionUtils.getRefClass;
logger.info("[P2] (UUID) Using the offline mode UUID service");
}
- final OfflinePlayerUUIDService offlinePlayerUUIDService = new OfflinePlayerUUIDService();
- this.impromptuPipeline.registerService(offlinePlayerUUIDService);
- this.backgroundPipeline.registerService(offlinePlayerUUIDService);
+ if (Settings.UUID.SERVICE_BUKKIT) {
+ final OfflinePlayerUUIDService offlinePlayerUUIDService = new OfflinePlayerUUIDService();
+ this.impromptuPipeline.registerService(offlinePlayerUUIDService);
+ this.backgroundPipeline.registerService(offlinePlayerUUIDService);
+ }
final SQLiteUUIDService sqLiteUUIDService = new SQLiteUUIDService("user_cache.db");
@@ -404,7 +406,8 @@ import static com.plotsquared.core.util.ReflectionUtils.getRefClass;
}
final LuckPermsUUIDService luckPermsUUIDService;
- if (Bukkit.getPluginManager().getPlugin("LuckPerms") != null) {
+ if (Settings.UUID.SERVICE_LUCKPERMS &&
+ Bukkit.getPluginManager().getPlugin("LuckPerms") != null) {
luckPermsUUIDService = new LuckPermsUUIDService();
logger.info("[P2] (UUID) Using LuckPerms as a complementary UUID service");
} else {
@@ -412,7 +415,8 @@ import static com.plotsquared.core.util.ReflectionUtils.getRefClass;
}
final BungeePermsUUIDService bungeePermsUUIDService;
- if (Bukkit.getPluginManager().getPlugin("BungeePerms") != null) {
+ if (Settings.UUID.SERVICE_BUNGEE_PERMS &&
+ Bukkit.getPluginManager().getPlugin("BungeePerms") != null) {
bungeePermsUUIDService = new BungeePermsUUIDService();
logger.info("[P2] (UUID) Using BungeePerms as a complementary UUID service");
} else {
@@ -420,16 +424,16 @@ import static com.plotsquared.core.util.ReflectionUtils.getRefClass;
}
final EssentialsUUIDService essentialsUUIDService;
- if (Bukkit.getPluginManager().getPlugin("Essentials") != null) {
+ if (Settings.UUID.SERVICE_ESSENTIALSX && Bukkit.getPluginManager().getPlugin("Essentials") != null) {
essentialsUUIDService = new EssentialsUUIDService();
- logger.info("[P2] (UUID) Using Essentials as a complementary UUID service");
+ logger.info("[P2] (UUID) Using EssentialsX as a complementary UUID service");
} else {
essentialsUUIDService = null;
}
if (!Settings.UUID.OFFLINE) {
// If running Paper we'll also try to use their profiles
- if (PaperLib.isPaper()) {
+ if (Bukkit.getOnlineMode() && PaperLib.isPaper() && Settings.UUID.SERVICE_PAPER) {
final PaperUUIDService paperUUIDService = new PaperUUIDService();
this.impromptuPipeline.registerService(paperUUIDService);
this.backgroundPipeline.registerService(paperUUIDService);
diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/listener/PlayerEvents.java b/Bukkit/src/main/java/com/plotsquared/bukkit/listener/PlayerEvents.java
index d218beac0..ce868a61e 100644
--- a/Bukkit/src/main/java/com/plotsquared/bukkit/listener/PlayerEvents.java
+++ b/Bukkit/src/main/java/com/plotsquared/bukkit/listener/PlayerEvents.java
@@ -1535,8 +1535,9 @@ import java.util.regex.Pattern;
}
for (Block block1 : event.getBlocks()) {
Location bloc = BukkitUtil.getLocation(block1.getLocation());
- if (bloc.isPlotArea() || bloc.add(relative.getBlockX(),
- relative.getBlockY(), relative.getBlockZ()).isPlotArea()) {
+ if (bloc.isPlotArea() || bloc
+ .add(relative.getBlockX(), relative.getBlockY(), relative.getBlockZ())
+ .isPlotArea()) {
event.setCancelled(true);
return;
}
@@ -1567,8 +1568,8 @@ import java.util.regex.Pattern;
return;
}
}
- if (!plot.equals(area.getOwnedPlot(location.add(
- relative.getBlockX(), relative.getBlockY(), relative.getBlockZ())))) {
+ if (!plot.equals(area.getOwnedPlot(
+ location.add(relative.getBlockX(), relative.getBlockY(), relative.getBlockZ())))) {
// This branch is only necessary to prevent pistons from extending
// if they are: on a plot edge, facing outside the plot, and not
// pushing any blocks
@@ -1589,8 +1590,9 @@ import java.util.regex.Pattern;
}
for (Block block1 : event.getBlocks()) {
Location bloc = BukkitUtil.getLocation(block1.getLocation());
- if (bloc.isPlotArea() || bloc.add(relative.getBlockX(),
- relative.getBlockY(), relative.getBlockZ()).isPlotArea()) {
+ if (bloc.isPlotArea() || bloc
+ .add(relative.getBlockX(), relative.getBlockY(), relative.getBlockZ())
+ .isPlotArea()) {
event.setCancelled(true);
return;
}
@@ -1976,7 +1978,7 @@ import java.util.regex.Pattern;
}
if (event.getAction() == Action.RIGHT_CLICK_AIR) {
Material item = event.getMaterial();
- if (item.toString().toLowerCase().endsWith("egg")) {
+ if (item.toString().toLowerCase().endsWith("_egg")) {
event.setCancelled(true);
event.setUseItemInHand(Event.Result.DENY);
}
@@ -1988,7 +1990,7 @@ import java.util.regex.Pattern;
if (type == Material.AIR) {
type = offType;
}
- if (type.toString().toLowerCase().endsWith("egg")) {
+ if (type.toString().toLowerCase().endsWith("_egg")) {
Block block = player.getTargetBlockExact(5, FluidCollisionMode.SOURCE_ONLY);
if (block != null && block.getType() != Material.AIR) {
Location location = BukkitUtil.getLocation(block.getLocation());
diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/queue/ChunkCoordinator.java b/Bukkit/src/main/java/com/plotsquared/bukkit/queue/ChunkCoordinator.java
new file mode 100644
index 000000000..cc5c1f72f
--- /dev/null
+++ b/Bukkit/src/main/java/com/plotsquared/bukkit/queue/ChunkCoordinator.java
@@ -0,0 +1,326 @@
+/*
+ * _____ _ _ _____ _
+ * | __ \| | | | / ____| | |
+ * | |__) | | ___ | |_| (___ __ _ _ _ __ _ _ __ ___ __| |
+ * | ___/| |/ _ \| __|\___ \ / _` | | | |/ _` | '__/ _ \/ _` |
+ * | | | | (_) | |_ ____) | (_| | |_| | (_| | | | __/ (_| |
+ * |_| |_|\___/ \__|_____/ \__, |\__,_|\__,_|_| \___|\__,_|
+ * | |
+ * |_|
+ * PlotSquared plot management system for Minecraft
+ * Copyright (C) 2020 IntellectualSites
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see
+ * The coordinator takes in collection of chunk coordinates, loads them + * and allows the caller to specify a sink for the loaded chunks. The + * coordinator will prevent the chunks from being unloaded until the sink + * has fully consumed the chunk + *
+ * Usage: + *
{@code + * final ChunkCoordinator chunkCoordinator = ChunkCoordinator.builder() + * .inWorld(Objects.requireNonNull(Bukkit.getWorld("world"))).withChunk(BlockVector2.at(0, 0)) + * .withConsumer(chunk -> System.out.printf("Got chunk %d;%d", chunk.getX(), chunk.getZ())) + * .withFinalAction(() -> System.out.println("All chunks have been loaded")) + * .withThrowableConsumer(throwable -> System.err.println("Something went wrong... =(")) + * .withMaxIterationTime(25L) + * .build(); + * chunkCoordinator.subscribeToProgress((coordinator, progress) -> + * System.out.printf("Progress: %.1f", progress * 100.0f)); + * chunkCoordinator.start(); + * }+ * + * @author Alexander Söderberg + * @see #builder() To create a new coordinator instance + */ +public final class ChunkCoordinator extends BukkitRunnable { + + private final List