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();
|
Arrow arrow = (Arrow)event.getEntity();
|
||||||
if ((arrow.getShooter() instanceof Player)) {
|
if ((arrow.getShooter() instanceof Player)) {
|
||||||
Player player = (Player)arrow.getShooter();
|
Player player = (Player)arrow.getShooter();
|
||||||
if (player.getItemInHand() != null) {
|
if (player.getInventory().getItemInMainHand() != null) {
|
||||||
this.itemInHand = player.getItemInHand();
|
this.itemInHand = player.getInventory().getItemInMainHand();
|
||||||
if ((this.itemInHand.getType() != null) && (this.itemInHand.getType() == Material.BOW)) {
|
if ((this.itemInHand.getType() != null) && (this.itemInHand.getType() == Material.BOW)) {
|
||||||
this.getLore = ItemName.getLore(this.itemInHand);
|
this.getLore = ItemName.getLore(this.itemInHand);
|
||||||
if ((this.getLore != null) && (this.getLore.containsAll(this.equalsLore)) && (Herobrine.getPluginCore().getConfigDB().UseArtifactBow)) {
|
if ((this.getLore != null) && (this.getLore.containsAll(this.equalsLore)) && (Herobrine.getPluginCore().getConfigDB().UseArtifactBow)) {
|
||||||
|
@ -50,10 +50,10 @@ public class PlayerListener implements Listener {
|
|||||||
@EventHandler
|
@EventHandler
|
||||||
public void onPlayerInteract(final PlayerInteractEvent event) {
|
public void onPlayerInteract(final PlayerInteractEvent event) {
|
||||||
if (((event.getAction() == Action.LEFT_CLICK_BLOCK) || (event.getAction() == Action.RIGHT_CLICK_BLOCK)) &&
|
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();
|
ItemStack itemInHand = event.getPlayer().getInventory().getItemInMainHand();
|
||||||
if ((event.getPlayer().getItemInHand().getType() != null) &&
|
if ((event.getPlayer().getInventory().getItemInMainHand().getType() != null) &&
|
||||||
((itemInHand.getType() == Material.DIAMOND_SWORD) || (itemInHand.getType() == Material.GOLDEN_APPLE)) &&
|
((itemInHand.getType() == Material.DIAMOND_SWORD) || (itemInHand.getType() == Material.GOLDEN_APPLE)) &&
|
||||||
(ItemName.getLore(itemInHand) != null)) {
|
(ItemName.getLore(itemInHand) != null)) {
|
||||||
if ((ItemName.getLore(itemInHand).containsAll(this.equalsLoreS)) && (Herobrine.getPluginCore().getConfigDB().UseArtifactSword))
|
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)) {
|
if ((event.getClickedBlock() != null) && (event.getPlayer().getInventory().getItemInMainHand() != null) && (event.getClickedBlock().getType() == Material.JUKEBOX)) {
|
||||||
final ItemStack item = event.getPlayer().getItemInHand();
|
final ItemStack item = event.getPlayer().getInventory().getItemInMainHand();
|
||||||
final Jukebox block = (Jukebox) event.getClickedBlock().getState();
|
final Jukebox block = (Jukebox) event.getClickedBlock().getState();
|
||||||
if (!block.isPlaying() && (item.getType() == Material.RECORD_11)) {
|
if (!block.isPlaying() && (item.getType() == Material.RECORD_11)) {
|
||||||
Herobrine.getPluginCore().getAICore();
|
Herobrine.getPluginCore().getAICore();
|
||||||
|
@ -39,7 +39,7 @@ public class HumanNPC {
|
|||||||
|
|
||||||
public void setItemInHand(final ItemStack item) {
|
public void setItemInHand(final ItemStack item) {
|
||||||
if (item != null) {
|
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