Changed usage of CraftItemStack to ItemStack.

This commit is contained in:
sk89q 2011-02-23 10:05:29 -08:00
parent edd2f460a0
commit 8edb6976fb

View File

@ -20,7 +20,6 @@
package com.sk89q.worldguard.bukkit; package com.sk89q.worldguard.bukkit;
import com.sk89q.worldguard.blacklist.events.ItemAcquireBlacklistEvent; import com.sk89q.worldguard.blacklist.events.ItemAcquireBlacklistEvent;
import org.bukkit.craftbukkit.entity.CraftItem;
import org.bukkit.entity.Item; import org.bukkit.entity.Item;
import com.sk89q.worldguard.blacklist.events.ItemDropBlacklistEvent; import com.sk89q.worldguard.blacklist.events.ItemDropBlacklistEvent;
import org.bukkit.*; import org.bukkit.*;
@ -182,10 +181,12 @@ public void onPlayerDropItem(PlayerDropItemEvent event) {
} }
if (plugin.blacklist != null) { if (plugin.blacklist != null) {
CraftItem ci = (CraftItem)event.getItemDrop(); Item ci = event.getItemDrop();
if (!plugin.blacklist.check(new ItemDropBlacklistEvent(plugin.wrapPlayer(event.getPlayer()), toVector(ci.getLocation()), if (!plugin.blacklist.check(
ci.getItemStack().getTypeId()), false, false)) { new ItemDropBlacklistEvent(plugin.wrapPlayer(event
.getPlayer()), toVector(ci.getLocation()), ci
.getItemStack().getTypeId()), false, false)) {
event.setCancelled(true); event.setCancelled(true);
return; return;
} }
@ -194,8 +195,9 @@ public void onPlayerDropItem(PlayerDropItemEvent event) {
/** /**
* Called when a player attempts to pickup an item * Called when a player attempts to pickup an item
* *
* @param event Relevant event details * @param event
* Relevant event details
*/ */
@Override @Override
public void onPlayerPickupItem(PlayerPickupItemEvent event) { public void onPlayerPickupItem(PlayerPickupItemEvent event) {
@ -205,10 +207,12 @@ public void onPlayerPickupItem(PlayerPickupItemEvent event) {
} }
if (plugin.blacklist != null) { if (plugin.blacklist != null) {
CraftItem ci = (CraftItem)event.getItem(); Item ci = event.getItem();
if (!plugin.blacklist.check(new ItemAcquireBlacklistEvent(plugin.wrapPlayer(event.getPlayer()), toVector(ci.getLocation()), if (!plugin.blacklist.check(
ci.getItemStack().getTypeId()), false, false)) { new ItemAcquireBlacklistEvent(plugin.wrapPlayer(event
.getPlayer()), toVector(ci.getLocation()), ci
.getItemStack().getTypeId()), false, false)) {
event.setCancelled(true); event.setCancelled(true);
return; return;
} }