forked from LogBlock/LogBlock
Tool lookups no longer require WorldEdit for double chests
This commit is contained in:
@@ -1,11 +1,11 @@
|
|||||||
package de.diddiz.LogBlock.listeners;
|
package de.diddiz.LogBlock.listeners;
|
||||||
|
|
||||||
import de.diddiz.LogBlock.*;
|
import de.diddiz.LogBlock.*;
|
||||||
|
import de.diddiz.util.BukkitUtils;
|
||||||
import de.diddiz.worldedit.CuboidRegion;
|
import de.diddiz.worldedit.CuboidRegion;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.block.BlockFace;
|
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
@@ -53,19 +53,14 @@ public class ToolListener implements Listener {
|
|||||||
params.sel = null;
|
params.sel = null;
|
||||||
if (behavior == ToolBehavior.BLOCK) {
|
if (behavior == ToolBehavior.BLOCK) {
|
||||||
params.setLocation(block.getRelative(event.getBlockFace()).getLocation());
|
params.setLocation(block.getRelative(event.getBlockFace()).getLocation());
|
||||||
} else if ((block.getType() != Material.CHEST && block.getType() != Material.TRAPPED_CHEST) || tool.params.radius != 0) {
|
} else if (tool.params.radius != 0) {
|
||||||
params.setLocation(block.getLocation());
|
params.setLocation(block.getLocation());
|
||||||
} else {
|
} else {
|
||||||
if (logblock.getServer().getPluginManager().isPluginEnabled("WorldEdit")) {
|
Block otherHalfChest = BukkitUtils.getConnectedChest(block);
|
||||||
for (final BlockFace face : new BlockFace[]{BlockFace.NORTH, BlockFace.SOUTH, BlockFace.EAST, BlockFace.WEST}) {
|
if (otherHalfChest == null) {
|
||||||
if (block.getRelative(face).getType() == block.getType()) {
|
|
||||||
params.setSelection(CuboidRegion.fromCorners(event.getPlayer().getWorld(),
|
|
||||||
block.getLocation(), block.getRelative(face).getLocation()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (params.sel == null) {
|
|
||||||
params.setLocation(block.getLocation());
|
params.setLocation(block.getLocation());
|
||||||
|
} else {
|
||||||
|
params.setSelection(CuboidRegion.fromCorners(block.getLocation().getWorld(), block.getLocation(), otherHalfChest.getLocation()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
|
Reference in New Issue
Block a user