mirror of
https://github.com/EngineHub/WorldGuard.git
synced 2024-11-08 03:49:32 +01:00
Use BlockTarget for blocks.
This commit is contained in:
parent
d8dba47c0f
commit
3203a81710
@ -22,6 +22,7 @@
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import com.sk89q.worldedit.bukkit.BukkitAdapter;
|
||||
import com.sk89q.worldguard.blacklist.target.BlockTarget;
|
||||
import com.sk89q.worldguard.blacklist.target.ItemTarget;
|
||||
import com.sk89q.worldguard.blacklist.target.Target;
|
||||
import org.bukkit.ChatColor;
|
||||
@ -186,7 +187,7 @@ public static boolean isIntensiveEntity(Entity entity) {
|
||||
*/
|
||||
public static Target createTarget(Block block) {
|
||||
checkNotNull(block);
|
||||
return new ItemTarget(BukkitAdapter.adapt(block.getBlockData()).getBlockType().getItemType());
|
||||
return new BlockTarget(BukkitAdapter.adapt(block.getBlockData()).getBlockType());
|
||||
}
|
||||
|
||||
/**
|
||||
@ -208,6 +209,10 @@ public static Target createTarget(ItemStack item) {
|
||||
*/
|
||||
public static Target createTarget(Material material) {
|
||||
checkNotNull(material);
|
||||
return new ItemTarget(BukkitAdapter.asItemType(material));
|
||||
if (material.isBlock()) {
|
||||
return new BlockTarget(BukkitAdapter.asBlockType(material));
|
||||
} else {
|
||||
return new ItemTarget(BukkitAdapter.asItemType(material));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user