Fixed many crashes with B14, added color customization
This commit is contained in:
@@ -21,7 +21,7 @@ import java.io.IOException;
|
||||
import static io.anuke.mindustry.Vars.*;
|
||||
|
||||
public class Net{
|
||||
public static final int version = 14;
|
||||
public static final int version = 15;
|
||||
|
||||
private static boolean server;
|
||||
private static boolean active;
|
||||
@@ -94,6 +94,11 @@ public class Net{
|
||||
public static Array<NetConnection> getConnections(){
|
||||
return (Array<NetConnection>)serverProvider.getConnections();
|
||||
}
|
||||
|
||||
/**Returns a connection by ID*/
|
||||
public static NetConnection getConnection(int id){
|
||||
return serverProvider.getByID(id);
|
||||
}
|
||||
|
||||
/**Send an object to all connected clients, or to the server if this is a client.*/
|
||||
public static void send(Object object, SendMode mode){
|
||||
@@ -261,6 +266,8 @@ public class Net{
|
||||
void close();
|
||||
/**Return all connected users.*/
|
||||
Array<? extends NetConnection> getConnections();
|
||||
/**Returns a connection by ID.*/
|
||||
NetConnection getByID(int id);
|
||||
/**Kick a certain connection.*/
|
||||
void kick(int connection, KickReason reason);
|
||||
/**Returns the ping for a certain connection.*/
|
||||
|
||||
@@ -52,6 +52,7 @@ public class Packets {
|
||||
public int version;
|
||||
public String name;
|
||||
public boolean android;
|
||||
public int color;
|
||||
|
||||
@Override
|
||||
public void write(ByteBuffer buffer) {
|
||||
@@ -59,6 +60,7 @@ public class Packets {
|
||||
buffer.put((byte)name.getBytes().length);
|
||||
buffer.put(name.getBytes());
|
||||
buffer.put(android ? (byte)1 : 0);
|
||||
buffer.putInt(color);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -69,6 +71,7 @@ public class Packets {
|
||||
buffer.get(bytes);
|
||||
name = new String(bytes);
|
||||
android = buffer.get() == 1;
|
||||
color = buffer.getInt();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -29,6 +29,8 @@ public class ServerDebug {
|
||||
build.append(player.clientid);
|
||||
build.append(" / player '");
|
||||
build.append(player.name);
|
||||
build.append(" android: ");
|
||||
build.append(player.isAndroid);
|
||||
build.append("'\n");
|
||||
|
||||
for(Class<?> type : map.orderedKeys()){
|
||||
|
||||
Reference in New Issue
Block a user