Implement EditSessionFactory

This commit is contained in:
Ammar Askar
2012-10-18 15:34:09 +05:00
parent ae75061492
commit 04c00034cf
7 changed files with 85 additions and 13 deletions

View File

@ -46,7 +46,7 @@ public class BlockReplacer implements DoubleActionBlockTool {
BlockBag bag = session.getBlockBag(player);
LocalWorld world = clicked.getWorld();
EditSession editSession = new EditSession(world, -1, bag);
EditSession editSession = WorldEdit.getInstance().getEditSessionFactory().getEditSession(world, -1, bag);
try {
editSession.setBlock(clicked, targetBlock);
@ -66,7 +66,8 @@ public class BlockReplacer implements DoubleActionBlockTool {
LocalSession session, WorldVector clicked) {
LocalWorld world = clicked.getWorld();
targetBlock = (new EditSession(world, -1)).getBlock(clicked);
EditSession editSession = WorldEdit.getInstance().getEditSessionFactory().getEditSession(world, -1);
targetBlock = (editSession).getBlock(clicked);
BlockType type = BlockType.fromID(targetBlock.getType());
if (type != null) {

View File

@ -37,7 +37,8 @@ public class QueryTool implements BlockTool {
LocalPlayer player, LocalSession session, WorldVector clicked) {
LocalWorld world = clicked.getWorld();
BaseBlock block = (new EditSession(world, 0)).rawGetBlock(clicked);
EditSession editSession = WorldEdit.getInstance().getEditSessionFactory().getEditSession(world, 0);
BaseBlock block = (editSession).rawGetBlock(clicked);
BlockType type = BlockType.fromID(block.getType());
player.print("\u00A79@" + clicked + ": " + "\u00A7e"