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 ItemDropPermission(),
new FishingPermission(plugin),
new CauldronPermission(plugin),
// Basic
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'
Noteblock:
Displayname: '&aNoteblock use'
Cauldron:
Displayname: '&aCauldron use'
Minecart:
Displayname: '&aMinecart'
Damage:

View File

@ -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