Converted API over to use new World.

This breaks backwards compatibility for all getWorld() methods, but
shim methods were added for binary compatibility with method calls that
use LocalWorld.
This commit is contained in:
sk89q
2014-04-05 02:59:38 -07:00
parent 63a2ca824d
commit 24f8fbc92a
49 changed files with 827 additions and 232 deletions

View File

@ -22,7 +22,7 @@ package com.sk89q.worldedit.extension.platform;
import com.sk89q.minecraft.util.commands.Command;
import com.sk89q.minecraft.util.commands.CommandsManager;
import com.sk89q.worldedit.LocalPlayer;
import com.sk89q.worldedit.LocalWorld;
import com.sk89q.worldedit.world.World;
import java.util.Collections;
import java.util.List;
@ -38,7 +38,7 @@ public abstract class AbstractPlatform implements Platform {
}
@Override
public List<LocalWorld> getWorlds() {
public List<? extends World> getWorlds() {
return Collections.emptyList();
}

View File

@ -27,6 +27,7 @@ import com.sk89q.worldedit.blocks.ItemID;
import com.sk89q.worldedit.entity.Player;
import com.sk89q.worldedit.internal.cui.CUIEvent;
import com.sk89q.worldedit.util.TargetBlock;
import com.sk89q.worldedit.world.World;
import java.io.File;
@ -94,7 +95,7 @@ public abstract class AbstractPlayerActor implements Actor, Player {
@Override
public void findFreePosition(WorldVector searchPos) {
LocalWorld world = searchPos.getWorld();
World world = searchPos.getWorld();
int x = searchPos.getBlockX();
int y = Math.max(0, searchPos.getBlockY());
int origY = y;
@ -126,7 +127,7 @@ public abstract class AbstractPlayerActor implements Actor, Player {
@Override
public void setOnGround(WorldVector searchPos) {
LocalWorld world = searchPos.getWorld();
World world = searchPos.getWorld();
int x = searchPos.getBlockX();
int y = Math.max(0, searchPos.getBlockY());
int z = searchPos.getBlockZ();
@ -155,7 +156,7 @@ public abstract class AbstractPlayerActor implements Actor, Player {
final int x = pos.getBlockX();
int y = Math.max(0, pos.getBlockY());
final int z = pos.getBlockZ();
final LocalWorld world = pos.getWorld();
final World world = pos.getWorld();
byte free = 0;
byte spots = 0;
@ -196,7 +197,7 @@ public abstract class AbstractPlayerActor implements Actor, Player {
final int x = pos.getBlockX();
int y = Math.max(0, pos.getBlockY() - 1);
final int z = pos.getBlockZ();
final LocalWorld world = pos.getWorld();
final World world = pos.getWorld();
byte free = 0;
@ -247,7 +248,7 @@ public abstract class AbstractPlayerActor implements Actor, Player {
int initialY = Math.max(0, pos.getBlockY());
int y = Math.max(0, pos.getBlockY() + 2);
int z = pos.getBlockZ();
LocalWorld world = getPosition().getWorld();
World world = getPosition().getWorld();
// No free space above
if (world.getBlockType(new Vector(x, y, z)) != 0) {
@ -281,7 +282,7 @@ public abstract class AbstractPlayerActor implements Actor, Player {
int y = Math.max(0, pos.getBlockY() + 1);
final int z = pos.getBlockZ();
final int maxY = Math.min(getWorld().getMaxY() + 1, initialY + distance);
final LocalWorld world = getPosition().getWorld();
final World world = getPosition().getWorld();
while (y <= world.getMaxY() + 2) {
if (!BlockType.canPassThrough(world.getBlock(new Vector(x, y, z)))) {
@ -383,7 +384,7 @@ public abstract class AbstractPlayerActor implements Actor, Player {
public boolean passThroughForwardWall(int range) {
int searchDist = 0;
TargetBlock hitBlox = new TargetBlock(this, range, 0.2);
LocalWorld world = getPosition().getWorld();
World world = getPosition().getWorld();
BlockWorldVector block;
boolean firstBlock = true;
int freeToFind = 2;

View File

@ -19,9 +19,9 @@
package com.sk89q.worldedit.extension.platform;
import com.sk89q.worldedit.LocalWorld;
import com.sk89q.worldedit.WorldEditPermissionException;
import com.sk89q.worldedit.internal.cui.CUIEvent;
import com.sk89q.worldedit.world.World;
import java.io.File;
@ -42,7 +42,7 @@ public interface Actor {
*
* @return the world
*/
LocalWorld getWorld();
World getWorld();
/**
* Print a message.

View File

@ -24,7 +24,7 @@ import com.sk89q.minecraft.util.commands.CommandsManager;
import com.sk89q.worldedit.BiomeTypes;
import com.sk89q.worldedit.LocalConfiguration;
import com.sk89q.worldedit.LocalPlayer;
import com.sk89q.worldedit.LocalWorld;
import com.sk89q.worldedit.world.World;
import java.util.List;
@ -75,7 +75,7 @@ public interface Platform {
*/
int schedule(long delay, long period, Runnable task);
List<LocalWorld> getWorlds();
List<? extends World> getWorlds();
@Deprecated
void onCommandRegistration(List<Command> commands);

View File

@ -22,6 +22,7 @@ package com.sk89q.worldedit.extension.platform;
import com.sk89q.minecraft.util.commands.Command;
import com.sk89q.minecraft.util.commands.CommandsManager;
import com.sk89q.worldedit.*;
import com.sk89q.worldedit.world.World;
import java.util.List;
@ -70,7 +71,7 @@ class ServerInterfaceAdapter extends ServerInterface {
}
@Override
public List<LocalWorld> getWorlds() {
public List<? extends World> getWorlds() {
return platform.getWorlds();
}