Being retarded at plugin developing, I have a simple question...

Discussion in 'Plugin Development' started by nichiatu, Sep 17, 2011.

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

    nichiatu

    I'm trying to get and cancel a block. Block 51, to be specific. This is my listener:
    Code:
    package me.*.*;
    
    import org.bukkit.event.block.BlockPlaceEvent;
    import org.bukkit.event.player.PlayerListener;
    
    public class *PlayerListener extends PlayerListener{
        public static * plugin; public *PluginListener(* instance){
            plugin = instance;
        }
        public void onBlockPlace(BlockPlaceEvent event){
    
        }
    }
    
    The * was by purpose, btw. Don't worry.

    Well, my question: HOOOOOOOOOOOOOOOOOOOOOOOOOOW
     
  2. Offline

    TehRandomGuy

    @nichiatu
    Haha, thats simple. Just put this in:
    Code:
    public void onBlockPlace(BlockPlaceEvent event){
            if(event.getBlockPlaced().getType().equals(Material.FIRE)){
                event.setCancelled(true);
            }
        }
    
    What it will do is get the block that was placed and check if it equals FIRE, if it does then cancel the event, if not do nothing. Thats it.

    But I beg you, do not release it. There is too many fire, lava, water, bedrock, TNT blocking plugins out there. Just use it as a learning experience.
     
  3. Offline

    emericask8ur

    And please don't make a Plugin thts been made a billion times.....
     
    TehRandomGuy and Adamki11s like this.
  4. Offline

    TehRandomGuy

    A billion times doesn't cut it. I see soo many plugin requests that say "I want to block TNT!" when there is thousands of plugins that do just that.
     
  5. Offline

    Marcos Cosmos

    And yet, few plugins that do that as part of a real feature, (applies for a lot of things xD)
     
    TehRandomGuy likes this.
  6. Offline

    nichiatu

    I was coding this for my own server, don't worry :)
     
    emericask8ur likes this.
  7. Offline

    TehRandomGuy

    Haha thats good :p
     
Thread Status:
Not open for further replies.

Share This Page