Multiplayer fix

This commit is contained in:
Anuken
2022-02-27 20:08:47 -05:00
parent 1fc7f0e58a
commit 84fdd7e3fd
2 changed files with 9 additions and 3 deletions

View File

@@ -999,20 +999,20 @@ public class NetServer implements ApplicationListener{
return result.toString();
}
String checkColor(String str){
static String checkColor(String str){
for(int i = 1; i < str.length(); i++){
if(str.charAt(i) == ']'){
String color = str.substring(1, i);
if(Colors.get(color.toUpperCase()) != null || Colors.get(color.toLowerCase()) != null){
Color result = (Colors.get(color.toLowerCase()) == null ? Colors.get(color.toUpperCase()) : Colors.get(color.toLowerCase()));
if(result.a <= 0.8f){
if(result.a < 1f){
return str.substring(i + 1);
}
}else{
try{
Color result = Color.valueOf(color);
if(result.a <= 0.8f){
if(result.a < 1f){
return str.substring(i + 1);
}
}catch(Exception e){

View File

@@ -338,6 +338,11 @@ public class TypeIO{
//on the network, plans must be capped by size
public static void writePlansQueueNet(Writes write, Queue<BuildPlan> plans){
if(plans == null){
write.i(-1);
return;
}
int used = getMaxPlans(plans);
write.i(used);
@@ -348,6 +353,7 @@ public class TypeIO{
public static Queue<BuildPlan> readPlansQueue(Reads read){
int used = read.i();
if(used == -1) return null;
var out = new Queue<BuildPlan>();
for(int i = 0; i < used; i++){
out.add(readPlan(read));