Added left click support to /repl to pick up the block.

Dieser Commit ist enthalten in:
sk89q 2011-04-25 02:05:58 -07:00
Ursprung 47268bef20
Commit 3ffd67e7f3

Datei anzeigen

@ -22,13 +22,14 @@ package com.sk89q.worldedit.tools;
import com.sk89q.worldedit.*;
import com.sk89q.worldedit.bags.BlockBag;
import com.sk89q.worldedit.blocks.BaseBlock;
import com.sk89q.worldedit.blocks.BlockType;
/**
* A mode that replaces one block.
*
* @author sk89q
*/
public class BlockReplacer implements BlockTool {
public class BlockReplacer implements DoubleActionBlockTool {
private BaseBlock targetBlock;
public BlockReplacer(BaseBlock targetBlock) {
@ -57,4 +58,20 @@ public class BlockReplacer implements BlockTool {
return true;
}
@Override
public boolean actSecondary(ServerInterface server,
LocalConfiguration config, LocalPlayer player,
LocalSession session, WorldVector clicked) {
LocalWorld world = clicked.getWorld();
targetBlock = (new EditSession(world, -1)).getBlock(clicked);
BlockType type = BlockType.fromID(targetBlock.getType());
if (type != null) {
player.print("Replacer tool switched to: " + type.getName());
}
return true;
}
}