TekkitSense Posted November 21, 2013 Posted November 21, 2013 my code so far my PlayerInteractEvent is not getting called and i got banned on bukkit forums for posting this same question package me.marshall; import org.bukkit.Material; import org.bukkit.command.Command; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; import org.bukkit.event.Listener; import org.bukkit.event.block.Action; import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.plugin.PluginManager; import org.bukkit.plugin.java.JavaPlugin; public class Main extends JavaPlugin implements Listener{ @Override public void onEnable(){ PluginManager pm = this.getServer().getPluginManager(); pm.registerEvents(PlayerInteractEvent, this); getLogger().info("SenseRestrict has been Enabled."); } @Override public void onDisable(){ getLogger().info("SenseRestrict has been Disabled."); } public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args){ Player user = (Player) sender; if(cmd.getName().equalsIgnoreCase("restricted")){ user.sendMessage("§a§m---------------------------------------------"); user.sendMessage("§2->§4 Banned-Items:"); user.sendMessage("§2->§4 add some items here"); user.sendMessage("§a§m---------------------------------------------"); return true; } return false; } @EventHandler(priority=EventPriority.HIGH) public void onPlayerClickItem(PlayerInteractEvent e) { Player user = e.getPlayer(); if(user.getItemInHand().equals(Material.DIRT) && e.getAction().equals(Action.LEFT_CLICK_AIR) || e.getAction().equals(Action.LEFT_CLICK_BLOCK) || e.getAction().equals(Action.RIGHT_CLICK_AIR)|| e.getAction().equals(Action.RIGHT_CLICK_BLOCK)){ user.sendMessage("§a§m---------------------------------------------"); user.sendMessage("§2->§4 That item can only be used in crafting."); user.sendMessage("§a§m---------------------------------------------"); } } }
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now