From 731e2d86914145dbc27749ac6df0b17a7831c59b Mon Sep 17 00:00:00 2001 From: HSGamer Date: Sun, 20 Aug 2023 21:33:29 +0700 Subject: [PATCH] replace BukkitRunnable to CancellableRunnable --- .../com/gmail/nossr50/database/SQLDatabaseManager.java | 1 - .../java/com/gmail/nossr50/listeners/PlayerListener.java | 1 - .../java/com/gmail/nossr50/listeners/WorldListener.java | 3 --- src/main/java/com/gmail/nossr50/mcMMO.java | 2 -- .../java/com/gmail/nossr50/runnables/CheckDateTask.java | 4 ++-- .../com/gmail/nossr50/runnables/MobDodgeMetaCleanup.java | 4 ++-- .../nossr50/runnables/MobHealthDisplayUpdaterTask.java | 4 ++-- .../com/gmail/nossr50/runnables/PistonTrackerTask.java | 4 ++-- .../java/com/gmail/nossr50/runnables/SaveTimerTask.java | 4 ++-- .../gmail/nossr50/runnables/StickyPistonTrackerTask.java | 4 ++-- .../nossr50/runnables/TravelingBlockMetaCleanup.java | 4 ++-- .../gmail/nossr50/runnables/backups/CleanBackupsTask.java | 4 ++-- .../nossr50/runnables/commands/McScoreboardKeepTask.java | 4 ++-- .../runnables/commands/McrankCommandAsyncTask.java | 4 ++-- .../runnables/commands/McrankCommandDisplayTask.java | 4 ++-- .../nossr50/runnables/commands/MctopCommandAsyncTask.java | 4 ++-- .../runnables/commands/MctopCommandDisplayTask.java | 4 ++-- .../runnables/commands/NotifySquelchReminderTask.java | 4 ++-- .../runnables/database/DatabaseConversionTask.java | 4 ++-- .../nossr50/runnables/database/FormulaConversionTask.java | 4 ++-- .../nossr50/runnables/database/UUIDUpdateAsyncTask.java | 1 - .../gmail/nossr50/runnables/database/UserPurgeTask.java | 4 ++-- .../gmail/nossr50/runnables/items/ChimaeraWingWarmup.java | 4 ++-- .../nossr50/runnables/items/TeleportationWarmup.java | 4 ++-- .../gmail/nossr50/runnables/party/PartyAutoKickTask.java | 4 ++-- .../runnables/player/ClearRegisteredXPGainTask.java | 4 ++-- .../runnables/player/PlayerProfileLoadingTask.java | 6 +++--- .../nossr50/runnables/player/PlayerProfileSaveTask.java | 4 ++-- .../runnables/player/PlayerUpdateInventoryTask.java | 4 ++-- .../nossr50/runnables/player/PowerLevelUpdatingTask.java | 4 ++-- .../nossr50/runnables/skills/AbilityCooldownTask.java | 4 ++-- .../nossr50/runnables/skills/AbilityDisableTask.java | 4 ++-- .../nossr50/runnables/skills/AlchemyBrewCheckTask.java | 4 ++-- .../gmail/nossr50/runnables/skills/AlchemyBrewTask.java | 4 ++-- .../com/gmail/nossr50/runnables/skills/AprilTask.java | 4 ++-- .../gmail/nossr50/runnables/skills/AwardCombatXpTask.java | 4 ++-- .../gmail/nossr50/runnables/skills/BleedTimerTask.java | 4 ++-- .../nossr50/runnables/skills/DelayedCropReplant.java | 8 ++++---- .../runnables/skills/DelayedHerbalismXPCheckTask.java | 4 ++-- .../nossr50/runnables/skills/ExperienceBarHideTask.java | 4 ++-- .../runnables/skills/HerbalismBlockUpdaterTask.java | 4 ++-- .../gmail/nossr50/runnables/skills/MasterAnglerTask.java | 4 ++-- .../com/gmail/nossr50/runnables/skills/RuptureTask.java | 4 ++-- .../runnables/skills/SkillUnlockNotificationTask.java | 4 ++-- .../com/gmail/nossr50/runnables/skills/ToolLowerTask.java | 4 ++-- .../com/gmail/nossr50/skills/archery/TrackedEntity.java | 4 ++-- .../gmail/nossr50/skills/herbalism/HerbalismManager.java | 3 +-- .../gmail/nossr50/skills/taming/TrackedTamingEntity.java | 4 ++-- .../gmail/nossr50/util/player/NotificationManager.java | 1 - .../gmail/nossr50/util/scoreboards/ScoreboardWrapper.java | 8 ++++---- .../java/com/gmail/nossr50/util/skills/CombatUtils.java | 2 -- 51 files changed, 92 insertions(+), 104 deletions(-) diff --git a/src/main/java/com/gmail/nossr50/database/SQLDatabaseManager.java b/src/main/java/com/gmail/nossr50/database/SQLDatabaseManager.java index 5e9d98041..0be013e7e 100644 --- a/src/main/java/com/gmail/nossr50/database/SQLDatabaseManager.java +++ b/src/main/java/com/gmail/nossr50/database/SQLDatabaseManager.java @@ -23,7 +23,6 @@ import org.jetbrains.annotations.Nullable; import java.sql.*; import java.util.*; -import java.util.concurrent.TimeUnit; import java.util.concurrent.locks.ReentrantLock; public final class SQLDatabaseManager implements DatabaseManager { diff --git a/src/main/java/com/gmail/nossr50/listeners/PlayerListener.java b/src/main/java/com/gmail/nossr50/listeners/PlayerListener.java index 78495ba56..912f70af3 100644 --- a/src/main/java/com/gmail/nossr50/listeners/PlayerListener.java +++ b/src/main/java/com/gmail/nossr50/listeners/PlayerListener.java @@ -51,7 +51,6 @@ import org.bukkit.inventory.EquipmentSlot; import org.bukkit.inventory.ItemStack; import java.util.Locale; -import java.util.concurrent.TimeUnit; public class PlayerListener implements Listener { private final mcMMO plugin; diff --git a/src/main/java/com/gmail/nossr50/listeners/WorldListener.java b/src/main/java/com/gmail/nossr50/listeners/WorldListener.java index 725f890eb..4c24930c6 100644 --- a/src/main/java/com/gmail/nossr50/listeners/WorldListener.java +++ b/src/main/java/com/gmail/nossr50/listeners/WorldListener.java @@ -2,7 +2,6 @@ package com.gmail.nossr50.listeners; import com.gmail.nossr50.config.WorldBlacklist; import com.gmail.nossr50.mcMMO; -import org.bukkit.Bukkit; import org.bukkit.Chunk; import org.bukkit.block.BlockState; import org.bukkit.event.EventHandler; @@ -12,8 +11,6 @@ import org.bukkit.event.world.ChunkUnloadEvent; import org.bukkit.event.world.StructureGrowEvent; import org.bukkit.event.world.WorldUnloadEvent; -import java.util.concurrent.TimeUnit; - public class WorldListener implements Listener { private final mcMMO plugin; diff --git a/src/main/java/com/gmail/nossr50/mcMMO.java b/src/main/java/com/gmail/nossr50/mcMMO.java index 191a5756b..7e56af378 100644 --- a/src/main/java/com/gmail/nossr50/mcMMO.java +++ b/src/main/java/com/gmail/nossr50/mcMMO.java @@ -54,7 +54,6 @@ import com.gmail.nossr50.util.skills.SmeltingTracker; import com.gmail.nossr50.util.upgrade.UpgradeManager; import com.gmail.nossr50.worldguard.WorldGuardManager; import com.tcoded.folialib.FoliaLib; -import com.tcoded.folialib.impl.ServerImplementation; import net.kyori.adventure.platform.bukkit.BukkitAudiences; import net.shatteredlands.shatt.backup.ZipLibrary; import org.bstats.bukkit.Metrics; @@ -76,7 +75,6 @@ import java.io.InputStreamReader; import java.nio.charset.StandardCharsets; import java.util.ArrayList; import java.util.List; -import java.util.concurrent.TimeUnit; public class mcMMO extends JavaPlugin { diff --git a/src/main/java/com/gmail/nossr50/runnables/CheckDateTask.java b/src/main/java/com/gmail/nossr50/runnables/CheckDateTask.java index 9f52ed5bf..e52cb2c25 100644 --- a/src/main/java/com/gmail/nossr50/runnables/CheckDateTask.java +++ b/src/main/java/com/gmail/nossr50/runnables/CheckDateTask.java @@ -3,9 +3,9 @@ //import com.gmail.nossr50.mcMMO; //import com.gmail.nossr50.runnables.skills.AprilTask; //import com.gmail.nossr50.util.Misc; -//import org.bukkit.scheduler.BukkitRunnable; +//import com.gmail.nossr50.util.CancellableRunnable; // -//public class CheckDateTask extends BukkitRunnable { +//public class CheckDateTask extends CancellableRunnable { // // @Override // public void run() { diff --git a/src/main/java/com/gmail/nossr50/runnables/MobDodgeMetaCleanup.java b/src/main/java/com/gmail/nossr50/runnables/MobDodgeMetaCleanup.java index 43e2a2e4b..8087d3c65 100644 --- a/src/main/java/com/gmail/nossr50/runnables/MobDodgeMetaCleanup.java +++ b/src/main/java/com/gmail/nossr50/runnables/MobDodgeMetaCleanup.java @@ -1,12 +1,12 @@ package com.gmail.nossr50.runnables; import com.gmail.nossr50.mcMMO; +import com.gmail.nossr50.util.CancellableRunnable; import com.gmail.nossr50.util.MetadataConstants; import org.bukkit.entity.Mob; -import org.bukkit.scheduler.BukkitRunnable; import org.jetbrains.annotations.NotNull; -public class MobDodgeMetaCleanup extends BukkitRunnable { +public class MobDodgeMetaCleanup extends CancellableRunnable { private final @NotNull Mob mob; private final @NotNull mcMMO pluginRef; diff --git a/src/main/java/com/gmail/nossr50/runnables/MobHealthDisplayUpdaterTask.java b/src/main/java/com/gmail/nossr50/runnables/MobHealthDisplayUpdaterTask.java index a48375727..8e59fcb5b 100644 --- a/src/main/java/com/gmail/nossr50/runnables/MobHealthDisplayUpdaterTask.java +++ b/src/main/java/com/gmail/nossr50/runnables/MobHealthDisplayUpdaterTask.java @@ -1,11 +1,11 @@ package com.gmail.nossr50.runnables; import com.gmail.nossr50.mcMMO; +import com.gmail.nossr50.util.CancellableRunnable; import com.gmail.nossr50.util.MetadataConstants; import org.bukkit.entity.LivingEntity; -import org.bukkit.scheduler.BukkitRunnable; -public class MobHealthDisplayUpdaterTask extends BukkitRunnable { +public class MobHealthDisplayUpdaterTask extends CancellableRunnable { private final LivingEntity target; public MobHealthDisplayUpdaterTask(LivingEntity target) { diff --git a/src/main/java/com/gmail/nossr50/runnables/PistonTrackerTask.java b/src/main/java/com/gmail/nossr50/runnables/PistonTrackerTask.java index 1dc0d4ea6..d4e69c5bc 100644 --- a/src/main/java/com/gmail/nossr50/runnables/PistonTrackerTask.java +++ b/src/main/java/com/gmail/nossr50/runnables/PistonTrackerTask.java @@ -2,14 +2,14 @@ package com.gmail.nossr50.runnables; import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.util.BlockUtils; +import com.gmail.nossr50.util.CancellableRunnable; import com.gmail.nossr50.util.MetadataConstants; import org.bukkit.block.Block; import org.bukkit.block.BlockFace; -import org.bukkit.scheduler.BukkitRunnable; import java.util.List; -public class PistonTrackerTask extends BukkitRunnable { +public class PistonTrackerTask extends CancellableRunnable { private final List blocks; private final BlockFace direction; private final Block futureEmptyBlock; diff --git a/src/main/java/com/gmail/nossr50/runnables/SaveTimerTask.java b/src/main/java/com/gmail/nossr50/runnables/SaveTimerTask.java index d42eb6b2f..84f810ad8 100644 --- a/src/main/java/com/gmail/nossr50/runnables/SaveTimerTask.java +++ b/src/main/java/com/gmail/nossr50/runnables/SaveTimerTask.java @@ -4,11 +4,11 @@ import com.gmail.nossr50.datatypes.player.McMMOPlayer; import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.party.PartyManager; import com.gmail.nossr50.runnables.player.PlayerProfileSaveTask; +import com.gmail.nossr50.util.CancellableRunnable; import com.gmail.nossr50.util.LogUtils; import com.gmail.nossr50.util.player.UserManager; -import org.bukkit.scheduler.BukkitRunnable; -public class SaveTimerTask extends BukkitRunnable { +public class SaveTimerTask extends CancellableRunnable { @Override public void run() { LogUtils.debug(mcMMO.p.getLogger(), "[User Data] Saving..."); diff --git a/src/main/java/com/gmail/nossr50/runnables/StickyPistonTrackerTask.java b/src/main/java/com/gmail/nossr50/runnables/StickyPistonTrackerTask.java index 40e21b71b..d8f52ae30 100644 --- a/src/main/java/com/gmail/nossr50/runnables/StickyPistonTrackerTask.java +++ b/src/main/java/com/gmail/nossr50/runnables/StickyPistonTrackerTask.java @@ -2,11 +2,11 @@ package com.gmail.nossr50.runnables; import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.util.BlockUtils; +import com.gmail.nossr50.util.CancellableRunnable; import org.bukkit.block.Block; import org.bukkit.block.BlockFace; -import org.bukkit.scheduler.BukkitRunnable; -public class StickyPistonTrackerTask extends BukkitRunnable { +public class StickyPistonTrackerTask extends CancellableRunnable { private final BlockFace direction; private final Block block; private final Block movedBlock; diff --git a/src/main/java/com/gmail/nossr50/runnables/TravelingBlockMetaCleanup.java b/src/main/java/com/gmail/nossr50/runnables/TravelingBlockMetaCleanup.java index 2b4dc57ae..366fb2967 100644 --- a/src/main/java/com/gmail/nossr50/runnables/TravelingBlockMetaCleanup.java +++ b/src/main/java/com/gmail/nossr50/runnables/TravelingBlockMetaCleanup.java @@ -1,12 +1,12 @@ package com.gmail.nossr50.runnables; import com.gmail.nossr50.mcMMO; +import com.gmail.nossr50.util.CancellableRunnable; import com.gmail.nossr50.util.MetadataConstants; import org.bukkit.entity.Entity; -import org.bukkit.scheduler.BukkitRunnable; import org.jetbrains.annotations.NotNull; -public class TravelingBlockMetaCleanup extends BukkitRunnable { +public class TravelingBlockMetaCleanup extends CancellableRunnable { private final @NotNull Entity entity; private final @NotNull mcMMO pluginRef; diff --git a/src/main/java/com/gmail/nossr50/runnables/backups/CleanBackupsTask.java b/src/main/java/com/gmail/nossr50/runnables/backups/CleanBackupsTask.java index e90705996..c4de1183d 100644 --- a/src/main/java/com/gmail/nossr50/runnables/backups/CleanBackupsTask.java +++ b/src/main/java/com/gmail/nossr50/runnables/backups/CleanBackupsTask.java @@ -1,8 +1,8 @@ package com.gmail.nossr50.runnables.backups; import com.gmail.nossr50.mcMMO; +import com.gmail.nossr50.util.CancellableRunnable; import com.gmail.nossr50.util.LogUtils; -import org.bukkit.scheduler.BukkitRunnable; import java.io.File; import java.text.ParseException; @@ -10,7 +10,7 @@ import java.text.SimpleDateFormat; import java.util.*; import java.util.concurrent.TimeUnit; -public class CleanBackupsTask extends BukkitRunnable { +public class CleanBackupsTask extends CancellableRunnable { private static final String BACKUP_DIRECTORY = mcMMO.getMainDirectory() + "backup" + File.separator; private static final File BACKUP_DIR = new File(BACKUP_DIRECTORY); diff --git a/src/main/java/com/gmail/nossr50/runnables/commands/McScoreboardKeepTask.java b/src/main/java/com/gmail/nossr50/runnables/commands/McScoreboardKeepTask.java index a5d02c1dc..2a9243b0c 100644 --- a/src/main/java/com/gmail/nossr50/runnables/commands/McScoreboardKeepTask.java +++ b/src/main/java/com/gmail/nossr50/runnables/commands/McScoreboardKeepTask.java @@ -1,10 +1,10 @@ package com.gmail.nossr50.runnables.commands; +import com.gmail.nossr50.util.CancellableRunnable; import com.gmail.nossr50.util.scoreboards.ScoreboardManager; import org.bukkit.entity.Player; -import org.bukkit.scheduler.BukkitRunnable; -public class McScoreboardKeepTask extends BukkitRunnable { +public class McScoreboardKeepTask extends CancellableRunnable { private final Player player; public McScoreboardKeepTask(Player player) { diff --git a/src/main/java/com/gmail/nossr50/runnables/commands/McrankCommandAsyncTask.java b/src/main/java/com/gmail/nossr50/runnables/commands/McrankCommandAsyncTask.java index 7311b50bf..ed0e19ad2 100644 --- a/src/main/java/com/gmail/nossr50/runnables/commands/McrankCommandAsyncTask.java +++ b/src/main/java/com/gmail/nossr50/runnables/commands/McrankCommandAsyncTask.java @@ -2,14 +2,14 @@ package com.gmail.nossr50.runnables.commands; import com.gmail.nossr50.datatypes.skills.PrimarySkillType; import com.gmail.nossr50.mcMMO; +import com.gmail.nossr50.util.CancellableRunnable; import org.apache.commons.lang.Validate; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; -import org.bukkit.scheduler.BukkitRunnable; import java.util.Map; -public class McrankCommandAsyncTask extends BukkitRunnable { +public class McrankCommandAsyncTask extends CancellableRunnable { private final String playerName; private final CommandSender sender; private final boolean useBoard, useChat; diff --git a/src/main/java/com/gmail/nossr50/runnables/commands/McrankCommandDisplayTask.java b/src/main/java/com/gmail/nossr50/runnables/commands/McrankCommandDisplayTask.java index 76a68345d..c1067ecf1 100644 --- a/src/main/java/com/gmail/nossr50/runnables/commands/McrankCommandDisplayTask.java +++ b/src/main/java/com/gmail/nossr50/runnables/commands/McrankCommandDisplayTask.java @@ -3,19 +3,19 @@ package com.gmail.nossr50.runnables.commands; import com.gmail.nossr50.datatypes.skills.PrimarySkillType; import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.mcMMO; +import com.gmail.nossr50.util.CancellableRunnable; import com.gmail.nossr50.util.MetadataConstants; import com.gmail.nossr50.util.scoreboards.ScoreboardManager; import com.gmail.nossr50.util.skills.SkillTools; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; -import org.bukkit.scheduler.BukkitRunnable; import java.util.Map; /** * Display the results of McrankCommandAsyncTask to the sender. */ -public class McrankCommandDisplayTask extends BukkitRunnable { +public class McrankCommandDisplayTask extends CancellableRunnable { private final Map skills; private final CommandSender sender; private final String playerName; diff --git a/src/main/java/com/gmail/nossr50/runnables/commands/MctopCommandAsyncTask.java b/src/main/java/com/gmail/nossr50/runnables/commands/MctopCommandAsyncTask.java index 387175cf7..eb0a9ad64 100644 --- a/src/main/java/com/gmail/nossr50/runnables/commands/MctopCommandAsyncTask.java +++ b/src/main/java/com/gmail/nossr50/runnables/commands/MctopCommandAsyncTask.java @@ -3,14 +3,14 @@ package com.gmail.nossr50.runnables.commands; import com.gmail.nossr50.datatypes.database.PlayerStat; import com.gmail.nossr50.datatypes.skills.PrimarySkillType; import com.gmail.nossr50.mcMMO; +import com.gmail.nossr50.util.CancellableRunnable; import org.apache.commons.lang.Validate; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; -import org.bukkit.scheduler.BukkitRunnable; import java.util.List; -public class MctopCommandAsyncTask extends BukkitRunnable { +public class MctopCommandAsyncTask extends CancellableRunnable { private final CommandSender sender; private final PrimarySkillType skill; private final int page; diff --git a/src/main/java/com/gmail/nossr50/runnables/commands/MctopCommandDisplayTask.java b/src/main/java/com/gmail/nossr50/runnables/commands/MctopCommandDisplayTask.java index f105faa42..ed1a2f73c 100644 --- a/src/main/java/com/gmail/nossr50/runnables/commands/MctopCommandDisplayTask.java +++ b/src/main/java/com/gmail/nossr50/runnables/commands/MctopCommandDisplayTask.java @@ -4,19 +4,19 @@ import com.gmail.nossr50.datatypes.database.PlayerStat; import com.gmail.nossr50.datatypes.skills.PrimarySkillType; import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.mcMMO; +import com.gmail.nossr50.util.CancellableRunnable; import com.gmail.nossr50.util.MetadataConstants; import com.gmail.nossr50.util.scoreboards.ScoreboardManager; import org.bukkit.ChatColor; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; -import org.bukkit.scheduler.BukkitRunnable; import java.util.List; /** * Display the results of {@link MctopCommandAsyncTask} to the sender. */ -public class MctopCommandDisplayTask extends BukkitRunnable { +public class MctopCommandDisplayTask extends CancellableRunnable { private final List userStats; private final CommandSender sender; private final PrimarySkillType skill; diff --git a/src/main/java/com/gmail/nossr50/runnables/commands/NotifySquelchReminderTask.java b/src/main/java/com/gmail/nossr50/runnables/commands/NotifySquelchReminderTask.java index 4d7b11fc6..9b9fcd6fe 100644 --- a/src/main/java/com/gmail/nossr50/runnables/commands/NotifySquelchReminderTask.java +++ b/src/main/java/com/gmail/nossr50/runnables/commands/NotifySquelchReminderTask.java @@ -1,12 +1,12 @@ package com.gmail.nossr50.runnables.commands; import com.gmail.nossr50.locale.LocaleLoader; +import com.gmail.nossr50.util.CancellableRunnable; import com.gmail.nossr50.util.player.UserManager; import org.bukkit.Bukkit; import org.bukkit.entity.Player; -import org.bukkit.scheduler.BukkitRunnable; -public class NotifySquelchReminderTask extends BukkitRunnable { +public class NotifySquelchReminderTask extends CancellableRunnable { @Override public void run() { diff --git a/src/main/java/com/gmail/nossr50/runnables/database/DatabaseConversionTask.java b/src/main/java/com/gmail/nossr50/runnables/database/DatabaseConversionTask.java index 83c6ac859..65589947f 100644 --- a/src/main/java/com/gmail/nossr50/runnables/database/DatabaseConversionTask.java +++ b/src/main/java/com/gmail/nossr50/runnables/database/DatabaseConversionTask.java @@ -3,10 +3,10 @@ package com.gmail.nossr50.runnables.database; import com.gmail.nossr50.database.DatabaseManager; import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.mcMMO; +import com.gmail.nossr50.util.CancellableRunnable; import org.bukkit.command.CommandSender; -import org.bukkit.scheduler.BukkitRunnable; -public class DatabaseConversionTask extends BukkitRunnable { +public class DatabaseConversionTask extends CancellableRunnable { private final DatabaseManager sourceDatabase; private final CommandSender sender; private final String message; diff --git a/src/main/java/com/gmail/nossr50/runnables/database/FormulaConversionTask.java b/src/main/java/com/gmail/nossr50/runnables/database/FormulaConversionTask.java index 331c90f92..214d4e58b 100644 --- a/src/main/java/com/gmail/nossr50/runnables/database/FormulaConversionTask.java +++ b/src/main/java/com/gmail/nossr50/runnables/database/FormulaConversionTask.java @@ -8,14 +8,14 @@ import com.gmail.nossr50.datatypes.player.PlayerProfile; import com.gmail.nossr50.datatypes.skills.PrimarySkillType; import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.mcMMO; +import com.gmail.nossr50.util.CancellableRunnable; import com.gmail.nossr50.util.LogUtils; import com.gmail.nossr50.util.Misc; import com.gmail.nossr50.util.player.UserManager; import com.gmail.nossr50.util.skills.SkillTools; import org.bukkit.command.CommandSender; -import org.bukkit.scheduler.BukkitRunnable; -public class FormulaConversionTask extends BukkitRunnable { +public class FormulaConversionTask extends CancellableRunnable { private final CommandSender sender; private final FormulaType formulaType; diff --git a/src/main/java/com/gmail/nossr50/runnables/database/UUIDUpdateAsyncTask.java b/src/main/java/com/gmail/nossr50/runnables/database/UUIDUpdateAsyncTask.java index 7470ebba1..d6336e018 100644 --- a/src/main/java/com/gmail/nossr50/runnables/database/UUIDUpdateAsyncTask.java +++ b/src/main/java/com/gmail/nossr50/runnables/database/UUIDUpdateAsyncTask.java @@ -18,7 +18,6 @@ import java.util.List; import java.util.Map; import java.util.UUID; import java.util.concurrent.CountDownLatch; -import java.util.concurrent.TimeUnit; import java.util.logging.Level; public class UUIDUpdateAsyncTask implements Runnable { diff --git a/src/main/java/com/gmail/nossr50/runnables/database/UserPurgeTask.java b/src/main/java/com/gmail/nossr50/runnables/database/UserPurgeTask.java index cf570e3f2..ab2b4cbea 100644 --- a/src/main/java/com/gmail/nossr50/runnables/database/UserPurgeTask.java +++ b/src/main/java/com/gmail/nossr50/runnables/database/UserPurgeTask.java @@ -1,11 +1,11 @@ package com.gmail.nossr50.runnables.database; import com.gmail.nossr50.mcMMO; -import org.bukkit.scheduler.BukkitRunnable; +import com.gmail.nossr50.util.CancellableRunnable; import java.util.concurrent.locks.ReentrantLock; -public class UserPurgeTask extends BukkitRunnable { +public class UserPurgeTask extends CancellableRunnable { private final ReentrantLock lock = new ReentrantLock(); @Override public void run() { diff --git a/src/main/java/com/gmail/nossr50/runnables/items/ChimaeraWingWarmup.java b/src/main/java/com/gmail/nossr50/runnables/items/ChimaeraWingWarmup.java index c7409b3ce..bb0996b50 100644 --- a/src/main/java/com/gmail/nossr50/runnables/items/ChimaeraWingWarmup.java +++ b/src/main/java/com/gmail/nossr50/runnables/items/ChimaeraWingWarmup.java @@ -3,6 +3,7 @@ package com.gmail.nossr50.runnables.items; import com.gmail.nossr50.datatypes.player.McMMOPlayer; import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.mcMMO; +import com.gmail.nossr50.util.CancellableRunnable; import com.gmail.nossr50.util.ChimaeraWing; import com.gmail.nossr50.util.ItemUtils; import com.gmail.nossr50.util.Misc; @@ -10,9 +11,8 @@ import com.gmail.nossr50.util.skills.SkillUtils; import org.bukkit.Location; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; -import org.bukkit.scheduler.BukkitRunnable; -public class ChimaeraWingWarmup extends BukkitRunnable { +public class ChimaeraWingWarmup extends CancellableRunnable { private final McMMOPlayer mcMMOPlayer; public ChimaeraWingWarmup(McMMOPlayer mcMMOPlayer) { diff --git a/src/main/java/com/gmail/nossr50/runnables/items/TeleportationWarmup.java b/src/main/java/com/gmail/nossr50/runnables/items/TeleportationWarmup.java index 49ce24aad..52d245227 100644 --- a/src/main/java/com/gmail/nossr50/runnables/items/TeleportationWarmup.java +++ b/src/main/java/com/gmail/nossr50/runnables/items/TeleportationWarmup.java @@ -4,6 +4,7 @@ import com.gmail.nossr50.datatypes.player.McMMOPlayer; import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.party.PartyManager; +import com.gmail.nossr50.util.CancellableRunnable; import com.gmail.nossr50.util.EventUtils; import com.gmail.nossr50.util.Misc; import com.gmail.nossr50.util.Permissions; @@ -11,9 +12,8 @@ import com.gmail.nossr50.util.skills.SkillUtils; import org.bukkit.Location; import org.bukkit.World; import org.bukkit.entity.Player; -import org.bukkit.scheduler.BukkitRunnable; -public class TeleportationWarmup extends BukkitRunnable { +public class TeleportationWarmup extends CancellableRunnable { private final McMMOPlayer mcMMOPlayer; private final McMMOPlayer mcMMOTarget; diff --git a/src/main/java/com/gmail/nossr50/runnables/party/PartyAutoKickTask.java b/src/main/java/com/gmail/nossr50/runnables/party/PartyAutoKickTask.java index f66b003b6..18891155c 100644 --- a/src/main/java/com/gmail/nossr50/runnables/party/PartyAutoKickTask.java +++ b/src/main/java/com/gmail/nossr50/runnables/party/PartyAutoKickTask.java @@ -3,8 +3,8 @@ package com.gmail.nossr50.runnables.party; import com.gmail.nossr50.datatypes.party.Party; import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.party.PartyManager; +import com.gmail.nossr50.util.CancellableRunnable; import org.bukkit.OfflinePlayer; -import org.bukkit.scheduler.BukkitRunnable; import java.util.ArrayList; import java.util.HashMap; @@ -12,7 +12,7 @@ import java.util.List; import java.util.Map.Entry; import java.util.UUID; -public class PartyAutoKickTask extends BukkitRunnable { +public class PartyAutoKickTask extends CancellableRunnable { private final static long KICK_TIME = 24L * 60L * 60L * 1000L * mcMMO.p.getGeneralConfig().getAutoPartyKickTime(); @Override diff --git a/src/main/java/com/gmail/nossr50/runnables/player/ClearRegisteredXPGainTask.java b/src/main/java/com/gmail/nossr50/runnables/player/ClearRegisteredXPGainTask.java index 2c281ee88..47923c7a4 100644 --- a/src/main/java/com/gmail/nossr50/runnables/player/ClearRegisteredXPGainTask.java +++ b/src/main/java/com/gmail/nossr50/runnables/player/ClearRegisteredXPGainTask.java @@ -1,10 +1,10 @@ package com.gmail.nossr50.runnables.player; import com.gmail.nossr50.datatypes.player.McMMOPlayer; +import com.gmail.nossr50.util.CancellableRunnable; import com.gmail.nossr50.util.player.UserManager; -import org.bukkit.scheduler.BukkitRunnable; -public class ClearRegisteredXPGainTask extends BukkitRunnable { +public class ClearRegisteredXPGainTask extends CancellableRunnable { @Override public void run() { for (McMMOPlayer mcMMOPlayer : UserManager.getPlayers()) { diff --git a/src/main/java/com/gmail/nossr50/runnables/player/PlayerProfileLoadingTask.java b/src/main/java/com/gmail/nossr50/runnables/player/PlayerProfileLoadingTask.java index 986882bb8..0ac8485dd 100644 --- a/src/main/java/com/gmail/nossr50/runnables/player/PlayerProfileLoadingTask.java +++ b/src/main/java/com/gmail/nossr50/runnables/player/PlayerProfileLoadingTask.java @@ -5,6 +5,7 @@ import com.gmail.nossr50.datatypes.player.PlayerProfile; import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.runnables.commands.McScoreboardKeepTask; +import com.gmail.nossr50.util.CancellableRunnable; import com.gmail.nossr50.util.EventUtils; import com.gmail.nossr50.util.LogUtils; import com.gmail.nossr50.util.Misc; @@ -12,9 +13,8 @@ import com.gmail.nossr50.util.player.UserManager; import com.gmail.nossr50.util.scoreboards.ScoreboardManager; import org.bukkit.Server; import org.bukkit.entity.Player; -import org.bukkit.scheduler.BukkitRunnable; -public class PlayerProfileLoadingTask extends BukkitRunnable { +public class PlayerProfileLoadingTask extends CancellableRunnable { private final Player player; private int attempt = 0; @@ -77,7 +77,7 @@ public class PlayerProfileLoadingTask extends BukkitRunnable { new PlayerProfileLoadingTask(player, attempt).runTaskLaterAsynchronously(mcMMO.p, (100 + (attempt * 100L))); } - private class ApplySuccessfulProfile extends BukkitRunnable { + private class ApplySuccessfulProfile extends CancellableRunnable { private final McMMOPlayer mcMMOPlayer; private ApplySuccessfulProfile(McMMOPlayer mcMMOPlayer) { diff --git a/src/main/java/com/gmail/nossr50/runnables/player/PlayerProfileSaveTask.java b/src/main/java/com/gmail/nossr50/runnables/player/PlayerProfileSaveTask.java index 2a6d30c69..9868c3898 100644 --- a/src/main/java/com/gmail/nossr50/runnables/player/PlayerProfileSaveTask.java +++ b/src/main/java/com/gmail/nossr50/runnables/player/PlayerProfileSaveTask.java @@ -1,9 +1,9 @@ package com.gmail.nossr50.runnables.player; import com.gmail.nossr50.datatypes.player.PlayerProfile; -import org.bukkit.scheduler.BukkitRunnable; +import com.gmail.nossr50.util.CancellableRunnable; -public class PlayerProfileSaveTask extends BukkitRunnable { +public class PlayerProfileSaveTask extends CancellableRunnable { private final PlayerProfile playerProfile; private final boolean isSync; diff --git a/src/main/java/com/gmail/nossr50/runnables/player/PlayerUpdateInventoryTask.java b/src/main/java/com/gmail/nossr50/runnables/player/PlayerUpdateInventoryTask.java index cdfb17d88..d5361e7ce 100644 --- a/src/main/java/com/gmail/nossr50/runnables/player/PlayerUpdateInventoryTask.java +++ b/src/main/java/com/gmail/nossr50/runnables/player/PlayerUpdateInventoryTask.java @@ -1,10 +1,10 @@ package com.gmail.nossr50.runnables.player; +import com.gmail.nossr50.util.CancellableRunnable; import org.bukkit.entity.Player; -import org.bukkit.scheduler.BukkitRunnable; @SuppressWarnings("deprecation") -public class PlayerUpdateInventoryTask extends BukkitRunnable { +public class PlayerUpdateInventoryTask extends CancellableRunnable { private final Player player; public PlayerUpdateInventoryTask(Player player) { diff --git a/src/main/java/com/gmail/nossr50/runnables/player/PowerLevelUpdatingTask.java b/src/main/java/com/gmail/nossr50/runnables/player/PowerLevelUpdatingTask.java index 3f50bce89..da7217261 100644 --- a/src/main/java/com/gmail/nossr50/runnables/player/PowerLevelUpdatingTask.java +++ b/src/main/java/com/gmail/nossr50/runnables/player/PowerLevelUpdatingTask.java @@ -1,9 +1,9 @@ package com.gmail.nossr50.runnables.player; +import com.gmail.nossr50.util.CancellableRunnable; import com.gmail.nossr50.util.scoreboards.ScoreboardManager; -import org.bukkit.scheduler.BukkitRunnable; -public class PowerLevelUpdatingTask extends BukkitRunnable { +public class PowerLevelUpdatingTask extends CancellableRunnable { @Override public void run() { if (!ScoreboardManager.powerLevelHeartbeat()) { diff --git a/src/main/java/com/gmail/nossr50/runnables/skills/AbilityCooldownTask.java b/src/main/java/com/gmail/nossr50/runnables/skills/AbilityCooldownTask.java index 56c772a84..69e080972 100644 --- a/src/main/java/com/gmail/nossr50/runnables/skills/AbilityCooldownTask.java +++ b/src/main/java/com/gmail/nossr50/runnables/skills/AbilityCooldownTask.java @@ -3,10 +3,10 @@ package com.gmail.nossr50.runnables.skills; import com.gmail.nossr50.datatypes.interactions.NotificationType; import com.gmail.nossr50.datatypes.player.McMMOPlayer; import com.gmail.nossr50.datatypes.skills.SuperAbilityType; +import com.gmail.nossr50.util.CancellableRunnable; import com.gmail.nossr50.util.player.NotificationManager; -import org.bukkit.scheduler.BukkitRunnable; -public class AbilityCooldownTask extends BukkitRunnable { +public class AbilityCooldownTask extends CancellableRunnable { private final McMMOPlayer mcMMOPlayer; private final SuperAbilityType ability; diff --git a/src/main/java/com/gmail/nossr50/runnables/skills/AbilityDisableTask.java b/src/main/java/com/gmail/nossr50/runnables/skills/AbilityDisableTask.java index 7265b386b..fd87b5a04 100644 --- a/src/main/java/com/gmail/nossr50/runnables/skills/AbilityDisableTask.java +++ b/src/main/java/com/gmail/nossr50/runnables/skills/AbilityDisableTask.java @@ -4,6 +4,7 @@ import com.gmail.nossr50.datatypes.interactions.NotificationType; import com.gmail.nossr50.datatypes.player.McMMOPlayer; import com.gmail.nossr50.datatypes.skills.SuperAbilityType; import com.gmail.nossr50.mcMMO; +import com.gmail.nossr50.util.CancellableRunnable; import com.gmail.nossr50.util.EventUtils; import com.gmail.nossr50.util.Misc; import com.gmail.nossr50.util.player.NotificationManager; @@ -12,9 +13,8 @@ import com.gmail.nossr50.util.skills.SkillUtils; import org.bukkit.Chunk; import org.bukkit.World; import org.bukkit.entity.Player; -import org.bukkit.scheduler.BukkitRunnable; -public class AbilityDisableTask extends BukkitRunnable { +public class AbilityDisableTask extends CancellableRunnable { private final McMMOPlayer mcMMOPlayer; private final SuperAbilityType ability; diff --git a/src/main/java/com/gmail/nossr50/runnables/skills/AlchemyBrewCheckTask.java b/src/main/java/com/gmail/nossr50/runnables/skills/AlchemyBrewCheckTask.java index e81804ac8..68de298f5 100644 --- a/src/main/java/com/gmail/nossr50/runnables/skills/AlchemyBrewCheckTask.java +++ b/src/main/java/com/gmail/nossr50/runnables/skills/AlchemyBrewCheckTask.java @@ -2,15 +2,15 @@ package com.gmail.nossr50.runnables.skills; import com.gmail.nossr50.skills.alchemy.Alchemy; import com.gmail.nossr50.skills.alchemy.AlchemyPotionBrewer; +import com.gmail.nossr50.util.CancellableRunnable; import org.bukkit.Location; import org.bukkit.block.BrewingStand; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; -import org.bukkit.scheduler.BukkitRunnable; import java.util.Arrays; -public class AlchemyBrewCheckTask extends BukkitRunnable { +public class AlchemyBrewCheckTask extends CancellableRunnable { private final Player player; private final BrewingStand brewingStand; private final ItemStack[] oldInventory; diff --git a/src/main/java/com/gmail/nossr50/runnables/skills/AlchemyBrewTask.java b/src/main/java/com/gmail/nossr50/runnables/skills/AlchemyBrewTask.java index 7a615bd96..a6b5b05c6 100644 --- a/src/main/java/com/gmail/nossr50/runnables/skills/AlchemyBrewTask.java +++ b/src/main/java/com/gmail/nossr50/runnables/skills/AlchemyBrewTask.java @@ -7,6 +7,7 @@ import com.gmail.nossr50.events.skills.alchemy.McMMOPlayerCatalysisEvent; import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.skills.alchemy.Alchemy; import com.gmail.nossr50.skills.alchemy.AlchemyPotionBrewer; +import com.gmail.nossr50.util.CancellableRunnable; import com.gmail.nossr50.util.Misc; import com.gmail.nossr50.util.Permissions; import com.gmail.nossr50.util.player.UserManager; @@ -15,9 +16,8 @@ import org.bukkit.Material; import org.bukkit.block.BlockState; import org.bukkit.block.BrewingStand; import org.bukkit.entity.Player; -import org.bukkit.scheduler.BukkitRunnable; -public class AlchemyBrewTask extends BukkitRunnable { +public class AlchemyBrewTask extends CancellableRunnable { private static final double DEFAULT_BREW_SPEED = 1.0; private static final int DEFAULT_BREW_TICKS = 400; diff --git a/src/main/java/com/gmail/nossr50/runnables/skills/AprilTask.java b/src/main/java/com/gmail/nossr50/runnables/skills/AprilTask.java index 86fd6b819..9b4aa61a4 100644 --- a/src/main/java/com/gmail/nossr50/runnables/skills/AprilTask.java +++ b/src/main/java/com/gmail/nossr50/runnables/skills/AprilTask.java @@ -8,9 +8,9 @@ //import org.bukkit.ChatColor; //import org.bukkit.Statistic; //import org.bukkit.entity.Player; -//import org.bukkit.scheduler.BukkitRunnable; +//import com.gmail.nossr50.util.CancellableRunnable; // -//public class AprilTask extends BukkitRunnable { +//public class AprilTask extends CancellableRunnable { // // @Override // public void run() { diff --git a/src/main/java/com/gmail/nossr50/runnables/skills/AwardCombatXpTask.java b/src/main/java/com/gmail/nossr50/runnables/skills/AwardCombatXpTask.java index 02e01ed1e..6ced4c66a 100644 --- a/src/main/java/com/gmail/nossr50/runnables/skills/AwardCombatXpTask.java +++ b/src/main/java/com/gmail/nossr50/runnables/skills/AwardCombatXpTask.java @@ -5,10 +5,10 @@ import com.gmail.nossr50.datatypes.experience.XPGainReason; import com.gmail.nossr50.datatypes.experience.XPGainSource; import com.gmail.nossr50.datatypes.player.McMMOPlayer; import com.gmail.nossr50.datatypes.skills.PrimarySkillType; +import com.gmail.nossr50.util.CancellableRunnable; import org.bukkit.entity.LivingEntity; -import org.bukkit.scheduler.BukkitRunnable; -public class AwardCombatXpTask extends BukkitRunnable { +public class AwardCombatXpTask extends CancellableRunnable { private final McMMOPlayer mcMMOPlayer; private final double baseXp; private final PrimarySkillType primarySkillType; diff --git a/src/main/java/com/gmail/nossr50/runnables/skills/BleedTimerTask.java b/src/main/java/com/gmail/nossr50/runnables/skills/BleedTimerTask.java index 839358afd..0cb4d3d13 100644 --- a/src/main/java/com/gmail/nossr50/runnables/skills/BleedTimerTask.java +++ b/src/main/java/com/gmail/nossr50/runnables/skills/BleedTimerTask.java @@ -15,7 +15,7 @@ //import org.bukkit.entity.Player; //import org.bukkit.event.entity.EntityDamageEvent; //import org.bukkit.inventory.ItemStack; -//import org.bukkit.scheduler.BukkitRunnable; +//import com.gmail.nossr50.util.CancellableRunnable; //import org.jetbrains.annotations.NotNull; // //import java.util.HashMap; @@ -23,7 +23,7 @@ //import java.util.Map; //import java.util.Map.Entry; // -//public class BleedTimerTask extends BukkitRunnable { +//public class BleedTimerTask extends CancellableRunnable { // private static final @NotNull Map bleedList = new HashMap<>(); // private static boolean isIterating = false; // diff --git a/src/main/java/com/gmail/nossr50/runnables/skills/DelayedCropReplant.java b/src/main/java/com/gmail/nossr50/runnables/skills/DelayedCropReplant.java index 31f19fada..65a37d011 100644 --- a/src/main/java/com/gmail/nossr50/runnables/skills/DelayedCropReplant.java +++ b/src/main/java/com/gmail/nossr50/runnables/skills/DelayedCropReplant.java @@ -2,6 +2,7 @@ package com.gmail.nossr50.runnables.skills; import com.gmail.nossr50.datatypes.meta.RecentlyReplantedCropMeta; import com.gmail.nossr50.mcMMO; +import com.gmail.nossr50.util.CancellableRunnable; import com.gmail.nossr50.util.MetadataConstants; import com.gmail.nossr50.util.skills.ParticleEffectUtils; import org.bukkit.Location; @@ -14,11 +15,10 @@ import org.bukkit.block.data.BlockData; import org.bukkit.block.data.Directional; import org.bukkit.block.data.type.Cocoa; import org.bukkit.event.block.BlockBreakEvent; -import org.bukkit.scheduler.BukkitRunnable; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -public class DelayedCropReplant extends BukkitRunnable { +public class DelayedCropReplant extends CancellableRunnable { private final int desiredCropAge; private final Location cropLocation; @@ -110,7 +110,7 @@ public class DelayedCropReplant extends BukkitRunnable { COCOA } - private static class PhysicsBlockUpdate extends BukkitRunnable { + private static class PhysicsBlockUpdate extends CancellableRunnable { private final Block plantBlock; private final PlantAnchorType plantAnchorType; private BlockFace plantFace; @@ -160,7 +160,7 @@ public class DelayedCropReplant extends BukkitRunnable { - private static class markPlantAsOld extends BukkitRunnable { + private static class markPlantAsOld extends CancellableRunnable { private final Location cropLoc; diff --git a/src/main/java/com/gmail/nossr50/runnables/skills/DelayedHerbalismXPCheckTask.java b/src/main/java/com/gmail/nossr50/runnables/skills/DelayedHerbalismXPCheckTask.java index 3ecc03747..dcc583f02 100644 --- a/src/main/java/com/gmail/nossr50/runnables/skills/DelayedHerbalismXPCheckTask.java +++ b/src/main/java/com/gmail/nossr50/runnables/skills/DelayedHerbalismXPCheckTask.java @@ -2,11 +2,11 @@ package com.gmail.nossr50.runnables.skills; import com.gmail.nossr50.datatypes.BlockSnapshot; import com.gmail.nossr50.datatypes.player.McMMOPlayer; -import org.bukkit.scheduler.BukkitRunnable; +import com.gmail.nossr50.util.CancellableRunnable; import java.util.ArrayList; -public class DelayedHerbalismXPCheckTask extends BukkitRunnable { +public class DelayedHerbalismXPCheckTask extends CancellableRunnable { private final McMMOPlayer mcMMOPlayer; private final ArrayList chorusBlocks; diff --git a/src/main/java/com/gmail/nossr50/runnables/skills/ExperienceBarHideTask.java b/src/main/java/com/gmail/nossr50/runnables/skills/ExperienceBarHideTask.java index 23e78909c..34c87b0d4 100644 --- a/src/main/java/com/gmail/nossr50/runnables/skills/ExperienceBarHideTask.java +++ b/src/main/java/com/gmail/nossr50/runnables/skills/ExperienceBarHideTask.java @@ -2,10 +2,10 @@ package com.gmail.nossr50.runnables.skills; import com.gmail.nossr50.datatypes.player.McMMOPlayer; import com.gmail.nossr50.datatypes.skills.PrimarySkillType; +import com.gmail.nossr50.util.CancellableRunnable; import com.gmail.nossr50.util.experience.ExperienceBarManager; -import org.bukkit.scheduler.BukkitRunnable; -public class ExperienceBarHideTask extends BukkitRunnable { +public class ExperienceBarHideTask extends CancellableRunnable { public final McMMOPlayer mcMMOPlayer; public final PrimarySkillType primarySkillType; public final ExperienceBarManager experienceBarManagerRef; diff --git a/src/main/java/com/gmail/nossr50/runnables/skills/HerbalismBlockUpdaterTask.java b/src/main/java/com/gmail/nossr50/runnables/skills/HerbalismBlockUpdaterTask.java index 102c9b0b7..e753957e3 100644 --- a/src/main/java/com/gmail/nossr50/runnables/skills/HerbalismBlockUpdaterTask.java +++ b/src/main/java/com/gmail/nossr50/runnables/skills/HerbalismBlockUpdaterTask.java @@ -1,9 +1,9 @@ package com.gmail.nossr50.runnables.skills; +import com.gmail.nossr50.util.CancellableRunnable; import org.bukkit.block.BlockState; -import org.bukkit.scheduler.BukkitRunnable; -public class HerbalismBlockUpdaterTask extends BukkitRunnable { +public class HerbalismBlockUpdaterTask extends CancellableRunnable { private final BlockState blockState; public HerbalismBlockUpdaterTask(BlockState blockState) { diff --git a/src/main/java/com/gmail/nossr50/runnables/skills/MasterAnglerTask.java b/src/main/java/com/gmail/nossr50/runnables/skills/MasterAnglerTask.java index 0f652e02c..39a6c01b4 100644 --- a/src/main/java/com/gmail/nossr50/runnables/skills/MasterAnglerTask.java +++ b/src/main/java/com/gmail/nossr50/runnables/skills/MasterAnglerTask.java @@ -1,11 +1,11 @@ package com.gmail.nossr50.runnables.skills; import com.gmail.nossr50.skills.fishing.FishingManager; +import com.gmail.nossr50.util.CancellableRunnable; import org.bukkit.entity.FishHook; -import org.bukkit.scheduler.BukkitRunnable; import org.jetbrains.annotations.NotNull; -public class MasterAnglerTask extends BukkitRunnable { +public class MasterAnglerTask extends CancellableRunnable { private final @NotNull FishHook fishHook; private final @NotNull FishingManager fishingManager; private final int lureLevel; diff --git a/src/main/java/com/gmail/nossr50/runnables/skills/RuptureTask.java b/src/main/java/com/gmail/nossr50/runnables/skills/RuptureTask.java index 4a93893cb..32ecf72b2 100644 --- a/src/main/java/com/gmail/nossr50/runnables/skills/RuptureTask.java +++ b/src/main/java/com/gmail/nossr50/runnables/skills/RuptureTask.java @@ -3,15 +3,15 @@ package com.gmail.nossr50.runnables.skills; import com.gmail.nossr50.datatypes.player.McMMOPlayer; import com.gmail.nossr50.events.skills.rupture.McMMOEntityDamageByRuptureEvent; import com.gmail.nossr50.mcMMO; +import com.gmail.nossr50.util.CancellableRunnable; import com.gmail.nossr50.util.MetadataConstants; import com.gmail.nossr50.util.skills.ParticleEffectUtils; import com.google.common.base.Objects; import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; -import org.bukkit.scheduler.BukkitRunnable; import org.jetbrains.annotations.NotNull; -public class RuptureTask extends BukkitRunnable { +public class RuptureTask extends CancellableRunnable { public static final int DAMAGE_TICK_INTERVAL = 10; public static final int ANIMATION_TICK_INTERVAL = 1; diff --git a/src/main/java/com/gmail/nossr50/runnables/skills/SkillUnlockNotificationTask.java b/src/main/java/com/gmail/nossr50/runnables/skills/SkillUnlockNotificationTask.java index 342f77162..c9b6d87a5 100644 --- a/src/main/java/com/gmail/nossr50/runnables/skills/SkillUnlockNotificationTask.java +++ b/src/main/java/com/gmail/nossr50/runnables/skills/SkillUnlockNotificationTask.java @@ -2,11 +2,11 @@ package com.gmail.nossr50.runnables.skills; import com.gmail.nossr50.datatypes.player.McMMOPlayer; import com.gmail.nossr50.datatypes.skills.SubSkillType; +import com.gmail.nossr50.util.CancellableRunnable; import com.gmail.nossr50.util.player.NotificationManager; -import org.bukkit.scheduler.BukkitRunnable; -public class SkillUnlockNotificationTask extends BukkitRunnable { +public class SkillUnlockNotificationTask extends CancellableRunnable { private final McMMOPlayer mcMMOPlayer; private final SubSkillType subSkillType; private final int rank; diff --git a/src/main/java/com/gmail/nossr50/runnables/skills/ToolLowerTask.java b/src/main/java/com/gmail/nossr50/runnables/skills/ToolLowerTask.java index ef3cd0561..98f336e84 100644 --- a/src/main/java/com/gmail/nossr50/runnables/skills/ToolLowerTask.java +++ b/src/main/java/com/gmail/nossr50/runnables/skills/ToolLowerTask.java @@ -4,10 +4,10 @@ import com.gmail.nossr50.datatypes.interactions.NotificationType; import com.gmail.nossr50.datatypes.player.McMMOPlayer; import com.gmail.nossr50.datatypes.skills.ToolType; import com.gmail.nossr50.mcMMO; +import com.gmail.nossr50.util.CancellableRunnable; import com.gmail.nossr50.util.player.NotificationManager; -import org.bukkit.scheduler.BukkitRunnable; -public class ToolLowerTask extends BukkitRunnable { +public class ToolLowerTask extends CancellableRunnable { private final McMMOPlayer mcMMOPlayer; private final ToolType tool; diff --git a/src/main/java/com/gmail/nossr50/skills/archery/TrackedEntity.java b/src/main/java/com/gmail/nossr50/skills/archery/TrackedEntity.java index 8cc97cc29..561398934 100644 --- a/src/main/java/com/gmail/nossr50/skills/archery/TrackedEntity.java +++ b/src/main/java/com/gmail/nossr50/skills/archery/TrackedEntity.java @@ -1,12 +1,12 @@ package com.gmail.nossr50.skills.archery; import com.gmail.nossr50.mcMMO; +import com.gmail.nossr50.util.CancellableRunnable; import org.bukkit.entity.LivingEntity; -import org.bukkit.scheduler.BukkitRunnable; import java.util.UUID; -public class TrackedEntity extends BukkitRunnable { +public class TrackedEntity extends CancellableRunnable { private final LivingEntity livingEntity; private final UUID id; private int arrowCount; diff --git a/src/main/java/com/gmail/nossr50/skills/herbalism/HerbalismManager.java b/src/main/java/com/gmail/nossr50/skills/herbalism/HerbalismManager.java index 611e69232..fbaba9170 100644 --- a/src/main/java/com/gmail/nossr50/skills/herbalism/HerbalismManager.java +++ b/src/main/java/com/gmail/nossr50/skills/herbalism/HerbalismManager.java @@ -39,7 +39,6 @@ import org.bukkit.entity.Player; import org.bukkit.event.block.BlockBreakEvent; import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.PlayerInventory; -import org.bukkit.scheduler.BukkitRunnable; import org.jetbrains.annotations.NotNull; import java.util.*; @@ -112,7 +111,7 @@ public class HerbalismManager extends SkillManager { } } - private class CheckBushAge extends BukkitRunnable { + private class CheckBushAge extends CancellableRunnable { @NotNull Block block; @NotNull McMMOPlayer mmoPlayer; diff --git a/src/main/java/com/gmail/nossr50/skills/taming/TrackedTamingEntity.java b/src/main/java/com/gmail/nossr50/skills/taming/TrackedTamingEntity.java index 79cd4802b..2a20735f0 100644 --- a/src/main/java/com/gmail/nossr50/skills/taming/TrackedTamingEntity.java +++ b/src/main/java/com/gmail/nossr50/skills/taming/TrackedTamingEntity.java @@ -2,13 +2,13 @@ package com.gmail.nossr50.skills.taming; import com.gmail.nossr50.datatypes.skills.subskills.taming.CallOfTheWildType; import com.gmail.nossr50.mcMMO; +import com.gmail.nossr50.util.CancellableRunnable; import com.gmail.nossr50.util.Misc; import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; -import org.bukkit.scheduler.BukkitRunnable; import org.jetbrains.annotations.NotNull; -public class TrackedTamingEntity extends BukkitRunnable { +public class TrackedTamingEntity extends CancellableRunnable { private final @NotNull LivingEntity livingEntity; private final @NotNull CallOfTheWildType callOfTheWildType; private final @NotNull Player player; diff --git a/src/main/java/com/gmail/nossr50/util/player/NotificationManager.java b/src/main/java/com/gmail/nossr50/util/player/NotificationManager.java index 6bf10c8ea..9a3d8da16 100644 --- a/src/main/java/com/gmail/nossr50/util/player/NotificationManager.java +++ b/src/main/java/com/gmail/nossr50/util/player/NotificationManager.java @@ -31,7 +31,6 @@ import org.bukkit.entity.Player; import org.jetbrains.annotations.NotNull; import java.time.LocalDate; -import java.util.concurrent.TimeUnit; public class NotificationManager { diff --git a/src/main/java/com/gmail/nossr50/util/scoreboards/ScoreboardWrapper.java b/src/main/java/com/gmail/nossr50/util/scoreboards/ScoreboardWrapper.java index e0d337413..7f2252b7d 100644 --- a/src/main/java/com/gmail/nossr50/util/scoreboards/ScoreboardWrapper.java +++ b/src/main/java/com/gmail/nossr50/util/scoreboards/ScoreboardWrapper.java @@ -12,6 +12,7 @@ import com.gmail.nossr50.events.scoreboard.ScoreboardObjectiveEventReason; import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.skills.child.FamilyTree; +import com.gmail.nossr50.util.CancellableRunnable; import com.gmail.nossr50.util.LogUtils; import com.gmail.nossr50.util.Misc; import com.gmail.nossr50.util.player.NotificationManager; @@ -22,7 +23,6 @@ import org.apache.commons.lang.Validate; import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.entity.Player; -import org.bukkit.scheduler.BukkitRunnable; import org.bukkit.scheduler.BukkitTask; import org.bukkit.scoreboard.DisplaySlot; import org.bukkit.scoreboard.Objective; @@ -88,7 +88,7 @@ public class ScoreboardWrapper { public BukkitTask updateTask = null; - private class ScoreboardQuickUpdate extends BukkitRunnable { + private class ScoreboardQuickUpdate extends CancellableRunnable { @Override public void run() { updateSidebar(); @@ -98,7 +98,7 @@ public class ScoreboardWrapper { public BukkitTask revertTask = null; - private class ScoreboardChangeTask extends BukkitRunnable { + private class ScoreboardChangeTask extends CancellableRunnable { @Override public void run() { tryRevertBoard(); @@ -108,7 +108,7 @@ public class ScoreboardWrapper { public BukkitTask cooldownTask = null; - private class ScoreboardCooldownTask extends BukkitRunnable { + private class ScoreboardCooldownTask extends CancellableRunnable { @Override public void run() { // Stop updating if it's no longer something displaying cooldowns diff --git a/src/main/java/com/gmail/nossr50/util/skills/CombatUtils.java b/src/main/java/com/gmail/nossr50/util/skills/CombatUtils.java index f2f7cf77b..e07b715ed 100644 --- a/src/main/java/com/gmail/nossr50/util/skills/CombatUtils.java +++ b/src/main/java/com/gmail/nossr50/util/skills/CombatUtils.java @@ -23,7 +23,6 @@ import com.gmail.nossr50.skills.unarmed.UnarmedManager; import com.gmail.nossr50.util.*; import com.gmail.nossr50.util.player.NotificationManager; import com.gmail.nossr50.util.player.UserManager; -import org.bukkit.Bukkit; import org.bukkit.GameMode; import org.bukkit.Material; import org.bukkit.attribute.Attribute; @@ -40,7 +39,6 @@ import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import java.util.List; -import java.util.concurrent.TimeUnit; public final class CombatUtils {