change lapis block

Discussion in 'Plugin Development' started by nongman1, Dec 29, 2014.

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

    nongman1

    @EventHandler
    public void onInteract(PlayerInteractEvent e)
    {
    Action a = e.getAction();
    if((a.equals(Action.RIGHT_CLICK_BLOCK) ||
    a.equals(Action.RIGHT_CLICK_AIR)) && e.getPlayer().getInventory().getItemInHand().getType() == Material.COAL)
    {
    ItemStack item = new ItemStack(Material.AIR);
    item.setTypeId(36);
    Player player= e.getPlayer();
    e.getPlayer().getLocation().getBlock().setType(Material.LAPIS_BLOCK);
    Block block = e.getPlayer().getLocation().getBlock();
    if(e.getPlayer().getLocation().getBlock().getType()== Material.LAPIS_BLOCK){
    this.getServer().getScheduler().scheduleAsyncRepeatingTask(this, new Runnable(){
    public void run(){
    if(num !=-1){
    if(num !=0){

    }
    else{
    player.sendMessage("ok");
    e.getPlayer().getLocation().getBlock().setType(Material.WATER);
    e.getPlayer().getLocation().add(1,0,0).getBlock().setType(Material.WATER);
    e.getPlayer().getLocation().add(-1,0,0).getBlock().setType(Material.WATER);
    e.getPlayer().getLocation().add(0,0,1).getBlock().setType(Material.WATER);
    e.getPlayer().getLocation().add(0,0,-1).getBlock().setType(Material.WATER);
    e.getPlayer().getLocation().add(2,0,0).getBlock().setType(item.getType());
    e.getPlayer().getLocation().add(-2,0,0).getBlock().setType(item.getType());
    e.getPlayer().getLocation().add(0,0,2).getBlock().setType(item.getType());
    e.getPlayer().getLocation().add(0,0,2).getBlock().setType(item.getType());
    e.getPlayer().getLocation().add(1,0,1).getBlock().setType(item.getType());
    e.getPlayer().getLocation().add(-1,0,1).getBlock().setType(item.getType());
    e.getPlayer().getLocation().add(-1,0,-1).getBlock().setType(item.getType());
    e.getPlayer().getLocation().add(1,0,-1).getBlock().setType(item.getType());

    }

    }
    }
    }, 0L, 20L);}
    }



    how can i change lapis block to water after 3second??
     
  2. Offline

    WarmakerT

  3. Offline

    nongman1

    thank you to say that
    i made a hash map like this
    public HashMap<Location, Block> hash = new HashMap<Location, Block>();
    and
    Block block = e.getPlayer().getLocation().getBlock();
    hash.put(e.getPlayer().getLocation(), block );
    but i donot know how can i use it ?
     
Thread Status:
Not open for further replies.

Share This Page