This commit is contained in:
Anuken
2020-07-30 21:41:17 -04:00
parent b12c25bc0b
commit ff990925f0
8 changed files with 15 additions and 41 deletions

View File

@ -64,24 +64,6 @@ public class AndroidLauncher extends AndroidApplication{
moveTaskToBack(true);
}
@Override
public String getUUID(){
try{
String s = Secure.getString(getContext().getContentResolver(), Secure.ANDROID_ID);
int len = s.length();
byte[] data = new byte[len / 2];
for(int i = 0; i < len; i += 2){
data[i / 2] = (byte)((Character.digit(s.charAt(i), 16) << 4)
+ Character.digit(s.charAt(i + 1), 16));
}
String result = new String(Base64Coder.encode(data));
if(result.equals("AAAAAAAAAOA=")) throw new RuntimeException("Bad UUID.");
return result;
}catch(Exception e){
return super.getUUID();
}
}
@Override
public rhino.Context getScriptContext(){
return AndroidRhinoContext.enter(getContext().getCacheDir());

Binary file not shown.

View File

@ -687,6 +687,7 @@ public class NetServer implements ApplicationListener{
logic.skipWave();
}else if(action == AdminAction.ban){
netServer.admins.banPlayerIP(other.con.address);
netServer.admins.banPlayerID(other.con.uuid);
other.kick(KickReason.banned);
Log.info("&lc@ has banned @.", player.name, other.name);
}else if(action == AdminAction.kick){

View File

@ -79,6 +79,8 @@ public class SectorInfo{
//update sector's internal time spent counter1
state.rules.sector.setTimeSpent(internalTimeSpent);
Log.info(production);
}
/** Update averages of various stats, updates some special sector logic.
@ -160,5 +162,9 @@ public class SectorInfo{
/** mean in terms of items produced per refresh rate (currently, per second) */
public float mean;
public String toString(){
return mean + "";
}
}
}

View File

@ -31,6 +31,6 @@ public class SaveMeta{
this.mods = JsonIO.read(String[].class, tags.get("mods", "[]"));
this.secinfo = secinfo;
secinfo.exportRates().each(e -> hasProduction |= e.value > 0.001f);
secinfo.production.each((e, amount) -> hasProduction |= amount.mean > 0.001f);
}
}

View File

@ -171,9 +171,10 @@ public class Packets{
TypeIO.writeString(buffer, name);
TypeIO.writeString(buffer, usid);
buffer.put(Base64Coder.decode(uuid));
byte[] b = Base64Coder.decode(uuid);
buffer.put(b);
CRC32 crc = new CRC32();
crc.update(Base64Coder.decode(uuid));
crc.update(Base64Coder.decode(uuid), 0, b.length);
buffer.putLong(crc.getValue());
buffer.put(mobile ? (byte)1 : 0);

View File

@ -44,6 +44,8 @@ public class PlanetDialog extends BaseDialog implements PlanetInterfaceRenderer{
public PlanetDialog(){
super("", Styles.fullDialog);
shouldPause = true;
getCell(buttons).padBottom(-4);
buttons.background(Styles.black).defaults().growX().height(64f).pad(0);

View File

@ -16,14 +16,12 @@ import mindustry.*;
import mindustry.core.*;
import mindustry.desktop.steam.*;
import mindustry.game.EventType.*;
import mindustry.gen.*;
import mindustry.net.*;
import mindustry.net.Net.*;
import mindustry.type.*;
import mindustry.gen.*;
import java.io.*;
import java.net.*;
import java.util.*;
import static mindustry.Vars.*;
@ -307,23 +305,7 @@ public class DesktopLauncher extends ClientLauncher{
}
}
try{
Enumeration<NetworkInterface> e = NetworkInterface.getNetworkInterfaces();
NetworkInterface out;
for(out = e.nextElement(); (out.getHardwareAddress() == null || out.isVirtual() || !validAddress(out.getHardwareAddress())) && e.hasMoreElements(); out = e.nextElement());
byte[] bytes = out.getHardwareAddress();
byte[] result = new byte[8];
System.arraycopy(bytes, 0, result, 0, bytes.length);
String str = new String(Base64Coder.encode(result));
if(str.equals("AAAAAAAAAOA=") || str.equals("AAAAAAAAAAA=")) throw new RuntimeException("Bad UUID.");
return str;
}catch(Exception e){
return super.getUUID();
}
return super.getUUID();
}
private static void message(String message){