updated onPlayerDropItem for latest bukkit, updated WorldEdit API calls for latest WorldEdit

This commit is contained in:
Redecouverte 2011-02-22 12:04:44 +01:00
parent d2ca8bffc4
commit 7f1552dff8
2 changed files with 12 additions and 10 deletions

View File

@ -19,8 +19,9 @@
package com.sk89q.worldguard.bukkit;
import org.bukkit.craftbukkit.entity.CraftItem;
import org.bukkit.entity.Item;
import com.sk89q.worldguard.blacklist.events.ItemDropBlacklistEvent;
import org.bukkit.entity.ItemDrop;
import org.bukkit.*;
import org.bukkit.block.Block;
import org.bukkit.entity.Player;
@ -180,9 +181,10 @@ public void onPlayerDropItem(PlayerDropItemEvent event) {
}
if (plugin.blacklist != null) {
ItemDrop id = event.getItemDrop();
if (!plugin.blacklist.check(new ItemDropBlacklistEvent(plugin.wrapPlayer(event.getPlayer()), toVector(id.getLocation()),
id.getItemStack().getTypeId()), false, false)) {
CraftItem ci = (CraftItem)event.getItemDrop();
if (!plugin.blacklist.check(new ItemDropBlacklistEvent(plugin.wrapPlayer(event.getPlayer()), toVector(ci.getLocation()),
ci.getItemStack().getTypeId()), false, false)) {
event.setCancelled(true);
return;
}

View File

@ -48,6 +48,7 @@
import com.sk89q.worldedit.LocalSession;
import com.sk89q.worldedit.Vector;
import com.sk89q.worldedit.blocks.ItemType;
import com.sk89q.worldedit.bukkit.BukkitWorld;
import com.sk89q.worldedit.bukkit.WorldEditAPI;
import com.sk89q.worldedit.bukkit.WorldEditPlugin;
import com.sk89q.worldedit.regions.Region;
@ -433,6 +434,7 @@ public void postReload() {
/**
* Handles a command.
*/
@Override
public boolean onCommand(CommandSender sender, Command cmd,
String commandLabel, String[] args) {
try {
@ -772,10 +774,9 @@ private boolean handleRegionCommand(Player player, String action, String[] args)
String id = args[0].toLowerCase();
WorldEditPlugin worldEdit = (WorldEditPlugin)wePlugin;
WorldEditAPI api = worldEdit.getAPI();
LocalSession session = api.getSession(player);
Region weRegion = session.getRegion();
LocalSession session = worldEdit.getSession(player);
Region weRegion = session.getSelection(new BukkitWorld(player.getWorld()));
BlockVector min = weRegion.getMinimumPoint().toBlockVector();
BlockVector max = weRegion.getMaximumPoint().toBlockVector();
@ -814,10 +815,9 @@ private boolean handleRegionCommand(Player player, String action, String[] args)
}
WorldEditPlugin worldEdit = (WorldEditPlugin)wePlugin;
WorldEditAPI api = worldEdit.getAPI();
LocalSession session = api.getSession(player);
Region weRegion = session.getRegion();
LocalSession session = worldEdit.getSession(player);
Region weRegion = session.getSelection(new BukkitWorld(player.getWorld()));
BlockVector min = weRegion.getMinimumPoint().toBlockVector();
BlockVector max = weRegion.getMaximumPoint().toBlockVector();