More deprecation removal

This commit is contained in:
Matthew Miller
2018-06-16 16:36:55 +10:00
parent 20bf6e079b
commit aaaf2d5678
152 changed files with 701 additions and 1150 deletions

View File

@ -244,7 +244,7 @@ public abstract class AbstractPlayerActor implements Actor, Player, Cloneable {
int initialY = Math.max(0, pos.getBlockY());
int y = Math.max(0, pos.getBlockY() + 2);
int z = pos.getBlockZ();
Extent world = getPosition().getExtent();
Extent world = getLocation().getExtent();
// No free space above
if (world.getBlock(new Vector(x, y, z)).getId() != 0) {
@ -278,7 +278,7 @@ public abstract class AbstractPlayerActor implements Actor, Player, Cloneable {
int y = Math.max(0, pos.getBlockY() + 1);
final int z = pos.getBlockZ();
final int maxY = Math.min(getWorld().getMaxY() + 1, initialY + distance);
final Extent world = getPosition().getExtent();
final Extent world = getLocation().getExtent();
while (y <= world.getMaximumPoint().getY() + 2) {
if (!BlockType.canPassThrough(world.getBlock(new Vector(x, y, z)))) {
@ -299,7 +299,7 @@ public abstract class AbstractPlayerActor implements Actor, Player, Cloneable {
@Override
public void floatAt(int x, int y, int z, boolean alwaysGlass) {
try {
getPosition().getExtent().setBlock(new Vector(x, y - 1, z), new BaseBlock(BlockTypes.GLASS));
getLocation().getExtent().setBlock(new Vector(x, y - 1, z), new BaseBlock(BlockTypes.GLASS));
} catch (WorldEditException e) {
e.printStackTrace();
}
@ -308,12 +308,12 @@ public abstract class AbstractPlayerActor implements Actor, Player, Cloneable {
@Override
public Location getBlockIn() {
return getPosition();
return getLocation();
}
@Override
public Location getBlockOn() {
return getPosition().setY(getPosition().getY() - 1);
return getLocation().setY(getLocation().getY() - 1);
}
@Override
@ -346,15 +346,15 @@ public abstract class AbstractPlayerActor implements Actor, Player, Cloneable {
@Override
public PlayerDirection getCardinalDirection(int yawOffset) {
if (getPitch() > 67.5) {
if (getLocation().getPitch() > 67.5) {
return PlayerDirection.DOWN;
}
if (getPitch() < -67.5) {
if (getLocation().getPitch() < -67.5) {
return PlayerDirection.UP;
}
// From hey0's code
double rot = (getYaw() + yawOffset) % 360; //let's use real yaw now
double rot = (getLocation().getYaw() + yawOffset) % 360; //let's use real yaw now
if (rot < 0) {
rot += 360.0;
}
@ -380,7 +380,7 @@ public abstract class AbstractPlayerActor implements Actor, Player, Cloneable {
public boolean passThroughForwardWall(int range) {
int searchDist = 0;
TargetBlock hitBlox = new TargetBlock(this, range, 0.2);
Extent world = getPosition().getExtent();
Extent world = getLocation().getExtent();
Location block;
boolean firstBlock = true;
int freeToFind = 2;
@ -422,7 +422,7 @@ public abstract class AbstractPlayerActor implements Actor, Player, Cloneable {
@Override
public void setPosition(Vector pos) {
setPosition(pos, (float) getPitch(), (float) getYaw());
setPosition(pos, getLocation().getPitch(), getLocation().getYaw());
}
@Override

View File

@ -69,8 +69,8 @@ public class PlatformManager {
private final WorldEdit worldEdit;
private final CommandManager commandManager;
private final List<Platform> platforms = new ArrayList<Platform>();
private final Map<Capability, Platform> preferences = new EnumMap<Capability, Platform>(Capability.class);
private final List<Platform> platforms = new ArrayList<>();
private final Map<Capability, Platform> preferences = new EnumMap<>(Capability.class);
private @Nullable String firstSeenVersion;
private final AtomicBoolean initialized = new AtomicBoolean();
private final AtomicBoolean configured = new AtomicBoolean();
@ -218,7 +218,7 @@ public class PlatformManager {
* @return a list of platforms
*/
public synchronized List<Platform> getPlatforms() {
return new ArrayList<Platform>(platforms);
return new ArrayList<>(platforms);
}
/**
@ -291,7 +291,6 @@ public class PlatformManager {
* @return a {@link ServerInterface}
* @throws IllegalStateException if no platform has been registered
*/
@SuppressWarnings("deprecation")
public ServerInterface getServerInterface() throws IllegalStateException {
return ServerInterfaceAdapter.adapt(queryCapability(Capability.USER_COMMANDS));
}
@ -304,7 +303,6 @@ public class PlatformManager {
}
}
@SuppressWarnings("deprecation")
@Subscribe
public void handleBlockInteract(BlockInteractEvent event) {
// Create a proxy actor with a potentially different world for
@ -385,7 +383,6 @@ public class PlatformManager {
}
}
@SuppressWarnings("deprecation")
@Subscribe
public void handlePlayerInput(PlayerInputEvent event) {
// Create a proxy actor with a potentially different world for

View File

@ -87,21 +87,6 @@ class PlayerProxy extends AbstractPlayerActor {
return basePlayer.getLocation();
}
@Override
public Location getPosition() {
return basePlayer.getPosition();
}
@Override
public double getPitch() {
return basePlayer.getPitch();
}
@Override
public double getYaw() {
return basePlayer.getYaw();
}
@Override
public void setPosition(Vector pos, float pitch, float yaw) {
basePlayer.setPosition(pos, pitch, yaw);

View File

@ -19,13 +19,14 @@
package com.sk89q.worldedit.extension.platform.permission;
import com.google.common.base.Optional;
import static com.google.common.base.Preconditions.checkNotNull;
import com.sk89q.worldedit.LocalConfiguration;
import com.sk89q.worldedit.WorldEdit;
import com.sk89q.worldedit.extension.platform.Actor;
import com.sk89q.worldedit.regions.selector.limit.SelectorLimits;
import static com.google.common.base.Preconditions.checkNotNull;
import java.util.Optional;
public class ActorSelectorLimits implements SelectorLimits {
@ -55,7 +56,7 @@ public class ActorSelectorLimits implements SelectorLimits {
if (limit > 0) {
return Optional.of(limit);
} else {
return Optional.absent();
return Optional.empty();
}
}
@ -74,7 +75,7 @@ public class ActorSelectorLimits implements SelectorLimits {
if (limit > 0) {
return Optional.of(limit);
} else {
return Optional.absent();
return Optional.empty();
}
}