diff --git a/Bukkit/build.gradle b/Bukkit/build.gradle index 0b8bf2714..2affa47cd 100644 --- a/Bukkit/build.gradle +++ b/Bukkit/build.gradle @@ -13,6 +13,7 @@ repositories { url = "https://papermc.io/repo/repository/maven-public/" } maven { url = "https://ci.ender.zone/plugin/repository/everything/" } + maven { url = "https://mvn.intellectualsites.com/content/repositories/releases" } maven { url = "https://mvn.intellectualsites.com/content/repositories/snapshots" } maven { url = "https://repo.wea-ondara.net/repository/public/" } maven { url = "https://oss.sonatype.org/content/repositories/snapshots/" } @@ -28,7 +29,6 @@ dependencies { implementation("org.spigotmc:spigot-api:1.16.2-R0.1-SNAPSHOT") compile(group: "com.sk89q.worldedit", name: "worldedit-bukkit", version: "7.2.0-SNAPSHOT") { exclude(module: "bukkit") - } compile("io.papermc:paperlib:1.0.4") implementation("net.kyori:text-adapter-bukkit:3.0.3") @@ -45,7 +45,7 @@ dependencies { implementation('net.kyori:adventure-text-minimessage:4.0.0-SNAPSHOT') compile("se.hyperver.hyperverse:Core:0.6.0-SNAPSHOT"){ transitive = false } compile('com.sk89q:squirrelid:1.0.0-SNAPSHOT'){ transitive = false } - compile('be.maximvdw:MVdWPlaceholderAPI:3.1.1-SNAPSHOT'){ transitive = false } + compile('be.maximvdw:MVdWPlaceholderAPI:3.1.1'){ transitive = false } // logging implementation('org.apache.logging.log4j:log4j-slf4j-impl:2.8.1') } diff --git a/Bukkit/pom.xml b/Bukkit/pom.xml index 291bb536c..e95ab6610 100644 --- a/Bukkit/pom.xml +++ b/Bukkit/pom.xml @@ -93,7 +93,7 @@ be.maximvdw MVdWPlaceholderAPI - 3.1.1-SNAPSHOT + 3.1.1 compile diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/BukkitPlatform.java b/Bukkit/src/main/java/com/plotsquared/bukkit/BukkitPlatform.java index bca3318cf..bdad258d7 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/BukkitPlatform.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/BukkitPlatform.java @@ -59,7 +59,6 @@ import com.plotsquared.bukkit.util.UpdateUtility; import com.plotsquared.bukkit.util.task.BukkitTaskManager; import com.plotsquared.bukkit.util.task.PaperTimeConverter; import com.plotsquared.bukkit.util.task.SpigotTimeConverter; -import com.plotsquared.bukkit.uuid.BungeePermsUUIDService; import com.plotsquared.bukkit.uuid.EssentialsUUIDService; import com.plotsquared.bukkit.uuid.LuckPermsUUIDService; import com.plotsquared.bukkit.uuid.OfflinePlayerUUIDService; @@ -423,14 +422,6 @@ public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPl luckPermsUUIDService = null; } - final BungeePermsUUIDService bungeePermsUUIDService; - if (Settings.UUID.SERVICE_BUNGEE_PERMS && Bukkit.getPluginManager().getPlugin("BungeePerms") != null) { - bungeePermsUUIDService = new BungeePermsUUIDService(); - logger.info("(UUID) Using BungeePerms as a complementary UUID service"); - } else { - bungeePermsUUIDService = null; - } - final EssentialsUUIDService essentialsUUIDService; if (Settings.UUID.SERVICE_ESSENTIALSX && Bukkit.getPluginManager().getPlugin("Essentials") != null) { essentialsUUIDService = new EssentialsUUIDService(); @@ -463,10 +454,6 @@ public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPl this.impromptuPipeline.registerService(luckPermsUUIDService); this.backgroundPipeline.registerService(luckPermsUUIDService); } - if (bungeePermsUUIDService != null) { - this.impromptuPipeline.registerService(bungeePermsUUIDService); - this.backgroundPipeline.registerService(bungeePermsUUIDService); - } if (essentialsUUIDService != null) { this.impromptuPipeline.registerService(essentialsUUIDService); this.backgroundPipeline.registerService(essentialsUUIDService); @@ -1047,13 +1034,21 @@ public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPl return new BukkitPlotGenerator(world, generator, this.plotAreaManager); } - @Override public List, Boolean>> getPluginIds() { - List, Boolean>> names = new ArrayList<>(); - for (final Plugin plugin : Bukkit.getPluginManager().getPlugins()) { - Map.Entry id = new AbstractMap.SimpleEntry<>(plugin.getName(), plugin.getDescription().getVersion()); - names.add(new AbstractMap.SimpleEntry<>(id, plugin.isEnabled())); + @Override public String getPluginList() { + StringBuilder msg = new StringBuilder(); + Plugin[] plugins = Bukkit.getServer().getPluginManager().getPlugins(); + msg.append("Plugins (").append(plugins.length).append("): \n"); + for (Plugin p : plugins) { + msg.append(" - ").append(p.getName()).append(":").append("\n") + .append(" • Version: ").append(p.getDescription().getVersion()).append("\n") + .append(" • Enabled: ").append(p.isEnabled()).append("\n") + .append(" • Main: ").append(p.getDescription().getMain()).append("\n") + .append(" • Authors: ").append(p.getDescription().getAuthors()).append("\n") + .append(" • Load Before: ").append(p.getDescription().getLoadBefore()).append("\n") + .append(" • Dependencies: ").append(p.getDescription().getDepend()).append("\n") + .append(" • Soft Dependencies: ").append(p.getDescription().getSoftDepend()).append("\n"); } - return names; + return msg.toString(); } @Override @Nonnull public com.plotsquared.core.location.World getPlatformWorld(@Nonnull final String worldName) { @@ -1061,7 +1056,7 @@ public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPl } @Override @Nonnull public Audience getConsoleAudience() { - return BukkitUtil.BUKKIT_AUDIENCES.audience(Bukkit.getConsoleSender()); + return BukkitUtil.BUKKIT_AUDIENCES.console(); } @Override public String getPluginName() { diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/listener/PaperListener.java b/Bukkit/src/main/java/com/plotsquared/bukkit/listener/PaperListener.java index 70413d799..73a823ffe 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/listener/PaperListener.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/listener/PaperListener.java @@ -229,18 +229,24 @@ public class PaperListener implements Listener { } Plot plot = location.getOwnedPlotAbs(); if (plot == null) { + EntityType type = event.getType(); if (!area.isMobSpawning()) { - EntityType type = event.getType(); switch (type) { case DROPPED_ITEM: if (Settings.Enabled_Components.KILL_ROAD_ITEMS) { event.setShouldAbortSpawn(true); event.setCancelled(true); - break; + return; } case PLAYER: return; } + if (type.isAlive()) { + event.setShouldAbortSpawn(true); + event.setCancelled(true); + } + } + if (!area.isMiscSpawnUnowned() && !type.isAlive()) { event.setShouldAbortSpawn(true); event.setCancelled(true); } diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/listener/PlayerEventListener.java b/Bukkit/src/main/java/com/plotsquared/bukkit/listener/PlayerEventListener.java index 713780bcb..496d19482 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/listener/PlayerEventListener.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/listener/PlayerEventListener.java @@ -90,6 +90,7 @@ import org.bukkit.FluidCollisionMode; import org.bukkit.Material; import org.bukkit.block.Block; import org.bukkit.block.BlockFace; +import org.bukkit.block.data.Waterlogged; import org.bukkit.command.PluginCommand; import org.bukkit.entity.ArmorStand; import org.bukkit.entity.Entity; @@ -1118,9 +1119,16 @@ public class PlayerEventListener extends PlotListener implements Listener { @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) public void onBucketEmpty(PlayerBucketEmptyEvent event) { BlockFace bf = event.getBlockFace(); - Block block = - event.getBlockClicked().getLocation().add(bf.getModX(), bf.getModY(), bf.getModZ()) - .getBlock(); + final Block block; + // if the block can be waterlogged, the event might waterlog the block + // sometimes + if (event.getBlockClicked().getBlockData() instanceof Waterlogged) { + block = event.getBlockClicked(); + } else { + block = event.getBlockClicked().getLocation() + .add(bf.getModX(), bf.getModY(), bf.getModZ()) + .getBlock(); + } Location location = BukkitUtil.adapt(block.getLocation()); PlotArea area = location.getPlotArea(); if (area == null) { diff --git a/Core/src/main/java/com/plotsquared/core/PlotPlatform.java b/Core/src/main/java/com/plotsquared/core/PlotPlatform.java index 84bf76ec2..3d6387bec 100644 --- a/Core/src/main/java/com/plotsquared/core/PlotPlatform.java +++ b/Core/src/main/java/com/plotsquared/core/PlotPlatform.java @@ -142,8 +142,6 @@ public interface PlotPlatform

extends LocaleHolder { return getInjector().getInstance(Key.get(IndependentPlotGenerator.class, DefaultGenerator.class)); } - List, Boolean>> getPluginIds(); - /** * Get the backup manager instance * @@ -256,6 +254,8 @@ public interface PlotPlatform

extends LocaleHolder { */ @Nonnull Audience getConsoleAudience(); + String getPluginList(); + /** * Load the caption maps */ diff --git a/Core/src/main/java/com/plotsquared/core/command/DebugPaste.java b/Core/src/main/java/com/plotsquared/core/command/DebugPaste.java index a79a8a240..7d67e2b29 100644 --- a/Core/src/main/java/com/plotsquared/core/command/DebugPaste.java +++ b/Core/src/main/java/com/plotsquared/core/command/DebugPaste.java @@ -103,28 +103,21 @@ public class DebugPaste extends SubCommand { .append("\n"); b.append("online_mode: ").append(!Settings.UUID.OFFLINE).append(';') .append(!Settings.UUID.OFFLINE).append('\n'); - b.append("Plugins:"); - for (Map.Entry, Boolean> pluginInfo : PlotSquared - .platform().getPluginIds()) { - Map.Entry nameVersion = pluginInfo.getKey(); - String name = nameVersion.getKey(); - String version = nameVersion.getValue(); - boolean enabled = pluginInfo.getValue(); - b.append("\n ").append(name).append(":\n ").append("version: '") - .append(version).append('\'').append("\n enabled: ").append(enabled); - } + b.append(PlotSquared.platform().getPluginList()); b.append("\n\n# YAY! Now, let's see what we can find in your JVM\n"); Runtime runtime = Runtime.getRuntime(); RuntimeMXBean rb = ManagementFactory.getRuntimeMXBean(); - b.append("Uptime: ").append( - TimeUnit.MINUTES.convert(rb.getUptime(), TimeUnit.MILLISECONDS) + " minutes") + b.append("Uptime: ") + .append(TimeUnit.MINUTES.convert(rb.getUptime(), TimeUnit.MILLISECONDS)) + .append(" minutes") .append('\n'); b.append("JVM Flags: ").append(rb.getInputArguments()).append('\n'); - b.append("Free Memory: ").append(runtime.freeMemory() / 1024 / 1024 + " MB") + b.append("Free Memory: ").append(runtime.freeMemory() / 1024 / 1024).append(" MB") .append('\n'); - b.append("Max Memory: ").append(runtime.maxMemory() / 1024 / 1024 + " MB") + b.append("Max Memory: ").append(runtime.maxMemory() / 1024 / 1024).append(" MB") + .append('\n'); + b.append("Total Memory: ").append(runtime.totalMemory() / 1024 / 1024).append(" MB") .append('\n'); - b.append("Total Memory: ").append(runtime.totalMemory() / 1024 / 1024 + " MB").append('\n'); b.append("Available Processors: ").append(runtime.availableProcessors()).append('\n'); b.append("Java Name: ").append(rb.getVmName()).append('\n'); b.append("Java Version: '").append(System.getProperty("java.version")) diff --git a/Core/src/main/java/com/plotsquared/core/command/Grant.java b/Core/src/main/java/com/plotsquared/core/command/Grant.java index 1745eec0c..a40c45ca8 100644 --- a/Core/src/main/java/com/plotsquared/core/command/Grant.java +++ b/Core/src/main/java/com/plotsquared/core/command/Grant.java @@ -39,11 +39,11 @@ import com.plotsquared.core.util.task.RunnableVal; import com.plotsquared.core.util.task.RunnableVal2; import com.plotsquared.core.util.task.RunnableVal3; import net.kyori.adventure.text.minimessage.Template; +import com.plotsquared.core.uuid.UUIDMapping; import java.util.Collection; import java.util.Locale; import java.util.Map; -import java.util.UUID; import java.util.concurrent.CompletableFuture; import java.util.concurrent.TimeoutException; import java.util.stream.Collectors; @@ -86,8 +86,8 @@ public class Grant extends Command { Template.of("value", String.valueOf(uuids)) ); } else { - final UUID uuid = uuids.toArray(new UUID[0])[0]; - PlotPlayer pp = PlotSquared.platform().getPlayerManager().getPlayerIfExists(uuid); + final UUIDMapping uuid = uuids.toArray(new UUIDMapping[0])[0]; + PlotPlayer pp = PlotSquared.platform().getPlayerManager().getPlayerIfExists(uuid.getUuid()); if (pp != null) { try (final MetaDataAccess access = pp.accessPersistentMetaData( PlayerMetaDataKeys.PERSISTENT_GRANTED_PLOTS)) { @@ -99,7 +99,7 @@ public class Grant extends Command { } } } else { - DBFunc.getPersistentMeta(uuid, new RunnableVal>() { + DBFunc.getPersistentMeta(uuid.getUuid(), new RunnableVal>() { @Override public void run(Map value) { final byte[] array = value.get("grantedPlots"); if (arg0.equals("check")) { // check @@ -123,7 +123,7 @@ public class Grant extends Command { boolean replace = array != null; String key = "grantedPlots"; byte[] rawData = Ints.toByteArray(amount); - DBFunc.addPersistentMeta(uuid, key, rawData, replace); + DBFunc.addPersistentMeta(uuid.getUuid(), key, rawData, replace); } } }); diff --git a/Core/src/main/java/com/plotsquared/core/configuration/Settings.java b/Core/src/main/java/com/plotsquared/core/configuration/Settings.java index fed29c9f0..6c8b4cb58 100644 --- a/Core/src/main/java/com/plotsquared/core/configuration/Settings.java +++ b/Core/src/main/java/com/plotsquared/core/configuration/Settings.java @@ -267,8 +267,6 @@ public class Settings extends Config { public static boolean SERVICE_BUKKIT = true; @Comment("Whether the EssentialsX service is enabled") public static boolean SERVICE_ESSENTIALSX = true; - @Comment("Whether the BungeePerms service is enabled") - public static boolean SERVICE_BUNGEE_PERMS = true; } diff --git a/Core/src/main/java/com/plotsquared/core/setup/CommonSetupSteps.java b/Core/src/main/java/com/plotsquared/core/setup/CommonSetupSteps.java index f4ea7b178..fadc2821f 100644 --- a/Core/src/main/java/com/plotsquared/core/setup/CommonSetupSteps.java +++ b/Core/src/main/java/com/plotsquared/core/setup/CommonSetupSteps.java @@ -269,7 +269,7 @@ public enum CommonSetupSteps implements SetupStep { private static boolean isValidWorldName(String s) { return s.chars().allMatch((i) -> { - return i == 95 || i == 45 || i >= 97 && i <= 122 || i >= 48 && i <= 57 || i == 46; + return i == 95 || i == 45 || i >= 97 && i <= 122 || i >= 65 && i <= 90 || i >= 48 && i <= 57 || i == 46; }); }