Adds a permission for reading lecterns
This commit is contained in:
@ -41,6 +41,7 @@ import org.bukkit.event.player.PlayerBucketFillEvent;
|
||||
import org.bukkit.event.player.PlayerInteractAtEntityEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEntityEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
import org.bukkit.event.player.PlayerTakeLecternBookEvent;
|
||||
import org.bukkit.projectiles.ProjectileSource;
|
||||
|
||||
import java.util.List;
|
||||
@ -151,6 +152,11 @@ public class EnginePermBuild extends Engine {
|
||||
// BUILD > BLOCK
|
||||
// -------------------------------------------- //
|
||||
|
||||
@EventHandler(priority = EventPriority.NORMAL)
|
||||
public void takeBook(PlayerTakeLecternBookEvent event) {
|
||||
protect(ProtectCase.TAKE_BOOK, true, event.getPlayer(), PS.valueOf(event.getLectern().getBlock()), Material.LECTERN, event);
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.NORMAL)
|
||||
public void build(BlockPlaceEvent event) {
|
||||
build(event.getPlayer(), event.getBlock(), event);
|
||||
|
@ -3,6 +3,7 @@ package com.massivecraft.factions.engine;
|
||||
import com.massivecraft.factions.entity.MPerm;
|
||||
import com.massivecraft.factions.util.EnumerationUtil;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Tag;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.EntityType;
|
||||
|
||||
@ -16,6 +17,8 @@ public enum ProtectCase {
|
||||
USE_ITEM,
|
||||
USE_ENTITY,
|
||||
|
||||
TAKE_BOOK,
|
||||
|
||||
// END OF LIST
|
||||
;
|
||||
|
||||
@ -26,6 +29,7 @@ public enum ProtectCase {
|
||||
public MPerm getPerm(Object object) {
|
||||
switch (this) {
|
||||
case BUILD:
|
||||
case TAKE_BOOK:
|
||||
return MPerm.getPermBuild();
|
||||
|
||||
case USE_ITEM:
|
||||
@ -55,6 +59,9 @@ public enum ProtectCase {
|
||||
return null;
|
||||
}
|
||||
Material material = (Material) object;
|
||||
if (material == Material.LECTERN) {
|
||||
return MPerm.getPermLectern();
|
||||
}
|
||||
if (EnumerationUtil.isMaterialEditOnInteract(material)) {
|
||||
return MPerm.getPermBuild();
|
||||
}
|
||||
@ -64,7 +71,7 @@ public enum ProtectCase {
|
||||
if (EnumerationUtil.isMaterialDoor(material)) {
|
||||
return MPerm.getPermDoor();
|
||||
}
|
||||
if (material == Material.STONE_BUTTON) {
|
||||
if (Tag.BUTTONS.isTagged(material)) {
|
||||
return MPerm.getPermButton();
|
||||
}
|
||||
if (material == Material.LEVER) {
|
||||
|
Reference in New Issue
Block a user