mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-22 21:26:45 +01:00
Should fix #267
This commit is contained in:
parent
ba64bf37de
commit
8f09a19a06
@ -240,6 +240,12 @@ public class Set extends SubCommand {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
blocks = new PlotBlock[] { new PlotBlock((short) BlockManager.manager.getBlockIdFromString(args[1]), (byte) 0) };
|
blocks = new PlotBlock[] { new PlotBlock((short) BlockManager.manager.getBlockIdFromString(args[1]), (byte) 0) };
|
||||||
|
for (PlotBlock block : blocks) {
|
||||||
|
if (!BlockManager.manager.isBlockSolid(block)) {
|
||||||
|
MainUtil.sendMessage(plr, C.NOT_VALID_BLOCK);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
} catch (final Exception e2) {
|
} catch (final Exception e2) {
|
||||||
MainUtil.sendMessage(plr, C.NOT_VALID_BLOCK);
|
MainUtil.sendMessage(plr, C.NOT_VALID_BLOCK);
|
||||||
return false;
|
return false;
|
||||||
|
@ -6,6 +6,8 @@ import com.intellectualcrafters.plot.object.schematic.PlotItem;
|
|||||||
|
|
||||||
public abstract class BlockManager {
|
public abstract class BlockManager {
|
||||||
public static BlockManager manager;
|
public static BlockManager manager;
|
||||||
|
|
||||||
|
public abstract boolean isBlockSolid(PlotBlock block);
|
||||||
|
|
||||||
public abstract String[] getBiomeList();
|
public abstract String[] getBiomeList();
|
||||||
|
|
||||||
|
@ -183,6 +183,17 @@ public abstract class SchematicHandler {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
final File file = new File(PlotSquared.IMP.getDirectory() + File.separator + "schematics" + File.separator + name + ".schematic");
|
final File file = new File(PlotSquared.IMP.getDirectory() + File.separator + "schematics" + File.separator + name + ".schematic");
|
||||||
|
return getSchematic(file);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get a schematic
|
||||||
|
*
|
||||||
|
* @param name to check
|
||||||
|
*
|
||||||
|
* @return schematic if found, else null
|
||||||
|
*/
|
||||||
|
public Schematic getSchematic(File file) {
|
||||||
if (!file.exists()) {
|
if (!file.exists()) {
|
||||||
PlotSquared.log(file.toString() + " doesn't exist");
|
PlotSquared.log(file.toString() + " doesn't exist");
|
||||||
return null;
|
return null;
|
||||||
|
@ -293,4 +293,15 @@ public class BukkitUtil extends BlockManager {
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isBlockSolid(PlotBlock block) {
|
||||||
|
try {
|
||||||
|
Material material = Material.getMaterial(block.id);
|
||||||
|
return material.isBlock() && material.isSolid() && material.isOccluding() && !material.hasGravity();
|
||||||
|
}
|
||||||
|
catch (Exception e) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user