Stop using deprecated getItemInHand()

This commit is contained in:
ryanhamshire 2016-04-07 21:37:50 -07:00
parent f9cc07608d
commit 3402efe5c7
2 changed files with 4 additions and 2 deletions

View File

@ -19,6 +19,7 @@
package me.ryanhamshire.GriefPrevention;
import org.bukkit.entity.Player;
import org.bukkit.inventory.EquipmentSlot;
//tells a player about how many claim blocks he has, etc
//implemented as a task so that it can be delayed
@ -37,7 +38,7 @@ class EquipShovelProcessingTask implements Runnable
public void run()
{
//if he's not holding the golden shovel anymore, do nothing
if(player.getItemInHand().getType() != GriefPrevention.instance.config_claims_modificationTool) return;
if(GriefPrevention.instance.getItemInHand(player, EquipmentSlot.HAND).getType() != GriefPrevention.instance.config_claims_modificationTool) return;
PlayerData playerData = GriefPrevention.instance.dataStore.getPlayerData(player.getUniqueId());

View File

@ -64,6 +64,7 @@ import org.bukkit.event.entity.PlayerDeathEvent;
import org.bukkit.event.player.*;
import org.bukkit.event.player.PlayerLoginEvent.Result;
import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
import org.bukkit.inventory.EquipmentSlot;
import org.bukkit.inventory.InventoryHolder;
import org.bukkit.inventory.ItemStack;
import org.bukkit.metadata.MetadataValue;
@ -1405,7 +1406,7 @@ class PlayerEventHandler implements Listener
if(!GriefPrevention.instance.pvpRulesApply(player.getWorld())) return;
//if we're preventing spawn camping and the player was previously empty handed...
if(GriefPrevention.instance.config_pvp_protectFreshSpawns && (player.getItemInHand().getType() == Material.AIR))
if(GriefPrevention.instance.config_pvp_protectFreshSpawns && (GriefPrevention.instance.getItemInHand(player, EquipmentSlot.HAND).getType() == Material.AIR))
{
//if that player is currently immune to pvp
PlayerData playerData = this.dataStore.getPlayerData(event.getPlayer().getUniqueId());