1
votes

Main.java

package me.gideon.chatbot;

import org.bukkit.plugin.java.JavaPlugin;

public final class ChatBot extends JavaPlugin {

    @Override
    public void onEnable() {
        System.out.println("Help me please!!!");
        getServer().getPluginManager().registerEvent(new BreakBlock(), this);
    }
    @Override
    public void onDisable() {
        // Plugin shutdown logic
    }
}

and BreakBlock.java

package me.gideon.chatbot;

import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.block.BlockBreakEvent;
import org.bukkit.inventory.ItemStack;

public class BreakBlock implements Listener {
    @EventHandler
    public void onPlayerBreakBlock(BlockBreakEvent event)
    {
        Block blockBroken = event.getBlock();
        if(blockBroken.getType() == Material.DIAMOND_ORE)
        {
            event.setCancelled(true);
            blockBroken.setType(Material.DIRT);
            ItemStack diamonds = new ItemStack(Material.DIAMOND, 2);
            blockBroken.getWorld().dropItemNaturally(blockBroken.getLocation(), diamonds);
        }
    }
}

It's erroring here: java getServer().getPluginManager().registerEvent(new BreakBlock(), this);

here is the console: no suitable method found for registerEvent(me.gideon.chatbot.BreakBlock,me.gideon.chatbot.ChatBot)

I haven't tried anything really, I'm super new... here is a link to the youtube video I'm following: https://www.youtube.com/watch?v=GK4aQzxQSoQ

As per the Bukkit API you need to use registerEvents not registerEvent note the extra s on the end. There is a method without the s on the end, but it requires different parameters as shown in the API registerEvent(Event, Listener, EventPriority, EventExecutor, Plugin)sorifiend
thank you so much!!!! I'm such a noob lolpredsfan2
could u post that as an answer?predsfan2
I have voted to close this question as a typo instead. Good luck with your pluginsorifiend