how would i change a dispensed block?

Discussion in 'Plugin Development' started by tommycake50, Sep 21, 2012.

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

    tommycake50

    well the code for my listener so far is below
    as far as i see should work but when someone dispenses lava it does nothing.
    can anyone tell me what i am doing wrong?
    Code:JAVA
    1.  
    2. @EventHandler(priority = EventPriority.NORMAL)
    3. public void onBlockDispenseEvent(BlockDispenseEvent e){
    4. int block = e.getBlock().getTypeId();
    5. if(block == 10 || block == 11){
    6. Location loc = e.getBlock().getLocation();
    7. loc.getBlock().setType(Material.COBBLESTONE);
    8. }
     
  2. Offline

    Assult

    Try loc.setType instead of loc.getBlock().setType
     
  3. mayby because the actual lava block and the bukkit are 2 diferend kind of things?
     
  4. Offline

    tommycake50

    so i check if it dispenses the bukkit?
     
Thread Status:
Not open for further replies.

Share This Page