From 0317ba55be4bf195413562ddd3f6d71193a63c4b Mon Sep 17 00:00:00 2001 From: Loving11ish Date: Wed, 13 Mar 2024 19:52:18 +0000 Subject: [PATCH] Added startup checks to look for Hybrid server environment. Cleaned up some code formatting. Updated Folia API to 1.20.2. Changed version to `2.9.10-SNAPSHOT-01`. --- build.gradle.kts | 4 +- .../java/main/java/me/dniym/IllegalStack.java | 150 ++++++++++++------ .../main/java/me/dniym/timers/fTimer.java | 149 ++++++++++------- .../main/java/me/dniym/timers/sTimer.java | 20 ++- .../main/java/me/dniym/timers/syncTimer.java | 75 +++++---- src/main/resources/plugin.yml | 4 +- 6 files changed, 260 insertions(+), 142 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index f3d04a8..2ae6e4b 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -39,7 +39,7 @@ repositories { } dependencies { - compileOnly("dev.folia:folia-api:1.20.1-R0.1-SNAPSHOT") + compileOnly("dev.folia:folia-api:1.20.2-R0.1-SNAPSHOT") compileOnly("com.comphenix.protocol:ProtocolLib:5.0.0") compileOnly("com.elmakers.mine.bukkit:MagicAPI:10.2") compileOnly("de.tr7zw:item-nbt-api-plugin:2.8.0") @@ -66,7 +66,7 @@ tasks.compileJava.configure { options.release.set(8) } -version = "2.9.9" +version = "2.9.10-SNAPSHOT-01" tasks.named("processResources") { filesMatching("plugin.yml") { diff --git a/src/main/java/main/java/me/dniym/IllegalStack.java b/src/main/java/main/java/me/dniym/IllegalStack.java index 520e325..6a7ebb7 100644 --- a/src/main/java/main/java/me/dniym/IllegalStack.java +++ b/src/main/java/main/java/me/dniym/IllegalStack.java @@ -42,6 +42,7 @@ public class IllegalStack extends JavaPlugin { private static IllegalStack plugin; private static Plugin ProCosmetics = null; + private static boolean isHybridEnvironment = false; private static boolean hasProtocolLib = false; private static boolean hasAttribAPI = false; private static boolean nbtAPI = false; @@ -82,6 +83,10 @@ public void setPlugin(IllegalStack plugin) { IllegalStack.plugin = plugin; } + public static boolean isIsHybridEnvironment() { + return isHybridEnvironment; + } + public static boolean isSpigot() { return Spigot; } @@ -106,7 +111,44 @@ public static void ReloadConfig(Boolean wasCommand) { } + private static void checkForHybridEnvironment() { + try { + Class.forName("io.izzel.arclight.i18n.ArclightConfig"); + isHybridEnvironment = true; + LOGGER.info("Server is an ArcLight hybrid environment, enabling hybrid scheduler checks."); + } catch (ClassNotFoundException e) { + isHybridEnvironment = false; + LOGGER.info("Server is NOT an ArcLight hybrid environment, continuing as normal."); + } + + if (!isIsHybridEnvironment()) { + try { + Class.forName("net.minecraftforge.fml.ModList"); + isHybridEnvironment = true; + LOGGER.info("Server is a Forge hybrid environment, enabling hybrid scheduler checks."); + + } catch (ClassNotFoundException e) { + isHybridEnvironment = false; + LOGGER.info("Server is NOT a Forge hybrid environment, continuing as normal."); + } + } + + if (!isIsHybridEnvironment()) { + try { + Class.forName("net.fabricmc.loader.api.FabricLoader"); + isHybridEnvironment = true; + LOGGER.info("Server is a Fabric hybrid environment, enabling hybrid scheduler checks."); + } catch (ClassNotFoundException e) { + isHybridEnvironment = false; + LOGGER.info("Server is NOT a Fabric hybrid environment, continuing as normal."); + } + } + } + private static void StartupPlugin() { + + checkForHybridEnvironment(); + try { Class.forName("org.spigotmc.SpigotConfig"); Spigot = true; @@ -116,13 +158,13 @@ private static void StartupPlugin() { } if (plugin.getServer().getPluginManager().getPlugin("Logblock") != null) { - File conf = new File(Bukkit.getPluginManager().getPlugin("Logblock").getDataFolder(), "config.yml"); - final FileConfiguration lbconfig = YamlConfiguration.loadConfiguration(conf); - - if(lbconfig != null) { - setLbBlock(Material.matchMaterial(lbconfig.getString("tools.toolblock.item"))); - LOGGER.info("Logblock plugin found, if blacklisted the toolblock item: " + getLbBlock().name() + " will not be removed."); - } + File conf = new File(Bukkit.getPluginManager().getPlugin("Logblock").getDataFolder(), "config.yml"); + final FileConfiguration lbconfig = YamlConfiguration.loadConfiguration(conf); + + if (lbconfig != null) { + setLbBlock(Material.matchMaterial(lbconfig.getString("tools.toolblock.item"))); + LOGGER.info("Logblock plugin found, if blacklisted the toolblock item: " + getLbBlock().name() + " will not be removed."); + } } if (plugin.getServer().getPluginManager().getPlugin("CMI") != null) { CMI = true; @@ -149,8 +191,9 @@ private static void StartupPlugin() { if (plugin.ScanTimer != null) { plugin.ScanTimer.cancel(); } - if (plugin.syncTimer != null) - plugin.syncTimer.cancel(); + if (plugin.syncTimer != null) { + plugin.syncTimer.cancel(); + } } @@ -322,8 +365,9 @@ public static boolean hasIds() { } public static boolean hasAsyncScheduler() { - return hasAsyncScheduler; + return hasAsyncScheduler; } + public static boolean hasShulkers() { return hasShulkers; } @@ -357,14 +401,15 @@ public void onEnable() { loadConfig(); updateConfig(); loadMsgs(); + checkForHybridEnvironment(); IllegalStackCommand illegalStackCommand = new IllegalStackCommand(); this.getCommand("istack").setExecutor(illegalStackCommand); this.getCommand("istack").setTabCompleter(illegalStackCommand); - + ProCosmetics = this.getServer().getPluginManager().getPlugin("ProCosmetics"); - - + + if (this.getServer().getPluginManager().getPlugin("EpicRename") != null) { EpicRename = true; } @@ -437,13 +482,13 @@ public void onEnable() { } if (plugin.getServer().getPluginManager().getPlugin("Logblock") != null) { - File conf = new File(Bukkit.getPluginManager().getPlugin("Logblock").getDataFolder(), "config.yml"); - final FileConfiguration lbconfig = YamlConfiguration.loadConfiguration(conf); - - if(lbconfig != null) { - setLbBlock(Material.matchMaterial(lbconfig.getString("tools.toolblock.item"))); - LOGGER.info("Logblock plugin found, if blacklisted the toolblock item: " + getLbBlock().name() + " will not be removed."); - } + File conf = new File(Bukkit.getPluginManager().getPlugin("Logblock").getDataFolder(), "config.yml"); + final FileConfiguration lbconfig = YamlConfiguration.loadConfiguration(conf); + + if (lbconfig != null) { + setLbBlock(Material.matchMaterial(lbconfig.getString("tools.toolblock.item"))); + LOGGER.info("Logblock plugin found, if blacklisted the toolblock item: " + getLbBlock().name() + " will not be removed."); + } } if (this.getServer().getPluginManager().getPlugin("CMI") != null) { @@ -490,7 +535,7 @@ public void onEnable() { Protections.ItemScanTimer.getIntValue() ); syncTimer = Scheduler.runTaskTimer(this, new syncTimer(this), 10, 10); - + } if (Protections.RemoveBooksNotMatchingCharset.isEnabled() && !fListener.getInstance().is113() && !fListener.is18()) { @@ -599,13 +644,14 @@ private void setHasContainers() { } private void setHasAsyncScheduler() { - try { - Class.forName("org.bukkit.Server.getAsyncScheduler"); - hasAsyncScheduler = true; - } catch (ClassNotFoundException ignored) { - - } + try { + Class.forName("org.bukkit.Server.getAsyncScheduler"); + hasAsyncScheduler = true; + } catch (ClassNotFoundException ignored) { + + } } + private void setHasChestedAnimals() { try { @@ -728,7 +774,11 @@ private void loadMsgs() { boolean update = false; for (Msg m : Msg.values()) { if (fc.getString(m.name()) == null) { - LOGGER.info(" {} Was missing from messages.yml, adding it with the default value {}", m.name(), m.getConfigVal()); + LOGGER.info( + " {} Was missing from messages.yml, adding it with the default value {}", + m.name(), + m.getConfigVal() + ); fc.set(m.name(), m.getConfigVal()); update = true; @@ -830,7 +880,10 @@ private void loadConfig() { } if (whitelisted.length() > 0) { - LOGGER.warn("WARNING: IllegalStack will NOT block but instead, will notify for the following exploits: {}", whitelisted); + LOGGER.warn( + "WARNING: IllegalStack will NOT block but instead, will notify for the following exploits: {}", + whitelisted + ); } whitelisted = new StringBuilder(); @@ -932,7 +985,7 @@ private void loadConfig() { } } - private static boolean disable=false; + private static boolean disable = false; public static boolean isDisable() { return disable; @@ -940,10 +993,10 @@ public static boolean isDisable() { @Override public void onDisable() { - disable=true; - if(hasAsyncScheduler) { + disable = true; + if (hasAsyncScheduler) { getServer().getAsyncScheduler().cancelTasks(this); - }else { + } else { Bukkit.getScheduler().cancelTasks(this); } @@ -969,14 +1022,17 @@ private void writeConfig() { if (relevant.get(p)) //relevant to this version, check if it exists. { if (config.getString(p.getConfigPath()) == null) { - - if(p == Protections.RemoveOverstackedItems && this.getServer().getPluginManager().getPlugin("StackableItems") != null) { - config.set(p.getConfigPath(), false); - LOGGER.warn("The StackableItems plugin has been detected on your server, The protection RemoveOverstackedItems has been automatically disabled to prevent item loss, enabling this protection will most definitely remove items as this plugin is known to break the vanilla stack limits."); - p.setEnabled(false); - } else - config.set(p.getConfigPath(), p.getDefaultValue()); - + + if (p == Protections.RemoveOverstackedItems && this.getServer().getPluginManager().getPlugin( + "StackableItems") != null) { + config.set(p.getConfigPath(), false); + LOGGER.warn( + "The StackableItems plugin has been detected on your server, The protection RemoveOverstackedItems has been automatically disabled to prevent item loss, enabling this protection will most definitely remove items as this plugin is known to break the vanilla stack limits."); + p.setEnabled(false); + } else { + config.set(p.getConfigPath(), p.getDefaultValue()); + } + LOGGER.warn( "Found a missing protection from your configuration: {} it has been added with a default value of: {}", p.name(), @@ -1033,12 +1089,12 @@ private void setVersion() { IllegalStack.version = version; } - public static Material getLbBlock() { - return lbBlock; - } + public static Material getLbBlock() { + return lbBlock; + } - public static void setLbBlock(Material lbBlock) { - IllegalStack.lbBlock = lbBlock; - } + public static void setLbBlock(Material lbBlock) { + IllegalStack.lbBlock = lbBlock; + } } diff --git a/src/main/java/main/java/me/dniym/timers/fTimer.java b/src/main/java/main/java/me/dniym/timers/fTimer.java index 2dd1702..f8b17f8 100644 --- a/src/main/java/main/java/me/dniym/timers/fTimer.java +++ b/src/main/java/main/java/me/dniym/timers/fTimer.java @@ -51,8 +51,8 @@ public class fTimer implements Runnable { private static final Map fbTracker = new ConcurrentHashMap<>(); //private static final Map projTracker = new ConcurrentHashMap<>(); - - + + private static final Logger LOGGER = LogManager.getLogger("IllegalStack/" + fTimer.class.getSimpleName()); private static long endScanFinish = 0L; private static World dragon = null; @@ -64,19 +64,20 @@ public class fTimer implements Runnable { private long longScan; private long endScan = 0L; private long nextNetherDamage = 0L; - + public fTimer(IllegalStack illegalStack) { this.plugin = illegalStack; this.nextScan = System.currentTimeMillis() + (scanDelay * 6000); - if(Protections.DamagePlayersAboveNether.isEnabled()) { - if(Protections.AboveNetherDamageAmount.getIntValue() < 1) - Protections.AboveNetherDamageAmount.setIntValue(1); - if(Protections.AboveNetherDamageDelay.getIntValue() < 1) - Protections.AboveNetherDamageDelay.setIntValue(1); - - this.nextNetherDamage = System.currentTimeMillis() + (Protections.AboveNetherDamageDelay.getIntValue() * 1000); + if (Protections.DamagePlayersAboveNether.isEnabled()) { + if (Protections.AboveNetherDamageAmount.getIntValue() < 1) { + Protections.AboveNetherDamageAmount.setIntValue(1); + } + if (Protections.AboveNetherDamageDelay.getIntValue() < 1) { + Protections.AboveNetherDamageDelay.setIntValue(1); + } + + this.nextNetherDamage = System.currentTimeMillis() + (Protections.AboveNetherDamageDelay.getIntValue() * 1000); } - String version = plugin.getServer().getClass().getPackage().getName().replace(".", ",") @@ -97,8 +98,9 @@ public static void trackBlock(FallingBlock fb) { } public static void trackProjectile(Projectile proj) { - if (Protections.PreventProjectileExploit2.isEnabled(proj.getWorld())) - new TrackedProjectile(proj); + if (Protections.PreventProjectileExploit2.isEnabled(proj.getWorld())) { + new TrackedProjectile(proj); + } } public static long getEndScanFinish() { @@ -119,26 +121,39 @@ public static void setPunish(HashMap punish) { @Override public void run() { - if(IllegalStack.isDisable()|| Bukkit.getServer().isStopping()){ + + if (!IllegalStack.isIsHybridEnvironment()) { + if (IllegalStack.isDisable() || Bukkit.getServer().isStopping()) { + return; + } + } + + if (IllegalStack.isDisable()) { return; } + for (Player p : punish.keySet()) { Scheduler.executeOrScheduleSync(plugin, () -> fListener.punishPlayer(p, punish.get(p)), p); } punish.clear(); if (Protections.DamagePlayersAboveNether.isEnabled() && System.currentTimeMillis() >= nextNetherDamage) { - nextNetherDamage = System.currentTimeMillis() + (Protections.AboveNetherDamageDelay.getIntValue() * 1000L); - for(World w:plugin.getServer().getWorlds()) - if(w.getName().toLowerCase().contains("nether") || w.getEnvironment() == Environment.NETHER) - for(Player p:w.getPlayers()) - if(p.isOp() || p.hasPermission("illegalstack.notify")) - continue; - else if (p.getLocation().getY()>= Protections.NetherYLevel.getIntValue()) - Scheduler.executeOrScheduleSync(plugin, - () -> p.damage(Protections.AboveNetherDamageAmount.getIntValue()), p); - - + nextNetherDamage = System.currentTimeMillis() + (Protections.AboveNetherDamageDelay.getIntValue() * 1000L); + for (World w : plugin.getServer().getWorlds()) { + if (w.getName().toLowerCase().contains("nether") || w.getEnvironment() == Environment.NETHER) { + for (Player p : w.getPlayers()) { + if (p.isOp() || p.hasPermission("illegalstack.notify")) { + continue; + } else if (p.getLocation().getY() >= Protections.NetherYLevel.getIntValue()) { + Scheduler.executeOrScheduleSync(plugin, + () -> p.damage(Protections.AboveNetherDamageAmount.getIntValue()), p + ); + } + } + } + } + + } if (Protections.BlockNonPlayersInEndPortal.isEnabled() && getDragon() != null && System.currentTimeMillis() > endScan) { endScan = System.currentTimeMillis() + 500L; @@ -204,7 +219,8 @@ else if (p.getLocation().getY()>= Protections.NetherYLevel.getIntValue()) } //didn't find a valid exit point at the exit block, lets search and try to find a new valid portal block to check if (!valid) { Scheduler.executeOrScheduleSync(plugin, - () -> p.getLocation().getBlock().breakNaturally(), p); + () -> p.getLocation().getBlock().breakNaturally(), p + ); fListener.getLog().append2(Msg.StaffMsgBlockedPortalLogin.getValue(p, p.getLocation().toString())); // LOGGER.info("Invalid was: {}", invalid); return true; @@ -232,12 +248,12 @@ else if (p.getLocation().getY()>= Protections.NetherYLevel.getIntValue()) } if (System.currentTimeMillis() >= this.nextScan) { - /* - * Moved to a sync listener, if tracked projectiles are removed via this async timer it crashes the server. - */ - - //TrackedProjectile.manageAsync(); - + /* + * Moved to a sync listener, if tracked projectiles are removed via this async timer it crashes the server. + */ + + //TrackedProjectile.manageAsync(); + if (Protections.PreventVibratingBlocks.isEnabled()) { HashSet removed = new HashSet<>(); for (FallingBlock fb : fbTracker.keySet()) { @@ -246,7 +262,9 @@ else if (p.getLocation().getY()>= Protections.NetherYLevel.getIntValue()) } try { - for (Entity ent : Scheduler.executeOrScheduleSync(plugin, () -> fb.getNearbyEntities(1, 1, 1), fb).get()) { + for (Entity ent : Scheduler + .executeOrScheduleSync(plugin, () -> fb.getNearbyEntities(1, 1, 1), fb) + .get()) { if (ent instanceof Minecart || ent instanceof Boat) { removed.add(fb); Scheduler.executeOrScheduleSync(plugin, () -> fb.remove(), fb); @@ -287,21 +305,22 @@ else if (p.getLocation().getY()>= Protections.NetherYLevel.getIntValue()) if (is != null && !p.isOp()) { - if (Protections.RemoveItemTypes.isWhitelisted(is)) { - if (IllegalStack.getLbBlock() != null && IllegalStack.getLbBlock() == is.getType() && p.hasPermission("logblock.tools.toolblock")) { - //found a logblock block in the players inventory and they have permission to have it. don't remove it. - } else { - if (Protections.RemoveItemTypes.notifyOnly()) { - fListener.getLog().notify( - Protections.RemoveItemTypes, - " Triggered by: " + p.getName() + " with item: " + is.getType().name() - ); - } else { - fListener.getLog().append2(Msg.ItemTypeRemovedPlayer.getValue(p, is)); - p.getInventory().remove(is); - } - } - } + if (Protections.RemoveItemTypes.isWhitelisted(is)) { + if (IllegalStack.getLbBlock() != null && IllegalStack.getLbBlock() == is.getType() && p.hasPermission( + "logblock.tools.toolblock")) { + //found a logblock block in the players inventory and they have permission to have it. don't remove it. + } else { + if (Protections.RemoveItemTypes.notifyOnly()) { + fListener.getLog().notify( + Protections.RemoveItemTypes, + " Triggered by: " + p.getName() + " with item: " + is.getType().name() + ); + } else { + fListener.getLog().append2(Msg.ItemTypeRemovedPlayer.getValue(p, is)); + p.getInventory().remove(is); + } + } + } } if (Protections.RemoveAllRenamedItems.isEnabled()) { @@ -427,7 +446,10 @@ else if (p.getLocation().getY()>= Protections.NetherYLevel.getIntValue()) if (Protections.EnchantedItemWhitelist.isWhitelisted(is)) { break; } - if (Protections.CustomEnchantOverride.isAllowedEnchant(en, is.getEnchantmentLevel(en))) { + if (Protections.CustomEnchantOverride.isAllowedEnchant( + en, + is.getEnchantmentLevel(en) + )) { continue; } fListener.getLog().append2(Msg.IllegalEnchantLevel.getValue(p, is, en)); @@ -452,7 +474,12 @@ else if (p.getLocation().getY()>= Protections.NetherYLevel.getIntValue()) is.removeEnchantment(en); p.updateInventory(); if (en.canEnchantItem(is)) { - Scheduler.runTaskLater(this.plugin, () -> is.addEnchantment(en, en.getMaxLevel()), 1, p); + Scheduler.runTaskLater( + this.plugin, + () -> is.addEnchantment(en, en.getMaxLevel()), + 1, + p + ); } @@ -532,7 +559,10 @@ else if (p.getLocation().getY()>= Protections.NetherYLevel.getIntValue()) if (Protections.EnchantedItemWhitelist.isWhitelisted(is)) { break; } - if (Protections.CustomEnchantOverride.isAllowedEnchant(en, is.getEnchantmentLevel(en))) { + if (Protections.CustomEnchantOverride.isAllowedEnchant( + en, + is.getEnchantmentLevel(en) + )) { continue; } fListener.getLog().append2(Msg.IllegalEnchantLevel.getValue(p, is, en)); @@ -556,7 +586,12 @@ else if (p.getLocation().getY()>= Protections.NetherYLevel.getIntValue()) is.removeEnchantment(en); p.updateInventory(); if (en.canEnchantItem(is)) { - Scheduler.runTaskLater(this.plugin, () -> is.addEnchantment(en, en.getMaxLevel()), 1, p); + Scheduler.runTaskLater( + this.plugin, + () -> is.addEnchantment(en, en.getMaxLevel()), + 1, + p + ); } } @@ -631,8 +666,14 @@ else if (p.getLocation().getY()>= Protections.NetherYLevel.getIntValue()) p.getInventory().remove(is); StringBuilder efx = new StringBuilder(); for (PotionEffect ce : potion.getCustomEffects()) { - efx.append(ce.getType().getName()).append(" amplifier: ").append(ce.getAmplifier()).append( - " duration: ").append(ce.getDuration()).append(","); + efx + .append(ce.getType().getName()) + .append(" amplifier: ") + .append(ce.getAmplifier()) + .append( + " duration: ") + .append(ce.getDuration()) + .append(","); } fListener.getLog().append2(Msg.InvalidPotionRemoved.getValue(p, efx.toString())); diff --git a/src/main/java/main/java/me/dniym/timers/sTimer.java b/src/main/java/main/java/me/dniym/timers/sTimer.java index f6bbaed..7f26bd9 100644 --- a/src/main/java/main/java/me/dniym/timers/sTimer.java +++ b/src/main/java/main/java/me/dniym/timers/sTimer.java @@ -64,9 +64,17 @@ public static void checkChunk(String chunkID, BlockState[] tileEntities) { @Override public void run() { - if(IllegalStack.isDisable()|| Bukkit.getServer().isStopping()){ + + if (!IllegalStack.isIsHybridEnvironment()) { + if (IllegalStack.isDisable() || Bukkit.getServer().isStopping()) { + return; + } + } + + if (IllegalStack.isDisable()) { return; } + if (!Protections.DestroyBadSignsonChunkLoad.isEnabled() || Protections.DestroyBadSignsonChunkLoad.notifyOnly()) { return; } @@ -78,8 +86,11 @@ public void run() { Sign sign = (Sign) st; boolean illegal = false; for (String line : sign.getLines()) { - if (!Charset.forName(Protections.ValidCharset.getTxtValue()).newEncoder().canEncode(ChatColor.stripColor( - line))) { + if (!Charset + .forName(Protections.ValidCharset.getTxtValue()) + .newEncoder() + .canEncode(ChatColor.stripColor( + line))) { illegal = true; LOGGER.info( "Found a sign with illegal chars: line with invalid text was: {} @ {}", @@ -119,7 +130,8 @@ public void run() { .newEncoder() .canEncode(ChatColor.stripColor(line))) { Scheduler.executeOrScheduleSync(IllegalStack.getPlugin(), - () -> sign.getBlock().setType(Material.AIR), sign.getLocation()); + () -> sign.getBlock().setType(Material.AIR), sign.getLocation() + ); found.add(sign.getBlock()); } } diff --git a/src/main/java/main/java/me/dniym/timers/syncTimer.java b/src/main/java/main/java/me/dniym/timers/syncTimer.java index 2151c05..f9320ab 100644 --- a/src/main/java/main/java/me/dniym/timers/syncTimer.java +++ b/src/main/java/main/java/me/dniym/timers/syncTimer.java @@ -3,6 +3,7 @@ import java.util.HashSet; import java.util.Set; +import org.bukkit.Bukkit; import org.bukkit.entity.Entity; import main.java.me.dniym.IllegalStack; @@ -10,39 +11,47 @@ public class syncTimer implements Runnable { - IllegalStack plugin; - Long nextScan = 0l; - int scanDelay = 3; - - private static Set entitiesToRemove = new HashSet(); - - public syncTimer(IllegalStack illegalStack) { - this.plugin = illegalStack; + IllegalStack plugin; + Long nextScan = 0l; + int scanDelay = 3; + + private static Set entitiesToRemove = new HashSet(); + + public syncTimer(IllegalStack illegalStack) { + this.plugin = illegalStack; this.nextScan = System.currentTimeMillis() + (scanDelay * 1000); - } - - @Override - public void run() { - if(IllegalStack.isDisable()) - return; - if(System.currentTimeMillis() >= nextScan) { - TrackedProjectile.manage(); - } - - } - - public static void removeEntity(Entity ent) { - getEntitiesToRemove().add(ent); - } - - public static Set getEntitiesToRemove() { - return entitiesToRemove; - } - - public static void setEntitiesToRemove(Set entitiesToRemove) { - syncTimer.entitiesToRemove = entitiesToRemove; - } - - + } + + @Override + public void run() { + + if (!IllegalStack.isIsHybridEnvironment()) { + if (IllegalStack.isDisable() || Bukkit.getServer().isStopping()) { + return; + } + } + + if (IllegalStack.isDisable()) { + return; + } + + if (System.currentTimeMillis() >= nextScan) { + TrackedProjectile.manage(); + } + + } + + public static void removeEntity(Entity ent) { + getEntitiesToRemove().add(ent); + } + + public static Set getEntitiesToRemove() { + return entitiesToRemove; + } + + public static void setEntitiesToRemove(Set entitiesToRemove) { + syncTimer.entitiesToRemove = entitiesToRemove; + } + } diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index b8e4dd8..aa74972 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -4,7 +4,7 @@ version: "${version}" api-version: 1.13 folia-supported: true description: Closes some dupe bugs still present in vanilla minecraft. -author: dNiym +authors: [ dNiym, Loving11ish ] softdepend: [Magic, Factions, NBTAPI, ProtocolLib, Slimefun, CraftingStore, DynamicShop, ClueScrolls, mcMMO, JetsMinions, SmartInvs, FactionsX] loadbefore: [MythicDrops] website: https://www.spigotmc.org/resources/44411/ @@ -31,4 +31,4 @@ permissions: default: false illegalstack.overstack: description: Allows users with this perm to have items in this list that are greater than the vanilla stack size. - default: false \ No newline at end of file + default: false