[SOLVED]Glitch in my plugin wont allow buckets to work.

Discussion in 'Plugin Development' started by TopGear93, Dec 22, 2011.

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

    TopGear93

    ive ran into a bug that i cant seem to fix. When i try and scoop up water with this code, my bucket wont pickup the water but the water above the iron block disappears and comes back after a few seconds. What can be causing this water bug?

    FYI - yes i know this only effects the block place, but wouldnt this effect how the water can be picked up?


    Code:
        public void onBlockPlace(BlockPlaceEvent event){
            Block block = event.getBlock();
            Player player = event.getPlayer();
            if(block.getType() == Material.IRON_BLOCK){
                block.getRelative(BlockFace.UP).setType(Material.STATIONARY_WATER);
                block.isLiquid();
                player.sendMessage(ChatColor.DARK_PURPLE + "[TheWell]-" + ChatColor.GRAY + "Well Created");
            }
        }
    }
    any idea what might be cuasing the bucket not to pickup the water? i cant seem to solve this.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 22, 2016
  2. Offline

    Drakonix

    Code:JAVA
    1.  
    2. public void onBlockPlace (BlockPlaceEvent event){
    3. Block block = event.getBlock();
    4. Player player = event.getPlayer();
    5. if(block.getType().equals(Material.AIR) && player.getItemInHand().getType().equals(Material.BUCKET) && block.getRelative(BlockFace.DOWN).equals(Material.IRON_BLOCK)){
    6. ItemStack hand = new ItemStack(Material.WATER_BUCKET);
    7. player.setItemInHand(hand);
    8. block.setType(Material.WATER);
    9. player.sendMessage(ChatColor.DARK_PURPLE + "[TheWell]-" + ChatColor.GRAY + "Well Created");
    10. }
    11. }
    12.  
    13.  


    try this.
     
    TopGear93 likes this.
  3. Offline

    TopGear93

    thanks this fixed the issue. now i just need to figure out unlimited water :D

    nvm this wont allow water to spawn when iron block is placed

    Fixed. this works fine now.


    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 22, 2016
Thread Status:
Not open for further replies.

Share This Page