mirror of
https://github.com/Auxilor/EcoEnchants.git
synced 2024-12-26 20:27:38 +01:00
Fixed players in spectator mode being able to use spells
This commit is contained in:
parent
0dfb795240
commit
d54c499cf5
@ -11,6 +11,7 @@ import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
|
||||
import com.willfp.ecoenchants.enchantments.util.EnchantChecks;
|
||||
import com.willfp.ecoenchants.enchantments.util.SpellActivateEvent;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.SoundCategory;
|
||||
@ -147,6 +148,10 @@ public abstract class Spell extends EcoEnchant {
|
||||
preventDuplicateList.add(player.getUniqueId());
|
||||
this.getPlugin().getScheduler().runLater(() -> preventDuplicateList.remove(player.getUniqueId()), 5);
|
||||
|
||||
if (player.getGameMode() == GameMode.SPECTATOR) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (LEFT_CLICK_ITEMS.contains(player.getInventory().getItemInMainHand().getType())) {
|
||||
if (!(event.getAction().equals(Action.LEFT_CLICK_AIR) || event.getAction().equals(Action.LEFT_CLICK_BLOCK))) {
|
||||
return;
|
||||
|
Loading…
Reference in New Issue
Block a user