help with world guard plugin

Discussion in 'Plugin Development' started by nanerz_123, Jun 18, 2014.

Thread Status:
Not open for further replies.
  1. Offline

    nanerz_123

    Is this possible or how do I ban certain items in a region? Say that I wanted to ban dirt (3) at spawn. So if someone were to go to spawn, with dirt, the dirt will disappear, but when they leave spawn, it comes back. Is this possible? How do I do it? Thanks in advance :)
     
  2. WorldGuard has a pretty useful feature. Item blacklist. I'm not sure about the details, but I'm 99% sure it covers breaking, placing, using, interacting, aquiring (this means picking it up or whatever), dropping

    But not what you want. Making it disappear when you enter a region.

    There is good news. Somebody was nice enough to provide some useful events.
    With examples and everything.
    http://dev.bukkit.org/bukkit-plugins/worldguard-region-events/
    (not sure if this still works)

    So you can execute code "when a player enters a region".
    All that is left to do, is to remove certain items from all players' inventories.

    Code:
    private Material[] materials = new Material[] {
        Material.DIRT,
        Material.STONE
    }
    @EventHandler
    public void onRegionEnter(RegionEnterEvent e)
    {
        e.getPlayer().sendMessage("You just entered "+e.getRegion().getId() + ". Removing illegal items.");
        for (Material mat : materials) {
            e.getPlayer().getInventory().remove(mat);
        }
    }
    
     
Thread Status:
Not open for further replies.

Share This Page