PlayerBucketFillEvent

Discussion in 'Plugin Development' started by JustClown, May 1, 2021 at 4:49 PM.

  1. Offline

    JustClown

    Im using the PlayerBucketFill event and for whatever reason, nothing happens when a player picks up water with the bucket. Nothing, no error message no teleport or anything. There aren't any errors in the code,
    Any help is appreciated :)

    package me.justclown.firstplugin.events;import org.bukkit.Bukkit;import org.bukkit.ChatColor;import org.bukkit.Location;import org.bukkit.Material;import org.bukkit.entity.Player;import org.bukkit.event.EventHandler;import org.bukkit.event.Listener;import org.bukkit.event.player.PlayerBucketFillEvent;import org.bukkit.inventory.ItemStack;public class onPlayerBucketFill implements Listener {


    ItemStack water = new ItemStack(Material.WATER_BUCKET);@EventHandlerpublic void onPlayerBucketFill(PlayerBucketFillEvent e) {
    Player player = e.getPlayer();player.sendMessage(ChatColor.GREEN + "Teleporting...");Location mlg2 = new Location(Bukkit.getWorld("world"), 79, 60, -9.1);player.teleport(mlg2);}


    }
     
  2. Offline

    pixelrider2000

    Could you please post your code via pastebin or something in that ball park. That way it's much easier for everyone to read your code!
     
  3. Offline

    xpaintall

    Did you register your class in your main? And also, the
    Code:
    ItemStack water = new ItemStack(Material.WATER_BUCKET);
    doesn't do anything.
     
  4. Offline

    JustClown

    hey sorry for the messy code, here's the pastebin link!
    https://pastebin.com/v2WyHhDZ

    my bad actually! i forgot to register it in my main :/
    im pretty new to plugin construction so thank u!!

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 2, 2021 at 9:51 AM

Share This Page