mirror of
https://github.com/PEXPlugins/Modifyworld.git
synced 2024-12-22 16:18:24 +01:00
Added monster egg permissions (modifyworld.spawn.<entity>, example: modifyworld.spawn.villager)
This commit is contained in:
parent
081dc8786f
commit
eb36ff3422
@ -159,6 +159,8 @@ public abstract class ModifyworldListener implements Listener {
|
||||
protected String getObjectPermission(Object obj) {
|
||||
if (obj instanceof Entity) {
|
||||
return (getEntityName((Entity) obj));
|
||||
} else if (obj instanceof EntityType) {
|
||||
return formatEnumString(((EntityType)obj).name());
|
||||
} else if (obj instanceof BlockState) {
|
||||
return (getBlockPermission(((BlockState)obj).getBlock()));
|
||||
} else if (obj instanceof ItemStack) {
|
||||
|
@ -37,6 +37,7 @@ import org.bukkit.inventory.Inventory;
|
||||
import org.bukkit.inventory.InventoryHolder;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.PlayerInventory;
|
||||
import org.bukkit.material.SpawnEgg;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
import org.bukkit.util.Vector;
|
||||
import ru.tehkode.modifyworld.ModifyworldListener;
|
||||
@ -265,9 +266,13 @@ public class PlayerListener extends ModifyworldListener {
|
||||
event.getPlayer().updateInventory();
|
||||
}
|
||||
}
|
||||
if (action == Action.RIGHT_CLICK_AIR) {
|
||||
return;
|
||||
return; // no need to check further
|
||||
case MONSTER_EGG:
|
||||
case MONSTER_EGGS:
|
||||
if (permissionDenied(player, "modifyworld.spawn", ((SpawnEgg)player.getItemInHand().getData()).getSpawnedType())) {
|
||||
event.setUseItemInHand(Result.DENY);
|
||||
}
|
||||
return; // no need to check further
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user