diff --git a/src/main/java/com/songoda/skyblock/permission/PermissionManager.java b/src/main/java/com/songoda/skyblock/permission/PermissionManager.java index 9bb7d17d..6d08121c 100644 --- a/src/main/java/com/songoda/skyblock/permission/PermissionManager.java +++ b/src/main/java/com/songoda/skyblock/permission/PermissionManager.java @@ -86,6 +86,7 @@ public class PermissionManager { new ItemPickupPermission(), new ItemDropPermission(), new FishingPermission(plugin), + new CauldronPermission(plugin), // Basic new MemberPermission(), diff --git a/src/main/java/com/songoda/skyblock/permission/permissions/listening/CauldronPermission.java b/src/main/java/com/songoda/skyblock/permission/permissions/listening/CauldronPermission.java new file mode 100644 index 00000000..b788ecb9 --- /dev/null +++ b/src/main/java/com/songoda/skyblock/permission/permissions/listening/CauldronPermission.java @@ -0,0 +1,39 @@ +package com.songoda.skyblock.permission.permissions.listening; + +import com.songoda.core.compatibility.CompatibleMaterial; +import com.songoda.skyblock.SkyBlock; +import com.songoda.skyblock.message.MessageManager; +import com.songoda.skyblock.permission.ListeningPermission; +import com.songoda.skyblock.permission.PermissionHandler; +import com.songoda.skyblock.permission.PermissionType; +import org.bukkit.block.Block; +import org.bukkit.entity.Player; +import org.bukkit.event.block.Action; +import org.bukkit.event.player.PlayerInteractEvent; + +public class CauldronPermission extends ListeningPermission { + + private final SkyBlock plugin; + private final MessageManager messageManager; + + public CauldronPermission(SkyBlock plugin) { + super("Cauldron", CompatibleMaterial.CAULDRON, PermissionType.GENERIC); + this.plugin = plugin; + this.messageManager = plugin.getMessageManager(); + } + + @PermissionHandler + public void onInteract(PlayerInteractEvent event) { + if (event.getAction() == Action.RIGHT_CLICK_BLOCK || event.getAction() == Action.LEFT_CLICK_BLOCK) { + if(event.getItem() != null && !event.getItem().getType().isBlock()){ + Player player = event.getPlayer(); + Block block = event.getClickedBlock(); + + + if (CompatibleMaterial.getMaterial(block) == CompatibleMaterial.CAULDRON) + cancelAndMessage(event, player, plugin, messageManager); + } + } + + } +} diff --git a/src/main/resources/language.yml b/src/main/resources/language.yml index fee7823e..098e950e 100644 --- a/src/main/resources/language.yml +++ b/src/main/resources/language.yml @@ -1168,6 +1168,8 @@ Menu: Displayname: '&aPvP' Noteblock: Displayname: '&aNoteblock use' + Cauldron: + Displayname: '&aCauldron use' Minecart: Displayname: '&aMinecart' Damage: diff --git a/src/main/resources/settings.yml b/src/main/resources/settings.yml index cbaed5f7..562bbb25 100644 --- a/src/main/resources/settings.yml +++ b/src/main/resources/settings.yml @@ -28,6 +28,7 @@ Settings: LeverButton: false Milking: false Jukebox: false + Cauldron: false PressurePlate: false Redstone: false Shearing: false @@ -59,6 +60,7 @@ Settings: AnimalBreeding: true Brewing: true Bucket: true + Cauldron: true WaterCollection: true Storage: true Workbench: true @@ -130,6 +132,7 @@ Settings: Crop: true Door: true Gate: true + Cauldron: true Projectile: true Enchant: true Fire: true