From bce8e051053806c94a8dfd44bde655d6ca16143f Mon Sep 17 00:00:00 2001 From: ceze88 Date: Fri, 5 Jun 2026 17:33:42 +0200 Subject: [PATCH 1/2] Add folia support --- Compatibility/pom.xml | 7 + .../core/compatibility/ClientVersion.java | 24 +- .../core/compatibility/ServerProject.java | 8 +- Core/pom.xml | 28 +- .../java/com/craftaro/core/SongodaCore.java | 57 ++- .../java/com/craftaro/core/SongodaPlugin.java | 23 +- .../com/craftaro/core/gui/GuiManager.java | 50 ++- .../com/craftaro/core/input/ChatPrompt.java | 51 ++- .../core/lootables/loot/DropUtils.java | 36 +- .../java/com/craftaro/core/utils/Metrics.java | 9 +- .../java/com/craftaro/core/world/SWorld.java | 10 + Folia-Compatibility/.gitignore | 113 ++++++ Folia-Compatibility/pom.xml | 85 +++++ .../folia/SchedulerRunnable.java | 19 + .../compatibility/folia/SchedulerTask.java | 41 +++ .../compatibility/folia/SchedulerUtils.java | 348 ++++++++++++++++++ NMS/NMS-API/pom.xml | 7 + .../com/craftaro/core/nms/world/SWorld.java | 8 + NMS/NMS-v1_19_R3/pom.xml | 14 + .../core/nms/v1_19_R3/world/SSpawnerImpl.java | 3 +- .../core/nms/v1_19_R3/world/SWorldImpl.java | 29 ++ pom.xml | 1 + 22 files changed, 887 insertions(+), 84 deletions(-) create mode 100644 Folia-Compatibility/.gitignore create mode 100644 Folia-Compatibility/pom.xml create mode 100644 Folia-Compatibility/src/main/java/com/craftaro/core/compatibility/folia/SchedulerRunnable.java create mode 100644 Folia-Compatibility/src/main/java/com/craftaro/core/compatibility/folia/SchedulerTask.java create mode 100644 Folia-Compatibility/src/main/java/com/craftaro/core/compatibility/folia/SchedulerUtils.java diff --git a/Compatibility/pom.xml b/Compatibility/pom.xml index 1624bc350..f56e6e0ed 100644 --- a/Compatibility/pom.xml +++ b/Compatibility/pom.xml @@ -27,6 +27,13 @@ provided + + ${project.groupId} + Folia-Compatibility + ${project.version} + compile + + com.viaversion viaversion-api diff --git a/Compatibility/src/main/java/com/craftaro/core/compatibility/ClientVersion.java b/Compatibility/src/main/java/com/craftaro/core/compatibility/ClientVersion.java index 9a9f915af..5f0f985a5 100644 --- a/Compatibility/src/main/java/com/craftaro/core/compatibility/ClientVersion.java +++ b/Compatibility/src/main/java/com/craftaro/core/compatibility/ClientVersion.java @@ -1,5 +1,7 @@ package com.craftaro.core.compatibility; +import com.craftaro.core.compatibility.folia.SchedulerRunnable; +import com.craftaro.core.compatibility.folia.SchedulerUtils; import com.viaversion.viaversion.api.Via; import org.bukkit.Bukkit; import org.bukkit.entity.Player; @@ -37,10 +39,13 @@ public static ServerVersion getClientVersion(Player player) { */ @Deprecated public static void onLoginProtocol(Player p, JavaPlugin plugin) { - Bukkit.getScheduler().runTaskLater(plugin, () -> { - if (p.isOnline()) { - final int version = protocolsupport.api.ProtocolSupportAPI.getProtocolVersion(p).getId(); - players.put(p.getUniqueId(), protocolToVersion(version)); + SchedulerUtils.runTaskLater(plugin, new SchedulerRunnable() { + @Override + public void run() { + if (p.isOnline()) { + final int version = protocolsupport.api.ProtocolSupportAPI.getProtocolVersion(p).getId(); + players.put(p.getUniqueId(), protocolToVersion(version)); + } } }, 20); } @@ -50,10 +55,13 @@ public static void onLoginProtocol(Player p, JavaPlugin plugin) { */ @Deprecated public static void onLoginVia(Player p, JavaPlugin plugin) { - Bukkit.getScheduler().runTaskLater(plugin, () -> { - if (p.isOnline()) { - final int version = Via.getAPI().getPlayerVersion(p.getUniqueId()); - players.put(p.getUniqueId(), protocolToVersion(version)); + SchedulerUtils.runTaskLater(plugin, new SchedulerRunnable() { + @Override + public void run() { + if (p.isOnline()) { + final int version = Via.getAPI().getPlayerVersion(p.getUniqueId()); + players.put(p.getUniqueId(), protocolToVersion(version)); + } } }, 20); } diff --git a/Compatibility/src/main/java/com/craftaro/core/compatibility/ServerProject.java b/Compatibility/src/main/java/com/craftaro/core/compatibility/ServerProject.java index 9f614f056..0b0b6def4 100644 --- a/Compatibility/src/main/java/com/craftaro/core/compatibility/ServerProject.java +++ b/Compatibility/src/main/java/com/craftaro/core/compatibility/ServerProject.java @@ -4,7 +4,7 @@ import org.bukkit.Bukkit; public enum ServerProject { - UNKNOWN, CRAFTBUKKIT, SPIGOT, PAPER, TACO, GLOWSTONE, MOCK_BUKKIT; + UNKNOWN, CRAFTBUKKIT, SPIGOT, PAPER, FOLIA, TACO, GLOWSTONE, MOCK_BUKKIT; private static final ServerProject serverProject = checkProject(); private static ServerProject checkProject() { @@ -38,6 +38,12 @@ private static ServerProject checkProject() { } catch (ClassNotFoundException ignore) { } + try { + Class.forName("io.papermc.paper.threadedregions.RegionizedServer"); + return FOLIA; + } catch (ClassNotFoundException ignored) { + } + // spigot is the fork that pretty much all builds are based on anymore try { Class.forName("org.spigotmc.SpigotConfig"); diff --git a/Core/pom.xml b/Core/pom.xml index 488e40717..9cb912233 100644 --- a/Core/pom.xml +++ b/Core/pom.xml @@ -96,6 +96,8 @@ com.github.GeorgeV220:LibraryLoader org.ow2.asm:asm org.ow2.asm:asm-commons + + io.papermc:paperlib @@ -159,6 +161,11 @@ org.objectweb.asm com.craftaro.core.third_party.org.objectweb.asm + + + io.papermc.lib + com.craftaro.third_party.io.papermc.lib + @@ -202,7 +209,21 @@ provided + + dev.folia + folia-api + 1.19.4-R0.1-SNAPSHOT + provided + + + + io.papermc + paperlib + 1.0.7 + compile + + ${project.groupId} CraftaroCore-Compatibility @@ -273,13 +294,6 @@ compile - - org.ow2.asm - asm-commons - 9.2 - compile - - com.zaxxer diff --git a/Core/src/main/java/com/craftaro/core/SongodaCore.java b/Core/src/main/java/com/craftaro/core/SongodaCore.java index 201b6dc3d..70ef97526 100644 --- a/Core/src/main/java/com/craftaro/core/SongodaCore.java +++ b/Core/src/main/java/com/craftaro/core/SongodaCore.java @@ -1,5 +1,8 @@ package com.craftaro.core; +import com.craftaro.core.compatibility.folia.SchedulerRunnable; +import com.craftaro.core.compatibility.folia.SchedulerTask; +import com.craftaro.core.compatibility.folia.SchedulerUtils; import com.craftaro.core.commands.CommandManager; import com.craftaro.core.compatibility.ClientVersion; import com.craftaro.core.core.LocaleModule; @@ -23,7 +26,6 @@ import org.bukkit.event.server.PluginEnableEvent; import org.bukkit.plugin.ServicePriority; import org.bukkit.plugin.java.JavaPlugin; -import org.bukkit.scheduler.BukkitTask; import org.json.simple.JSONObject; import org.json.simple.parser.JSONParser; import org.json.simple.parser.ParseException; @@ -198,15 +200,26 @@ private void init() { Bukkit.getPluginManager().registerEvents(this.shadingListener, this.piggybackedPlugin); // we aggressively want to own this command - this.tasks.add(Bukkit.getScheduler().runTaskLaterAsynchronously(this.piggybackedPlugin, () -> - CommandManager.registerCommandDynamically(this.piggybackedPlugin, "songoda", this.commandManager, this.commandManager), - 10 * 60)); - this.tasks.add(Bukkit.getScheduler().runTaskLaterAsynchronously(this.piggybackedPlugin, () -> - CommandManager.registerCommandDynamically(this.piggybackedPlugin, "songoda", this.commandManager, this.commandManager), - 20 * 60)); - this.tasks.add(Bukkit.getScheduler().runTaskLaterAsynchronously(this.piggybackedPlugin, () -> - CommandManager.registerCommandDynamically(this.piggybackedPlugin, "songoda", this.commandManager, this.commandManager), - 20 * 60 * 2)); + tasks.add(SchedulerUtils.runTaskLater(piggybackedPlugin, new SchedulerRunnable() { + @Override + public void run() { + CommandManager.registerCommandDynamically(piggybackedPlugin, "songoda", commandManager, commandManager); + } + }, 10 * 60)); + + tasks.add(SchedulerUtils.runTaskLater(piggybackedPlugin, new SchedulerRunnable() { + @Override + public void run() { + CommandManager.registerCommandDynamically(piggybackedPlugin, "songoda", commandManager, commandManager); + } + }, 20 * 60)); + + tasks.add(SchedulerUtils.runTaskLater(piggybackedPlugin, new SchedulerRunnable() { + @Override + public void run() { + CommandManager.registerCommandDynamically(piggybackedPlugin, "songoda", commandManager, commandManager); + } + }, 20 * 60 * 2)); } /** @@ -215,8 +228,8 @@ private void init() { private void destroy() { Bukkit.getServicesManager().unregister(SongodaCore.class, INSTANCE); - this.tasks.stream().filter(Objects::nonNull) - .forEach(task -> Bukkit.getScheduler().cancelTask(task.getTaskId())); + tasks.stream().filter(Objects::nonNull) + .forEach(SchedulerUtils::cancelTask); HandlerList.unregisterAll(this.loginListener); if (!hasShading()) { @@ -228,7 +241,7 @@ private void destroy() { this.loginListener = null; } - private ArrayList tasks = new ArrayList<>(); + private final ArrayList tasks = new ArrayList<>(); private void register(JavaPlugin plugin, int pluginID, String icon, String libraryVersion) { ProductVerificationStatus verificationStatus = ProductVerificationStatus.VERIFIED; @@ -246,7 +259,12 @@ private void register(JavaPlugin plugin, int pluginID, String icon, String libra // don't forget to check for language pack updates ;) info.addModule(new LocaleModule()); registeredPlugins.add(info); - this.tasks.add(Bukkit.getScheduler().runTaskLaterAsynchronously(plugin, () -> update(info), 60L)); + tasks.add(SchedulerUtils.runTaskLaterAsynchronously(plugin, new SchedulerRunnable() { + @Override + public void run() { + update(info); + } + }, 60L)); } /** @@ -425,9 +443,14 @@ void onLogin(PlayerLoginEvent event) { // check for updates! ;) for (PluginInfo plugin : getPlugins()) { - if (plugin.getNotification() != null && plugin.getJavaPlugin().isEnabled()) - Bukkit.getScheduler().runTaskLaterAsynchronously(plugin.getJavaPlugin(), () -> - player.sendMessage("[" + plugin.getJavaPlugin().getName() + "] " + plugin.getNotification()), 10L); + if (plugin.getNotification() != null && plugin.getJavaPlugin().isEnabled()) { + SchedulerUtils.runTaskLaterAsynchronously(plugin.getJavaPlugin(), new SchedulerRunnable() { + @Override + public void run() { + player.sendMessage("[" + plugin.getJavaPlugin().getName() + "] " + plugin.getNotification()); + } + }, 10L); + } } } diff --git a/Core/src/main/java/com/craftaro/core/SongodaPlugin.java b/Core/src/main/java/com/craftaro/core/SongodaPlugin.java index fe3244b8b..054677b68 100644 --- a/Core/src/main/java/com/craftaro/core/SongodaPlugin.java +++ b/Core/src/main/java/com/craftaro/core/SongodaPlugin.java @@ -1,5 +1,7 @@ package com.craftaro.core; +import com.craftaro.core.compatibility.folia.SchedulerRunnable; +import com.craftaro.core.compatibility.folia.SchedulerUtils; import com.craftaro.core.configuration.Config; import com.craftaro.core.database.DataManager; import com.craftaro.core.database.DataMigration; @@ -18,7 +20,9 @@ import org.bukkit.ChatColor; import org.bukkit.command.CommandSender; import org.bukkit.configuration.file.FileConfiguration; +import org.bukkit.plugin.SimplePluginManager; import org.bukkit.plugin.java.JavaPlugin; +import org.bukkit.plugin.java.JavaPluginLoader; import org.jetbrains.annotations.NotNull; import java.io.File; @@ -131,6 +135,7 @@ public final void onLoad() { dependencies.add(new Dependency("https://repo1.maven.org/maven2", "com;github;cryptomorin", "XSeries", "9.8.0", false, new Relocation("com;cryptomorin;xseries", "com;craftaro;third_party;com;cryptomorin;xseries")) // Custom relocation if the package names not match with the groupId ); + dependencies.add(new Dependency("https://papermc.io/repo/repository/maven-public/", "io;papermc", "paperlib", "1.0.7")); //Load plugin dependencies new DependencyLoader(this).loadDependencies(dependencies); @@ -165,10 +170,13 @@ public final void onEnable() { this.licensePreventedPluginLoad = true; SongodaCore.registerPlugin(this, CraftaroProductVerification.getProductId(), (XMaterial) null); - getServer().getScheduler().scheduleSyncRepeatingTask(this, () -> { - String pluginName = getDescription().getName(); - String pluginUrl = "https://craftaro.com/marketplace/product/" + CraftaroProductVerification.getProductId(); - Bukkit.broadcastMessage(ChatColor.RED + pluginName + " has not been activated. Please download " + pluginName + " here: " + pluginUrl); + SchedulerUtils.scheduleSyncRepeatingTask(this, new SchedulerRunnable() { + @Override + public void run() { + String pluginName = getDescription().getName(); + String pluginUrl = "https://craftaro.com/marketplace/product/" + CraftaroProductVerification.getProductId(); + Bukkit.broadcastMessage(ChatColor.RED + pluginName + " has not been activated. Please download " + pluginName + " here: " + pluginUrl); + } }, 5 * 20, 60 * 20); return; } @@ -189,7 +197,12 @@ public final void onEnable() { } // Load Data. - Bukkit.getScheduler().runTaskLater(this, this::onDataLoad, this.dataLoadDelay); + SchedulerUtils.runTaskLater(this, new SchedulerRunnable() { + @Override + public void run() { + onDataLoad(); + } + }, this.dataLoadDelay); if (this.emergencyStop) { console.sendMessage(ChatColor.RED + "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"); diff --git a/Core/src/main/java/com/craftaro/core/gui/GuiManager.java b/Core/src/main/java/com/craftaro/core/gui/GuiManager.java index be65909e4..18164dbe8 100644 --- a/Core/src/main/java/com/craftaro/core/gui/GuiManager.java +++ b/Core/src/main/java/com/craftaro/core/gui/GuiManager.java @@ -1,5 +1,7 @@ package com.craftaro.core.gui; +import com.craftaro.core.compatibility.folia.SchedulerRunnable; +import com.craftaro.core.compatibility.folia.SchedulerUtils; import com.craftaro.core.compatibility.ClientVersion; import com.craftaro.core.compatibility.ServerVersion; import com.cryptomorin.xseries.XMaterial; @@ -102,23 +104,29 @@ public void showGUI(Player player, Gui gui) { return; } - Bukkit.getScheduler().runTaskAsynchronously(this.plugin, () -> { - Gui openInv = this.openInventories.get(player); + SchedulerUtils.runTaskAsynchronously(plugin, new SchedulerRunnable() { + @Override + public void run() { + Gui openInv = openInventories.get(player); - if (openInv != null) { - openInv.open = false; - } + if (openInv != null) { + openInv.open = false; + } - Inventory inv = gui.getOrCreateInventory(this); + Inventory inv = gui.getOrCreateInventory(GuiManager.this); - Bukkit.getScheduler().runTask(this.plugin, () -> { - player.openInventory(inv); - gui.onOpen(this, player); + SchedulerUtils.runTask(plugin, new SchedulerRunnable() { + @Override + public void run() { + player.openInventory(inv); + gui.onOpen(GuiManager.this, player); - synchronized (this.lock) { - this.openInventories.put(player, gui); - } - }); + synchronized (GuiManager.this.lock) { + GuiManager.this.openInventories.put(player, gui); + } + } + }); + } }); } @@ -136,9 +144,12 @@ public void showPopup(Player player, String message, XMaterial icon, BackgroundT popup.add(); popup.grant(player); - Bukkit.getScheduler().runTaskLaterAsynchronously(this.plugin, () -> { - popup.revoke(player); - popup.remove(); + SchedulerUtils.runTaskLaterAsynchronously(plugin, new SchedulerRunnable() { + @Override + public void run() { + popup.revoke(player); + popup.remove(); + } }, 70); return; @@ -280,7 +291,12 @@ void onCloseGUI(InventoryCloseEvent event) { if (this.manager.shutdown) { gui.onClose(this.manager, player); } else { - Bukkit.getScheduler().runTaskLater(this.manager.plugin, () -> gui.onClose(this.manager, player), 1); + SchedulerUtils.runEntityTaskLater(manager.plugin, player, new SchedulerRunnable() { + @Override + public void run() { + gui.onClose(manager, player); + } + }, 1); } this.manager.openInventories.remove(player); diff --git a/Core/src/main/java/com/craftaro/core/input/ChatPrompt.java b/Core/src/main/java/com/craftaro/core/input/ChatPrompt.java index aa7ff98d2..1bcbe7fbf 100644 --- a/Core/src/main/java/com/craftaro/core/input/ChatPrompt.java +++ b/Core/src/main/java/com/craftaro/core/input/ChatPrompt.java @@ -1,5 +1,8 @@ package com.craftaro.core.input; +import com.craftaro.core.compatibility.folia.SchedulerRunnable; +import com.craftaro.core.compatibility.folia.SchedulerTask; +import com.craftaro.core.compatibility.folia.SchedulerUtils; import org.bukkit.Bukkit; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; @@ -20,7 +23,7 @@ public class ChatPrompt implements Listener { private final Plugin plugin; private final ChatConfirmHandler handler; - private int taskId; + private SchedulerTask task; private OnClose onClose = null; private OnCancel onCancel = null; private Listener listener; @@ -67,14 +70,21 @@ public ChatPrompt setOnCancel(OnCancel onCancel) { } public ChatPrompt setTimeOut(Player player, long ticks) { - taskId = Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, () -> { - if (onClose != null) { - plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, () -> - onClose.onClose(), 0L); - } + task = SchedulerUtils.scheduleSyncDelayedTask(plugin, new SchedulerRunnable() { + @Override + public void run() { + if (onClose != null) { + SchedulerUtils.scheduleSyncDelayedTask(plugin, new SchedulerRunnable() { + @Override + public void run() { + onClose.onClose(); + } + }, 0L); + } - HandlerList.unregisterAll(listener); - player.sendMessage("Your action has timed out."); + HandlerList.unregisterAll(listener); + player.sendMessage("Your action has timed out."); + } }, ticks); return this; @@ -104,11 +114,16 @@ public void onChat(AsyncPlayerChatEvent event) { } if (onClose != null) { - plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, () -> onClose.onClose(), 0L); + SchedulerUtils.scheduleSyncDelayedTask(plugin, new SchedulerRunnable() { + @Override + public void run() { + onClose.onClose(); + } + }, 0L); } HandlerList.unregisterAll(listener); - Bukkit.getScheduler().cancelTask(taskId); + SchedulerUtils.cancelTask(task); } @EventHandler(priority = EventPriority.LOWEST) @@ -126,13 +141,23 @@ public void onCancel(PlayerCommandPreprocessEvent event) { } if (onCancel != null) { - plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, () -> onCancel.onCancel(), 0L); + SchedulerUtils.scheduleSyncDelayedTask(plugin, new SchedulerRunnable() { + @Override + public void run() { + onCancel.onCancel(); + } + }, 0L); } else if (onClose != null) { - plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, () -> onClose.onClose(), 0L); + SchedulerUtils.scheduleSyncDelayedTask(plugin, new SchedulerRunnable() { + @Override + public void run() { + onClose.onClose(); + } + }, 0L); } HandlerList.unregisterAll(listener); - Bukkit.getScheduler().cancelTask(taskId); + SchedulerUtils.cancelTask(task); } }; diff --git a/Core/src/main/java/com/craftaro/core/lootables/loot/DropUtils.java b/Core/src/main/java/com/craftaro/core/lootables/loot/DropUtils.java index e4f9c44d4..60361706c 100644 --- a/Core/src/main/java/com/craftaro/core/lootables/loot/DropUtils.java +++ b/Core/src/main/java/com/craftaro/core/lootables/loot/DropUtils.java @@ -1,5 +1,7 @@ package com.craftaro.core.lootables.loot; +import com.craftaro.core.compatibility.folia.SchedulerRunnable; +import com.craftaro.core.compatibility.folia.SchedulerUtils; import com.craftaro.core.SongodaCore; import com.craftaro.ultimatestacker.api.UltimateStackerApi; import org.bukkit.Bukkit; @@ -85,9 +87,12 @@ private static void dropItems(List items, EntityDeathEvent event) { } stack.setAmount(newAmount.intValue()); } - Bukkit.getScheduler().runTask(UltimateStackerApi.getPlugin(), () -> { - for (StackedItem stack : stacks) { - UltimateStackerApi.getStackedItemManager().createStack(stack.getItemToDrop(), event.getEntity().getLocation(), stack.getAmount()); + SchedulerUtils.runLocationTask(SongodaCore.getHijackedPlugin(), event.getEntity().getLocation(), new SchedulerRunnable() { + @Override + public void run() { + for (StackedItem stack : stacks) { + UltimateStackerApi.getStackedItemManager().createStack(stack.getItemToDrop(), event.getEntity().getLocation(), stack.getAmount()); + } } }); return; @@ -96,17 +101,20 @@ private static void dropItems(List items, EntityDeathEvent event) { } private static void runCommands(LivingEntity entity, List commands) { - Bukkit.getScheduler().runTask(SongodaCore.getHijackedPlugin(), () -> { - for (String command : commands) { - if (entity.getKiller() != null) { - command = command.replace("%player%", entity.getKiller().getName() - .replace("%x%", String.valueOf((int) entity.getLocation().getX())) - .replace("%y%", String.valueOf((int) entity.getLocation().getY())) - .replace("%z%", String.valueOf((int) entity.getLocation().getZ()))); - } - - if (!command.contains("%player%")) { - Bukkit.dispatchCommand(Bukkit.getConsoleSender(), command); + SchedulerUtils.runTask(SongodaCore.getHijackedPlugin(), new SchedulerRunnable() { + @Override + public void run() { + for (String command : commands) { + if (entity.getKiller() != null) { + command = command.replace("%player%", entity.getKiller().getName() + .replace("%x%", String.valueOf((int) entity.getLocation().getX())) + .replace("%y%", String.valueOf((int) entity.getLocation().getY())) + .replace("%z%", String.valueOf((int) entity.getLocation().getZ()))); + } + + if (!command.contains("%player%")) { + Bukkit.dispatchCommand(Bukkit.getConsoleSender(), command); + } } } }); diff --git a/Core/src/main/java/com/craftaro/core/utils/Metrics.java b/Core/src/main/java/com/craftaro/core/utils/Metrics.java index 0a58111f9..775fe8ba8 100644 --- a/Core/src/main/java/com/craftaro/core/utils/Metrics.java +++ b/Core/src/main/java/com/craftaro/core/utils/Metrics.java @@ -1,5 +1,7 @@ package com.craftaro.core.utils; +import com.craftaro.core.compatibility.folia.SchedulerRunnable; +import com.craftaro.core.compatibility.folia.SchedulerUtils; import org.bukkit.Bukkit; import org.bukkit.configuration.file.YamlConfiguration; import org.bukkit.entity.Player; @@ -191,7 +193,12 @@ public void run() { } // Nevertheless we want our code to run in the Bukkit main thread, so we have to use the Bukkit scheduler // Don't be afraid! The connection to the bStats server is still async, only the stats collection is sync ;) - Bukkit.getScheduler().runTask(plugin, () -> submitData()); + SchedulerUtils.runTask(plugin, new SchedulerRunnable() { + @Override + public void run() { + submitData(); + } + }); } }, 1000 * 60 * 5, 1000 * 60 * 30); // Submit the data every 30 minutes, first time after 5 minutes to give other plugins enough time to start diff --git a/Core/src/main/java/com/craftaro/core/world/SWorld.java b/Core/src/main/java/com/craftaro/core/world/SWorld.java index 5f89f54bd..96c9a31ab 100644 --- a/Core/src/main/java/com/craftaro/core/world/SWorld.java +++ b/Core/src/main/java/com/craftaro/core/world/SWorld.java @@ -2,12 +2,14 @@ import com.craftaro.core.compatibility.ServerVersion; import com.craftaro.core.nms.Nms; +import io.papermc.paper.threadedregions.scheduler.EntityScheduler; import org.bukkit.Location; import org.bukkit.World; import org.bukkit.entity.Entity; import org.bukkit.entity.LivingEntity; import java.util.List; +import java.util.Map; public class SWorld { protected final com.craftaro.core.nms.world.SWorld sWorld; @@ -35,6 +37,14 @@ public List getLivingEntities() { return this.sWorld.getLivingEntities(); } + /** + * For folia servers + * @return EntityScheduler and a list of entities belongs to it + */ + public Map> getRegionizedEntities() { + return sWorld.getRegionizedEntities(); + } + public World getWorld() { return this.world; } diff --git a/Folia-Compatibility/.gitignore b/Folia-Compatibility/.gitignore new file mode 100644 index 000000000..4788b4b45 --- /dev/null +++ b/Folia-Compatibility/.gitignore @@ -0,0 +1,113 @@ +# User-specific stuff +.idea/ + +*.iml +*.ipr +*.iws + +# IntelliJ +out/ + +# Compiled class file +*.class + +# Log file +*.log + +# BlueJ files +*.ctxt + +# Package Files # +*.jar +*.war +*.nar +*.ear +*.zip +*.tar.gz +*.rar + +# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml +hs_err_pid* + +*~ + +# temporary files which can be created if a process still has a handle open of a deleted file +.fuse_hidden* + +# KDE directory preferences +.directory + +# Linux trash folder which might appear on any partition or disk +.Trash-* + +# .nfs files are created when an open file is removed but is still being accessed +.nfs* + +# General +.DS_Store +.AppleDouble +.LSOverride + +# Icon must end with two \r +Icon + +# Thumbnails +._* + +# Files that might appear in the root of a volume +.DocumentRevisions-V100 +.fseventsd +.Spotlight-V100 +.TemporaryItems +.Trashes +.VolumeIcon.icns +.com.apple.timemachine.donotpresent + +# Directories potentially created on remote AFP share +.AppleDB +.AppleDesktop +Network Trash Folder +Temporary Items +.apdisk + +# Windows thumbnail cache files +Thumbs.db +Thumbs.db:encryptable +ehthumbs.db +ehthumbs_vista.db + +# Dump file +*.stackdump + +# Folder config file +[Dd]esktop.ini + +# Recycle Bin used on file shares +$RECYCLE.BIN/ + +# Windows Installer files +*.cab +*.msi +*.msix +*.msm +*.msp + +# Windows shortcuts +*.lnk + +target/ + +pom.xml.tag +pom.xml.releaseBackup +pom.xml.versionsBackup +pom.xml.next + +release.properties +dependency-reduced-pom.xml +buildNumber.properties +.mvn/timing.properties +.mvn/wrapper/maven-wrapper.jar +.flattened-pom.xml + +# Common working directory +run/ diff --git a/Folia-Compatibility/pom.xml b/Folia-Compatibility/pom.xml new file mode 100644 index 000000000..d4fca0456 --- /dev/null +++ b/Folia-Compatibility/pom.xml @@ -0,0 +1,85 @@ + + + 4.0.0 + + com.craftaro + CraftaroCore-Modules + 3.0.0-SNAPSHOT + ../pom.xml + + + Folia-Compatibility + + Folia-Compatibility + + + 1.8 + UTF-8 + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.8.1 + + ${java.version} + ${java.version} + + + + org.apache.maven.plugins + maven-shade-plugin + 3.2.4 + + + package + + shade + + + + + + + + src/main/resources + true + + + + + + + papermc + https://repo.papermc.io/repository/maven-public/ + + + + + + + io.papermc + paperlib + 1.0.7 + provided + + + + dev.folia + folia-api + 1.19.4-R0.1-SNAPSHOT + provided + + + + io.papermc.paper + paper-api + 1.19.4-R0.1-SNAPSHOT + provided + + + diff --git a/Folia-Compatibility/src/main/java/com/craftaro/core/compatibility/folia/SchedulerRunnable.java b/Folia-Compatibility/src/main/java/com/craftaro/core/compatibility/folia/SchedulerRunnable.java new file mode 100644 index 000000000..022e95e86 --- /dev/null +++ b/Folia-Compatibility/src/main/java/com/craftaro/core/compatibility/folia/SchedulerRunnable.java @@ -0,0 +1,19 @@ +package com.craftaro.core.compatibility.folia; + +public abstract class SchedulerRunnable implements Runnable { + + private SchedulerTask task; + + @Override + public void run() { + + } + + public void cancel() { + SchedulerUtils.cancelTask(task); + } + + void setTask(SchedulerTask task) { + this.task = task; + } +} diff --git a/Folia-Compatibility/src/main/java/com/craftaro/core/compatibility/folia/SchedulerTask.java b/Folia-Compatibility/src/main/java/com/craftaro/core/compatibility/folia/SchedulerTask.java new file mode 100644 index 000000000..147c7c379 --- /dev/null +++ b/Folia-Compatibility/src/main/java/com/craftaro/core/compatibility/folia/SchedulerTask.java @@ -0,0 +1,41 @@ +package com.craftaro.core.compatibility.folia; + +import io.papermc.paper.threadedregions.scheduler.ScheduledTask; +import org.bukkit.scheduler.BukkitTask; + +public class SchedulerTask { + + private final Object task; + + public SchedulerTask(Object task) { + if (task == null) throw new IllegalArgumentException("Task cannot be null"); + switch (task.getClass().getSimpleName()) { + case "BukkitTask": + case "SchedulerTask": + case "AsyncScheduledTask": + case "EntityScheduledTask": + case "GlobalScheduledTask": + case "LocationScheduledTask": + this.task = task; + break; + default: + throw new IllegalArgumentException("Task: " + task.getClass().getSimpleName() + " is not a BukkitTask or ScheduledTask"); + } + } + + public Object getTask() { + return task; + } + + public ScheduledTask getAsFoliaTask() { + return (ScheduledTask) task; + } + + public BukkitTask getAsBukkitTask() { + return (BukkitTask) task; + } + + public int getAsBukkitTaskId() { + return getAsBukkitTask().getTaskId(); + } +} diff --git a/Folia-Compatibility/src/main/java/com/craftaro/core/compatibility/folia/SchedulerUtils.java b/Folia-Compatibility/src/main/java/com/craftaro/core/compatibility/folia/SchedulerUtils.java new file mode 100644 index 000000000..4f5917ecf --- /dev/null +++ b/Folia-Compatibility/src/main/java/com/craftaro/core/compatibility/folia/SchedulerUtils.java @@ -0,0 +1,348 @@ +package com.craftaro.core.compatibility.folia; + +import io.papermc.paper.threadedregions.scheduler.ScheduledTask; +import org.bukkit.Bukkit; +import org.bukkit.Location; +import org.bukkit.block.Block; +import org.bukkit.entity.Entity; +import org.bukkit.plugin.Plugin; +import org.jetbrains.annotations.NotNull; + +import java.util.concurrent.TimeUnit; + +/** + * Run a task on Folia Scheduler or fallback for Bukkit Scheduler + * Delay is in ticks + */ +public class SchedulerUtils { + + // Bukkit.getScheduler().runTaskTimerAsynchronously(plugin, runnable, delay, period); + + //TODO: Add methods for simple Runnable + + private static boolean isFolia; + + public static boolean isFolia() { + return isFolia; + } + + public static boolean isOwnedByCurrentRegion(Location location) { + return Bukkit.isOwnedByCurrentRegion(location); + } + + public static boolean isOwnedByCurrentRegion(Block block) { + return Bukkit.isOwnedByCurrentRegion(block); + } + + public static boolean isOwnedByCurrentRegion(Entity entity) { + return Bukkit.isOwnedByCurrentRegion(entity); + } + + static { + try { + Class.forName("io.papermc.paper.threadedregions.RegionizedServer"); + isFolia = true; + } catch (ClassNotFoundException e) { + isFolia = false; + } + } + + //Entity + public static SchedulerTask runEntityTask(@NotNull Plugin plugin, @NotNull Entity entity, @NotNull SchedulerRunnable runnable) { + if (isFolia) { + SchedulerTask task = new SchedulerTask(entity.getScheduler().run(plugin, scheduledTask -> runnable.run(), null)); + runnable.setTask(task); + return task; + } + SchedulerTask task = new SchedulerTask(Bukkit.getScheduler().runTask(plugin, runnable)); + runnable.setTask(task); + return task; + } + + public static SchedulerTask runEntityTask(@NotNull Plugin plugin, @NotNull Entity entity, @NotNull Runnable runnable) { + if (isFolia) { + return new SchedulerTask(entity.getScheduler().run(plugin, scheduledTask -> runnable.run(), null)); + } + return new SchedulerTask(Bukkit.getScheduler().runTask(plugin, runnable)); + } + + public static SchedulerTask runEntityTaskLater(@NotNull Plugin plugin, @NotNull Entity entity, @NotNull SchedulerRunnable runnable, long delay) { + if (isFolia) { + SchedulerTask task = new SchedulerTask(entity.getScheduler().runDelayed(plugin, scheduledTask -> runnable.run(), null, correctDelay(delay))); + runnable.setTask(task); + return task; + } + SchedulerTask task = new SchedulerTask(Bukkit.getScheduler().runTask(plugin, runnable)); + runnable.setTask(task); + return task; + } + + public static SchedulerTask runEntityTaskLater(@NotNull Plugin plugin, @NotNull Entity entity, @NotNull Runnable runnable, long delay) { + if (isFolia) { + return new SchedulerTask(entity.getScheduler().runDelayed(plugin, scheduledTask -> runnable.run(), null, correctDelay(delay))); + } + return new SchedulerTask(Bukkit.getScheduler().runTaskLater(plugin, runnable, delay)); + } + + public static SchedulerTask runEntityTaskTimer(@NotNull Plugin plugin, @NotNull Entity entity, @NotNull SchedulerRunnable runnable, long delay, long period) { + if (isFolia) { + SchedulerTask task = new SchedulerTask(entity.getScheduler().runAtFixedRate(plugin, scheduledTask -> runnable.run(), null, correctDelay(delay), correctDelay(period))); + runnable.setTask(task); + return task; + } + SchedulerTask task = new SchedulerTask(Bukkit.getScheduler().runTask(plugin, runnable)); + runnable.setTask(task); + return task; + } + + public static SchedulerTask runEntityTaskTimer(@NotNull Plugin plugin, @NotNull Entity entity, @NotNull Runnable runnable, long delay, long period) { + if (isFolia) { + return new SchedulerTask(entity.getScheduler().runAtFixedRate(plugin, scheduledTask -> runnable.run(), null, correctDelay(delay), correctDelay(period))); + } + return new SchedulerTask(Bukkit.getScheduler().runTaskTimer(plugin, runnable, delay, period)); + } + + //Location + public static SchedulerTask runLocationTask(@NotNull Plugin plugin, @NotNull Location location, @NotNull SchedulerRunnable runnable) { + if (isFolia) { + SchedulerTask task = new SchedulerTask(plugin.getServer().getRegionScheduler().run(plugin, location, scheduledTask -> { + runnable.run(); + })); + runnable.setTask(task); + return task; + } + SchedulerTask task = new SchedulerTask(Bukkit.getScheduler().runTask(plugin, runnable)); + runnable.setTask(task); + return task; + } + + public static SchedulerTask runLocationTask(@NotNull Plugin plugin, @NotNull Location location, @NotNull Runnable runnable) { + if (isFolia) { + return new SchedulerTask(plugin.getServer().getRegionScheduler().run(plugin, location, scheduledTask -> runnable.run())); + } + return new SchedulerTask(Bukkit.getScheduler().runTask(plugin, runnable)); + } + + public static SchedulerTask runLocationTaskLater(@NotNull Plugin plugin, @NotNull Location location, @NotNull SchedulerRunnable runnable, long delay) { + if (isFolia) { + SchedulerTask task = new SchedulerTask(plugin.getServer().getRegionScheduler().runDelayed(plugin, location, scheduledTask -> runnable.run(), correctDelay(delay))); + runnable.setTask(task); + return task; + } + SchedulerTask task = new SchedulerTask(Bukkit.getScheduler().runTaskLater(plugin, runnable, delay)); + runnable.setTask(task); + return task; + } + + public static SchedulerTask runLocationTaskLater(@NotNull Plugin plugin, @NotNull Location location, @NotNull Runnable runnable, long delay) { + if (isFolia) { + return new SchedulerTask(plugin.getServer().getRegionScheduler().runDelayed(plugin, location, scheduledTask -> runnable.run(), correctDelay(delay))); + } + return new SchedulerTask(Bukkit.getScheduler().runTaskLater(plugin, runnable, delay)); + } + + public static SchedulerTask runLocationTaskTimer(@NotNull Plugin plugin, @NotNull Location location, @NotNull SchedulerRunnable runnable, long delay, long period) { + if (isFolia) { + SchedulerTask task = new SchedulerTask(plugin.getServer().getRegionScheduler().runAtFixedRate(plugin, location, scheduledTask -> runnable.run(), correctDelay(delay), correctDelay(period))); + runnable.setTask(task); + return task; + } + SchedulerTask task = new SchedulerTask(Bukkit.getScheduler().runTaskTimer(plugin, runnable, delay, period)); + runnable.setTask(task); + return task; + } + + public static SchedulerTask runLocationTaskTimer(@NotNull Plugin plugin, @NotNull Location location, @NotNull Runnable runnable, long delay, long period) { + if (isFolia) { + return new SchedulerTask(plugin.getServer().getRegionScheduler().runAtFixedRate(plugin, location, scheduledTask -> runnable.run(), correctDelay(delay), correctDelay(period))); + } + return new SchedulerTask(Bukkit.getScheduler().runTaskTimer(plugin, runnable, delay, period)); + } + + //Default + public static SchedulerTask runTask(@NotNull Plugin plugin, @NotNull SchedulerRunnable runnable) { + if (isFolia) { + SchedulerTask task = new SchedulerTask(plugin.getServer().getGlobalRegionScheduler().run(plugin, scheduledTask -> runnable.run())); + runnable.setTask(task); + return task; + } + SchedulerTask task = new SchedulerTask(Bukkit.getScheduler().runTask(plugin, runnable)); + runnable.setTask(task); + return task; + } + + public static SchedulerTask runTask(@NotNull Plugin plugin, @NotNull Runnable runnable) { + if (isFolia) { + return new SchedulerTask(plugin.getServer().getGlobalRegionScheduler().run(plugin, scheduledTask -> runnable.run())); + } + return new SchedulerTask(Bukkit.getScheduler().runTask(plugin, runnable)); + } + + public static SchedulerTask runTaskAsynchronously(@NotNull Plugin plugin, @NotNull SchedulerRunnable runnable) { + if (isFolia) { + SchedulerTask task = new SchedulerTask(plugin.getServer().getAsyncScheduler().runNow(plugin, scheduledTask -> runnable.run())); + runnable.setTask(task); + return task; + } + SchedulerTask task = new SchedulerTask(Bukkit.getScheduler().runTaskAsynchronously(plugin, runnable)); + runnable.setTask(task); + return task; + } + + public static SchedulerTask runTaskAsynchronously(@NotNull Plugin plugin, @NotNull Runnable runnable) { + if (isFolia) { + return new SchedulerTask(plugin.getServer().getAsyncScheduler().runNow(plugin, scheduledTask -> runnable.run())); + } + return new SchedulerTask(Bukkit.getScheduler().runTaskAsynchronously(plugin, runnable)); + } + + public static SchedulerTask runTaskLater(@NotNull Plugin plugin, @NotNull SchedulerRunnable runnable, long delay) { + if (isFolia) { + SchedulerTask task = new SchedulerTask(plugin.getServer().getGlobalRegionScheduler().runDelayed(plugin, scheduledTask -> runnable.run(), correctDelay(delay))); + runnable.setTask(task); + return task; + } + SchedulerTask task = new SchedulerTask(Bukkit.getScheduler().runTaskLater(plugin, runnable, delay)); + runnable.setTask(task); + return task; + } + + public static SchedulerTask runTaskLater(@NotNull Plugin plugin, @NotNull Runnable runnable, long delay) { + if (isFolia) { + return new SchedulerTask(plugin.getServer().getGlobalRegionScheduler().runDelayed(plugin, scheduledTask -> runnable.run(), correctDelay(delay))); + } + return new SchedulerTask(Bukkit.getScheduler().runTaskLater(plugin, runnable, delay)); + } + + public static SchedulerTask runTaskLaterAsynchronously(@NotNull Plugin plugin, @NotNull SchedulerRunnable runnable, long delay) { + if (isFolia) { + SchedulerTask task = new SchedulerTask(plugin.getServer().getAsyncScheduler().runDelayed(plugin, scheduledTask -> runnable.run(), correctDelay(delay), TimeUnit.MILLISECONDS)); + runnable.setTask(task); + return task; + } + SchedulerTask task = new SchedulerTask(Bukkit.getScheduler().runTaskLaterAsynchronously(plugin, runnable, delay)); + runnable.setTask(task); + return task; + } + + public static SchedulerTask runTaskLaterAsynchronously(@NotNull Plugin plugin, @NotNull Runnable runnable, long delay) { + if (isFolia) { + return new SchedulerTask(plugin.getServer().getAsyncScheduler().runDelayed(plugin, scheduledTask -> runnable.run(), correctDelay(delay), TimeUnit.MILLISECONDS)); + } + return new SchedulerTask(Bukkit.getScheduler().runTaskLaterAsynchronously(plugin, runnable, delay)); + } + + public static SchedulerTask scheduleSyncDelayedTask(@NotNull Plugin plugin, @NotNull SchedulerRunnable runnable, long delay) { + if (isFolia) { + SchedulerTask task = new SchedulerTask(plugin.getServer().getGlobalRegionScheduler().runDelayed(plugin, scheduledTask -> runnable.run(), correctDelay(delay))); + runnable.setTask(task); + return task; + } + SchedulerTask task = new SchedulerTask(Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, runnable, delay)); + runnable.setTask(task); + return task; + } + + public static SchedulerTask scheduleSyncDelayedTask(@NotNull Plugin plugin, @NotNull Runnable runnable, long delay) { + if (isFolia) { + return new SchedulerTask(plugin.getServer().getGlobalRegionScheduler().runDelayed(plugin, scheduledTask -> runnable.run(), correctDelay(delay))); + } + return new SchedulerTask(Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, runnable, delay)); + } + + public static SchedulerTask scheduleSyncRepeatingTask(@NotNull Plugin plugin, @NotNull SchedulerRunnable runnable, long delay, long period) { + if (isFolia) { + SchedulerTask task = new SchedulerTask(plugin.getServer().getGlobalRegionScheduler().runAtFixedRate(plugin, scheduledTask -> runnable.run(), correctDelay(delay), correctDelay(period))); + runnable.setTask(task); + return task; + } + SchedulerTask task = new SchedulerTask(Bukkit.getScheduler().scheduleSyncRepeatingTask(plugin, runnable, delay, period)); + runnable.setTask(task); + return task; + } + + public static SchedulerTask scheduleSyncRepeatingTask(@NotNull Plugin plugin, @NotNull Runnable runnable, long delay, long period) { + if (isFolia) { + return new SchedulerTask(plugin.getServer().getGlobalRegionScheduler().runAtFixedRate(plugin, scheduledTask -> runnable.run(), correctDelay(delay), correctDelay(period))); + } + return new SchedulerTask(Bukkit.getScheduler().scheduleSyncRepeatingTask(plugin, runnable, delay, period)); + } + + public static SchedulerTask runTaskTimer(@NotNull Plugin plugin, @NotNull SchedulerRunnable runnable, long delay, long period) { + if (isFolia) { + SchedulerTask task = new SchedulerTask(plugin.getServer().getGlobalRegionScheduler().runAtFixedRate(plugin, scheduledTask -> runnable.run(), correctDelay(delay), correctDelay(period))); + runnable.setTask(task); + return task; + } + //return new SchedulerTask(Bukkit.getScheduler().runTaskTimer(plugin, runnable, delay, period)); + SchedulerTask task = new SchedulerTask(Bukkit.getScheduler().runTaskTimer(plugin, runnable, correctDelay(delay), period)); + runnable.setTask(task); + return task; + } + + public static SchedulerTask runTaskTimer(@NotNull Plugin plugin, @NotNull Runnable runnable, long delay, long period) { + if (isFolia) { + return new SchedulerTask(plugin.getServer().getGlobalRegionScheduler().runAtFixedRate(plugin, scheduledTask -> runnable.run(), delay, period)); + } + return new SchedulerTask(Bukkit.getScheduler().runTaskTimer(plugin, runnable, delay, period)); + } + + public static SchedulerTask runTaskTimerAsynchronously(@NotNull Plugin plugin, @NotNull SchedulerRunnable runnable, long delay, long period) { + if (isFolia) { + SchedulerTask task = new SchedulerTask(plugin.getServer().getAsyncScheduler().runAtFixedRate(plugin, scheduledTask -> runnable.run(), correctDelay(delay), correctDelay(period), TimeUnit.MILLISECONDS)); + runnable.setTask(task); + return task; + } + SchedulerTask task = new SchedulerTask(Bukkit.getScheduler().runTaskTimerAsynchronously(plugin, runnable, delay, period)); + runnable.setTask(task); + return task; + } + + public static SchedulerTask runTaskTimerAsynchronously(@NotNull Plugin plugin, @NotNull Runnable runnable, long delay, long period) { + if (isFolia) { + return new SchedulerTask(plugin.getServer().getAsyncScheduler().runAtFixedRate(plugin, scheduledTask -> runnable.run(), correctDelay(delay), correctDelay(period), TimeUnit.MILLISECONDS)); + } + return new SchedulerTask(Bukkit.getScheduler().runTaskTimerAsynchronously(plugin, runnable, delay, period)); + } + + public static void cancelTask(SchedulerTask task) { + if (task == null) return; + if (isFolia) { + task.getAsFoliaTask().cancel(); + } else { + Bukkit.getScheduler().cancelTask(task.getAsBukkitTaskId()); + } + } + + public static void cancelAllTasks(Plugin plugin) { + if (isFolia) { + Bukkit.getAsyncScheduler().cancelTasks(plugin); + Bukkit.getGlobalRegionScheduler().cancelTasks(plugin); + } else { + Bukkit.getScheduler().cancelTasks(plugin); + } + } + + public static boolean isCurrentlyRunning(SchedulerTask task) { + if (isFolia) { + return task.getAsFoliaTask().getExecutionState() == ScheduledTask.ExecutionState.RUNNING; + } else { + return Bukkit.getScheduler().isCurrentlyRunning(task.getAsBukkitTaskId()); + } + } + + public static boolean isQueued(SchedulerTask task) { + if (isFolia) { + return task.getAsFoliaTask().getExecutionState() == ScheduledTask.ExecutionState.RUNNING; + } else { + return Bukkit.getScheduler().isQueued(task.getAsBukkitTaskId()); + } + } + + private static long correctDelay(long delay) { + if (isFolia && delay <= 0) { + return 1; + } + return delay; + } +} diff --git a/NMS/NMS-API/pom.xml b/NMS/NMS-API/pom.xml index 762336d8a..67b8b4fa2 100644 --- a/NMS/NMS-API/pom.xml +++ b/NMS/NMS-API/pom.xml @@ -13,6 +13,13 @@ CraftaroCore-NMS-API + + dev.folia + folia-api + 1.19.4-R0.1-SNAPSHOT + provided + + org.spigotmc diff --git a/NMS/NMS-API/src/main/java/com/craftaro/core/nms/world/SWorld.java b/NMS/NMS-API/src/main/java/com/craftaro/core/nms/world/SWorld.java index 00bc2d512..48b2bcf95 100644 --- a/NMS/NMS-API/src/main/java/com/craftaro/core/nms/world/SWorld.java +++ b/NMS/NMS-API/src/main/java/com/craftaro/core/nms/world/SWorld.java @@ -1,9 +1,13 @@ package com.craftaro.core.nms.world; +import io.papermc.paper.threadedregions.scheduler.EntityScheduler; +import org.bukkit.Location; import org.bukkit.Material; +import org.bukkit.entity.Entity; import org.bukkit.entity.LivingEntity; import java.util.List; +import java.util.Map; public interface SWorld { List getLivingEntities(); @@ -17,4 +21,8 @@ public interface SWorld { // TODO: Check if FabledSkyBlock *really* needs this method and if it can be removed. // Would make thinks less complicated and I kinda cannot imagine it being *that* much faster to be worth it? void setBlockFast(int x, int y, int z, Material material); + + default Map> getRegionizedEntities() { + throw new UnsupportedOperationException("This server version does not support threaded regions. Not a Folia server."); + } } diff --git a/NMS/NMS-v1_19_R3/pom.xml b/NMS/NMS-v1_19_R3/pom.xml index e959ef456..84bebb7f4 100644 --- a/NMS/NMS-v1_19_R3/pom.xml +++ b/NMS/NMS-v1_19_R3/pom.xml @@ -62,6 +62,13 @@ + + dev.folia + folia-api + 1.19.4-R0.1-SNAPSHOT + provided + + org.spigotmc @@ -84,5 +91,12 @@ ${project.version} provided + + + io.papermc + paperlib + 1.0.7 + provided + diff --git a/NMS/NMS-v1_19_R3/src/main/java/com/craftaro/core/nms/v1_19_R3/world/SSpawnerImpl.java b/NMS/NMS-v1_19_R3/src/main/java/com/craftaro/core/nms/v1_19_R3/world/SSpawnerImpl.java index f96131fa5..3e5637d08 100644 --- a/NMS/NMS-v1_19_R3/src/main/java/com/craftaro/core/nms/v1_19_R3/world/SSpawnerImpl.java +++ b/NMS/NMS-v1_19_R3/src/main/java/com/craftaro/core/nms/v1_19_R3/world/SSpawnerImpl.java @@ -5,6 +5,7 @@ import com.craftaro.core.nms.world.SSpawner; import com.craftaro.core.nms.world.SpawnedEntity; import com.cryptomorin.xseries.XMaterial; +import io.papermc.lib.PaperLib; import net.minecraft.core.BlockPos; import net.minecraft.nbt.CompoundTag; import net.minecraft.server.level.ServerLevel; @@ -93,7 +94,7 @@ public LivingEntity spawnEntity(EntityType type, String particleType, SpawnedEnt world.addFreshEntity(entity, CreatureSpawnEvent.SpawnReason.SPAWNER); spot.setYaw(random.nextFloat() * 360.0F); - craftEntity.teleport(spot); + PaperLib.teleportAsync(craftEntity, spot); return craftEntity; } diff --git a/NMS/NMS-v1_19_R3/src/main/java/com/craftaro/core/nms/v1_19_R3/world/SWorldImpl.java b/NMS/NMS-v1_19_R3/src/main/java/com/craftaro/core/nms/v1_19_R3/world/SWorldImpl.java index d0395d53c..695b547e9 100644 --- a/NMS/NMS-v1_19_R3/src/main/java/com/craftaro/core/nms/v1_19_R3/world/SWorldImpl.java +++ b/NMS/NMS-v1_19_R3/src/main/java/com/craftaro/core/nms/v1_19_R3/world/SWorldImpl.java @@ -1,20 +1,29 @@ package com.craftaro.core.nms.v1_19_R3.world; +import com.craftaro.core.compatibility.ServerProject; +import com.craftaro.core.compatibility.ServerVersion; import com.craftaro.core.nms.world.SWorld; +import io.papermc.paper.threadedregions.scheduler.EntityScheduler; import net.minecraft.core.BlockPos; import net.minecraft.server.level.ServerLevel; import net.minecraft.world.entity.Entity; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.chunk.LevelChunk; import net.minecraft.world.level.entity.LevelEntityGetter; +import org.bukkit.Bukkit; +import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.World; import org.bukkit.craftbukkit.v1_19_R3.CraftWorld; import org.bukkit.craftbukkit.v1_19_R3.block.data.CraftBlockData; import org.bukkit.entity.LivingEntity; +import java.lang.reflect.Field; import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; import java.util.List; +import java.util.Map; public class SWorldImpl implements SWorld { private final World world; @@ -49,4 +58,24 @@ public void setBlockFast(int x, int y, int z, Material material) { levelChunk.setBlockState(new BlockPos(x & 0xF, y, z & 0xF), blockState, true); } + + @Override + public Map> getRegionizedEntities() { + if (!ServerProject.isServer(ServerProject.FOLIA)) { + SWorld.super.getRegionizedEntities(); + } + Map> result = new HashMap<>(); + + for (LivingEntity entity : getLivingEntities()) { + EntityScheduler scheduler = entity.getScheduler(); + + if (!result.containsKey(scheduler)) { + result.computeIfAbsent(scheduler, k -> new ArrayList<>(List.of(entity))); + } + + result.get(scheduler).add(entity); + } + + return result; + } } diff --git a/pom.xml b/pom.xml index 97f91b6ae..bd7998fa4 100644 --- a/pom.xml +++ b/pom.xml @@ -23,6 +23,7 @@ Core Compatibility + Folia-Compatibility NMS/NMS NMS/NMS-API From 8da9a13a32424b45284df310bdd7a867420238ed Mon Sep 17 00:00:00 2001 From: ceze88 Date: Fri, 5 Jun 2026 17:55:43 +0200 Subject: [PATCH 2/2] Fix compilation issues --- .../core/compatibility/ClientVersion.java | 5 +- Core/pom.xml | 2 +- .../java/com/songoda/core/SongodaCore.java | 98 +++---------------- .../java/com/songoda/core/SongodaPlugin.java | 32 +++--- .../java/com/songoda/core/gui/GuiManager.java | 2 + .../com/songoda/core/input/ChatPrompt.java | 6 +- .../core/lootables/loot/DropUtils.java | 8 +- .../java/com/songoda/core/utils/Metrics.java | 4 +- .../java/com/songoda/core/world/SWorld.java | 4 +- Folia-Compatibility/pom.xml | 10 +- .../folia/SchedulerRunnable.java | 2 +- .../compatibility/folia/SchedulerTask.java | 2 +- .../compatibility/folia/SchedulerUtils.java | 2 +- NMS/NMS-v1_19_R3/pom.xml | 2 +- .../core/nms/v1_19_R3/world/SWorldImpl.java | 6 +- 15 files changed, 54 insertions(+), 131 deletions(-) rename Folia-Compatibility/src/main/java/com/{craftaro => songoda}/core/compatibility/folia/SchedulerRunnable.java (86%) rename Folia-Compatibility/src/main/java/com/{craftaro => songoda}/core/compatibility/folia/SchedulerTask.java (95%) rename Folia-Compatibility/src/main/java/com/{craftaro => songoda}/core/compatibility/folia/SchedulerUtils.java (99%) diff --git a/Compatibility/src/main/java/com/songoda/core/compatibility/ClientVersion.java b/Compatibility/src/main/java/com/songoda/core/compatibility/ClientVersion.java index 5ba50a8e8..30ea7cccd 100644 --- a/Compatibility/src/main/java/com/songoda/core/compatibility/ClientVersion.java +++ b/Compatibility/src/main/java/com/songoda/core/compatibility/ClientVersion.java @@ -1,9 +1,8 @@ package com.songoda.core.compatibility; -import com.craftaro.core.compatibility.folia.SchedulerRunnable; -import com.craftaro.core.compatibility.folia.SchedulerUtils; +import com.songoda.core.compatibility.folia.SchedulerRunnable; +import com.songoda.core.compatibility.folia.SchedulerUtils; import com.viaversion.viaversion.api.Via; -import org.bukkit.Bukkit; import org.bukkit.entity.Player; import org.bukkit.plugin.java.JavaPlugin; diff --git a/Core/pom.xml b/Core/pom.xml index 719a48496..1b0f729bb 100644 --- a/Core/pom.xml +++ b/Core/pom.xml @@ -226,7 +226,7 @@ io.papermc paperlib - 1.0.7 + 1.0.8 compile diff --git a/Core/src/main/java/com/songoda/core/SongodaCore.java b/Core/src/main/java/com/songoda/core/SongodaCore.java index d895ea30d..68a5fe474 100644 --- a/Core/src/main/java/com/songoda/core/SongodaCore.java +++ b/Core/src/main/java/com/songoda/core/SongodaCore.java @@ -1,21 +1,16 @@ package com.songoda.core; -import com.craftaro.core.compatibility.folia.SchedulerRunnable; -import com.craftaro.core.compatibility.folia.SchedulerTask; -import com.craftaro.core.compatibility.folia.SchedulerUtils; -import com.craftaro.core.commands.CommandManager; -import com.craftaro.core.compatibility.ClientVersion; -import com.craftaro.core.core.LocaleModule; -import com.craftaro.core.core.PluginInfo; -import com.craftaro.core.core.PluginInfoModule; -import com.craftaro.core.core.SongodaCoreCommand; -import com.craftaro.core.core.SongodaCoreDiagCommand; -import com.craftaro.core.core.SongodaCoreLicenseCommand; -import com.craftaro.core.core.SongodaCoreUUIDCommand; -import com.craftaro.core.verification.CraftaroProductVerification; -import com.craftaro.core.verification.ProductVerificationStatus; +import com.songoda.core.compatibility.folia.SchedulerRunnable; +import com.songoda.core.compatibility.folia.SchedulerTask; +import com.songoda.core.compatibility.folia.SchedulerUtils; +import com.songoda.core.commands.CommandManager; +import com.songoda.core.compatibility.ClientVersion; +import com.songoda.core.core.PluginInfo; +import com.songoda.core.core.SongodaCoreCommand; +import com.songoda.core.core.SongodaCoreDiagCommand; import com.cryptomorin.xseries.XMaterial; import org.bukkit.Bukkit; +import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.HandlerList; import org.bukkit.event.Listener; @@ -25,17 +20,16 @@ import org.bukkit.event.server.PluginEnableEvent; import org.bukkit.plugin.ServicePriority; import org.bukkit.plugin.java.JavaPlugin; -import org.json.simple.JSONObject; -import org.json.simple.parser.JSONParser; -import org.json.simple.parser.ParseException; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.util.ArrayList; +import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Objects; import java.util.Set; +import java.util.UUID; import java.util.logging.Level; public class SongodaCore { @@ -239,59 +233,8 @@ private void register(JavaPlugin plugin, int pluginID, String icon, String libra getLogger().info(getPrefix() + "Hooked " + plugin.getName() + "."); PluginInfo info = new PluginInfo(plugin, pluginID, icon, libraryVersion); - // don't forget to check for language pack updates ;) - info.addModule(new LocaleModule()); - registeredPlugins.add(info); - tasks.add(SchedulerUtils.runTaskLaterAsynchronously(plugin, new SchedulerRunnable() { - @Override - public void run() { - update(info); - } - }, 60L)); - } - - /** - * @deprecated Seems useless and will probably be replaced in the near future - */ - @Deprecated - private void update(PluginInfo plugin) { - try { - URL url = new URL("https://update.songoda.com/index.php?plugin=" + plugin.getSongodaId() - + "&version=" + plugin.getJavaPlugin().getDescription().getVersion() - + "&updaterVersion=" + updaterVersion); - HttpURLConnection urlConnection = (HttpURLConnection) url.openConnection(); - urlConnection.setRequestProperty("User-Agent", "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.95 Safari/537.11"); - urlConnection.setRequestProperty("Accept", "*/*"); - urlConnection.setConnectTimeout(5000); - InputStream is = urlConnection.getInputStream(); - InputStreamReader isr = new InputStreamReader(is); - - int numCharsRead; - char[] charArray = new char[1024]; - StringBuilder sb = new StringBuilder(); - while ((numCharsRead = isr.read(charArray)) > 0) { - sb.append(charArray, 0, numCharsRead); - } - urlConnection.disconnect(); - - String jsonString = sb.toString(); - JSONObject json = (JSONObject) new JSONParser().parse(jsonString); - - plugin.setLatestVersion((String) json.get("latestVersion")); - plugin.setMarketplaceLink((String) json.get("link")); - plugin.setNotification((String) json.get("notification")); - plugin.setChangeLog((String) json.get("changeLog")); - - plugin.setJson(json); - - for (PluginInfoModule module : plugin.getModules()) { - module.run(plugin); - } - } catch (IOException ex) { - final String er = ex.getMessage(); - getLogger().log(Level.FINE, "Connection with Songoda servers failed: " + (er.contains("URL") ? er.substring(0, er.indexOf("URL") + 3) : er)); - } catch (ParseException ex) { - getLogger().log(Level.FINE, "Failed to parse json for " + plugin.getJavaPlugin().getName() + " update check"); + if (plugin.getDescription().getWebsite() != null && plugin.getDescription().getWebsite().contains("songoda.com/")) { + info.setMarketplaceLink(plugin.getDescription().getWebsite()); } registeredPlugins.add(info); @@ -426,21 +369,6 @@ void onLogin(PlayerLoginEvent event) { } this.lastCheck.put(player.getUniqueId(), now); - - // is this player good to revieve update notices? - if (!event.getPlayer().isOp() && !player.hasPermission("songoda.updatecheck")) return; - - // check for updates! ;) - for (PluginInfo plugin : getPlugins()) { - if (plugin.getNotification() != null && plugin.getJavaPlugin().isEnabled()) { - SchedulerUtils.runTaskLaterAsynchronously(plugin.getJavaPlugin(), new SchedulerRunnable() { - @Override - public void run() { - player.sendMessage("[" + plugin.getJavaPlugin().getName() + "] " + plugin.getNotification()); - } - }, 10L); - } - } } @EventHandler diff --git a/Core/src/main/java/com/songoda/core/SongodaPlugin.java b/Core/src/main/java/com/songoda/core/SongodaPlugin.java index 2ed3d270e..58eb981f7 100644 --- a/Core/src/main/java/com/songoda/core/SongodaPlugin.java +++ b/Core/src/main/java/com/songoda/core/SongodaPlugin.java @@ -1,30 +1,24 @@ package com.songoda.core; -import com.craftaro.core.compatibility.folia.SchedulerRunnable; -import com.craftaro.core.compatibility.folia.SchedulerUtils; -import com.craftaro.core.configuration.Config; -import com.craftaro.core.database.DataManager; -import com.craftaro.core.database.DataMigration; -import com.craftaro.core.database.DatabaseType; -import com.craftaro.core.dependency.Dependency; -import com.craftaro.core.dependency.DependencyLoader; -import com.craftaro.core.dependency.Relocation; -import com.craftaro.core.hooks.HookRegistryManager; -import com.craftaro.core.locale.Locale; -import com.craftaro.core.utils.Metrics; -import com.craftaro.core.verification.CraftaroProductVerification; -import com.craftaro.core.verification.ProductVerificationStatus; -import com.cryptomorin.xseries.XMaterial; +import com.songoda.core.compatibility.folia.SchedulerRunnable; +import com.songoda.core.compatibility.folia.SchedulerUtils; +import com.songoda.core.configuration.Config; +import com.songoda.core.database.DataManager; +import com.songoda.core.database.DataMigration; +import com.songoda.core.database.DatabaseType; +import com.songoda.core.dependency.Dependency; +import com.songoda.core.dependency.DependencyLoader; +import com.songoda.core.dependency.Relocation; +import com.songoda.core.hooks.HookRegistryManager; +import com.songoda.core.locale.Locale; +import com.songoda.core.utils.Metrics; import de.tr7zw.changeme.nbtapi.utils.MinecraftVersion; -import net.kyori.adventure.audience.Audience; import net.kyori.adventure.platform.bukkit.BukkitAudiences; import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.command.CommandSender; import org.bukkit.configuration.file.FileConfiguration; -import org.bukkit.plugin.SimplePluginManager; import org.bukkit.plugin.java.JavaPlugin; -import org.bukkit.plugin.java.JavaPluginLoader; import org.jetbrains.annotations.NotNull; import java.io.File; @@ -124,7 +118,7 @@ public final void onLoad() { dependencies.add(new Dependency("https://repo.songoda.com/repository/third-party/", "com;cryptomorin", "XSeries", "13.7.0", false, new Relocation("com;cryptomorin;xseries", "com;songoda;third_party;com;cryptomorin;xseries")) // Custom relocation if the package names not match with the groupId ); - dependencies.add(new Dependency("https://papermc.io/repo/repository/maven-public/", "io;papermc", "paperlib", "1.0.7")); + dependencies.add(new Dependency("https://papermc.io/repo/repository/maven-public/", "io;papermc", "paperlib", "1.0.8")); //Load plugin dependencies new DependencyLoader(this).loadDependencies(dependencies); diff --git a/Core/src/main/java/com/songoda/core/gui/GuiManager.java b/Core/src/main/java/com/songoda/core/gui/GuiManager.java index b5e0b0558..61f6719b6 100644 --- a/Core/src/main/java/com/songoda/core/gui/GuiManager.java +++ b/Core/src/main/java/com/songoda/core/gui/GuiManager.java @@ -3,6 +3,8 @@ import com.songoda.core.compatibility.ClientVersion; import com.songoda.core.compatibility.ServerVersion; import com.cryptomorin.xseries.XMaterial; +import com.songoda.core.compatibility.folia.SchedulerRunnable; +import com.songoda.core.compatibility.folia.SchedulerUtils; import org.bukkit.Bukkit; import org.bukkit.Material; import org.bukkit.entity.Player; diff --git a/Core/src/main/java/com/songoda/core/input/ChatPrompt.java b/Core/src/main/java/com/songoda/core/input/ChatPrompt.java index 9fafe6d72..850c1e2fc 100644 --- a/Core/src/main/java/com/songoda/core/input/ChatPrompt.java +++ b/Core/src/main/java/com/songoda/core/input/ChatPrompt.java @@ -1,8 +1,8 @@ package com.songoda.core.input; -import com.craftaro.core.compatibility.folia.SchedulerRunnable; -import com.craftaro.core.compatibility.folia.SchedulerTask; -import com.craftaro.core.compatibility.folia.SchedulerUtils; +import com.songoda.core.compatibility.folia.SchedulerRunnable; +import com.songoda.core.compatibility.folia.SchedulerTask; +import com.songoda.core.compatibility.folia.SchedulerUtils; import org.bukkit.Bukkit; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; diff --git a/Core/src/main/java/com/songoda/core/lootables/loot/DropUtils.java b/Core/src/main/java/com/songoda/core/lootables/loot/DropUtils.java index c6eda91c6..e13bca2bd 100644 --- a/Core/src/main/java/com/songoda/core/lootables/loot/DropUtils.java +++ b/Core/src/main/java/com/songoda/core/lootables/loot/DropUtils.java @@ -1,9 +1,9 @@ package com.songoda.core.lootables.loot; -import com.craftaro.core.compatibility.folia.SchedulerRunnable; -import com.craftaro.core.compatibility.folia.SchedulerUtils; -import com.craftaro.core.SongodaCore; -import com.craftaro.ultimatestacker.api.UltimateStackerApi; +import com.songoda.core.compatibility.folia.SchedulerRunnable; +import com.songoda.core.compatibility.folia.SchedulerUtils; +import com.songoda.core.SongodaCore; +import com.songoda.ultimatestacker.api.UltimateStackerApi; import org.bukkit.Bukkit; import org.bukkit.Material; import org.bukkit.entity.LivingEntity; diff --git a/Core/src/main/java/com/songoda/core/utils/Metrics.java b/Core/src/main/java/com/songoda/core/utils/Metrics.java index 05a8e2830..684228452 100644 --- a/Core/src/main/java/com/songoda/core/utils/Metrics.java +++ b/Core/src/main/java/com/songoda/core/utils/Metrics.java @@ -1,7 +1,7 @@ package com.songoda.core.utils; -import com.craftaro.core.compatibility.folia.SchedulerRunnable; -import com.craftaro.core.compatibility.folia.SchedulerUtils; +import com.songoda.core.compatibility.folia.SchedulerRunnable; +import com.songoda.core.compatibility.folia.SchedulerUtils; import org.bukkit.Bukkit; import org.bukkit.configuration.file.YamlConfiguration; import org.bukkit.entity.Player; diff --git a/Core/src/main/java/com/songoda/core/world/SWorld.java b/Core/src/main/java/com/songoda/core/world/SWorld.java index 8c841ed61..ba3174121 100644 --- a/Core/src/main/java/com/songoda/core/world/SWorld.java +++ b/Core/src/main/java/com/songoda/core/world/SWorld.java @@ -1,7 +1,7 @@ package com.songoda.core.world; -import com.craftaro.core.compatibility.ServerVersion; -import com.craftaro.core.nms.Nms; +import com.songoda.core.compatibility.ServerVersion; +import com.songoda.core.nms.Nms; import io.papermc.paper.threadedregions.scheduler.EntityScheduler; import org.bukkit.Location; import org.bukkit.World; diff --git a/Folia-Compatibility/pom.xml b/Folia-Compatibility/pom.xml index d4fca0456..1e3458aa7 100644 --- a/Folia-Compatibility/pom.xml +++ b/Folia-Compatibility/pom.xml @@ -4,9 +4,9 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 - com.craftaro - CraftaroCore-Modules - 3.0.0-SNAPSHOT + com.songoda + SongodaCore-Modules + 4.0.0-SNAPSHOT ../pom.xml @@ -24,7 +24,7 @@ org.apache.maven.plugins maven-compiler-plugin - 3.8.1 + 3.15.0 ${java.version} ${java.version} @@ -64,7 +64,7 @@ io.papermc paperlib - 1.0.7 + 1.0.8 provided diff --git a/Folia-Compatibility/src/main/java/com/craftaro/core/compatibility/folia/SchedulerRunnable.java b/Folia-Compatibility/src/main/java/com/songoda/core/compatibility/folia/SchedulerRunnable.java similarity index 86% rename from Folia-Compatibility/src/main/java/com/craftaro/core/compatibility/folia/SchedulerRunnable.java rename to Folia-Compatibility/src/main/java/com/songoda/core/compatibility/folia/SchedulerRunnable.java index 022e95e86..23a028578 100644 --- a/Folia-Compatibility/src/main/java/com/craftaro/core/compatibility/folia/SchedulerRunnable.java +++ b/Folia-Compatibility/src/main/java/com/songoda/core/compatibility/folia/SchedulerRunnable.java @@ -1,4 +1,4 @@ -package com.craftaro.core.compatibility.folia; +package com.songoda.core.compatibility.folia; public abstract class SchedulerRunnable implements Runnable { diff --git a/Folia-Compatibility/src/main/java/com/craftaro/core/compatibility/folia/SchedulerTask.java b/Folia-Compatibility/src/main/java/com/songoda/core/compatibility/folia/SchedulerTask.java similarity index 95% rename from Folia-Compatibility/src/main/java/com/craftaro/core/compatibility/folia/SchedulerTask.java rename to Folia-Compatibility/src/main/java/com/songoda/core/compatibility/folia/SchedulerTask.java index 147c7c379..c7439da28 100644 --- a/Folia-Compatibility/src/main/java/com/craftaro/core/compatibility/folia/SchedulerTask.java +++ b/Folia-Compatibility/src/main/java/com/songoda/core/compatibility/folia/SchedulerTask.java @@ -1,4 +1,4 @@ -package com.craftaro.core.compatibility.folia; +package com.songoda.core.compatibility.folia; import io.papermc.paper.threadedregions.scheduler.ScheduledTask; import org.bukkit.scheduler.BukkitTask; diff --git a/Folia-Compatibility/src/main/java/com/craftaro/core/compatibility/folia/SchedulerUtils.java b/Folia-Compatibility/src/main/java/com/songoda/core/compatibility/folia/SchedulerUtils.java similarity index 99% rename from Folia-Compatibility/src/main/java/com/craftaro/core/compatibility/folia/SchedulerUtils.java rename to Folia-Compatibility/src/main/java/com/songoda/core/compatibility/folia/SchedulerUtils.java index 4f5917ecf..1ce9f5d47 100644 --- a/Folia-Compatibility/src/main/java/com/craftaro/core/compatibility/folia/SchedulerUtils.java +++ b/Folia-Compatibility/src/main/java/com/songoda/core/compatibility/folia/SchedulerUtils.java @@ -1,4 +1,4 @@ -package com.craftaro.core.compatibility.folia; +package com.songoda.core.compatibility.folia; import io.papermc.paper.threadedregions.scheduler.ScheduledTask; import org.bukkit.Bukkit; diff --git a/NMS/NMS-v1_19_R3/pom.xml b/NMS/NMS-v1_19_R3/pom.xml index 441f177f3..df2dc7f65 100644 --- a/NMS/NMS-v1_19_R3/pom.xml +++ b/NMS/NMS-v1_19_R3/pom.xml @@ -95,7 +95,7 @@ io.papermc paperlib - 1.0.7 + 1.0.8 provided diff --git a/NMS/NMS-v1_19_R3/src/main/java/com/songoda/core/nms/v1_19_R3/world/SWorldImpl.java b/NMS/NMS-v1_19_R3/src/main/java/com/songoda/core/nms/v1_19_R3/world/SWorldImpl.java index 819825003..bfa361ae7 100644 --- a/NMS/NMS-v1_19_R3/src/main/java/com/songoda/core/nms/v1_19_R3/world/SWorldImpl.java +++ b/NMS/NMS-v1_19_R3/src/main/java/com/songoda/core/nms/v1_19_R3/world/SWorldImpl.java @@ -1,8 +1,8 @@ package com.songoda.core.nms.v1_19_R3.world; -import com.craftaro.core.compatibility.ServerProject; -import com.craftaro.core.compatibility.ServerVersion; -import com.craftaro.core.nms.world.SWorld; +import com.songoda.core.compatibility.ServerProject; +import com.songoda.core.compatibility.ServerVersion; +import com.songoda.core.nms.world.SWorld; import io.papermc.paper.threadedregions.scheduler.EntityScheduler; import net.minecraft.core.BlockPos; import net.minecraft.server.level.ServerLevel;