Heres my code: public void onPlayerInteract(PlayerInteractEvent evt) { if (evt.getPlayer().getItemInHand().getTypeId() != 289) { return; } And the getTypeId has something like this in eclipse: @Deprecated Note: This element neither has attached source nor attached Javadoc and hence no Javadoc could be found. So how would i fix this? Heres more information about the code i'm trying to use, anything to do with typeId messes up... package com.division.freeforall.listeners; import static com.division.freeforall.divisionutils.LocationTools.toVector; import com.division.freeforall.core.FreeForAll; import com.division.freeforall.events.*; import com.division.freeforall.events.PlayerDeathInArenaEvent.DeathCause; import com.division.freeforall.regions.Region; import com.division.freeforall.regions.Selection; import org.bukkit.ChatColor; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.World; import org.bukkit.block.Block; 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.block.BlockBreakEvent; import org.bukkit.event.entity.EntityDamageByEntityEvent; import org.bukkit.event.entity.EntityDamageEvent; import org.bukkit.event.entity.PlayerDeathEvent; import org.bukkit.event.player.*; import org.bukkit.inventory.ItemStack; import org.bukkit.util.Vector; public class FFAPlayerListener implements Listener { FreeForAll FFA; public FFAPlayerListener(FreeForAll instance) { this.FFA = instance; FFA.getServer().getPluginManager().registerEvents(this, FFA); } @SuppressWarnings("deprecation") @EventHandler(priority = EventPriority.HIGH) public void onPlayerInteract(PlayerInteractEvent evt) { if (evt.getPlayer().getItemInHand().getTypeId() != 289) { return; } if (evt.getPlayer().hasPermission("ffa.define")) { if (evt.hasBlock()) { Block evtBlock = evt.getClickedBlock(); ItemStack iih = evt.getItem(); final int mat = Material.SULPHUR.getId(); if (iih != null) { if (iih.getTypeId() == mat) { if (evt.getAction() == Action.LEFT_CLICK_BLOCK) { Selection.setP2(toVector(evtBlock)); evt.getPlayer().sendMessage(ChatColor.LIGHT_PURPLE + "Set Point 1: " + toVector(evtBlock)); evt.setCancelled(true); } if (evt.getAction() == Action.RIGHT_CLICK_BLOCK) { Selection.setP1(toVector(evtBlock)); evt.getPlayer().sendMessage(ChatColor.LIGHT_PURPLE + "Set Point 2: " + toVector(evtBlock)); evt.setCancelled(true); } } } } } } EDIT by Moderator: merged posts, please use the edit button instead of double posting.
Try this: If(evt.getPlayer().getItemInHand() !== Material.GUNPOWDER)){ return false; } What we just did was that if the item in the players hand is not equal to a Gunpowder (289), the plugin will return nothing. And the @Deprecated is doing no harm to your plugin's preformane!
pcgamers123 That won't work. Material correlates with ItemStack#getType(); Also, when using the primitive equal operand (==), you negate it with !=, not !==. If must also be lowercase otherwise it is not a Java keyword. There is no point making your post quickly if it is riddled with errors. That's why try avoiding free handing it where possible and use code tags. FreeForAll Please use the code tags by pressing the button with a {}#, or consider using pastebin.com so we can read your code.
pcgamers123 Yeah, I understand the difficulty. For me I never write code on my phone. Otherwise you might give someone misinformation completely on accident