mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2025-08-02 20:45:28 +02:00
mcMMO-Folia-PR (#4925)
Folia Support --------- Co-authored-by: Rockyers <ethan@yocom.org> Co-authored-by: TechnicallyCoded <technicallycoded@gmail.com> Co-authored-by: HSGamer <huynhqtienvtag@gmail.com>
This commit is contained in:
@@ -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;
|
||||
|
||||
|
@@ -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;
|
||||
|
||||
@@ -63,7 +63,7 @@ public class AbilityDisableTask extends BukkitRunnable {
|
||||
SkillUtils.sendSkillMessage(player, NotificationType.SUPER_ABILITY_ALERT_OTHERS, ability.getAbilityPlayerOff());
|
||||
}
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -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;
|
||||
|
@@ -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;
|
||||
|
||||
@@ -62,7 +62,7 @@ public class AlchemyBrewTask extends BukkitRunnable {
|
||||
fuel--;
|
||||
|
||||
Alchemy.brewingStandMap.put(location, this);
|
||||
this.runTaskTimer(mcMMO.p, 1, 1);
|
||||
mcMMO.p.getFoliaLib().getImpl().runAtLocationTimer(location, this, 1, 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@@ -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() {
|
||||
|
@@ -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;
|
||||
|
@@ -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<LivingEntity, BleedContainer> bleedList = new HashMap<>();
|
||||
// private static boolean isIterating = false;
|
||||
//
|
||||
|
@@ -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;
|
||||
@@ -54,7 +54,7 @@ public class DelayedCropReplant extends BukkitRunnable {
|
||||
PlantAnchorType plantAnchorType = PlantAnchorType.NORMAL;
|
||||
|
||||
//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()) {
|
||||
wasImmaturePlant = true;
|
||||
@@ -101,7 +101,7 @@ public class DelayedCropReplant extends BukkitRunnable {
|
||||
|
||||
//Play an effect
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
@@ -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<BlockSnapshot> chorusBlocks;
|
||||
|
@@ -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;
|
||||
|
@@ -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) {
|
||||
|
@@ -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;
|
||||
|
@@ -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;
|
||||
|
@@ -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;
|
||||
|
@@ -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;
|
||||
|
||||
|
Reference in New Issue
Block a user