Cauldron permission

This commit is contained in:
Fabrizio La Rosa 2020-06-22 17:02:40 +02:00
parent 47ef00bb6f
commit cd15898858
4 changed files with 45 additions and 0 deletions

View File

@ -86,6 +86,7 @@ public class PermissionManager {
new ItemPickupPermission(), new ItemPickupPermission(),
new ItemDropPermission(), new ItemDropPermission(),
new FishingPermission(plugin), new FishingPermission(plugin),
new CauldronPermission(plugin),
// Basic // Basic
new MemberPermission(), new MemberPermission(),

View File

@ -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);
}
}
}
}

View File

@ -1168,6 +1168,8 @@ Menu:
Displayname: '&aPvP' Displayname: '&aPvP'
Noteblock: Noteblock:
Displayname: '&aNoteblock use' Displayname: '&aNoteblock use'
Cauldron:
Displayname: '&aCauldron use'
Minecart: Minecart:
Displayname: '&aMinecart' Displayname: '&aMinecart'
Damage: Damage:

View File

@ -28,6 +28,7 @@ Settings:
LeverButton: false LeverButton: false
Milking: false Milking: false
Jukebox: false Jukebox: false
Cauldron: false
PressurePlate: false PressurePlate: false
Redstone: false Redstone: false
Shearing: false Shearing: false
@ -59,6 +60,7 @@ Settings:
AnimalBreeding: true AnimalBreeding: true
Brewing: true Brewing: true
Bucket: true Bucket: true
Cauldron: true
WaterCollection: true WaterCollection: true
Storage: true Storage: true
Workbench: true Workbench: true
@ -130,6 +132,7 @@ Settings:
Crop: true Crop: true
Door: true Door: true
Gate: true Gate: true
Cauldron: true
Projectile: true Projectile: true
Enchant: true Enchant: true
Fire: true Fire: true