mirror of
https://github.com/RonanPlugins/BetterRTP.git
synced 2026-02-16 02:21:06 +00:00
potion effect Async fix
This commit is contained in:
@@ -73,7 +73,8 @@ public class RTPTeleport {
|
|||||||
|
|
||||||
//Effects
|
//Effects
|
||||||
|
|
||||||
public void afterTeleport(Player p, Location loc, WorldPlayer wPlayer, int attempts, Location oldLoc, RTP_TYPE type) { //Only a successful rtp should run this OR '/rtp test'
|
public void afterTeleport(Player p, Location loc, WorldPlayer wPlayer, int attempts, Location oldLoc, RTP_TYPE type) {
|
||||||
|
//Only a successful rtp should run this OR '/rtp test'
|
||||||
effects.getSounds().playTeleport(p);
|
effects.getSounds().playTeleport(p);
|
||||||
effects.getParticles().display(p);
|
effects.getParticles().display(p);
|
||||||
effects.getPotions().giveEffects(p);
|
effects.getPotions().giveEffects(p);
|
||||||
|
|||||||
@@ -2,6 +2,8 @@ package me.SuperRonanCraft.BetterRTP.player.rtp.effects;
|
|||||||
|
|
||||||
import me.SuperRonanCraft.BetterRTP.BetterRTP;
|
import me.SuperRonanCraft.BetterRTP.BetterRTP;
|
||||||
import me.SuperRonanCraft.BetterRTP.references.file.FileOther;
|
import me.SuperRonanCraft.BetterRTP.references.file.FileOther;
|
||||||
|
import me.SuperRonanCraft.BetterRTP.versions.AsyncHandler;
|
||||||
|
import me.SuperRonanCraft.BetterRTP.versions.FoliaHandler;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.potion.PotionEffect;
|
import org.bukkit.potion.PotionEffect;
|
||||||
import org.bukkit.potion.PotionEffectType;
|
import org.bukkit.potion.PotionEffectType;
|
||||||
@@ -49,6 +51,7 @@ public class RTPEffect_Potions { //Potions AND Invincibility
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void giveEffects(Player p) {
|
public void giveEffects(Player p) {
|
||||||
|
AsyncHandler.sync(() -> {
|
||||||
if (invincibleEnabled)
|
if (invincibleEnabled)
|
||||||
p.setNoDamageTicks(invincibleTime * 20);
|
p.setNoDamageTicks(invincibleTime * 20);
|
||||||
if (potionEnabled) {
|
if (potionEnabled) {
|
||||||
@@ -61,6 +64,7 @@ public class RTPEffect_Potions { //Potions AND Invincibility
|
|||||||
}
|
}
|
||||||
p.addPotionEffects(effects);
|
p.addPotionEffects(effects);
|
||||||
}
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user