mirror of
https://github.com/darksaid98/HuskHomes.git
synced 2026-12-02 06:28:49 +00:00
Networking rework, further refactoring
This commit is contained in:
1 parent
1cebdac9b8
commit
4c90e5498c
88 files changed
+1116
-1364
No files matched your search
@@ -10,15 +10,15 @@ import java.util.UUID;
|
||||
*/
|
||||
public class Position extends Location {
|
||||
|
||||
private Server server;
|
||||
private String server;
|
||||
|
||||
public Position(double x, double y, double z, float yaw, float pitch,
|
||||
@NotNull World world, @NotNull Server server) {
|
||||
@NotNull World world, @NotNull String server) {
|
||||
super(x, y, z, yaw, pitch, world);
|
||||
this.setServer(server);
|
||||
}
|
||||
|
||||
public Position(@NotNull Location location, @NotNull Server server) {
|
||||
public Position(@NotNull Location location, @NotNull String server) {
|
||||
super(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch(), location.getWorld());
|
||||
this.setServer(server);
|
||||
}
|
||||
@@ -61,7 +61,7 @@ public class Position extends Location {
|
||||
final double y = parseCoordinate(args[1], relativeTo.getY());
|
||||
final double z = parseCoordinate(args[2], relativeTo.getZ());
|
||||
final World world = args.length > 3 ? new World(args[3], UUID.randomUUID()) : relativeTo.getWorld();
|
||||
final Server server = args.length > 4 ? new Server(args[4]) : relativeTo.getServer();
|
||||
final String server = args.length > 4 ? args[4] : relativeTo.getServer();
|
||||
return Optional.of(new Position(x, y, z, relativeTo.getYaw(), relativeTo.getPitch(), world, server));
|
||||
} catch (NumberFormatException ignored) {
|
||||
return Optional.empty();
|
||||
@@ -90,13 +90,14 @@ public class Position extends Location {
|
||||
}
|
||||
|
||||
/**
|
||||
* The {@link Server} the position is on
|
||||
* The name of the server the position is on
|
||||
*/
|
||||
public Server getServer() {
|
||||
@NotNull
|
||||
public String getServer() {
|
||||
return server;
|
||||
}
|
||||
|
||||
public void setServer(Server server) {
|
||||
public void setServer(@NotNull String server) {
|
||||
this.server = server;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user