успешный логин
This commit is contained in:
@@ -10,7 +10,7 @@ import lombok.Setter;
|
||||
public abstract class NetStream {
|
||||
@Getter
|
||||
@Setter
|
||||
private int expectedSize;
|
||||
private int dataSize;
|
||||
|
||||
public abstract boolean readBoolean();
|
||||
public abstract byte readByte();
|
||||
@@ -27,6 +27,7 @@ public abstract class NetStream {
|
||||
|
||||
public abstract void writeBoolean(boolean value);
|
||||
public abstract void writeByte(int value);
|
||||
public abstract void writeUnsignedByte(int value);
|
||||
public abstract void writeBytes(byte[] buffer);
|
||||
public abstract void writeShort(int value);
|
||||
public abstract void writeInt(int value);
|
||||
|
||||
@@ -34,6 +34,7 @@ public class InMemoryPlayerManager implements PlayerManager, Runnable {
|
||||
public Player createPlayer(String name, Location defaultLocation, Look defaultLook) {
|
||||
SimplePlayer player = new SimplePlayer();
|
||||
player.setId(rand.nextInt(10000));
|
||||
player.setUUID(UUID.nameUUIDFromBytes(name.getBytes()));
|
||||
player.setName(name);
|
||||
player.getLocation().set(defaultLocation);
|
||||
player.getLook().set(defaultLook);
|
||||
|
||||
@@ -7,8 +7,11 @@ package mc.core.player;
|
||||
import mc.core.Location;
|
||||
import mc.core.network.NetChannel;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
public interface Player {
|
||||
int getId();
|
||||
UUID getUUID();
|
||||
String getName();
|
||||
boolean isOnline();
|
||||
|
||||
|
||||
@@ -11,7 +11,9 @@ import lombok.RequiredArgsConstructor;
|
||||
@Getter
|
||||
public enum PlayerMode {
|
||||
SURVIVAL(0),
|
||||
CREATIVE(1);
|
||||
CREATIVE(1),
|
||||
ADVENTURE(2),
|
||||
SPECTATOR(3);
|
||||
|
||||
private final int id;
|
||||
}
|
||||
|
||||
@@ -8,9 +8,12 @@ import lombok.Data;
|
||||
import mc.core.Location;
|
||||
import mc.core.network.NetChannel;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
@Data
|
||||
public class SimplePlayer implements Player {
|
||||
private int id;
|
||||
private UUID uuid;
|
||||
private String name;
|
||||
private boolean online = false;
|
||||
private NetChannel channel;
|
||||
@@ -25,4 +28,13 @@ public class SimplePlayer implements Player {
|
||||
public void setLook(Look look) {
|
||||
this.look.set(look);
|
||||
}
|
||||
|
||||
@Override
|
||||
public UUID getUUID() {
|
||||
return uuid;
|
||||
}
|
||||
|
||||
public void setUUID(UUID uuid) {
|
||||
this.uuid = uuid;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user