Proper Look structure refactoring
This commit is contained in:
@@ -36,7 +36,7 @@ public class WarpPosition extends Location implements Serializable, ILook {
|
||||
super(location.getX(), location.getY(), location.getZ());
|
||||
}
|
||||
|
||||
public WarpPosition(Location location, Look look) {
|
||||
public WarpPosition(Location location, ILook look) {
|
||||
super(location.getX(), location.getY(), location.getZ());
|
||||
this.look = look;
|
||||
}
|
||||
@@ -46,7 +46,7 @@ public class WarpPosition extends Location implements Serializable, ILook {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void set(Look look) {
|
||||
public void set(ILook look) {
|
||||
this.look = look;
|
||||
}
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ import mc.core.Location;
|
||||
import mc.core.chat.MessageType;
|
||||
import mc.core.network.NetChannel;
|
||||
import mc.core.network.SCPacket;
|
||||
import mc.core.player.Look;
|
||||
import mc.core.player.ILook;
|
||||
import mc.core.player.Player;
|
||||
import mc.core.player.PlayerManager;
|
||||
import mc.core.text.Text;
|
||||
@@ -52,7 +52,7 @@ public class FakePlayerManager implements PlayerManager {
|
||||
private static final NetChannel FAKE_NET_CHANNEL = new FakeNetChannet();
|
||||
|
||||
@Override
|
||||
public Player createPlayer(String name, Location defaultLocation, Look defaultLook) {
|
||||
public Player createPlayer(String name, Location defaultLocation, ILook defaultLook) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ package mc.core.events;
|
||||
import lombok.Getter;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.Setter;
|
||||
import mc.core.player.Look;
|
||||
import mc.core.player.ILook;
|
||||
import mc.core.player.Player;
|
||||
|
||||
@RequiredArgsConstructor
|
||||
@@ -15,5 +15,5 @@ import mc.core.player.Player;
|
||||
@Setter
|
||||
public class PlayerLookEvent extends EventBase {
|
||||
private final Player player;
|
||||
private Look newLook;
|
||||
private ILook newLook;
|
||||
}
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
package mc.core.player;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
public interface ILook extends Serializable {
|
||||
void set(Look look);
|
||||
public interface ILook {
|
||||
void set(ILook look);
|
||||
|
||||
float getYaw();
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ public class InMemoryPlayerManager implements PlayerManager, Runnable {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Player createPlayer(String name, Location defaultLocation, Look defaultLook) {
|
||||
public Player createPlayer(String name, Location defaultLocation, ILook defaultLook) {
|
||||
SimplePlayer player = new SimplePlayer();
|
||||
player.setId(rand.nextInt(10000));
|
||||
player.setUUID(UUID.nameUUIDFromBytes(name.getBytes()));
|
||||
|
||||
@@ -13,8 +13,8 @@ public class Look implements ILook {
|
||||
private float yaw, pitch;
|
||||
|
||||
@Override
|
||||
public void set(Look look) {
|
||||
this.yaw = look.yaw;
|
||||
this.pitch = look.pitch;
|
||||
public void set(ILook look) {
|
||||
this.yaw = look.getYaw();
|
||||
this.pitch = look.getPitch();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ public interface Player {
|
||||
|
||||
Location getLocation();
|
||||
|
||||
Look getLook();
|
||||
ILook getLook();
|
||||
|
||||
boolean isFlying();
|
||||
void setFlying(boolean value);
|
||||
|
||||
@@ -11,7 +11,7 @@ import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
public interface PlayerManager {
|
||||
Player createPlayer(String name, Location defaultLocation, Look defaultLook);
|
||||
Player createPlayer(String name, Location defaultLocation, ILook defaultLook);
|
||||
void joinServer(Player player);
|
||||
void leftServer(Player player);
|
||||
Optional<Player> getPlayer(String name);
|
||||
|
||||
@@ -18,7 +18,7 @@ public class SimplePlayer implements Player {
|
||||
private boolean online = false;
|
||||
private NetChannel channel;
|
||||
private Location location = new Location(0, 0, 0);
|
||||
private Look look = new Look(0, 0);
|
||||
private ILook look = new Look(0, 0);
|
||||
private boolean flying = false;
|
||||
private PlayerSettings settings;
|
||||
|
||||
@@ -26,7 +26,7 @@ public class SimplePlayer implements Player {
|
||||
this.location.set(location);
|
||||
}
|
||||
|
||||
public void setLook(Look look) {
|
||||
public void setLook(ILook look) {
|
||||
this.look.set(look);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user