Hi sorry for posting the code here but I was wondering if anyone could help me with this code it is set to when you left click on a player head it will say their head to you. I dont know if im missing anything , as far as the plugin no errors in console and loads perfectly could be something with the listener idk. Thanks in advance guys! package com.lol.lmao; import org.bukkit.Bukkit; import org.bukkit.Material; import org.bukkit.SkullType; import org.bukkit.block.Skull; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; import org.bukkit.event.block.Action; import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.plugin.java.JavaPlugin; public class Plugin extends JavaPlugin implements Listener { public void onEnable() { Bukkit.getServer().getLogger().info("PlayerInteractPlugin Enabled!"); } public void onDisable() { Bukkit.getServer().getLogger().info("PlayerInteractPlugin Enabled!"); } @EventHandler public void onPlayerInteract(PlayerInteractEvent e) { //check if the player clicked a block, either left or right click if(e.getAction() != Action.LEFT_CLICK_BLOCK && e.getAction() != Action.RIGHT_CLICK_BLOCK) { return; } //check if player clicked a skull if(e.getClickedBlock().getType() == Material.SKULL) { Skull sk = (Skull) e.getClickedBlock().getState(); if(sk.getSkullType() == SkullType.PLAYER) { e.getPlayer().sendMessage("Head Of "); } } }}
You package name might be used if you get an error- It might be a common name - for example for my plugins I use me.ScenicJaguar101.pluginname
you need to register you listener class with this code in you onEnable() method: Code (Text): this.getServer().getPluginManager().registerListener(this, this);
Code (Text): public void onEnable() { this.getServer().getPluginManager().registerListener(this, this);