diff --git a/src/main/java/com/songoda/epicanchors/listeners/InteractListeners.java b/src/main/java/com/songoda/epicanchors/listeners/InteractListeners.java index 93dffa3..97037e4 100644 --- a/src/main/java/com/songoda/epicanchors/listeners/InteractListeners.java +++ b/src/main/java/com/songoda/epicanchors/listeners/InteractListeners.java @@ -1,18 +1,13 @@ package com.songoda.epicanchors.listeners; -import com.songoda.core.compatibility.CompatibleSound; import com.songoda.core.compatibility.CompatibleMaterial; import com.songoda.core.compatibility.CompatibleParticleHandler; -import com.songoda.core.compatibility.ServerVersion; +import com.songoda.core.compatibility.CompatibleSound; import com.songoda.core.utils.ItemUtils; import com.songoda.epicanchors.EpicAnchors; import com.songoda.epicanchors.anchor.Anchor; import com.songoda.epicanchors.gui.GUIOverview; -import com.songoda.epicanchors.utils.Methods; import org.bukkit.GameMode; -import org.bukkit.Material; -import org.bukkit.Particle; -import org.bukkit.Sound; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; @@ -35,9 +30,9 @@ public class InteractListeners implements Listener { Anchor anchor = instance.getAnchorManager().getAnchor(event.getClickedBlock().getLocation()); if (anchor == null) return; + event.setCancelled(true); if (event.getAction() != Action.RIGHT_CLICK_BLOCK) { - event.setCancelled(true); anchor.bust(); return; } @@ -45,8 +40,7 @@ public class InteractListeners implements Listener { Player player = event.getPlayer(); ItemStack item = player.getItemInHand(); - if (instance.getConfig().getMaterial("Main.Anchor Block Material").matches(item)) { - event.setCancelled(true); + if (instance.getConfig().getMaterial("Main.Anchor Block Material", CompatibleMaterial.AIR).matches(item)) { if (instance.getTicksFromItem(item) == 0) return; anchor.setTicksLeft(anchor.getTicksLeft() + instance.getTicksFromItem(item)); @@ -58,11 +52,9 @@ public class InteractListeners implements Listener { CompatibleParticleHandler.spawnParticles(CompatibleParticleHandler.ParticleType.SPELL_WITCH, anchor.getLocation().add(.5, .5, .5), 100, .5, .5, .5); - return; + } else { + instance.getGuiManager().showGUI(player, new GUIOverview(EpicAnchors.getInstance(), anchor, player)); } - - instance.getGuiManager().showGUI(player, new GUIOverview(EpicAnchors.getInstance(), anchor, player)); - } }