mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2025-03-28 12:49:44 +01:00
fix Folia throwing IllegalArgumentException
This commit is contained in:
parent
44b22559fb
commit
bc6e4bc056
2
pom.xml
2
pom.xml
@ -459,7 +459,7 @@
|
||||
<dependency>
|
||||
<groupId>com.github.technicallycoded</groupId>
|
||||
<artifactId>FoliaLib</artifactId>
|
||||
<version>main-SNAPSHOT</version>
|
||||
<version>dev-SNAPSHOT</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
@ -64,10 +64,10 @@ public class ConvertDatabaseCommand implements CommandExecutor {
|
||||
mcMMO.getDatabaseManager().saveUser(profile);
|
||||
}
|
||||
|
||||
mcMMO.p.getFoliaLib().getImpl().runLaterAsync(new PlayerProfileLoadingTask(player), 1); // 1 Tick delay to ensure the player is marked as online before we begin loading
|
||||
mcMMO.p.getFoliaLib().getScheduler().runLaterAsync(new PlayerProfileLoadingTask(player), 1); // 1 Tick delay to ensure the player is marked as online before we begin loading
|
||||
}
|
||||
|
||||
mcMMO.p.getFoliaLib().getImpl().runAsync(new DatabaseConversionTask(oldDatabase, sender, previousType.toString(), newType.toString()));
|
||||
mcMMO.p.getFoliaLib().getScheduler().runAsync(new DatabaseConversionTask(oldDatabase, sender, previousType.toString(), newType.toString()));
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
@ -36,10 +36,10 @@ public class ConvertExperienceCommand implements CommandExecutor {
|
||||
UserManager.saveAll();
|
||||
UserManager.clearAll();
|
||||
|
||||
mcMMO.p.getFoliaLib().getImpl().runLater(new FormulaConversionTask(sender, newType), 1);
|
||||
mcMMO.p.getFoliaLib().getScheduler().runLater(new FormulaConversionTask(sender, newType), 1);
|
||||
|
||||
for (Player player : mcMMO.p.getServer().getOnlinePlayers()) {
|
||||
mcMMO.p.getFoliaLib().getImpl().runLaterAsync(new PlayerProfileLoadingTask(player), 1); // 1 Tick delay to ensure the player is marked as online before we begin loading
|
||||
mcMMO.p.getFoliaLib().getScheduler().runLaterAsync(new PlayerProfileLoadingTask(player), 1); // 1 Tick delay to ensure the player is marked as online before we begin loading
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -244,7 +244,7 @@ public class PtpCommand implements TabExecutor {
|
||||
|
||||
if (warmup > 0) {
|
||||
teleportingPlayer.sendMessage(LocaleLoader.getString("Teleport.Commencing", warmup));
|
||||
mcMMO.p.getFoliaLib().getImpl().runAtEntityLater(teleportingPlayer, new TeleportationWarmup(mcMMOPlayer, mcMMOTarget), 20 * warmup);
|
||||
mcMMO.p.getFoliaLib().getScheduler().runAtEntityLater(teleportingPlayer, new TeleportationWarmup(mcMMOPlayer, mcMMOTarget), 20 * warmup);
|
||||
} else {
|
||||
EventUtils.handlePartyTeleportEvent(teleportingPlayer, targetPlayer);
|
||||
}
|
||||
|
@ -110,7 +110,7 @@ public class McRankCommand implements TabExecutor {
|
||||
boolean useBoard = mcMMO.p.getGeneralConfig().getScoreboardsEnabled() && (sender instanceof Player) && (mcMMO.p.getGeneralConfig().getRankUseBoard());
|
||||
boolean useChat = !useBoard || mcMMO.p.getGeneralConfig().getRankUseChat();
|
||||
|
||||
mcMMO.p.getFoliaLib().getImpl().runAsync(new McRankCommandAsyncTask(playerName, sender, useBoard, useChat));
|
||||
mcMMO.p.getFoliaLib().getScheduler().runAsync(new McRankCommandAsyncTask(playerName, sender, useBoard, useChat));
|
||||
}
|
||||
|
||||
private long getCDSeconds(McMMOPlayer mcMMOPlayer, long cooldownMillis) {
|
||||
|
@ -127,7 +127,7 @@ public class McTopCommand implements TabExecutor {
|
||||
boolean useBoard = (sender instanceof Player) && (mcMMO.p.getGeneralConfig().getTopUseBoard());
|
||||
boolean useChat = !useBoard || mcMMO.p.getGeneralConfig().getTopUseChat();
|
||||
|
||||
mcMMO.p.getFoliaLib().getImpl().runAsync(new McTopCommandAsyncTask(page, skill, sender, useBoard, useChat));
|
||||
mcMMO.p.getFoliaLib().getScheduler().runAsync(new McTopCommandAsyncTask(page, skill, sender, useBoard, useChat));
|
||||
}
|
||||
|
||||
private PrimarySkillType extractSkill(CommandSender sender, String skillName) {
|
||||
|
@ -1472,7 +1472,7 @@ public final class SQLDatabaseManager implements DatabaseManager {
|
||||
statement.executeUpdate("ALTER TABLE `" + tablePrefix + "users` ADD `uuid` varchar(36) NULL DEFAULT NULL");
|
||||
statement.executeUpdate("ALTER TABLE `" + tablePrefix + "users` ADD UNIQUE INDEX `uuid` (`uuid`) USING BTREE");
|
||||
|
||||
mcMMO.p.getFoliaLib().getImpl().runLaterAsync(new GetUUIDUpdatesRequired(), 100); // wait until after first purge
|
||||
mcMMO.p.getFoliaLib().getScheduler().runLaterAsync(new GetUUIDUpdatesRequired(), 100); // wait until after first purge
|
||||
}
|
||||
|
||||
mcMMO.getUpgradeManager().setUpgradeCompleted(UpgradeType.ADD_UUIDS);
|
||||
|
@ -963,7 +963,7 @@ public class McMMOPlayer implements Identified {
|
||||
}
|
||||
|
||||
setToolPreparationMode(tool, false);
|
||||
mcMMO.p.getFoliaLib().getImpl().runAtEntityLater(player, new AbilityDisableTask(this, superAbilityType), (long) ticks * Misc.TICK_CONVERSION_FACTOR);
|
||||
mcMMO.p.getFoliaLib().getScheduler().runAtEntityLater(player, new AbilityDisableTask(this, superAbilityType), (long) ticks * Misc.TICK_CONVERSION_FACTOR);
|
||||
}
|
||||
|
||||
public void processAbilityActivation(@NotNull PrimarySkillType primarySkillType) {
|
||||
@ -1021,7 +1021,7 @@ public class McMMOPlayer implements Identified {
|
||||
}
|
||||
|
||||
setToolPreparationMode(tool, true);
|
||||
mcMMO.p.getFoliaLib().getImpl().runAtEntityLater(player, new ToolLowerTask(this, tool), 4 * Misc.TICK_CONVERSION_FACTOR);
|
||||
mcMMO.p.getFoliaLib().getScheduler().runAtEntityLater(player, new ToolLowerTask(this, tool), 4 * Misc.TICK_CONVERSION_FACTOR);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -108,16 +108,16 @@ public class PlayerProfile {
|
||||
}
|
||||
|
||||
public void scheduleAsyncSave() {
|
||||
mcMMO.p.getFoliaLib().getImpl().runAsync(new PlayerProfileSaveTask(this, false));
|
||||
mcMMO.p.getFoliaLib().getScheduler().runAsync(new PlayerProfileSaveTask(this, false));
|
||||
}
|
||||
|
||||
public void scheduleAsyncSaveDelay() {
|
||||
mcMMO.p.getFoliaLib().getImpl().runLaterAsync(new PlayerProfileSaveTask(this, false), 20);
|
||||
mcMMO.p.getFoliaLib().getScheduler().runLaterAsync(new PlayerProfileSaveTask(this, false), 20);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public void scheduleSyncSaveDelay() {
|
||||
mcMMO.p.getFoliaLib().getImpl().runLater(new PlayerProfileSaveTask(this, true), 20);
|
||||
mcMMO.p.getFoliaLib().getScheduler().runLater(new PlayerProfileSaveTask(this, true), 20);
|
||||
}
|
||||
|
||||
public void save(boolean useSync) {
|
||||
@ -143,7 +143,7 @@ public class PlayerProfile {
|
||||
|
||||
//Back out of async saving if we detect a server shutdown, this is not always going to be caught
|
||||
if (mcMMO.isServerShutdownExecuted() || useSync)
|
||||
mcMMO.p.getFoliaLib().getImpl().runNextTick(new PlayerProfileSaveTask(this, true));
|
||||
mcMMO.p.getFoliaLib().getScheduler().runNextTick(new PlayerProfileSaveTask(this, true));
|
||||
else
|
||||
scheduleAsyncSave();
|
||||
|
||||
|
@ -135,7 +135,7 @@ public class BlockListener implements Listener {
|
||||
final BlockFace direction = event.getDirection();
|
||||
|
||||
for (final Block block : event.getBlocks()) {
|
||||
mcMMO.p.getFoliaLib().getImpl().runAtLocation(block.getLocation(), t -> {
|
||||
mcMMO.p.getFoliaLib().getScheduler().runAtLocation(block.getLocation(), t -> {
|
||||
final Block movedBlock = block.getRelative(direction);
|
||||
|
||||
if (BlockUtils.isWithinWorldBounds(movedBlock)) {
|
||||
|
@ -216,7 +216,7 @@ public class EntityListener implements Listener {
|
||||
|
||||
entity.setMetadata(MetadataConstants.METADATA_KEY_TRAVELING_BLOCK, MetadataConstants.MCMMO_METADATA_VALUE);
|
||||
TravelingBlockMetaCleanup metaCleanupTask = new TravelingBlockMetaCleanup(entity, pluginRef);
|
||||
mcMMO.p.getFoliaLib().getImpl().runAtEntityTimer(entity, metaCleanupTask, 20, 20*60); //6000 ticks is 5 minutes
|
||||
mcMMO.p.getFoliaLib().getScheduler().runAtEntityTimer(entity, metaCleanupTask, 20, 20*60); //6000 ticks is 5 minutes
|
||||
} else if (isTracked) {
|
||||
BlockUtils.setUnnaturalBlock(block);
|
||||
entity.removeMetadata(MetadataConstants.METADATA_KEY_TRAVELING_BLOCK, pluginRef);
|
||||
|
@ -461,7 +461,7 @@ public class InventoryListener implements Listener {
|
||||
return;
|
||||
}
|
||||
|
||||
mcMMO.p.getFoliaLib().getImpl().runAtEntity(whoClicked, new PlayerUpdateInventoryTask((Player) whoClicked));
|
||||
mcMMO.p.getFoliaLib().getScheduler().runAtEntity(whoClicked, new PlayerUpdateInventoryTask((Player) whoClicked));
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -146,7 +146,7 @@ public class PlayerListener implements Listener {
|
||||
new MobHealthDisplayUpdaterTask(attacker).run();
|
||||
|
||||
// set the name back
|
||||
mcMMO.p.getFoliaLib().getImpl().runAtEntityLater(attacker, () -> MobHealthbarUtils.handleMobHealthbars(attacker, 0, mcMMO.p), 1);
|
||||
mcMMO.p.getFoliaLib().getScheduler().runAtEntityLater(attacker, () -> MobHealthbarUtils.handleMobHealthbars(attacker, 0, mcMMO.p), 1);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -575,7 +575,7 @@ public class PlayerListener implements Listener {
|
||||
Player player = event.getPlayer();
|
||||
|
||||
//Delay loading for 3 seconds in case the player has a save task running, its hacky but it should do the trick
|
||||
mcMMO.p.getFoliaLib().getImpl().runLaterAsync(new PlayerProfileLoadingTask(player), 60);
|
||||
mcMMO.p.getFoliaLib().getScheduler().runLaterAsync(new PlayerProfileLoadingTask(player), 60);
|
||||
|
||||
if (mcMMO.p.getGeneralConfig().getMOTDEnabled() && Permissions.motd(player)) {
|
||||
Motd.displayAll(player);
|
||||
|
@ -30,7 +30,7 @@ public class WorldListener implements Listener {
|
||||
return;
|
||||
|
||||
// Using 50 ms later as I do not know of a way to run one tick later (safely)
|
||||
plugin.getFoliaLib().getImpl().runLater(() -> {
|
||||
plugin.getFoliaLib().getScheduler().runLater(() -> {
|
||||
for (BlockState blockState : event.getBlocks()) {
|
||||
mcMMO.getUserBlockTracker().setEligible(blockState);
|
||||
}
|
||||
|
@ -247,7 +247,7 @@ public class mcMMO extends JavaPlugin {
|
||||
formulaManager = new FormulaManager();
|
||||
|
||||
for (Player player : getServer().getOnlinePlayers()) {
|
||||
getFoliaLib().getImpl().runLaterAsync(new PlayerProfileLoadingTask(player), 1); // 1 Tick delay to ensure the player is marked as online before we begin loading
|
||||
getFoliaLib().getScheduler().runLaterAsync(new PlayerProfileLoadingTask(player), 1); // 1 Tick delay to ensure the player is marked as online before we begin loading
|
||||
}
|
||||
|
||||
LogUtils.debug(mcMMO.p.getLogger(), "Version " + getDescription().getVersion() + " is enabled!");
|
||||
@ -385,7 +385,7 @@ public class mcMMO extends JavaPlugin {
|
||||
}
|
||||
|
||||
LogUtils.debug(mcMMO.p.getLogger(), "Canceling all tasks...");
|
||||
getFoliaLib().getImpl().cancelAllTasks(); // This removes our tasks
|
||||
getFoliaLib().getScheduler().cancelAllTasks(); // This removes our tasks
|
||||
LogUtils.debug(mcMMO.p.getLogger(), "Unregister all events...");
|
||||
HandlerList.unregisterAll(this); // Cancel event registrations
|
||||
|
||||
@ -613,7 +613,7 @@ public class mcMMO extends JavaPlugin {
|
||||
}
|
||||
|
||||
private void registerCustomRecipes() {
|
||||
getFoliaLib().getImpl().runLater(() -> {
|
||||
getFoliaLib().getScheduler().runLater(() -> {
|
||||
if (generalConfig.getChimaeraEnabled()) {
|
||||
getServer().addRecipe(ChimaeraWing.getChimaeraWingRecipe());
|
||||
}
|
||||
@ -627,18 +627,18 @@ public class mcMMO extends JavaPlugin {
|
||||
|
||||
long saveIntervalTicks = Math.max(minute, generalConfig.getSaveInterval() * minute);
|
||||
|
||||
getFoliaLib().getImpl().runTimer(new SaveTimerTask(), saveIntervalTicks, saveIntervalTicks);
|
||||
getFoliaLib().getScheduler().runTimer(new SaveTimerTask(), saveIntervalTicks, saveIntervalTicks);
|
||||
|
||||
// Cleanup the backups folder
|
||||
getFoliaLib().getImpl().runAsync(new CleanBackupsTask());
|
||||
getFoliaLib().getScheduler().runAsync(new CleanBackupsTask());
|
||||
|
||||
// Old & Powerless User remover
|
||||
long purgeIntervalTicks = generalConfig.getPurgeInterval() * 60L * 60L * Misc.TICK_CONVERSION_FACTOR;
|
||||
|
||||
if (purgeIntervalTicks == 0) {
|
||||
getFoliaLib().getImpl().runLaterAsync(new UserPurgeTask(), 2 * Misc.TICK_CONVERSION_FACTOR); // Start 2 seconds after startup.
|
||||
getFoliaLib().getScheduler().runLaterAsync(new UserPurgeTask(), 2 * Misc.TICK_CONVERSION_FACTOR); // Start 2 seconds after startup.
|
||||
} else if (purgeIntervalTicks > 0) {
|
||||
getFoliaLib().getImpl().runTimerAsync(new UserPurgeTask(), purgeIntervalTicks, purgeIntervalTicks);
|
||||
getFoliaLib().getScheduler().runTimerAsync(new UserPurgeTask(), purgeIntervalTicks, purgeIntervalTicks);
|
||||
}
|
||||
|
||||
// Automatically remove old members from parties
|
||||
@ -646,22 +646,22 @@ public class mcMMO extends JavaPlugin {
|
||||
long kickIntervalTicks = generalConfig.getAutoPartyKickInterval() * 60L * 60L * Misc.TICK_CONVERSION_FACTOR;
|
||||
|
||||
if (kickIntervalTicks == 0) {
|
||||
getFoliaLib().getImpl().runLater(new PartyAutoKickTask(), 2 * Misc.TICK_CONVERSION_FACTOR); // Start 2 seconds after startup.
|
||||
getFoliaLib().getScheduler().runLater(new PartyAutoKickTask(), 2 * Misc.TICK_CONVERSION_FACTOR); // Start 2 seconds after startup.
|
||||
} else if (kickIntervalTicks > 0) {
|
||||
getFoliaLib().getImpl().runTimer(new PartyAutoKickTask(), kickIntervalTicks, kickIntervalTicks);
|
||||
getFoliaLib().getScheduler().runTimer(new PartyAutoKickTask(), kickIntervalTicks, kickIntervalTicks);
|
||||
}
|
||||
}
|
||||
|
||||
// Update power level tag scoreboards
|
||||
getFoliaLib().getImpl().runTimer(new PowerLevelUpdatingTask(), 2 * Misc.TICK_CONVERSION_FACTOR, 2 * Misc.TICK_CONVERSION_FACTOR);
|
||||
getFoliaLib().getScheduler().runTimer(new PowerLevelUpdatingTask(), 2 * Misc.TICK_CONVERSION_FACTOR, 2 * Misc.TICK_CONVERSION_FACTOR);
|
||||
|
||||
// Clear the registered XP data so players can earn XP again
|
||||
if (ExperienceConfig.getInstance().getDiminishedReturnsEnabled()) {
|
||||
getFoliaLib().getImpl().runTimer(new ClearRegisteredXPGainTask(), 60, 60);
|
||||
getFoliaLib().getScheduler().runTimer(new ClearRegisteredXPGainTask(), 60, 60);
|
||||
}
|
||||
|
||||
if (mcMMO.p.getAdvancedConfig().allowPlayerTips()) {
|
||||
getFoliaLib().getImpl().runTimer(new NotifySquelchReminderTask(), 60, ((20 * 60) * 60));
|
||||
getFoliaLib().getScheduler().runTimer(new NotifySquelchReminderTask(), 60, ((20 * 60) * 60));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -15,7 +15,7 @@ public class SaveTimerTask extends CancellableRunnable {
|
||||
int count = 1;
|
||||
|
||||
for (McMMOPlayer mcMMOPlayer : UserManager.getPlayers()) {
|
||||
mcMMO.p.getFoliaLib().getImpl().runLaterAsync(new PlayerProfileSaveTask(mcMMOPlayer.getProfile(), false), count);
|
||||
mcMMO.p.getFoliaLib().getScheduler().runLaterAsync(new PlayerProfileSaveTask(mcMMOPlayer.getProfile(), false), count);
|
||||
count++;
|
||||
}
|
||||
|
||||
|
@ -32,7 +32,7 @@ public class McRankCommandAsyncTask extends CancellableRunnable {
|
||||
public void run() {
|
||||
Map<PrimarySkillType, Integer> skills = mcMMO.getDatabaseManager().readRank(playerName);
|
||||
|
||||
mcMMO.p.getFoliaLib().getImpl().runNextTick(new McRankCommandDisplayTask(skills, sender, playerName, useBoard, useChat));
|
||||
mcMMO.p.getFoliaLib().getScheduler().runNextTick(new McRankCommandDisplayTask(skills, sender, playerName, useBoard, useChat));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -35,6 +35,6 @@ public class McTopCommandAsyncTask extends CancellableRunnable {
|
||||
public void run() {
|
||||
final List<PlayerStat> userStats = mcMMO.getDatabaseManager().readLeaderboard(skill, page, 10);
|
||||
|
||||
mcMMO.p.getFoliaLib().getImpl().runNextTick(new MctopCommandDisplayTask(userStats, page, skill, sender, useBoard, useChat));
|
||||
mcMMO.p.getFoliaLib().getScheduler().runNextTick(new MctopCommandDisplayTask(userStats, page, skill, sender, useBoard, useChat));
|
||||
}
|
||||
}
|
||||
|
@ -21,6 +21,6 @@ public class DatabaseConversionTask extends CancellableRunnable {
|
||||
public void run() {
|
||||
sourceDatabase.convertUsers(mcMMO.getDatabaseManager());
|
||||
|
||||
mcMMO.p.getFoliaLib().getImpl().runNextTick(t -> sender.sendMessage(message));
|
||||
mcMMO.p.getFoliaLib().getScheduler().runNextTick(t -> sender.sendMessage(message));
|
||||
}
|
||||
}
|
||||
|
@ -110,11 +110,11 @@ public class UUIDUpdateAsyncTask extends CancellableRunnable {
|
||||
|
||||
// Bukkit runnables don't let themselves reschedule themselves, so we are a pseudo bukkit runnable.
|
||||
private void runTaskLaterAsynchronously(mcMMO plugin, int delay) {
|
||||
plugin.getFoliaLib().getImpl().runLaterAsync(this, delay);
|
||||
plugin.getFoliaLib().getScheduler().runLaterAsync(this, delay);
|
||||
}
|
||||
|
||||
public void start() {
|
||||
plugin.getFoliaLib().getImpl().runAsync(this);
|
||||
plugin.getFoliaLib().getScheduler().runAsync(this);
|
||||
}
|
||||
|
||||
private static UUID toUUID(String id) {
|
||||
|
@ -52,7 +52,7 @@ public class PlayerProfileLoadingTask extends CancellableRunnable {
|
||||
|
||||
// If successful, schedule the apply
|
||||
if (profile.isLoaded()) {
|
||||
mcMMO.p.getFoliaLib().getImpl().runAtEntity(player, new ApplySuccessfulProfile(new McMMOPlayer(player, profile)));
|
||||
mcMMO.p.getFoliaLib().getScheduler().runAtEntity(player, new ApplySuccessfulProfile(new McMMOPlayer(player, profile)));
|
||||
EventUtils.callPlayerProfileLoadEvent(player, profile);
|
||||
return;
|
||||
}
|
||||
@ -73,7 +73,7 @@ public class PlayerProfileLoadingTask extends CancellableRunnable {
|
||||
// Increment attempt counter and try
|
||||
attempt++;
|
||||
|
||||
mcMMO.p.getFoliaLib().getImpl().runLaterAsync(new PlayerProfileLoadingTask(player, attempt), (100 + (attempt * 100L)));
|
||||
mcMMO.p.getFoliaLib().getScheduler().runLaterAsync(new PlayerProfileLoadingTask(player, attempt), (100 + (attempt * 100L)));
|
||||
}
|
||||
|
||||
private class ApplySuccessfulProfile extends CancellableRunnable {
|
||||
@ -103,7 +103,7 @@ public class PlayerProfileLoadingTask extends CancellableRunnable {
|
||||
|
||||
if (mcMMO.p.getGeneralConfig().getShowStatsAfterLogin()) {
|
||||
ScoreboardManager.enablePlayerStatsScoreboard(player);
|
||||
mcMMO.p.getFoliaLib().getImpl().runAtEntityLater(player, new McScoreboardKeepTask(player), Misc.TICK_CONVERSION_FACTOR);
|
||||
mcMMO.p.getFoliaLib().getScheduler().runAtEntityLater(player, new McScoreboardKeepTask(player), Misc.TICK_CONVERSION_FACTOR);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -63,7 +63,7 @@ public class AbilityDisableTask extends CancellableRunnable {
|
||||
SkillUtils.sendSkillMessage(player, NotificationType.SUPER_ABILITY_ALERT_OTHERS, ability.getAbilityPlayerOff());
|
||||
}
|
||||
if (!mcMMO.isServerShutdownExecuted()) {
|
||||
mcMMO.p.getFoliaLib().getImpl().runAtEntityLater(player, new AbilityCooldownTask(mcMMOPlayer, ability), (long) PerksUtils.handleCooldownPerks(player, ability.getCooldown()) * Misc.TICK_CONVERSION_FACTOR);
|
||||
mcMMO.p.getFoliaLib().getScheduler().runAtEntityLater(player, new AbilityCooldownTask(mcMMOPlayer, ability), (long) PerksUtils.handleCooldownPerks(player, ability.getCooldown()) * Misc.TICK_CONVERSION_FACTOR);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -76,7 +76,7 @@ public class AlchemyBrewTask extends CancellableRunnable {
|
||||
fuel--;
|
||||
|
||||
Alchemy.brewingStandMap.put(brewingStand.getLocation(), this);
|
||||
mcMMO.p.getFoliaLib().getImpl().runAtLocationTimer(brewingStand.getLocation(), this, 1, 1);
|
||||
mcMMO.p.getFoliaLib().getScheduler().runAtLocationTimer(brewingStand.getLocation(), this, 1, 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -46,6 +46,6 @@ public class AwardCombatXpTask extends CancellableRunnable {
|
||||
}
|
||||
|
||||
final double finalDamage = damage;
|
||||
mcMMO.p.getFoliaLib().getImpl().runAtEntity(mcMMOPlayer.getPlayer(), task -> mcMMOPlayer.beginXpGain(primarySkillType, (int) (finalDamage * baseXp), xpGainReason, XPGainSource.SELF));
|
||||
mcMMO.p.getFoliaLib().getScheduler().runAtEntity(mcMMOPlayer.getPlayer(), task -> mcMMOPlayer.beginXpGain(primarySkillType, (int) (finalDamage * baseXp), xpGainReason, XPGainSource.SELF));
|
||||
}
|
||||
}
|
||||
|
@ -54,7 +54,7 @@ public class DelayedCropReplant extends CancellableRunnable {
|
||||
PlantAnchorType plantAnchorType = PlantAnchorType.NORMAL;
|
||||
|
||||
//Remove the metadata marking the block as recently replanted
|
||||
mcMMO.p.getFoliaLib().getImpl().runAtLocationLater(blockBreakEvent.getBlock().getLocation(), new markPlantAsOld(blockBreakEvent.getBlock().getLocation()), 10);
|
||||
mcMMO.p.getFoliaLib().getScheduler().runAtLocationLater(blockBreakEvent.getBlock().getLocation(), new markPlantAsOld(blockBreakEvent.getBlock().getLocation()), 10);
|
||||
|
||||
if (blockBreakEvent.isCancelled()) {
|
||||
wasImmaturePlant = true;
|
||||
@ -101,7 +101,7 @@ public class DelayedCropReplant extends CancellableRunnable {
|
||||
|
||||
//Play an effect
|
||||
ParticleEffectUtils.playGreenThumbEffect(cropLocation);
|
||||
mcMMO.p.getFoliaLib().getImpl().runAtLocationLater(newState.getLocation(), new PhysicsBlockUpdate(newState.getBlock(), cropFace, plantAnchorType), 1);
|
||||
mcMMO.p.getFoliaLib().getScheduler().runAtLocationLater(newState.getLocation(), new PhysicsBlockUpdate(newState.getBlock(), cropFace, plantAnchorType), 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -110,7 +110,7 @@ public class AcrobaticsManager extends SkillManager {
|
||||
applyXpGain((float) (damage * Acrobatics.dodgeXpModifier), XPGainReason.PVE);
|
||||
mob.setMetadata(MetadataConstants.METADATA_KEY_DODGE_TRACKER, new FixedMetadataValue(mcMMO.p, count + 1));
|
||||
MobDodgeMetaCleanup metaCleanupTask = new MobDodgeMetaCleanup(mob, mcMMO.p);
|
||||
mcMMO.p.getFoliaLib().getImpl().runAtEntityTimer(mob, metaCleanupTask, 20, 20*60); //one minute
|
||||
mcMMO.p.getFoliaLib().getScheduler().runAtEntityTimer(mob, metaCleanupTask, 20, 20*60); //one minute
|
||||
}
|
||||
} else {
|
||||
applyXpGain((float) (damage * Acrobatics.dodgeXpModifier), XPGainReason.PVE);
|
||||
|
@ -13,9 +13,9 @@ import java.util.Map;
|
||||
public final class Alchemy {
|
||||
public static final int INGREDIENT_SLOT = 3;
|
||||
|
||||
public static int catalysisMaxBonusLevel = mcMMO.p.getAdvancedConfig().getCatalysisMaxBonusLevel();
|
||||
public static double catalysisMinSpeed = mcMMO.p.getAdvancedConfig().getCatalysisMinSpeed();
|
||||
public static double catalysisMaxSpeed = mcMMO.p.getAdvancedConfig().getCatalysisMaxSpeed();
|
||||
public static int catalysisMaxBonusLevel = mcMMO.p.getAdvancedConfig().getCatalysisMaxBonusLevel();
|
||||
public static double catalysisMinSpeed = mcMMO.p.getAdvancedConfig().getCatalysisMinSpeed();
|
||||
public static double catalysisMaxSpeed = mcMMO.p.getAdvancedConfig().getCatalysisMaxSpeed();
|
||||
|
||||
public static Map<Location, AlchemyBrewTask> brewingStandMap = new HashMap<>();
|
||||
|
||||
|
@ -343,14 +343,14 @@ public final class AlchemyPotionBrewer {
|
||||
}
|
||||
|
||||
public static void scheduleCheck(@NotNull BrewingStand brewingStand) {
|
||||
mcMMO.p.getFoliaLib().getImpl().runAtLocation(
|
||||
mcMMO.p.getFoliaLib().getScheduler().runAtLocation(
|
||||
brewingStand.getLocation(), new AlchemyBrewCheckTask(brewingStand));
|
||||
}
|
||||
|
||||
public static void scheduleUpdate(Inventory inventory) {
|
||||
for (HumanEntity humanEntity : inventory.getViewers()) {
|
||||
if (humanEntity instanceof Player) {
|
||||
mcMMO.p.getFoliaLib().getImpl().runAtEntity(humanEntity, new PlayerUpdateInventoryTask((Player) humanEntity));
|
||||
mcMMO.p.getFoliaLib().getScheduler().runAtEntity(humanEntity, new PlayerUpdateInventoryTask((Player) humanEntity));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -96,7 +96,7 @@ public class ArcheryManager extends SkillManager {
|
||||
Location dazedLocation = defender.getLocation();
|
||||
dazedLocation.setPitch(90 - Misc.getRandom().nextInt(181));
|
||||
|
||||
mcMMO.p.getFoliaLib().getImpl().teleportAsync(defender, dazedLocation);
|
||||
mcMMO.p.getFoliaLib().getScheduler().teleportAsync(defender, dazedLocation);
|
||||
defender.addPotionEffect(new PotionEffect(getNauseaPotionEffectType(), 20 * 10, 10));
|
||||
|
||||
if (NotificationManager.doesPlayerUseNotifications(defender)) {
|
||||
|
@ -15,7 +15,7 @@ public class TrackedEntity extends CancellableRunnable {
|
||||
this.livingEntity = livingEntity;
|
||||
this.id = livingEntity.getUniqueId();
|
||||
|
||||
mcMMO.p.getFoliaLib().getImpl().runAtEntityTimer(livingEntity, this, 12000, 12000);
|
||||
mcMMO.p.getFoliaLib().getScheduler().runAtEntityTimer(livingEntity, this, 12000, 12000);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -252,7 +252,7 @@ public class FishingManager extends SkillManager {
|
||||
}
|
||||
|
||||
public void masterAngler(@NotNull FishHook hook, int lureLevel) {
|
||||
mcMMO.p.getFoliaLib().getImpl().runAtEntityLater(hook, new MasterAnglerTask(hook, this, lureLevel), 1); //We run later to get the lure bonus applied
|
||||
mcMMO.p.getFoliaLib().getScheduler().runAtEntityLater(hook, new MasterAnglerTask(hook, this, lureLevel), 1); //We run later to get the lure bonus applied
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -122,7 +122,7 @@ public class HerbalismManager extends SkillManager {
|
||||
}
|
||||
|
||||
CheckBushAge checkBushAge = new CheckBushAge(blockState.getBlock(), mmoPlayer, xpReward);
|
||||
mcMMO.p.getFoliaLib().getImpl().runAtLocationLater(blockState.getLocation(), checkBushAge, 1);
|
||||
mcMMO.p.getFoliaLib().getScheduler().runAtLocationLater(blockState.getLocation(), checkBushAge, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -331,7 +331,7 @@ public class HerbalismManager extends SkillManager {
|
||||
DelayedHerbalismXPCheckTask delayedHerbalismXPCheckTask = new DelayedHerbalismXPCheckTask(mmoPlayer, delayedChorusBlocks);
|
||||
|
||||
//Large delay because the tree takes a while to break
|
||||
mcMMO.p.getFoliaLib().getImpl().runAtEntity(mmoPlayer.getPlayer(), delayedHerbalismXPCheckTask); //Calculate Chorus XP + Bonus Drops 1 tick later
|
||||
mcMMO.p.getFoliaLib().getScheduler().runAtEntity(mmoPlayer.getPlayer(), delayedHerbalismXPCheckTask); //Calculate Chorus XP + Bonus Drops 1 tick later
|
||||
}
|
||||
}
|
||||
|
||||
@ -789,7 +789,7 @@ public class HerbalismManager extends SkillManager {
|
||||
*/
|
||||
private void startReplantTask(int desiredCropAge, BlockBreakEvent blockBreakEvent, BlockState cropState, boolean isImmature) {
|
||||
//Mark the plant as recently replanted to avoid accidental breakage
|
||||
mcMMO.p.getFoliaLib().getImpl().runAtLocationLater(blockBreakEvent.getBlock().getLocation(), new DelayedCropReplant(blockBreakEvent, cropState, desiredCropAge, isImmature), 2 * Misc.TICK_CONVERSION_FACTOR);
|
||||
mcMMO.p.getFoliaLib().getScheduler().runAtLocationLater(blockBreakEvent.getBlock().getLocation(), new DelayedCropReplant(blockBreakEvent, cropState, desiredCropAge, isImmature), 2 * Misc.TICK_CONVERSION_FACTOR);
|
||||
blockBreakEvent.getBlock().setMetadata(MetadataConstants.METADATA_KEY_REPLANT, new RecentlyReplantedCropMeta(mcMMO.p, true));
|
||||
}
|
||||
|
||||
|
@ -170,7 +170,7 @@ public class MiningManager extends SkillManager {
|
||||
|
||||
mmoPlayer.setAbilityDATS(SuperAbilityType.BLAST_MINING, System.currentTimeMillis());
|
||||
mmoPlayer.setAbilityInformed(SuperAbilityType.BLAST_MINING, false);
|
||||
mcMMO.p.getFoliaLib().getImpl().runAtEntityLater(mmoPlayer.getPlayer(), new AbilityCooldownTask(mmoPlayer, SuperAbilityType.BLAST_MINING), (long) SuperAbilityType.BLAST_MINING.getCooldown() * Misc.TICK_CONVERSION_FACTOR);
|
||||
mcMMO.p.getFoliaLib().getScheduler().runAtEntityLater(mmoPlayer.getPlayer(), new AbilityCooldownTask(mmoPlayer, SuperAbilityType.BLAST_MINING), (long) SuperAbilityType.BLAST_MINING.getCooldown() * Misc.TICK_CONVERSION_FACTOR);
|
||||
}
|
||||
|
||||
private boolean isInfestedBlock(String material) {
|
||||
|
@ -95,7 +95,7 @@ public class SwordsManager extends SkillManager {
|
||||
|
||||
RuptureTaskMeta ruptureTaskMeta = new RuptureTaskMeta(mcMMO.p, ruptureTask);
|
||||
|
||||
mcMMO.p.getFoliaLib().getImpl().runAtEntityTimer(target, ruptureTask, 1, 1);
|
||||
mcMMO.p.getFoliaLib().getScheduler().runAtEntityTimer(target, ruptureTask, 1, 1);
|
||||
target.setMetadata(MetadataConstants.METADATA_KEY_RUPTURE, ruptureTaskMeta);
|
||||
|
||||
// if (mmoPlayer.useChatNotifications()) {
|
||||
|
@ -27,7 +27,7 @@ public class TrackedTamingEntity extends CancellableRunnable {
|
||||
|
||||
if (tamingCOTWLength > 0) {
|
||||
int length = tamingCOTWLength * Misc.TICK_CONVERSION_FACTOR;
|
||||
mcMMO.p.getFoliaLib().getImpl().runAtEntityLater(livingEntity, this, length);
|
||||
mcMMO.p.getFoliaLib().getScheduler().runAtEntityLater(livingEntity, this, length);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -112,7 +112,7 @@ public final class ChimaeraWing {
|
||||
|
||||
if (warmup > 0) {
|
||||
NotificationManager.sendPlayerInformation(player, NotificationType.ITEM_MESSAGE, "Teleport.Commencing", String.valueOf(warmup));
|
||||
mcMMO.p.getFoliaLib().getImpl().runAtEntityLater(player, new ChimaeraWingWarmup(mcMMOPlayer), 20 * warmup);
|
||||
mcMMO.p.getFoliaLib().getScheduler().runAtEntityLater(player, new ChimaeraWingWarmup(mcMMOPlayer), 20 * warmup);
|
||||
} else {
|
||||
chimaeraExecuteTeleport();
|
||||
}
|
||||
@ -123,15 +123,15 @@ public final class ChimaeraWing {
|
||||
|
||||
if (mcMMO.p.getGeneralConfig().getChimaeraUseBedSpawn() && player.getBedSpawnLocation() != null) {
|
||||
// player.teleport(player.getBedSpawnLocation());
|
||||
mcMMO.p.getFoliaLib().getImpl().teleportAsync(player, player.getBedSpawnLocation());
|
||||
mcMMO.p.getFoliaLib().getScheduler().teleportAsync(player, player.getBedSpawnLocation());
|
||||
} else {
|
||||
Location spawnLocation = player.getWorld().getSpawnLocation();
|
||||
if (spawnLocation.getBlock().getType() == Material.AIR) {
|
||||
// player.teleport(spawnLocation);
|
||||
mcMMO.p.getFoliaLib().getImpl().teleportAsync(player, spawnLocation);
|
||||
mcMMO.p.getFoliaLib().getScheduler().teleportAsync(player, spawnLocation);
|
||||
} else {
|
||||
// player.teleport(player.getWorld().getHighestBlockAt(spawnLocation).getLocation());
|
||||
mcMMO.p.getFoliaLib().getImpl().teleportAsync(player, player.getWorld().getHighestBlockAt(spawnLocation).getLocation());
|
||||
mcMMO.p.getFoliaLib().getScheduler().teleportAsync(player, player.getWorld().getHighestBlockAt(spawnLocation).getLocation());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -358,7 +358,7 @@ public final class EventUtils {
|
||||
}
|
||||
|
||||
// teleportingPlayer.teleport(targetPlayer);
|
||||
mcMMO.p.getFoliaLib().getImpl().teleportAsync(teleportingPlayer, targetPlayer.getLocation());
|
||||
mcMMO.p.getFoliaLib().getScheduler().teleportAsync(teleportingPlayer, targetPlayer.getLocation());
|
||||
|
||||
teleportingPlayer.sendMessage(LocaleLoader.getString("Party.Teleport.Player", targetPlayer.getName()));
|
||||
targetPlayer.sendMessage(LocaleLoader.getString("Party.Teleport.Target", teleportingPlayer.getName()));
|
||||
|
@ -117,7 +117,7 @@ public final class Misc {
|
||||
|
||||
if (player != null) {
|
||||
UserManager.remove(player);
|
||||
mcMMO.p.getFoliaLib().getImpl().runLaterAsync(new PlayerProfileLoadingTask(player), 1); // 1 Tick delay to ensure the player is marked as online before we begin loading
|
||||
mcMMO.p.getFoliaLib().getScheduler().runLaterAsync(new PlayerProfileLoadingTask(player), 1); // 1 Tick delay to ensure the player is marked as online before we begin loading
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -80,7 +80,7 @@ public final class MobHealthbarUtils {
|
||||
target.setMetadata(MetadataConstants.METADATA_KEY_NAME_VISIBILITY, new FixedMetadataValue(mcMMO.p, false));
|
||||
}
|
||||
|
||||
mcMMO.p.getFoliaLib().getImpl().runAtEntityLater(target, new MobHealthDisplayUpdaterTask(target), (long) displayTime * Misc.TICK_CONVERSION_FACTOR); // Clear health display after 3 seconds
|
||||
mcMMO.p.getFoliaLib().getScheduler().runAtEntityLater(target, new MobHealthDisplayUpdaterTask(target), (long) displayTime * Misc.TICK_CONVERSION_FACTOR); // Clear health display after 3 seconds
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -75,7 +75,7 @@ public class ExperienceBarManager {
|
||||
return;
|
||||
|
||||
ExperienceBarHideTask experienceBarHideTask = new ExperienceBarHideTask(this, mcMMOPlayer, primarySkillType);
|
||||
mcMMO.p.getFoliaLib().getImpl().runAtEntityLater(mcMMOPlayer.getPlayer(), experienceBarHideTask, (long) delaySeconds * Misc.TICK_CONVERSION_FACTOR);
|
||||
mcMMO.p.getFoliaLib().getScheduler().runAtEntityLater(mcMMOPlayer.getPlayer(), experienceBarHideTask, (long) delaySeconds * Misc.TICK_CONVERSION_FACTOR);
|
||||
experienceBarHideTaskHashMap.put(primarySkillType, experienceBarHideTask);
|
||||
}
|
||||
|
||||
|
@ -305,7 +305,7 @@ public class NotificationManager {
|
||||
.hoverEvent(levelMilestoneHover);
|
||||
|
||||
// TODO: Update system msg API
|
||||
mcMMO.p.getFoliaLib().getImpl().runNextTick(
|
||||
mcMMO.p.getFoliaLib().getScheduler().runNextTick(
|
||||
t -> audience.sendMessage(component));
|
||||
}
|
||||
}
|
||||
@ -341,7 +341,7 @@ public class NotificationManager {
|
||||
String localeMessage = LocaleLoader.getString("Broadcasts.PowerLevelUpMilestone", mmoPlayer.getPlayer().getDisplayName(), powerLevel);
|
||||
Component message = LegacyComponentSerializer.legacySection().deserialize(localeMessage).hoverEvent(levelMilestoneHover);
|
||||
|
||||
mcMMO.p.getFoliaLib().getImpl().runNextTick(t -> audience.sendMessage(message));
|
||||
mcMMO.p.getFoliaLib().getScheduler().runNextTick(t -> audience.sendMessage(message));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -122,7 +122,7 @@ public class ScoreboardWrapper {
|
||||
public void doSidebarUpdateSoon() {
|
||||
if (updateTask == null) {
|
||||
// To avoid spamming the scheduler, store the instance and run 2 ticks later
|
||||
updateTask = mcMMO.p.getFoliaLib().getImpl().runAtEntityLater(player, new ScoreboardQuickUpdate(), 2L);
|
||||
updateTask = mcMMO.p.getFoliaLib().getScheduler().runAtEntityLater(player, new ScoreboardQuickUpdate(), 2L);
|
||||
}
|
||||
}
|
||||
|
||||
@ -130,7 +130,7 @@ public class ScoreboardWrapper {
|
||||
if (cooldownTask == null) {
|
||||
// Repeat every 5 seconds.
|
||||
// Cancels once all cooldowns are done, using stopCooldownUpdating().
|
||||
cooldownTask = mcMMO.p.getFoliaLib().getImpl().runAtEntityTimer(player, new ScoreboardCooldownTask(), 5 * Misc.TICK_CONVERSION_FACTOR, 5 * Misc.TICK_CONVERSION_FACTOR);
|
||||
cooldownTask = mcMMO.p.getFoliaLib().getScheduler().runAtEntityTimer(player, new ScoreboardCooldownTask(), 5 * Misc.TICK_CONVERSION_FACTOR, 5 * Misc.TICK_CONVERSION_FACTOR);
|
||||
}
|
||||
}
|
||||
|
||||
@ -212,7 +212,7 @@ public class ScoreboardWrapper {
|
||||
}
|
||||
|
||||
player.setScoreboard(scoreboard);
|
||||
revertTask = mcMMO.p.getFoliaLib().getImpl().runAtEntityLater(player, new ScoreboardChangeTask(), ticks);
|
||||
revertTask = mcMMO.p.getFoliaLib().getScheduler().runAtEntityLater(player, new ScoreboardChangeTask(), ticks);
|
||||
|
||||
// TODO is there any way to do the time that looks acceptable?
|
||||
// player.sendMessage(LocaleLoader.getString("Commands.Scoreboard.Timer", StringUtils.capitalize(sidebarType.toString().toLowerCase(Locale.ENGLISH)), ticks / 20F));
|
||||
@ -420,7 +420,7 @@ public class ScoreboardWrapper {
|
||||
NotificationManager.sendPlayerInformationChatOnlyPrefixed(player, "Scoreboard.Recovery");
|
||||
|
||||
initBoard(); //Start over
|
||||
mcMMO.p.getFoliaLib().getImpl().runAtEntity(player, t -> ScoreboardManager.retryLastSkillBoard(player));
|
||||
mcMMO.p.getFoliaLib().getScheduler().runAtEntity(player, t -> ScoreboardManager.retryLastSkillBoard(player));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -914,7 +914,7 @@ public final class CombatUtils {
|
||||
baseXP *= multiplier;
|
||||
|
||||
if (baseXP > 0) {
|
||||
mcMMO.p.getFoliaLib().getImpl().runAtEntity(target, new AwardCombatXpTask(mcMMOPlayer, primarySkillType, baseXP, target, xpGainReason));
|
||||
mcMMO.p.getFoliaLib().getScheduler().runAtEntity(target, new AwardCombatXpTask(mcMMOPlayer, primarySkillType, baseXP, target, xpGainReason));
|
||||
}
|
||||
}
|
||||
|
||||
@ -1056,6 +1056,6 @@ public final class CombatUtils {
|
||||
* @param arrow the projectile
|
||||
*/
|
||||
public static void delayArrowMetaCleanup(@NotNull Arrow arrow) {
|
||||
mcMMO.p.getFoliaLib().getImpl().runLater(() -> ProjectileUtils.cleanupProjectileMetadata(arrow), 20*120);
|
||||
mcMMO.p.getFoliaLib().getScheduler().runLater(() -> ProjectileUtils.cleanupProjectileMetadata(arrow), 20*120);
|
||||
}
|
||||
}
|
||||
|
@ -45,7 +45,7 @@ public class RankUtils {
|
||||
if (newLevel == innerMap.get(playerRankInSkill)) {
|
||||
SkillUnlockNotificationTask skillUnlockNotificationTask = new SkillUnlockNotificationTask(mcMMOPlayer, subSkillType, newLevel);
|
||||
|
||||
mcMMO.p.getFoliaLib().getImpl().runAtEntityLater(mcMMOPlayer.getPlayer(), skillUnlockNotificationTask, (count * 100L));
|
||||
mcMMO.p.getFoliaLib().getScheduler().runAtEntityLater(mcMMOPlayer.getPlayer(), skillUnlockNotificationTask, (count * 100L));
|
||||
|
||||
count++;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user