Moved most methods of ServerInterface to LocalWorld.

This commit is contained in:
sk89q
2011-01-08 11:26:27 -08:00
parent da4480ab49
commit b26624bc9b
16 changed files with 666 additions and 625 deletions

View File

@ -38,12 +38,12 @@ public class AreaPickaxe implements SuperPickaxeMode {
@Override
public boolean act(ServerInterface server, LocalConfiguration config,
LocalPlayer player, LocalSession session, LocalWorld world,
Vector clicked) {
LocalPlayer player, LocalSession session, WorldVector clicked) {
LocalWorld world = clicked.getWorld();
int ox = clicked.getBlockX();
int oy = clicked.getBlockY();
int oz = clicked.getBlockZ();
int initialType = server.getBlockType(world, clicked);
int initialType = world.getBlockType(clicked);
if (initialType == 0) {
return true;
@ -61,9 +61,9 @@ public class AreaPickaxe implements SuperPickaxeMode {
for (int y = oy - range; y <= oy + range; y++) {
for (int z = oz - range; z <= oz + range; z++) {
Vector pos = new Vector(x, y, z);
if (server.getBlockType(world, pos) == initialType) {
if (world.getBlockType(pos) == initialType) {
if (config.superPickaxeManyDrop) {
server.simulateBlockMine(world, pos);
world.simulateBlockMine(pos);
}
editSession.setBlock(pos, air);

View File

@ -36,9 +36,9 @@ public class BlockReplacer implements SuperPickaxeMode {
@Override
public boolean act(ServerInterface server, LocalConfiguration config,
LocalPlayer player, LocalSession session, LocalWorld world,
Vector clicked) {
LocalPlayer player, LocalSession session, WorldVector clicked) {
LocalWorld world = clicked.getWorld();
EditSession editSession = new EditSession(server, world, -1);
try {

View File

@ -31,8 +31,9 @@ public class QueryTool implements SuperPickaxeMode {
@Override
public boolean act(ServerInterface server, LocalConfiguration config,
LocalPlayer player, LocalSession session, LocalWorld world,
Vector clicked) {
LocalPlayer player, LocalSession session, WorldVector clicked) {
LocalWorld world = clicked.getWorld();
BaseBlock block = (new EditSession(server, world, 0)).rawGetBlock(clicked);
player.print("\u00A79@" + clicked + ": " + "\u00A7e"

View File

@ -41,9 +41,10 @@ public class RecursivePickaxe implements SuperPickaxeMode {
@Override
public boolean act(ServerInterface server, LocalConfiguration config,
LocalPlayer player, LocalSession session, LocalWorld world,
Vector clicked) {
int initialType = server.getBlockType(world, clicked);
LocalPlayer player, LocalSession session, WorldVector clicked) {
LocalWorld world = clicked.getWorld();
int initialType = world.getBlockType(clicked);
if (initialType == 0) {
return true;
@ -95,7 +96,7 @@ public class RecursivePickaxe implements SuperPickaxeMode {
if (editSession.getBlock(pos).getID() == initialType) {
if (drop) {
server.simulateBlockMine(world, pos);
world.simulateBlockMine(pos);
}
editSession.setBlock(pos, air);
} else {

View File

@ -30,21 +30,21 @@ import com.sk89q.worldedit.blocks.BlockID;
public class SinglePickaxe implements SuperPickaxeMode {
@Override
public boolean act(ServerInterface server, LocalConfiguration config,
LocalPlayer player, LocalSession session, LocalWorld world,
Vector clicked) {
LocalPlayer player, LocalSession session, WorldVector clicked) {
LocalWorld world = clicked.getWorld();
if (server.getBlockType(world, clicked) == BlockID.BEDROCK
if (world.getBlockType(clicked) == BlockID.BEDROCK
&& !player.canDestroyBedrock()) {
return true;
} else if (server.getBlockType(world, clicked) == BlockID.TNT) {
} else if (world.getBlockType(clicked) == BlockID.TNT) {
return false;
}
if (config.superPickaxeDrop) {
server.simulateBlockMine(world, clicked);
world.simulateBlockMine(clicked);
}
server.setBlockType(world, clicked, 0);
world.setBlockType(clicked, 0);
return true;
}

View File

@ -37,6 +37,5 @@ public interface SuperPickaxeMode {
* @return true to deny
*/
public boolean act(ServerInterface server, LocalConfiguration config,
LocalPlayer player, LocalSession session, LocalWorld world,
Vector clicked);
LocalPlayer player, LocalSession session, WorldVector clicked);
}

View File

@ -30,13 +30,14 @@ public class TreePlanter implements SuperPickaxeMode {
@Override
public boolean act(ServerInterface server, LocalConfiguration config,
LocalPlayer player, LocalSession session, LocalWorld world,
Vector clicked) {
LocalPlayer player, LocalSession session, WorldVector clicked) {
LocalWorld world = clicked.getWorld();
EditSession editSession =
new EditSession(server, world, session.getBlockChangeLimit());
try {
if (!server.generateTree(editSession, player.getWorld(), clicked)) {
if (!world.generateTree(editSession, clicked)) {
player.printError("Notch won't let you put a tree there.");
}
} finally {