This might break everything so test this first on alpha or something
This should check if a player is in vanish
This commit is contained in:
@@ -6,6 +6,8 @@ import com.alttd.frameSpawners.FrameSpawnerLocation;
|
||||
import com.alttd.frameSpawners.FrameSpawnerPlayer;
|
||||
import com.alttd.storage.PlayerSettings;
|
||||
import com.alttd.util.Logger;
|
||||
import de.myzelyam.api.vanish.VanishAPI;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
@@ -34,15 +36,15 @@ public class ParticleSet {
|
||||
this.itemStack = itemStack;
|
||||
}
|
||||
|
||||
public void run(Location location, UUID uuid) {
|
||||
if (tooSoon(uuid))
|
||||
public void run(Location location, Player player) {
|
||||
if (tooSoon(player.getUniqueId()) || isVanished(player))
|
||||
return;
|
||||
FrameSpawnerLocation frameSpawnerLocation = new FrameSpawnerLocation(repeat, repeatDelay, frames, location);
|
||||
frameSpawnerLocation.runTaskTimerAsynchronously(AltitudeParticles.getInstance(), 0, frameDelay);
|
||||
}
|
||||
|
||||
public void run(Player player, PlayerSettings playerSettings, UUID uuid) {
|
||||
if (tooSoon(uuid) && !player.hasPermission("apart.bypass-cooldown"))
|
||||
public void run(Player player, PlayerSettings playerSettings) {
|
||||
if (tooSoon(player.getUniqueId()) && !player.hasPermission("apart.bypass-cooldown"))
|
||||
return;
|
||||
if (Config.DEBUG)
|
||||
Logger.info("Starting particle set % for %.", uniqueId, player.getName());
|
||||
@@ -50,6 +52,10 @@ public class ParticleSet {
|
||||
frameSpawnerPlayer.runTaskTimerAsynchronously(AltitudeParticles.getInstance(), 0, frameDelay);
|
||||
}
|
||||
|
||||
private boolean isVanished(Player player) {
|
||||
return VanishAPI.isInvisible(player) || player.getGameMode().equals(GameMode.SPECTATOR);
|
||||
}
|
||||
|
||||
private boolean tooSoon(UUID uuid) {
|
||||
PlayerSettings ps = PlayerSettings.getPlayer(uuid);
|
||||
if (ps.canRun(aPartType))
|
||||
|
||||
Reference in New Issue
Block a user