forked from LogBlock/LogBlock
Compacted edit.perform()
This commit is contained in:
@@ -158,32 +158,20 @@ public class WorldEditor implements Runnable
|
|||||||
final Sign sign = (Sign)block.getState();
|
final Sign sign = (Sign)block.getState();
|
||||||
final String[] lines = signtext.split("\0");
|
final String[] lines = signtext.split("\0");
|
||||||
if (lines.length < 4)
|
if (lines.length < 4)
|
||||||
return PerformResult.ERROR;
|
return PerformResult.NO_ACTION;
|
||||||
for (int i = 0; i < 4; i++)
|
for (int i = 0; i < 4; i++)
|
||||||
sign.setLine(i, lines[i]);
|
sign.setLine(i, lines[i]);
|
||||||
if (!sign.update())
|
if (!sign.update())
|
||||||
return PerformResult.ERROR;
|
return PerformResult.ERROR;
|
||||||
} else if (curtype == 26) {
|
} else if (curtype == 26) {
|
||||||
final Bed bed = (Bed)block.getState().getData();
|
final Bed bed = (Bed)block.getState().getData();
|
||||||
final Block secBlock;
|
final Block secBlock = bed.isHeadOfBed() ? block.getFace(bed.getFacing().getOppositeFace()) : block.getFace(bed.getFacing());
|
||||||
if (!bed.isHeadOfBed())
|
if (secBlock.getTypeId() == 0 && !secBlock.setTypeIdAndData(26, (byte)(bed.getData() ^ 8), true))
|
||||||
secBlock = block.getFace(bed.getFacing());
|
|
||||||
else
|
|
||||||
secBlock = block.getFace(bed.getFacing().getOppositeFace());
|
|
||||||
if (secBlock.getTypeId() != 0)
|
|
||||||
return PerformResult.SUCCESS;
|
|
||||||
if (!secBlock.setTypeIdAndData(26, (byte)(bed.getData() ^ 8), true))
|
|
||||||
return PerformResult.ERROR;
|
return PerformResult.ERROR;
|
||||||
} else if (curtype == 64 || curtype == 71) {
|
} else if (curtype == 64 || curtype == 71) {
|
||||||
final Block secBlock;
|
|
||||||
final byte blockData = block.getData();
|
final byte blockData = block.getData();
|
||||||
if ((blockData & 8) == 8)
|
final Block secBlock = (blockData & 8) == 8 ? block.getFace(BlockFace.DOWN) : block.getFace(BlockFace.UP);
|
||||||
secBlock = block.getFace(BlockFace.DOWN);
|
if (secBlock.getTypeId() == 0 && !secBlock.setTypeIdAndData(curtype, (byte)(blockData ^ 8), true))
|
||||||
else
|
|
||||||
secBlock = block.getFace(BlockFace.UP);
|
|
||||||
if (secBlock.getTypeId() != 0)
|
|
||||||
return PerformResult.SUCCESS;
|
|
||||||
if (!secBlock.setTypeIdAndData(curtype, (byte)(blockData ^ 8), true))
|
|
||||||
return PerformResult.ERROR;
|
return PerformResult.ERROR;
|
||||||
} else if (curtype == 18 && (block.getData() & 8) > 0)
|
} else if (curtype == 18 && (block.getData() & 8) > 0)
|
||||||
block.setData((byte)(block.getData() & 0xF7));
|
block.setData((byte)(block.getData() & 0xF7));
|
||||||
@@ -195,10 +183,9 @@ public class WorldEditor implements Runnable
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("serial")
|
||||||
public static class WorldEditorException extends Exception
|
public static class WorldEditorException extends Exception
|
||||||
{
|
{
|
||||||
private static final long serialVersionUID = 7509084196124728986L;
|
|
||||||
|
|
||||||
public WorldEditorException(String msg) {
|
public WorldEditorException(String msg) {
|
||||||
super(msg);
|
super(msg);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user