forked from LogBlock/LogBlock
Fixed deprecated methods
This commit is contained in:
@@ -83,8 +83,8 @@ class LBBlockListener extends BlockListener
|
||||
if (type == 0 && event.getItemInHand() != null)
|
||||
if (event.getItemInHand().getTypeId() == 51)
|
||||
return;
|
||||
else if (event.getItemInHand().getTypeId() == 44 && event.getBlock().getFace(BlockFace.DOWN).getTypeId() == 43) {
|
||||
before = event.getBlock().getFace(BlockFace.DOWN).getState();
|
||||
else if (event.getItemInHand().getTypeId() == 44 && event.getBlock().getRelative(BlockFace.DOWN).getTypeId() == 43) {
|
||||
before = event.getBlock().getRelative(BlockFace.DOWN).getState();
|
||||
before.setTypeId(44);
|
||||
after.setTypeId(43);
|
||||
after.setData(event.getItemInHand().getData());
|
||||
|
||||
@@ -19,9 +19,9 @@ class LBPlayerListener extends PlayerListener
|
||||
public void onPlayerBucketEmpty(PlayerBucketEmptyEvent event) {
|
||||
if (!event.isCancelled())
|
||||
if (event.getBucket() == Material.WATER_BUCKET)
|
||||
consumer.queueBlockPlace(event.getPlayer().getName(), event.getBlockClicked().getFace(event.getBlockFace()).getLocation(), 9, (byte)0);
|
||||
consumer.queueBlockPlace(event.getPlayer().getName(), event.getBlockClicked().getRelative(event.getBlockFace()).getLocation(), 9, (byte)0);
|
||||
else if (event.getBucket() == Material.LAVA_BUCKET)
|
||||
consumer.queueBlockPlace(event.getPlayer().getName(), event.getBlockClicked().getFace(event.getBlockFace()).getLocation(), 11, (byte)0);
|
||||
consumer.queueBlockPlace(event.getPlayer().getName(), event.getBlockClicked().getRelative(event.getBlockFace()).getLocation(), 11, (byte)0);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -45,13 +45,13 @@ class LBToolListener extends PlayerListener
|
||||
params.loc = null;
|
||||
params.sel = null;
|
||||
if (type == toolblockID && action == Action.RIGHT_CLICK_BLOCK)
|
||||
params.setLocation(block.getFace(event.getBlockFace()).getLocation());
|
||||
params.setLocation(block.getRelative(event.getBlockFace()).getLocation());
|
||||
else if (block.getTypeId() != 54 || params.radius != 0)
|
||||
params.setLocation(block.getLocation());
|
||||
else {
|
||||
for (final BlockFace face : orientations)
|
||||
if (block.getFace(face).getTypeId() == 54)
|
||||
params.setSelection(new CuboidSelection(player.getWorld(), block.getLocation(), block.getFace(face).getLocation()));
|
||||
if (block.getRelative(face).getTypeId() == 54)
|
||||
params.setSelection(new CuboidSelection(player.getWorld(), block.getLocation(), block.getRelative(face).getLocation()));
|
||||
if (params.sel == null)
|
||||
params.setLocation(block.getLocation());
|
||||
}
|
||||
|
||||
@@ -147,8 +147,8 @@ public class WorldEditor implements Runnable
|
||||
leftover = modifyContainer(state, new ItemStack(ca.itemType, -ca.itemAmount, (short)0, ca.itemData));
|
||||
if (leftover > 0)
|
||||
for (final BlockFace face : new BlockFace[]{BlockFace.NORTH, BlockFace.SOUTH, BlockFace.EAST, BlockFace.WEST})
|
||||
if (block.getFace(face).getTypeId() == 54)
|
||||
leftover = modifyContainer(block.getFace(face).getState(), new ItemStack(ca.itemType, ca.itemAmount < 0 ? leftover : -leftover, (short)0, ca.itemData));
|
||||
if (block.getRelative(face).getTypeId() == 54)
|
||||
leftover = modifyContainer(block.getRelative(face).getState(), new ItemStack(ca.itemType, ca.itemAmount < 0 ? leftover : -leftover, (short)0, ca.itemData));
|
||||
} catch (final Exception ex) {
|
||||
throw new WorldEditorException(ex.getMessage(), block.getLocation());
|
||||
}
|
||||
@@ -180,22 +180,22 @@ public class WorldEditor implements Runnable
|
||||
throw new WorldEditorException("Failed to update signtext of " + materialName(block.getTypeId()), block.getLocation());
|
||||
} else if (curtype == 26) {
|
||||
final Bed bed = (Bed)block.getState().getData();
|
||||
final Block secBlock = bed.isHeadOfBed() ? block.getFace(bed.getFacing().getOppositeFace()) : block.getFace(bed.getFacing());
|
||||
final Block secBlock = bed.isHeadOfBed() ? block.getRelative(bed.getFacing().getOppositeFace()) : block.getRelative(bed.getFacing());
|
||||
if (secBlock.getTypeId() == 0 && !secBlock.setTypeIdAndData(26, (byte)(bed.getData() | 8), true))
|
||||
throw new WorldEditorException(secBlock.getTypeId(), 26, secBlock.getLocation());
|
||||
} else if (curtype == 64 || curtype == 71) {
|
||||
final byte blockData = block.getData();
|
||||
final Block secBlock = (blockData & 8) == 8 ? block.getFace(BlockFace.DOWN) : block.getFace(BlockFace.UP);
|
||||
final Block secBlock = (blockData & 8) == 8 ? block.getRelative(BlockFace.DOWN) : block.getRelative(BlockFace.UP);
|
||||
if (secBlock.getTypeId() == 0 && !secBlock.setTypeIdAndData(curtype, (byte)(blockData | 8), true))
|
||||
throw new WorldEditorException(secBlock.getTypeId(), curtype, secBlock.getLocation());
|
||||
} else if ((curtype == 29 || curtype == 33) && (block.getData() & 8) > 0) {
|
||||
final PistonBaseMaterial piston = (PistonBaseMaterial)block.getState().getData();
|
||||
final Block secBlock = block.getFace(piston.getFacing());
|
||||
final Block secBlock = block.getRelative(piston.getFacing());
|
||||
if (secBlock.getTypeId() == 0 && !secBlock.setTypeIdAndData(34, curtype == 29 ? (byte)(block.getData() | 8) : (byte)(block.getData() & ~8), true))
|
||||
throw new WorldEditorException(secBlock.getTypeId(), 34, secBlock.getLocation());
|
||||
} else if (curtype == 34) {
|
||||
final PistonExtensionMaterial piston = (PistonExtensionMaterial)block.getState().getData();
|
||||
final Block secBlock = block.getFace(piston.getFacing().getOppositeFace());
|
||||
final Block secBlock = block.getRelative(piston.getFacing().getOppositeFace());
|
||||
if (secBlock.getTypeId() == 0 && !secBlock.setTypeIdAndData(piston.isSticky() ? 29 : 33, (byte)(block.getData() | 8), true))
|
||||
throw new WorldEditorException(secBlock.getTypeId(), piston.isSticky() ? 29 : 33, secBlock.getLocation());
|
||||
} else if (curtype == 18 && (block.getData() & 8) > 0)
|
||||
|
||||
Reference in New Issue
Block a user