Solved Lava Right Click interaction

Discussion in 'Spigot Plugin Development' started by ArKeid0s, Feb 24, 2020.

  1. How can I fill my glass_bottle with lava ?
    PlayerInteractEvent
    Code (Java):
            /// - LAVA POTION
            if(player.getInventory().getItemInMainHand().getType().equals(Material.GLASS_BOTTLE)) {
                if(e.getAction().equals(Action.RIGHT_CLICK_BLOCK)) {
                    if(e.getClickedBlock().getType().equals(Material.LAVA) ) {
                        player.getInventory().getItemInMainHand().setAmount(0);
                        player.getInventory().addItem(main.iM.getLavaPotionItemStack(Color.ORANGE, main.iM.itLavaPotion, main.iM.itLavaPotionLore));
                    }
                }
            }
     
    • Like Like x 1
  2. By using @EventHandler, using == instead of equals for Material and also providing us what isn't working in that code. What is main.iM.getLavaPotionItemStack? What does this code do? Any error in the console?
     
  3. Double equals will work for enums, since enum values are essentially singletons
     
    • Like Like x 2
  4. I'll try that @Warren1001
    @Maxx_Qc imo the code is pretty simple to understand, if i had errors i would have obviously provided them and my function getLavaPotionItemStack is pretty explanatory i think :unsure:
    @DotRar +1
     
  5. Perfect it is working thx
    Code (Java):
    if(e.getPlayer().getTargetBlock(null, 4).getType() == Material.LAVA) {
     
  6. Many people do no provide any information, just like you did :) if there is no error, just mention it in your main post. We cannot guess or assume that you are getting no error. This is a public forum.