fix Folia throwing IllegalArgumentException

This commit is contained in:
nossr50
2025-03-09 16:35:20 -07:00
parent 44b22559fb
commit bc6e4bc056
44 changed files with 79 additions and 79 deletions

View File

@@ -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++;
}

View File

@@ -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));
}
}

View File

@@ -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));
}
}

View File

@@ -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));
}
}

View File

@@ -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) {

View File

@@ -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);
}
}

View File

@@ -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);
}
}

View File

@@ -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

View File

@@ -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));
}
}

View File

@@ -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);
}
}