mirror of
https://github.com/GeorgH93/Minepacks.git
synced 2025-01-03 18:47:43 +01:00
Refactor to use FoliaLib scheduler for "Bukkit.getServer().getScheduler()"
This commit is contained in:
parent
827f71f7d5
commit
daf83be12a
@ -116,14 +116,10 @@ private void debugSystem(final @NotNull CommandSender commandSender)
|
||||
ItemStack slot = sender.getInventory().getItem(0);
|
||||
if(slot == null || slot.getAmount() == 0 || slot.getType() == Material.AIR) sender.getInventory().setItem(0, new ItemStack(Material.ACACIA_BOAT));
|
||||
|
||||
Bukkit.getServer().getScheduler().runTaskLater(plugin, () -> {
|
||||
sender.performCommand("backpack");
|
||||
}, 5*20L);
|
||||
Bukkit.getServer().getScheduler().runTaskLater(plugin, () -> {
|
||||
Bukkit.getPluginManager().callEvent(new ClickEvent(sender.getOpenInventory(), InventoryType.SlotType.QUICKBAR, InventoryUtils.getPlayerTopInventory(sender).getSize() + 27, ClickType.LEFT, InventoryAction.PICKUP_ALL));
|
||||
}, 10*20L);
|
||||
Bukkit.getServer().getScheduler().runTaskLater(plugin, sender::closeInventory, 20*20L);
|
||||
Bukkit.getServer().getScheduler().runTaskLater(plugin, () -> {
|
||||
Minepacks.getScheduler().runAtEntityLater(sender, () -> sender.performCommand("backpack"), 5*20L);
|
||||
Minepacks.getScheduler().runAtEntityLater(sender, () -> Bukkit.getPluginManager().callEvent(new ClickEvent(sender.getOpenInventory(), InventoryType.SlotType.QUICKBAR, InventoryUtils.getPlayerTopInventory(sender).getSize() + 27, ClickType.LEFT, InventoryAction.PICKUP_ALL)), 10*20L);
|
||||
Minepacks.getScheduler().runAtEntityLater(sender, sender::closeInventory, 20*20L);
|
||||
Minepacks.getScheduler().runLater(() -> {
|
||||
try
|
||||
{
|
||||
writer.flush();
|
||||
|
@ -24,7 +24,6 @@
|
||||
import at.pcgamingfreaks.Minepacks.Bukkit.Minepacks;
|
||||
import at.pcgamingfreaks.Utils;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
@ -172,7 +171,7 @@ protected String replacePlaceholders(@Language("SQL") String query)
|
||||
|
||||
protected void runStatementAsync(final String query, final Object... args)
|
||||
{
|
||||
Bukkit.getServer().getScheduler().runTaskAsynchronously(plugin, () -> runStatement(query, args));
|
||||
Minepacks.getScheduler().runAsync(task -> runStatement(query, args));
|
||||
}
|
||||
|
||||
protected void runStatement(final String query, final Object... args)
|
||||
|
@ -262,7 +262,7 @@ private void unload()
|
||||
HandlerList.unregisterAll(this); // Stop the listeners
|
||||
if(cooldownManager != null) cooldownManager.close();
|
||||
cooldownManager = null;
|
||||
getServer().getScheduler().cancelTasks(this); // Kill all running task
|
||||
getScheduler().cancelAllTasks(); // Kill all running task
|
||||
itemFilter = null;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user