Fix for furnaces not covering all furnaces types

This commit is contained in:
Fabrizio La Rosa 2020-07-28 23:26:00 +02:00
parent c6791b104e
commit 8786cdd710

View File

@ -7,6 +7,7 @@ import com.songoda.skyblock.permission.ListeningPermission;
import com.songoda.skyblock.permission.PermissionHandler; import com.songoda.skyblock.permission.PermissionHandler;
import com.songoda.skyblock.permission.PermissionType; import com.songoda.skyblock.permission.PermissionType;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import org.bukkit.block.Furnace;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.block.Action; import org.bukkit.event.block.Action;
import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.event.player.PlayerInteractEvent;
@ -24,15 +25,13 @@ public class FurnacePermission extends ListeningPermission {
@PermissionHandler @PermissionHandler
public void onInteract(PlayerInteractEvent event) { public void onInteract(PlayerInteractEvent event) {
if (event.getAction() != Action.RIGHT_CLICK_BLOCK && event.getAction() != Action.LEFT_CLICK_BLOCK) if (event.getAction() != Action.RIGHT_CLICK_BLOCK && event.getAction() != Action.LEFT_CLICK_BLOCK)
return; return;
Player player = event.getPlayer(); Player player = event.getPlayer();
Block block = event.getClickedBlock(); Block block = event.getClickedBlock();
if (CompatibleMaterial.getMaterial(block) == CompatibleMaterial.FURNACE) if (block != null && block.getState() instanceof Furnace)
cancelAndMessage(event, player, plugin, messageManager); cancelAndMessage(event, player, plugin, messageManager);
} }
} }