Archived
0

Reverted location-fix

This commit is contained in:
Daniil
2018-08-10 03:34:11 +07:00
parent 57dc918888
commit dc0b85c23b
10 changed files with 19 additions and 18 deletions

View File

@@ -36,7 +36,7 @@ public class WarpPosition extends Location implements Serializable, ILook {
super(location.getX(), location.getY(), location.getZ()); super(location.getX(), location.getY(), location.getZ());
} }
public WarpPosition(Location location, ILook look) { public WarpPosition(Location location, Look look) {
super(location.getX(), location.getY(), location.getZ()); super(location.getX(), location.getY(), location.getZ());
this.look = look; this.look = look;
} }
@@ -46,7 +46,7 @@ public class WarpPosition extends Location implements Serializable, ILook {
} }
@Override @Override
public void set(ILook look) { public void set(Look look) {
this.look = look; this.look = look;
} }

View File

@@ -8,7 +8,7 @@ import mc.core.Location;
import mc.core.chat.MessageType; import mc.core.chat.MessageType;
import mc.core.network.NetChannel; import mc.core.network.NetChannel;
import mc.core.network.SCPacket; import mc.core.network.SCPacket;
import mc.core.player.ILook; import mc.core.player.Look;
import mc.core.player.Player; import mc.core.player.Player;
import mc.core.player.PlayerManager; import mc.core.player.PlayerManager;
import mc.core.text.Text; import mc.core.text.Text;
@@ -52,7 +52,7 @@ public class FakePlayerManager implements PlayerManager {
private static final NetChannel FAKE_NET_CHANNEL = new FakeNetChannet(); private static final NetChannel FAKE_NET_CHANNEL = new FakeNetChannet();
@Override @Override
public Player createPlayer(String name, Location defaultLocation, ILook defaultLook) { public Player createPlayer(String name, Location defaultLocation, Look defaultLook) {
return null; return null;
} }

View File

@@ -7,7 +7,7 @@ package mc.core.events;
import lombok.Getter; import lombok.Getter;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.Setter; import lombok.Setter;
import mc.core.player.ILook; import mc.core.player.Look;
import mc.core.player.Player; import mc.core.player.Player;
@RequiredArgsConstructor @RequiredArgsConstructor
@@ -15,5 +15,5 @@ import mc.core.player.Player;
@Setter @Setter
public class PlayerLookEvent extends EventBase { public class PlayerLookEvent extends EventBase {
private final Player player; private final Player player;
private ILook newLook; private Look newLook;
} }

View File

@@ -1,7 +1,9 @@
package mc.core.player; package mc.core.player;
public interface ILook { import java.io.Serializable;
void set(ILook look);
public interface ILook extends Serializable {
void set(Look look);
float getYaw(); float getYaw();

View File

@@ -31,7 +31,7 @@ public class InMemoryPlayerManager implements PlayerManager, Runnable {
} }
@Override @Override
public Player createPlayer(String name, Location defaultLocation, ILook defaultLook) { public Player createPlayer(String name, Location defaultLocation, Look defaultLook) {
SimplePlayer player = new SimplePlayer(); SimplePlayer player = new SimplePlayer();
player.setId(rand.nextInt(10000)); player.setId(rand.nextInt(10000));
player.setUUID(UUID.nameUUIDFromBytes(name.getBytes())); player.setUUID(UUID.nameUUIDFromBytes(name.getBytes()));

View File

@@ -13,8 +13,8 @@ public class Look implements ILook {
private float yaw, pitch; private float yaw, pitch;
@Override @Override
public void set(ILook look) { public void set(Look look) {
this.yaw = look.getYaw(); this.yaw = look.yaw;
this.pitch = look.getPitch(); this.pitch = look.pitch;
} }
} }

View File

@@ -20,7 +20,7 @@ public interface Player {
Location getLocation(); Location getLocation();
ILook getLook(); Look getLook();
boolean isFlying(); boolean isFlying();
void setFlying(boolean value); void setFlying(boolean value);

View File

@@ -11,7 +11,7 @@ import java.util.List;
import java.util.Optional; import java.util.Optional;
public interface PlayerManager { public interface PlayerManager {
Player createPlayer(String name, Location defaultLocation, ILook defaultLook); Player createPlayer(String name, Location defaultLocation, Look defaultLook);
void joinServer(Player player); void joinServer(Player player);
void leftServer(Player player); void leftServer(Player player);
Optional<Player> getPlayer(String name); Optional<Player> getPlayer(String name);

View File

@@ -18,7 +18,7 @@ public class SimplePlayer implements Player {
private boolean online = false; private boolean online = false;
private NetChannel channel; private NetChannel channel;
private Location location = new Location(0, 0, 0); private Location location = new Location(0, 0, 0);
private ILook look = new Look(0, 0); private Look look = new Look(0, 0);
private boolean flying = false; private boolean flying = false;
private PlayerSettings settings; private PlayerSettings settings;
@@ -26,7 +26,7 @@ public class SimplePlayer implements Player {
this.location.set(location); this.location.set(location);
} }
public void setLook(ILook look) { public void setLook(Look look) {
this.look.set(look); this.look.set(look);
} }

View File

@@ -10,7 +10,6 @@ import lombok.Setter;
import lombok.ToString; import lombok.ToString;
import mc.core.Location; import mc.core.Location;
import mc.core.network.*; import mc.core.network.*;
import mc.core.player.ILook;
import mc.core.player.Look; import mc.core.player.Look;
@NoArgsConstructor @NoArgsConstructor
@@ -19,7 +18,7 @@ import mc.core.player.Look;
@ToString @ToString
public class PlayerPositionAndLookPacket implements SCPacket, CSPacket { public class PlayerPositionAndLookPacket implements SCPacket, CSPacket {
private Location location; private Location location;
private ILook look; private Look look;
private int teleportId; private int teleportId;
private boolean onGround = false; private boolean onGround = false;