mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-24 06:06:45 +01:00
fix up all runnables
This commit is contained in:
parent
731e2d8691
commit
c4616a3674
@ -64,10 +64,10 @@ public class ConvertDatabaseCommand implements CommandExecutor {
|
|||||||
mcMMO.getDatabaseManager().saveUser(profile);
|
mcMMO.getDatabaseManager().saveUser(profile);
|
||||||
}
|
}
|
||||||
|
|
||||||
new PlayerProfileLoadingTask(player).runTaskLaterAsynchronously(mcMMO.p, 1); // 1 Tick delay to ensure the player is marked as online before we begin loading
|
mcMMO.p.getFoliaLib().getImpl().runLaterAsync(new PlayerProfileLoadingTask(player), 1); // 1 Tick delay to ensure the player is marked as online before we begin loading
|
||||||
}
|
}
|
||||||
|
|
||||||
new DatabaseConversionTask(oldDatabase, sender, previousType.toString(), newType.toString()).runTaskAsynchronously(mcMMO.p);
|
mcMMO.p.getFoliaLib().getImpl().runAsync(new DatabaseConversionTask(oldDatabase, sender, previousType.toString(), newType.toString()));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
@ -36,10 +36,10 @@ public class ConvertExperienceCommand implements CommandExecutor {
|
|||||||
UserManager.saveAll();
|
UserManager.saveAll();
|
||||||
UserManager.clearAll();
|
UserManager.clearAll();
|
||||||
|
|
||||||
new FormulaConversionTask(sender, newType).runTaskLater(mcMMO.p, 1);
|
mcMMO.p.getFoliaLib().getImpl().runLater(new FormulaConversionTask(sender, newType), 1);
|
||||||
|
|
||||||
for (Player player : mcMMO.p.getServer().getOnlinePlayers()) {
|
for (Player player : mcMMO.p.getServer().getOnlinePlayers()) {
|
||||||
new PlayerProfileLoadingTask(player).runTaskLaterAsynchronously(mcMMO.p, 1); // 1 Tick delay to ensure the player is marked as online before we begin loading
|
mcMMO.p.getFoliaLib().getImpl().runLaterAsync(new PlayerProfileLoadingTask(player), 1); // 1 Tick delay to ensure the player is marked as online before we begin loading
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -250,7 +250,7 @@ public class PtpCommand implements TabExecutor {
|
|||||||
|
|
||||||
if (warmup > 0) {
|
if (warmup > 0) {
|
||||||
teleportingPlayer.sendMessage(LocaleLoader.getString("Teleport.Commencing", warmup));
|
teleportingPlayer.sendMessage(LocaleLoader.getString("Teleport.Commencing", warmup));
|
||||||
new TeleportationWarmup(mcMMOPlayer, mcMMOTarget).runTaskLater(mcMMO.p, 20 * warmup);
|
mcMMO.p.getFoliaLib().getImpl().runAtEntityLater(teleportingPlayer, new TeleportationWarmup(mcMMOPlayer, mcMMOTarget), 20 * warmup);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
EventUtils.handlePartyTeleportEvent(teleportingPlayer, targetPlayer);
|
EventUtils.handlePartyTeleportEvent(teleportingPlayer, targetPlayer);
|
||||||
|
@ -111,7 +111,7 @@ public class McrankCommand implements TabExecutor {
|
|||||||
boolean useBoard = mcMMO.p.getGeneralConfig().getScoreboardsEnabled() && (sender instanceof Player) && (mcMMO.p.getGeneralConfig().getRankUseBoard());
|
boolean useBoard = mcMMO.p.getGeneralConfig().getScoreboardsEnabled() && (sender instanceof Player) && (mcMMO.p.getGeneralConfig().getRankUseBoard());
|
||||||
boolean useChat = !useBoard || mcMMO.p.getGeneralConfig().getRankUseChat();
|
boolean useChat = !useBoard || mcMMO.p.getGeneralConfig().getRankUseChat();
|
||||||
|
|
||||||
new McrankCommandAsyncTask(playerName, sender, useBoard, useChat).runTaskAsynchronously(mcMMO.p);
|
mcMMO.p.getFoliaLib().getImpl().runAsync(new McrankCommandAsyncTask(playerName, sender, useBoard, useChat));
|
||||||
}
|
}
|
||||||
|
|
||||||
private long getCDSeconds(McMMOPlayer mcMMOPlayer, long cooldownMillis) {
|
private long getCDSeconds(McMMOPlayer mcMMOPlayer, long cooldownMillis) {
|
||||||
|
@ -115,7 +115,7 @@ public class MctopCommand implements TabExecutor {
|
|||||||
boolean useBoard = (sender instanceof Player) && (mcMMO.p.getGeneralConfig().getTopUseBoard());
|
boolean useBoard = (sender instanceof Player) && (mcMMO.p.getGeneralConfig().getTopUseBoard());
|
||||||
boolean useChat = !useBoard || mcMMO.p.getGeneralConfig().getTopUseChat();
|
boolean useChat = !useBoard || mcMMO.p.getGeneralConfig().getTopUseChat();
|
||||||
|
|
||||||
new MctopCommandAsyncTask(page, skill, sender, useBoard, useChat).runTaskAsynchronously(mcMMO.p);
|
mcMMO.p.getFoliaLib().getImpl().runAsync(new MctopCommandAsyncTask(page, skill, sender, useBoard, useChat));
|
||||||
}
|
}
|
||||||
|
|
||||||
private PrimarySkillType extractSkill(CommandSender sender, String skillName) {
|
private PrimarySkillType extractSkill(CommandSender sender, String skillName) {
|
||||||
|
@ -951,7 +951,7 @@ public class McMMOPlayer implements Identified {
|
|||||||
}
|
}
|
||||||
|
|
||||||
setToolPreparationMode(tool, false);
|
setToolPreparationMode(tool, false);
|
||||||
new AbilityDisableTask(this, superAbilityType).runTaskLater(mcMMO.p, (long) ticks * Misc.TICK_CONVERSION_FACTOR);
|
mcMMO.p.getFoliaLib().getImpl().runAtEntityLater(player, new AbilityDisableTask(this, superAbilityType), (long) ticks * Misc.TICK_CONVERSION_FACTOR);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void processAbilityActivation(@NotNull PrimarySkillType primarySkillType) {
|
public void processAbilityActivation(@NotNull PrimarySkillType primarySkillType) {
|
||||||
@ -1013,7 +1013,7 @@ public class McMMOPlayer implements Identified {
|
|||||||
}
|
}
|
||||||
|
|
||||||
setToolPreparationMode(tool, true);
|
setToolPreparationMode(tool, true);
|
||||||
new ToolLowerTask(this, tool).runTaskLater(mcMMO.p, 4 * Misc.TICK_CONVERSION_FACTOR);
|
mcMMO.p.getFoliaLib().getImpl().runAtEntityLater(player, new ToolLowerTask(this, tool), 4 * Misc.TICK_CONVERSION_FACTOR);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -102,16 +102,16 @@ public class PlayerProfile {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void scheduleAsyncSave() {
|
public void scheduleAsyncSave() {
|
||||||
new PlayerProfileSaveTask(this, false).runTaskAsynchronously(mcMMO.p);
|
mcMMO.p.getFoliaLib().getImpl().runAsync(new PlayerProfileSaveTask(this, false));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void scheduleAsyncSaveDelay() {
|
public void scheduleAsyncSaveDelay() {
|
||||||
new PlayerProfileSaveTask(this, false).runTaskLaterAsynchronously(mcMMO.p, 20);
|
mcMMO.p.getFoliaLib().getImpl().runLaterAsync(new PlayerProfileSaveTask(this, false), 20);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public void scheduleSyncSaveDelay() {
|
public void scheduleSyncSaveDelay() {
|
||||||
new PlayerProfileSaveTask(this, true).runTaskLater(mcMMO.p, 20);
|
mcMMO.p.getFoliaLib().getImpl().runLater(new PlayerProfileSaveTask(this, true), 20);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void save(boolean useSync) {
|
public void save(boolean useSync) {
|
||||||
@ -138,7 +138,7 @@ public class PlayerProfile {
|
|||||||
|
|
||||||
//Back out of async saving if we detect a server shutdown, this is not always going to be caught
|
//Back out of async saving if we detect a server shutdown, this is not always going to be caught
|
||||||
if(mcMMO.isServerShutdownExecuted() || useSync)
|
if(mcMMO.isServerShutdownExecuted() || useSync)
|
||||||
new PlayerProfileSaveTask(this, true).runTask(mcMMO.p);
|
mcMMO.p.getFoliaLib().getImpl().runNextTick(new PlayerProfileSaveTask(this, true));
|
||||||
else
|
else
|
||||||
scheduleAsyncSave();
|
scheduleAsyncSave();
|
||||||
|
|
||||||
|
@ -137,7 +137,7 @@ public class BlockListener implements Listener {
|
|||||||
final BlockFace direction = event.getDirection();
|
final BlockFace direction = event.getDirection();
|
||||||
|
|
||||||
for (final Block block : event.getBlocks()) {
|
for (final Block block : event.getBlocks()) {
|
||||||
mcMMO.p.getFoliaLib().getImpl().runAtLocation(block.getLocation(), () -> {
|
mcMMO.p.getFoliaLib().getImpl().runAtLocation(block.getLocation(), t -> {
|
||||||
final Block movedBlock = block.getRelative(direction);
|
final Block movedBlock = block.getRelative(direction);
|
||||||
|
|
||||||
if (BlockUtils.isWithinWorldBounds(movedBlock)) {
|
if (BlockUtils.isWithinWorldBounds(movedBlock)) {
|
||||||
|
@ -242,7 +242,7 @@ public class EntityListener implements Listener {
|
|||||||
|
|
||||||
entity.setMetadata(MetadataConstants.METADATA_KEY_TRAVELING_BLOCK, MetadataConstants.MCMMO_METADATA_VALUE);
|
entity.setMetadata(MetadataConstants.METADATA_KEY_TRAVELING_BLOCK, MetadataConstants.MCMMO_METADATA_VALUE);
|
||||||
TravelingBlockMetaCleanup metaCleanupTask = new TravelingBlockMetaCleanup(entity, pluginRef);
|
TravelingBlockMetaCleanup metaCleanupTask = new TravelingBlockMetaCleanup(entity, pluginRef);
|
||||||
metaCleanupTask.runTaskTimer(pluginRef, 20, 20*60); //6000 ticks is 5 minutes
|
mcMMO.p.getFoliaLib().getImpl().runAtEntityTimer(entity, metaCleanupTask, 20, 20*60); //6000 ticks is 5 minutes
|
||||||
}
|
}
|
||||||
else if (isTracked) {
|
else if (isTracked) {
|
||||||
BlockUtils.setUnnaturalBlock(block);
|
BlockUtils.setUnnaturalBlock(block);
|
||||||
|
@ -439,7 +439,7 @@ public class InventoryListener implements Listener {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
new PlayerUpdateInventoryTask((Player) whoClicked).runTaskLater(plugin, 0);
|
mcMMO.p.getFoliaLib().getImpl().runAtEntity(whoClicked, new PlayerUpdateInventoryTask((Player) whoClicked));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -589,7 +589,7 @@ public class PlayerListener implements Listener {
|
|||||||
Player player = event.getPlayer();
|
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
|
//Delay loading for 3 seconds in case the player has a save task running, its hacky but it should do the trick
|
||||||
new PlayerProfileLoadingTask(player).runTaskLaterAsynchronously(mcMMO.p, 60);
|
mcMMO.p.getFoliaLib().getImpl().runLaterAsync(new PlayerProfileLoadingTask(player), 60);
|
||||||
|
|
||||||
if (mcMMO.p.getGeneralConfig().getMOTDEnabled() && Permissions.motd(player)) {
|
if (mcMMO.p.getGeneralConfig().getMOTDEnabled() && Permissions.motd(player)) {
|
||||||
Motd.displayAll(player);
|
Motd.displayAll(player);
|
||||||
|
@ -262,7 +262,7 @@ public class mcMMO extends JavaPlugin {
|
|||||||
formulaManager = new FormulaManager();
|
formulaManager = new FormulaManager();
|
||||||
|
|
||||||
for (Player player : getServer().getOnlinePlayers()) {
|
for (Player player : getServer().getOnlinePlayers()) {
|
||||||
new PlayerProfileLoadingTask(player).runTaskLaterAsynchronously(mcMMO.p, 1); // 1 Tick delay to ensure the player is marked as online before we begin loading
|
getFoliaLib().getImpl().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!");
|
LogUtils.debug(mcMMO.p.getLogger(), "Version " + getDescription().getVersion() + " is enabled!");
|
||||||
@ -645,7 +645,7 @@ public class mcMMO extends JavaPlugin {
|
|||||||
|
|
||||||
long saveIntervalTicks = Math.max(minute, generalConfig.getSaveInterval() * minute);
|
long saveIntervalTicks = Math.max(minute, generalConfig.getSaveInterval() * minute);
|
||||||
|
|
||||||
new SaveTimerTask().runTaskTimer(this, saveIntervalTicks, saveIntervalTicks);
|
getFoliaLib().getImpl().runTimer(new SaveTimerTask(), saveIntervalTicks, saveIntervalTicks);
|
||||||
|
|
||||||
// Cleanup the backups folder
|
// Cleanup the backups folder
|
||||||
getFoliaLib().getImpl().runAsync(new CleanBackupsTask());
|
getFoliaLib().getImpl().runAsync(new CleanBackupsTask());
|
||||||
@ -654,33 +654,33 @@ public class mcMMO extends JavaPlugin {
|
|||||||
long purgeIntervalTicks = generalConfig.getPurgeInterval() * 60L * 60L * Misc.TICK_CONVERSION_FACTOR;
|
long purgeIntervalTicks = generalConfig.getPurgeInterval() * 60L * 60L * Misc.TICK_CONVERSION_FACTOR;
|
||||||
|
|
||||||
if (purgeIntervalTicks == 0) {
|
if (purgeIntervalTicks == 0) {
|
||||||
new UserPurgeTask().runTaskLaterAsynchronously(this, 2 * Misc.TICK_CONVERSION_FACTOR); // Start 2 seconds after startup.
|
getFoliaLib().getImpl().runLaterAsync(new UserPurgeTask(), 2 * Misc.TICK_CONVERSION_FACTOR); // Start 2 seconds after startup.
|
||||||
}
|
}
|
||||||
else if (purgeIntervalTicks > 0) {
|
else if (purgeIntervalTicks > 0) {
|
||||||
new UserPurgeTask().runTaskTimerAsynchronously(this, purgeIntervalTicks, purgeIntervalTicks);
|
getFoliaLib().getImpl().runTimerAsync(new UserPurgeTask(), purgeIntervalTicks, purgeIntervalTicks);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Automatically remove old members from parties
|
// Automatically remove old members from parties
|
||||||
long kickIntervalTicks = generalConfig.getAutoPartyKickInterval() * 60L * 60L * Misc.TICK_CONVERSION_FACTOR;
|
long kickIntervalTicks = generalConfig.getAutoPartyKickInterval() * 60L * 60L * Misc.TICK_CONVERSION_FACTOR;
|
||||||
|
|
||||||
if (kickIntervalTicks == 0) {
|
if (kickIntervalTicks == 0) {
|
||||||
new PartyAutoKickTask().runTaskLater(this, 2 * Misc.TICK_CONVERSION_FACTOR); // Start 2 seconds after startup.
|
getFoliaLib().getImpl().runLater(new PartyAutoKickTask(), 2 * Misc.TICK_CONVERSION_FACTOR); // Start 2 seconds after startup.
|
||||||
}
|
}
|
||||||
else if (kickIntervalTicks > 0) {
|
else if (kickIntervalTicks > 0) {
|
||||||
new PartyAutoKickTask().runTaskTimer(this, kickIntervalTicks, kickIntervalTicks);
|
getFoliaLib().getImpl().runTimer(new PartyAutoKickTask(), kickIntervalTicks, kickIntervalTicks);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update power level tag scoreboards
|
// Update power level tag scoreboards
|
||||||
new PowerLevelUpdatingTask().runTaskTimer(this, 2 * Misc.TICK_CONVERSION_FACTOR, 2 * Misc.TICK_CONVERSION_FACTOR);
|
getFoliaLib().getImpl().runTimer(new PowerLevelUpdatingTask(), 2 * Misc.TICK_CONVERSION_FACTOR, 2 * Misc.TICK_CONVERSION_FACTOR);
|
||||||
|
|
||||||
// Clear the registered XP data so players can earn XP again
|
// Clear the registered XP data so players can earn XP again
|
||||||
if (ExperienceConfig.getInstance().getDiminishedReturnsEnabled()) {
|
if (ExperienceConfig.getInstance().getDiminishedReturnsEnabled()) {
|
||||||
new ClearRegisteredXPGainTask().runTaskTimer(this, 60, 60);
|
getFoliaLib().getImpl().runTimer(new ClearRegisteredXPGainTask(), 60, 60);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(mcMMO.p.getAdvancedConfig().allowPlayerTips())
|
if(mcMMO.p.getAdvancedConfig().allowPlayerTips())
|
||||||
{
|
{
|
||||||
new NotifySquelchReminderTask().runTaskTimer(this, 60, ((20 * 60) * 60));
|
getFoliaLib().getImpl().runTimer(new NotifySquelchReminderTask(), 60, ((20 * 60) * 60));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -16,7 +16,7 @@ public class SaveTimerTask extends CancellableRunnable {
|
|||||||
int count = 1;
|
int count = 1;
|
||||||
|
|
||||||
for (McMMOPlayer mcMMOPlayer : UserManager.getPlayers()) {
|
for (McMMOPlayer mcMMOPlayer : UserManager.getPlayers()) {
|
||||||
new PlayerProfileSaveTask(mcMMOPlayer.getProfile(), false).runTaskLaterAsynchronously(mcMMO.p, count);
|
mcMMO.p.getFoliaLib().getImpl().runLaterAsync(new PlayerProfileSaveTask(mcMMOPlayer.getProfile(), false), count);
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -32,7 +32,7 @@ public class McrankCommandAsyncTask extends CancellableRunnable {
|
|||||||
public void run() {
|
public void run() {
|
||||||
Map<PrimarySkillType, Integer> skills = mcMMO.getDatabaseManager().readRank(playerName);
|
Map<PrimarySkillType, Integer> skills = mcMMO.getDatabaseManager().readRank(playerName);
|
||||||
|
|
||||||
new McrankCommandDisplayTask(skills, sender, playerName, useBoard, useChat).runTaskLater(mcMMO.p, 1);
|
mcMMO.p.getFoliaLib().getImpl().runNextTick(new McrankCommandDisplayTask(skills, sender, playerName, useBoard, useChat));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -35,6 +35,6 @@ public class MctopCommandAsyncTask extends CancellableRunnable {
|
|||||||
public void run() {
|
public void run() {
|
||||||
final List<PlayerStat> userStats = mcMMO.getDatabaseManager().readLeaderboard(skill, page, 10);
|
final List<PlayerStat> userStats = mcMMO.getDatabaseManager().readLeaderboard(skill, page, 10);
|
||||||
|
|
||||||
new MctopCommandDisplayTask(userStats, page, skill, sender, useBoard, useChat).runTaskLater(mcMMO.p, 1);
|
mcMMO.p.getFoliaLib().getImpl().runNextTick(new MctopCommandDisplayTask(userStats, page, skill, sender, useBoard, useChat));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -21,6 +21,6 @@ public class DatabaseConversionTask extends CancellableRunnable {
|
|||||||
public void run() {
|
public void run() {
|
||||||
sourceDatabase.convertUsers(mcMMO.getDatabaseManager());
|
sourceDatabase.convertUsers(mcMMO.getDatabaseManager());
|
||||||
|
|
||||||
mcMMO.p.getFoliaLib().getImpl().runNextTick(() -> sender.sendMessage(message));
|
mcMMO.p.getFoliaLib().getImpl().runNextTick(t -> sender.sendMessage(message));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,7 @@ package com.gmail.nossr50.runnables.database;
|
|||||||
|
|
||||||
import com.gmail.nossr50.datatypes.database.UpgradeType;
|
import com.gmail.nossr50.datatypes.database.UpgradeType;
|
||||||
import com.gmail.nossr50.mcMMO;
|
import com.gmail.nossr50.mcMMO;
|
||||||
|
import com.gmail.nossr50.util.CancellableRunnable;
|
||||||
import com.gmail.nossr50.util.Misc;
|
import com.gmail.nossr50.util.Misc;
|
||||||
import com.google.common.collect.ImmutableList;
|
import com.google.common.collect.ImmutableList;
|
||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
@ -20,7 +21,7 @@ import java.util.UUID;
|
|||||||
import java.util.concurrent.CountDownLatch;
|
import java.util.concurrent.CountDownLatch;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
|
|
||||||
public class UUIDUpdateAsyncTask implements Runnable {
|
public class UUIDUpdateAsyncTask extends CancellableRunnable {
|
||||||
private static final Gson GSON = new Gson();
|
private static final Gson GSON = new Gson();
|
||||||
private static final String PROFILE_URL = "https://api.mojang.com/profiles/minecraft";
|
private static final String PROFILE_URL = "https://api.mojang.com/profiles/minecraft";
|
||||||
|
|
||||||
|
@ -52,7 +52,7 @@ public class PlayerProfileLoadingTask extends CancellableRunnable {
|
|||||||
|
|
||||||
// If successful, schedule the apply
|
// If successful, schedule the apply
|
||||||
if (profile.isLoaded()) {
|
if (profile.isLoaded()) {
|
||||||
new ApplySuccessfulProfile(new McMMOPlayer(player, profile)).runTask(mcMMO.p);
|
mcMMO.p.getFoliaLib().getImpl().runAtEntity(player, new ApplySuccessfulProfile(new McMMOPlayer(player, profile)));
|
||||||
EventUtils.callPlayerProfileLoadEvent(player, profile);
|
EventUtils.callPlayerProfileLoadEvent(player, profile);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -74,7 +74,7 @@ public class PlayerProfileLoadingTask extends CancellableRunnable {
|
|||||||
// Increment attempt counter and try
|
// Increment attempt counter and try
|
||||||
attempt++;
|
attempt++;
|
||||||
|
|
||||||
new PlayerProfileLoadingTask(player, attempt).runTaskLaterAsynchronously(mcMMO.p, (100 + (attempt * 100L)));
|
mcMMO.p.getFoliaLib().getImpl().runLaterAsync(new PlayerProfileLoadingTask(player, attempt), (100 + (attempt * 100L)));
|
||||||
}
|
}
|
||||||
|
|
||||||
private class ApplySuccessfulProfile extends CancellableRunnable {
|
private class ApplySuccessfulProfile extends CancellableRunnable {
|
||||||
@ -104,7 +104,7 @@ public class PlayerProfileLoadingTask extends CancellableRunnable {
|
|||||||
|
|
||||||
if (mcMMO.p.getGeneralConfig().getShowStatsAfterLogin()) {
|
if (mcMMO.p.getGeneralConfig().getShowStatsAfterLogin()) {
|
||||||
ScoreboardManager.enablePlayerStatsScoreboard(player);
|
ScoreboardManager.enablePlayerStatsScoreboard(player);
|
||||||
new McScoreboardKeepTask(player).runTaskLater(mcMMO.p, Misc.TICK_CONVERSION_FACTOR);
|
mcMMO.p.getFoliaLib().getImpl().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());
|
SkillUtils.sendSkillMessage(player, NotificationType.SUPER_ABILITY_ALERT_OTHERS, ability.getAbilityPlayerOff());
|
||||||
}
|
}
|
||||||
if(!mcMMO.isServerShutdownExecuted()) {
|
if(!mcMMO.isServerShutdownExecuted()) {
|
||||||
new AbilityCooldownTask(mcMMOPlayer, ability).runTaskLater(mcMMO.p, (long) PerksUtils.handleCooldownPerks(player, ability.getCooldown()) * Misc.TICK_CONVERSION_FACTOR);
|
mcMMO.p.getFoliaLib().getImpl().runAtEntityLater(player, new AbilityCooldownTask(mcMMOPlayer, ability), (long) PerksUtils.handleCooldownPerks(player, ability.getCooldown()) * Misc.TICK_CONVERSION_FACTOR);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -62,7 +62,7 @@ public class AlchemyBrewTask extends CancellableRunnable {
|
|||||||
fuel--;
|
fuel--;
|
||||||
|
|
||||||
Alchemy.brewingStandMap.put(location, this);
|
Alchemy.brewingStandMap.put(location, this);
|
||||||
this.runTaskTimer(mcMMO.p, 1, 1);
|
mcMMO.p.getFoliaLib().getImpl().runAtLocationTimer(location, this, 1, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -54,7 +54,7 @@ public class DelayedCropReplant extends CancellableRunnable {
|
|||||||
PlantAnchorType plantAnchorType = PlantAnchorType.NORMAL;
|
PlantAnchorType plantAnchorType = PlantAnchorType.NORMAL;
|
||||||
|
|
||||||
//Remove the metadata marking the block as recently replanted
|
//Remove the metadata marking the block as recently replanted
|
||||||
new markPlantAsOld(blockBreakEvent.getBlock().getLocation()).runTaskLater(mcMMO.p, 10);
|
mcMMO.p.getFoliaLib().getImpl().runAtLocationLater(blockBreakEvent.getBlock().getLocation(), new markPlantAsOld(blockBreakEvent.getBlock().getLocation()), 10);
|
||||||
|
|
||||||
if(blockBreakEvent.isCancelled()) {
|
if(blockBreakEvent.isCancelled()) {
|
||||||
wasImmaturePlant = true;
|
wasImmaturePlant = true;
|
||||||
@ -101,7 +101,7 @@ public class DelayedCropReplant extends CancellableRunnable {
|
|||||||
|
|
||||||
//Play an effect
|
//Play an effect
|
||||||
ParticleEffectUtils.playGreenThumbEffect(cropLocation);
|
ParticleEffectUtils.playGreenThumbEffect(cropLocation);
|
||||||
new PhysicsBlockUpdate(newState.getBlock(), cropFace, plantAnchorType).runTaskLater(mcMMO.p, 1);
|
mcMMO.p.getFoliaLib().getImpl().runAtLocationLater(newState.getLocation(), new PhysicsBlockUpdate(newState.getBlock(), cropFace, plantAnchorType), 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -113,7 +113,7 @@ public class AcrobaticsManager extends SkillManager {
|
|||||||
applyXpGain((float) (damage * Acrobatics.dodgeXpModifier), XPGainReason.PVE);
|
applyXpGain((float) (damage * Acrobatics.dodgeXpModifier), XPGainReason.PVE);
|
||||||
mob.setMetadata(MetadataConstants.METADATA_KEY_DODGE_TRACKER, new FixedMetadataValue(mcMMO.p, count + 1));
|
mob.setMetadata(MetadataConstants.METADATA_KEY_DODGE_TRACKER, new FixedMetadataValue(mcMMO.p, count + 1));
|
||||||
MobDodgeMetaCleanup metaCleanupTask = new MobDodgeMetaCleanup(mob, mcMMO.p);
|
MobDodgeMetaCleanup metaCleanupTask = new MobDodgeMetaCleanup(mob, mcMMO.p);
|
||||||
metaCleanupTask.runTaskTimer(mcMMO.p, 20, 20*60); //one minute
|
mcMMO.p.getFoliaLib().getImpl().runAtEntityTimer(mob, metaCleanupTask, 20, 20*60); //one minute
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
applyXpGain((float) (damage * Acrobatics.dodgeXpModifier), XPGainReason.PVE);
|
applyXpGain((float) (damage * Acrobatics.dodgeXpModifier), XPGainReason.PVE);
|
||||||
|
@ -259,13 +259,13 @@ public final class AlchemyPotionBrewer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void scheduleCheck(Player player, BrewingStand brewingStand) {
|
public static void scheduleCheck(Player player, BrewingStand brewingStand) {
|
||||||
new AlchemyBrewCheckTask(player, brewingStand).runTask(mcMMO.p);
|
mcMMO.p.getFoliaLib().getImpl().runAtEntity(player, new AlchemyBrewCheckTask(player, brewingStand));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void scheduleUpdate(Inventory inventory) {
|
public static void scheduleUpdate(Inventory inventory) {
|
||||||
for (HumanEntity humanEntity : inventory.getViewers()) {
|
for (HumanEntity humanEntity : inventory.getViewers()) {
|
||||||
if (humanEntity instanceof Player) {
|
if (humanEntity instanceof Player) {
|
||||||
new PlayerUpdateInventoryTask((Player) humanEntity).runTask(mcMMO.p);
|
mcMMO.p.getFoliaLib().getImpl().runAtEntity(humanEntity, new PlayerUpdateInventoryTask((Player) humanEntity));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -96,7 +96,8 @@ public class ArcheryManager extends SkillManager {
|
|||||||
Location dazedLocation = defender.getLocation();
|
Location dazedLocation = defender.getLocation();
|
||||||
dazedLocation.setPitch(90 - Misc.getRandom().nextInt(181));
|
dazedLocation.setPitch(90 - Misc.getRandom().nextInt(181));
|
||||||
|
|
||||||
defender.teleport(dazedLocation);
|
// defender.teleport(dazedLocation);
|
||||||
|
mcMMO.p.getFoliaLib().getImpl().teleportAsync(defender, dazedLocation);
|
||||||
defender.addPotionEffect(new PotionEffect(PotionEffectType.CONFUSION, 20 * 10, 10));
|
defender.addPotionEffect(new PotionEffect(PotionEffectType.CONFUSION, 20 * 10, 10));
|
||||||
|
|
||||||
|
|
||||||
|
@ -15,7 +15,7 @@ public class TrackedEntity extends CancellableRunnable {
|
|||||||
this.livingEntity = livingEntity;
|
this.livingEntity = livingEntity;
|
||||||
this.id = livingEntity.getUniqueId();
|
this.id = livingEntity.getUniqueId();
|
||||||
|
|
||||||
this.runTaskTimer(mcMMO.p, 12000, 12000);
|
mcMMO.p.getFoliaLib().getImpl().runAtEntityTimer(livingEntity, this, 12000, 12000);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -244,7 +244,7 @@ public class FishingManager extends SkillManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void masterAngler(@NotNull FishHook hook, int lureLevel) {
|
public void masterAngler(@NotNull FishHook hook, int lureLevel) {
|
||||||
new MasterAnglerTask(hook, this, lureLevel).runTaskLater(mcMMO.p, 0); //We run later to get the lure bonus applied
|
mcMMO.p.getFoliaLib().getImpl().runAtEntityLater(hook, new MasterAnglerTask(hook, this, lureLevel), 1); //We run later to get the lure bonus applied
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -106,7 +106,7 @@ public class HerbalismManager extends SkillManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
CheckBushAge checkBushAge = new CheckBushAge(blockState.getBlock(), mmoPlayer, xpReward);
|
CheckBushAge checkBushAge = new CheckBushAge(blockState.getBlock(), mmoPlayer, xpReward);
|
||||||
checkBushAge.runTaskLater(mcMMO.p, 1);
|
mcMMO.p.getFoliaLib().getImpl().runAtLocationLater(blockState.getLocation(), checkBushAge, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -310,7 +310,7 @@ public class HerbalismManager extends SkillManager {
|
|||||||
DelayedHerbalismXPCheckTask delayedHerbalismXPCheckTask = new DelayedHerbalismXPCheckTask(mmoPlayer, delayedChorusBlocks);
|
DelayedHerbalismXPCheckTask delayedHerbalismXPCheckTask = new DelayedHerbalismXPCheckTask(mmoPlayer, delayedChorusBlocks);
|
||||||
|
|
||||||
//Large delay because the tree takes a while to break
|
//Large delay because the tree takes a while to break
|
||||||
delayedHerbalismXPCheckTask.runTaskLater(mcMMO.p, 0); //Calculate Chorus XP + Bonus Drops 1 tick later
|
mcMMO.p.getFoliaLib().getImpl().runAtEntity(mmoPlayer.getPlayer(), delayedHerbalismXPCheckTask); //Calculate Chorus XP + Bonus Drops 1 tick later
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -741,7 +741,7 @@ public class HerbalismManager extends SkillManager {
|
|||||||
*/
|
*/
|
||||||
private void startReplantTask(int desiredCropAge, BlockBreakEvent blockBreakEvent, BlockState cropState, boolean isImmature) {
|
private void startReplantTask(int desiredCropAge, BlockBreakEvent blockBreakEvent, BlockState cropState, boolean isImmature) {
|
||||||
//Mark the plant as recently replanted to avoid accidental breakage
|
//Mark the plant as recently replanted to avoid accidental breakage
|
||||||
new DelayedCropReplant(blockBreakEvent, cropState, desiredCropAge, isImmature).runTaskLater(mcMMO.p, 20 * 2);
|
mcMMO.p.getFoliaLib().getImpl().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));
|
blockBreakEvent.getBlock().setMetadata(MetadataConstants.METADATA_KEY_REPLANT, new RecentlyReplantedCropMeta(mcMMO.p, true));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -130,7 +130,7 @@ public class MiningManager extends SkillManager {
|
|||||||
|
|
||||||
mmoPlayer.setAbilityDATS(SuperAbilityType.BLAST_MINING, System.currentTimeMillis());
|
mmoPlayer.setAbilityDATS(SuperAbilityType.BLAST_MINING, System.currentTimeMillis());
|
||||||
mmoPlayer.setAbilityInformed(SuperAbilityType.BLAST_MINING, false);
|
mmoPlayer.setAbilityInformed(SuperAbilityType.BLAST_MINING, false);
|
||||||
new AbilityCooldownTask(mmoPlayer, SuperAbilityType.BLAST_MINING).runTaskLater(mcMMO.p, (long) SuperAbilityType.BLAST_MINING.getCooldown() * Misc.TICK_CONVERSION_FACTOR);
|
mcMMO.p.getFoliaLib().getImpl().runAtEntityLater(mmoPlayer.getPlayer(), new AbilityCooldownTask(mmoPlayer, SuperAbilityType.BLAST_MINING), (long) SuperAbilityType.BLAST_MINING.getCooldown() * Misc.TICK_CONVERSION_FACTOR);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -95,7 +95,7 @@ public class SwordsManager extends SkillManager {
|
|||||||
|
|
||||||
RuptureTaskMeta ruptureTaskMeta = new RuptureTaskMeta(mcMMO.p, ruptureTask);
|
RuptureTaskMeta ruptureTaskMeta = new RuptureTaskMeta(mcMMO.p, ruptureTask);
|
||||||
|
|
||||||
ruptureTask.runTaskTimer(mcMMO.p, 0, 1);
|
mcMMO.p.getFoliaLib().getImpl().runAtEntityTimer(mmoPlayer.getPlayer(), ruptureTask, 0, 1);
|
||||||
target.setMetadata(MetadataConstants.METADATA_KEY_RUPTURE, ruptureTaskMeta);
|
target.setMetadata(MetadataConstants.METADATA_KEY_RUPTURE, ruptureTaskMeta);
|
||||||
|
|
||||||
// if (mmoPlayer.useChatNotifications()) {
|
// if (mmoPlayer.useChatNotifications()) {
|
||||||
|
@ -22,7 +22,7 @@ public class TrackedTamingEntity extends CancellableRunnable {
|
|||||||
|
|
||||||
if (tamingCOTWLength > 0) {
|
if (tamingCOTWLength > 0) {
|
||||||
int length = tamingCOTWLength * Misc.TICK_CONVERSION_FACTOR;
|
int length = tamingCOTWLength * Misc.TICK_CONVERSION_FACTOR;
|
||||||
this.runTaskLater(mcMMO.p, length);
|
mcMMO.p.getFoliaLib().getImpl().runAtEntityLater(livingEntity, this, length);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -112,7 +112,7 @@ public final class ChimaeraWing {
|
|||||||
|
|
||||||
if (warmup > 0) {
|
if (warmup > 0) {
|
||||||
NotificationManager.sendPlayerInformation(player, NotificationType.ITEM_MESSAGE, "Teleport.Commencing", String.valueOf(warmup));
|
NotificationManager.sendPlayerInformation(player, NotificationType.ITEM_MESSAGE, "Teleport.Commencing", String.valueOf(warmup));
|
||||||
new ChimaeraWingWarmup(mcMMOPlayer).runTaskLater(mcMMO.p, 20 * warmup);
|
mcMMO.p.getFoliaLib().getImpl().runAtEntityLater(player, new ChimaeraWingWarmup(mcMMOPlayer), 20 * warmup);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
chimaeraExecuteTeleport();
|
chimaeraExecuteTeleport();
|
||||||
@ -123,15 +123,18 @@ public final class ChimaeraWing {
|
|||||||
Player player = mcMMOPlayer.getPlayer();
|
Player player = mcMMOPlayer.getPlayer();
|
||||||
|
|
||||||
if (mcMMO.p.getGeneralConfig().getChimaeraUseBedSpawn() && player.getBedSpawnLocation() != null) {
|
if (mcMMO.p.getGeneralConfig().getChimaeraUseBedSpawn() && player.getBedSpawnLocation() != null) {
|
||||||
player.teleport(player.getBedSpawnLocation());
|
// player.teleport(player.getBedSpawnLocation());
|
||||||
|
mcMMO.p.getFoliaLib().getImpl().teleportAsync(player, player.getBedSpawnLocation());
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
Location spawnLocation = player.getWorld().getSpawnLocation();
|
Location spawnLocation = player.getWorld().getSpawnLocation();
|
||||||
if (spawnLocation.getBlock().getType() == Material.AIR) {
|
if (spawnLocation.getBlock().getType() == Material.AIR) {
|
||||||
player.teleport(spawnLocation);
|
// player.teleport(spawnLocation);
|
||||||
|
mcMMO.p.getFoliaLib().getImpl().teleportAsync(player, spawnLocation);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
player.teleport(player.getWorld().getHighestBlockAt(spawnLocation).getLocation());
|
// player.teleport(player.getWorld().getHighestBlockAt(spawnLocation).getLocation());
|
||||||
|
mcMMO.p.getFoliaLib().getImpl().teleportAsync(player, player.getWorld().getHighestBlockAt(spawnLocation).getLocation());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -367,7 +367,8 @@ public final class EventUtils {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
teleportingPlayer.teleport(targetPlayer);
|
// teleportingPlayer.teleport(targetPlayer);
|
||||||
|
mcMMO.p.getFoliaLib().getImpl().teleportAsync(teleportingPlayer, targetPlayer.getLocation());
|
||||||
|
|
||||||
teleportingPlayer.sendMessage(LocaleLoader.getString("Party.Teleport.Player", targetPlayer.getName()));
|
teleportingPlayer.sendMessage(LocaleLoader.getString("Party.Teleport.Player", targetPlayer.getName()));
|
||||||
targetPlayer.sendMessage(LocaleLoader.getString("Party.Teleport.Target", teleportingPlayer.getName()));
|
targetPlayer.sendMessage(LocaleLoader.getString("Party.Teleport.Target", teleportingPlayer.getName()));
|
||||||
|
@ -254,7 +254,7 @@ public final class Misc {
|
|||||||
|
|
||||||
if (player != null) {
|
if (player != null) {
|
||||||
UserManager.remove(player);
|
UserManager.remove(player);
|
||||||
new PlayerProfileLoadingTask(player).runTaskLaterAsynchronously(mcMMO.p, 1); // 1 Tick delay to ensure the player is marked as online before we begin loading
|
mcMMO.p.getFoliaLib().getImpl().runLaterAsync(new PlayerProfileLoadingTask(player), 1); // 1 Tick delay to ensure the player is marked as online before we begin loading
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -81,7 +81,7 @@ public final class MobHealthbarUtils {
|
|||||||
target.setMetadata(MetadataConstants.METADATA_KEY_NAME_VISIBILITY, new FixedMetadataValue(mcMMO.p, false));
|
target.setMetadata(MetadataConstants.METADATA_KEY_NAME_VISIBILITY, new FixedMetadataValue(mcMMO.p, false));
|
||||||
}
|
}
|
||||||
|
|
||||||
new MobHealthDisplayUpdaterTask(target).runTaskLater(mcMMO.p, (long) displayTime * Misc.TICK_CONVERSION_FACTOR); // Clear health display after 3 seconds
|
mcMMO.p.getFoliaLib().getImpl().runAtEntityLater(target, new MobHealthDisplayUpdaterTask(target), (long) displayTime * Misc.TICK_CONVERSION_FACTOR); // Clear health display after 3 seconds
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5,6 +5,7 @@ import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
|||||||
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
||||||
import com.gmail.nossr50.mcMMO;
|
import com.gmail.nossr50.mcMMO;
|
||||||
import com.gmail.nossr50.runnables.skills.ExperienceBarHideTask;
|
import com.gmail.nossr50.runnables.skills.ExperienceBarHideTask;
|
||||||
|
import com.gmail.nossr50.util.Misc;
|
||||||
import com.gmail.nossr50.util.player.NotificationManager;
|
import com.gmail.nossr50.util.player.NotificationManager;
|
||||||
import org.bukkit.plugin.Plugin;
|
import org.bukkit.plugin.Plugin;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
@ -77,7 +78,7 @@ public class ExperienceBarManager {
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
ExperienceBarHideTask experienceBarHideTask = new ExperienceBarHideTask(this, mcMMOPlayer, primarySkillType);
|
ExperienceBarHideTask experienceBarHideTask = new ExperienceBarHideTask(this, mcMMOPlayer, primarySkillType);
|
||||||
experienceBarHideTask.runTaskLater(plugin, 20L * delaySeconds);
|
mcMMO.p.getFoliaLib().getImpl().runAtEntityLater(mcMMOPlayer.getPlayer(), experienceBarHideTask, (long) delaySeconds * Misc.TICK_CONVERSION_FACTOR);
|
||||||
experienceBarHideTaskHashMap.put(primarySkillType, experienceBarHideTask);
|
experienceBarHideTaskHashMap.put(primarySkillType, experienceBarHideTask);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -296,7 +296,7 @@ public class NotificationManager {
|
|||||||
String localeMessage = LocaleLoader.getString("Broadcasts.LevelUpMilestone", mmoPlayer.getPlayer().getDisplayName(), level, mcMMO.p.getSkillTools().getLocalizedSkillName(primarySkillType));
|
String localeMessage = LocaleLoader.getString("Broadcasts.LevelUpMilestone", mmoPlayer.getPlayer().getDisplayName(), level, mcMMO.p.getSkillTools().getLocalizedSkillName(primarySkillType));
|
||||||
Component message = LegacyComponentSerializer.legacySection().deserialize(localeMessage).hoverEvent(levelMilestoneHover);
|
Component message = LegacyComponentSerializer.legacySection().deserialize(localeMessage).hoverEvent(levelMilestoneHover);
|
||||||
|
|
||||||
mcMMO.p.getFoliaLib().getImpl().runNextTick(() -> audience.sendMessage(Identity.nil(), message));
|
mcMMO.p.getFoliaLib().getImpl().runNextTick(t -> audience.sendMessage(Identity.nil(), message));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -331,7 +331,7 @@ public class NotificationManager {
|
|||||||
String localeMessage = LocaleLoader.getString("Broadcasts.PowerLevelUpMilestone", mmoPlayer.getPlayer().getDisplayName(), powerLevel);
|
String localeMessage = LocaleLoader.getString("Broadcasts.PowerLevelUpMilestone", mmoPlayer.getPlayer().getDisplayName(), powerLevel);
|
||||||
Component message = LegacyComponentSerializer.legacySection().deserialize(localeMessage).hoverEvent(levelMilestoneHover);
|
Component message = LegacyComponentSerializer.legacySection().deserialize(localeMessage).hoverEvent(levelMilestoneHover);
|
||||||
|
|
||||||
mcMMO.p.getFoliaLib().getImpl().runNextTick(() -> audience.sendMessage(Identity.nil(), message));
|
mcMMO.p.getFoliaLib().getImpl().runNextTick(t -> audience.sendMessage(Identity.nil(), message));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -12,18 +12,16 @@ import com.gmail.nossr50.events.scoreboard.ScoreboardObjectiveEventReason;
|
|||||||
import com.gmail.nossr50.locale.LocaleLoader;
|
import com.gmail.nossr50.locale.LocaleLoader;
|
||||||
import com.gmail.nossr50.mcMMO;
|
import com.gmail.nossr50.mcMMO;
|
||||||
import com.gmail.nossr50.skills.child.FamilyTree;
|
import com.gmail.nossr50.skills.child.FamilyTree;
|
||||||
import com.gmail.nossr50.util.CancellableRunnable;
|
|
||||||
import com.gmail.nossr50.util.LogUtils;
|
import com.gmail.nossr50.util.LogUtils;
|
||||||
import com.gmail.nossr50.util.Misc;
|
import com.gmail.nossr50.util.Misc;
|
||||||
import com.gmail.nossr50.util.player.NotificationManager;
|
import com.gmail.nossr50.util.player.NotificationManager;
|
||||||
import com.gmail.nossr50.util.player.UserManager;
|
import com.gmail.nossr50.util.player.UserManager;
|
||||||
import com.gmail.nossr50.util.scoreboards.ScoreboardManager.SidebarType;
|
import com.gmail.nossr50.util.scoreboards.ScoreboardManager.SidebarType;
|
||||||
import com.gmail.nossr50.util.skills.SkillTools;
|
import com.gmail.nossr50.util.skills.SkillTools;
|
||||||
|
import com.tcoded.folialib.wrapper.task.WrappedTask;
|
||||||
import org.apache.commons.lang.Validate;
|
import org.apache.commons.lang.Validate;
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.scheduler.BukkitTask;
|
|
||||||
import org.bukkit.scoreboard.DisplaySlot;
|
import org.bukkit.scoreboard.DisplaySlot;
|
||||||
import org.bukkit.scoreboard.Objective;
|
import org.bukkit.scoreboard.Objective;
|
||||||
import org.bukkit.scoreboard.Score;
|
import org.bukkit.scoreboard.Score;
|
||||||
@ -86,9 +84,9 @@ public class ScoreboardWrapper {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public BukkitTask updateTask = null;
|
public WrappedTask updateTask = null;
|
||||||
|
|
||||||
private class ScoreboardQuickUpdate extends CancellableRunnable {
|
private class ScoreboardQuickUpdate implements Runnable {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
updateSidebar();
|
updateSidebar();
|
||||||
@ -96,9 +94,9 @@ public class ScoreboardWrapper {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public BukkitTask revertTask = null;
|
public WrappedTask revertTask = null;
|
||||||
|
|
||||||
private class ScoreboardChangeTask extends CancellableRunnable {
|
private class ScoreboardChangeTask implements Runnable {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
tryRevertBoard();
|
tryRevertBoard();
|
||||||
@ -106,9 +104,9 @@ public class ScoreboardWrapper {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public BukkitTask cooldownTask = null;
|
public WrappedTask cooldownTask = null;
|
||||||
|
|
||||||
private class ScoreboardCooldownTask extends CancellableRunnable {
|
private class ScoreboardCooldownTask implements Runnable {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
// Stop updating if it's no longer something displaying cooldowns
|
// Stop updating if it's no longer something displaying cooldowns
|
||||||
@ -125,7 +123,7 @@ public class ScoreboardWrapper {
|
|||||||
public void doSidebarUpdateSoon() {
|
public void doSidebarUpdateSoon() {
|
||||||
if (updateTask == null) {
|
if (updateTask == null) {
|
||||||
// To avoid spamming the scheduler, store the instance and run 2 ticks later
|
// To avoid spamming the scheduler, store the instance and run 2 ticks later
|
||||||
updateTask = new ScoreboardQuickUpdate().runTaskLater(mcMMO.p, 2L);
|
updateTask = mcMMO.p.getFoliaLib().getImpl().runAtEntityLater(player, new ScoreboardQuickUpdate(), 2L);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -133,7 +131,7 @@ public class ScoreboardWrapper {
|
|||||||
if (cooldownTask == null) {
|
if (cooldownTask == null) {
|
||||||
// Repeat every 5 seconds.
|
// Repeat every 5 seconds.
|
||||||
// Cancels once all cooldowns are done, using stopCooldownUpdating().
|
// Cancels once all cooldowns are done, using stopCooldownUpdating().
|
||||||
cooldownTask = new ScoreboardCooldownTask().runTaskTimer(mcMMO.p, 5 * Misc.TICK_CONVERSION_FACTOR, 5 * Misc.TICK_CONVERSION_FACTOR);
|
cooldownTask = mcMMO.p.getFoliaLib().getImpl().runAtEntityTimer(player, new ScoreboardCooldownTask(), 5 * Misc.TICK_CONVERSION_FACTOR, 5 * Misc.TICK_CONVERSION_FACTOR);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -216,7 +214,7 @@ public class ScoreboardWrapper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
player.setScoreboard(scoreboard);
|
player.setScoreboard(scoreboard);
|
||||||
revertTask = new ScoreboardChangeTask().runTaskLater(mcMMO.p, ticks);
|
revertTask = mcMMO.p.getFoliaLib().getImpl().runAtEntityLater(player, new ScoreboardChangeTask(), ticks);
|
||||||
|
|
||||||
// TODO is there any way to do the time that looks acceptable?
|
// 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));
|
// player.sendMessage(LocaleLoader.getString("Commands.Scoreboard.Timer", StringUtils.capitalize(sidebarType.toString().toLowerCase(Locale.ENGLISH)), ticks / 20F));
|
||||||
@ -426,7 +424,7 @@ public class ScoreboardWrapper {
|
|||||||
NotificationManager.sendPlayerInformationChatOnlyPrefixed(player, "Scoreboard.Recovery");
|
NotificationManager.sendPlayerInformationChatOnlyPrefixed(player, "Scoreboard.Recovery");
|
||||||
|
|
||||||
initBoard(); //Start over
|
initBoard(); //Start over
|
||||||
Bukkit.getScheduler().runTaskLater(mcMMO.p, () -> ScoreboardManager.retryLastSkillBoard(player), 0);
|
mcMMO.p.getFoliaLib().getImpl().runAtEntity(player, t -> ScoreboardManager.retryLastSkillBoard(player));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -806,7 +806,7 @@ public final class CombatUtils {
|
|||||||
baseXP *= multiplier;
|
baseXP *= multiplier;
|
||||||
|
|
||||||
if (baseXP != 0) {
|
if (baseXP != 0) {
|
||||||
new AwardCombatXpTask(mcMMOPlayer, primarySkillType, baseXP, target, xpGainReason).runTaskLater(mcMMO.p, 0);
|
mcMMO.p.getFoliaLib().getImpl().runAtEntity(mcMMOPlayer.getPlayer(), new AwardCombatXpTask(mcMMOPlayer, primarySkillType, baseXP, target, xpGainReason));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -48,7 +48,7 @@ public class RankUtils {
|
|||||||
{
|
{
|
||||||
SkillUnlockNotificationTask skillUnlockNotificationTask = new SkillUnlockNotificationTask(mcMMOPlayer, subSkillType, newLevel);
|
SkillUnlockNotificationTask skillUnlockNotificationTask = new SkillUnlockNotificationTask(mcMMOPlayer, subSkillType, newLevel);
|
||||||
|
|
||||||
skillUnlockNotificationTask.runTaskLater(plugin, (count * 100L));
|
mcMMO.p.getFoliaLib().getImpl().runAtEntityLater(mcMMOPlayer.getPlayer(), skillUnlockNotificationTask, (count * 100L));
|
||||||
|
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user