Event for a Glass Bottle being filled

Discussion in 'Plugin Development' started by Tacodude, Aug 7, 2020.

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

    Tacodude

    I am having some troubles detecting glass bottles being filled. I first tried the PlayerInteractEvent but, when the player is right clicking in water, getClickedBlock() returns null or the block they are clicking through the water so there is no way to know if they are clicking on land (no effect) or clicking in water (the bottle is filled). I also tried PlayerBucketFillEvent but, as the class name suggests, that it only called when buckets are filled not water bottles.

    How do I detect water bottles being filled?
     
  2. Offline

    Tacodude

    Bump. I tried to count the amount of water bottles before and after clicking but sometimes the players inventory if full and the water bottle gets spit out onto the ground. Counting the empty bottles doesn't work because in creative mode, empty bottles are not consumed (Also note that these two methods also work for filling it up from a caldron). Creative mode detection is not necessary but it would be nice. If I went for the second method (assuming there is no event) how could I get the item stack in the case that the water bottle gets spit onto the ground.
     
Thread Status:
Not open for further replies.

Share This Page