Finished replacing instances of the now deprecated "setItemInHand" and "getItemInHand" methods with "setItemInMainHand" and "getItemInMainHand"
This commit is contained in:
parent
a9e1065ebe
commit
b868836f7a
@ -242,8 +242,8 @@ public class EntityListener implements Listener {
|
||||
Arrow arrow = (Arrow)event.getEntity();
|
||||
if ((arrow.getShooter() instanceof Player)) {
|
||||
Player player = (Player)arrow.getShooter();
|
||||
if (player.getItemInHand() != null) {
|
||||
this.itemInHand = player.getItemInHand();
|
||||
if (player.getInventory().getItemInMainHand() != null) {
|
||||
this.itemInHand = player.getInventory().getItemInMainHand();
|
||||
if ((this.itemInHand.getType() != null) && (this.itemInHand.getType() == Material.BOW)) {
|
||||
this.getLore = ItemName.getLore(this.itemInHand);
|
||||
if ((this.getLore != null) && (this.getLore.containsAll(this.equalsLore)) && (Herobrine.getPluginCore().getConfigDB().UseArtifactBow)) {
|
||||
|
@ -50,10 +50,10 @@ public class PlayerListener implements Listener {
|
||||
@EventHandler
|
||||
public void onPlayerInteract(final PlayerInteractEvent event) {
|
||||
if (((event.getAction() == Action.LEFT_CLICK_BLOCK) || (event.getAction() == Action.RIGHT_CLICK_BLOCK)) &&
|
||||
(event.getClickedBlock() != null) && (event.getPlayer().getItemInHand() != null))
|
||||
(event.getClickedBlock() != null) && (event.getPlayer().getInventory().getItemInMainHand() != null))
|
||||
{
|
||||
ItemStack itemInHand = event.getPlayer().getItemInHand();
|
||||
if ((event.getPlayer().getItemInHand().getType() != null) &&
|
||||
ItemStack itemInHand = event.getPlayer().getInventory().getItemInMainHand();
|
||||
if ((event.getPlayer().getInventory().getItemInMainHand().getType() != null) &&
|
||||
((itemInHand.getType() == Material.DIAMOND_SWORD) || (itemInHand.getType() == Material.GOLDEN_APPLE)) &&
|
||||
(ItemName.getLore(itemInHand) != null)) {
|
||||
if ((ItemName.getLore(itemInHand).containsAll(this.equalsLoreS)) && (Herobrine.getPluginCore().getConfigDB().UseArtifactSword))
|
||||
@ -110,8 +110,8 @@ public class PlayerListener implements Listener {
|
||||
}
|
||||
|
||||
|
||||
if ((event.getClickedBlock() != null) && (event.getPlayer().getItemInHand() != null) && (event.getClickedBlock().getType() == Material.JUKEBOX)) {
|
||||
final ItemStack item = event.getPlayer().getItemInHand();
|
||||
if ((event.getClickedBlock() != null) && (event.getPlayer().getInventory().getItemInMainHand() != null) && (event.getClickedBlock().getType() == Material.JUKEBOX)) {
|
||||
final ItemStack item = event.getPlayer().getInventory().getItemInMainHand();
|
||||
final Jukebox block = (Jukebox) event.getClickedBlock().getState();
|
||||
if (!block.isPlaying() && (item.getType() == Material.RECORD_11)) {
|
||||
Herobrine.getPluginCore().getAICore();
|
||||
|
@ -39,7 +39,7 @@ public class HumanNPC {
|
||||
|
||||
public void setItemInHand(final ItemStack item) {
|
||||
if (item != null) {
|
||||
((org.bukkit.entity.HumanEntity) getNMSEntity().getBukkitEntity()).setItemInHand(item);
|
||||
((org.bukkit.entity.HumanEntity) getNMSEntity().getBukkitEntity()).getInventory().setItemInMainHand(item);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user