Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.wd.stp;
- import java.util.Collection;
- import java.util.List;
- import org.bukkit.Server;
- import org.bukkit.World;
- import org.bukkit.block.Block;
- import org.bukkit.entity.Player;
- import org.bukkit.event.EventHandler;
- import org.bukkit.event.EventPriority;
- import org.bukkit.event.Listener;
- import org.bukkit.event.block.Action;
- import org.bukkit.event.player.PlayerInteractEvent;
- import org.bukkit.inventory.ItemStack;
- import org.bukkit.inventory.PlayerInventory;
- import org.bukkit.plugin.PluginManager;
- import org.bukkit.plugin.java.JavaPlugin;
- public class Main extends JavaPlugin implements Listener {
- public void onEnable() {
- getServer().getPluginManager().registerEvents(this, this);
- }
- @EventHandler(priority = EventPriority.HIGHEST)
- public void onInteract(PlayerInteractEvent e) {
- // Right click
- if (e.getAction() != Action.RIGHT_CLICK_BLOCK)
- return;
- // Spawn egg
- if (e.getItem().getType().getId() != 383)
- return;
- // Is spawner
- if (e.getClickedBlock().getType().getId() != 52)
- return;
- // Cancel it if they're missing the permission
- if (!e.getPlayer().hasPermission("spawnegg.allowspawner")) {
- e.setCancelled(true);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement