API changes for getting traces and upgrades
This commit is contained in:
@@ -31,10 +31,10 @@ public class Administration {
|
||||
}
|
||||
|
||||
/**Returns trace info by IP.*/
|
||||
public TraceInfo getTrace(String ip){
|
||||
if(!traceInfo.containsKey(ip)) traceInfo.put(ip, new TraceInfo(ip));
|
||||
public TraceInfo getTraceByID(String uuid){
|
||||
if(!traceInfo.containsKey(uuid)) traceInfo.put(uuid, new TraceInfo(uuid));
|
||||
|
||||
return traceInfo.get(ip);
|
||||
return traceInfo.get(uuid);
|
||||
}
|
||||
|
||||
public void clearTraces(){
|
||||
|
||||
@@ -133,7 +133,7 @@ public class NetEvents {
|
||||
if(Net.client()) {
|
||||
handleAdministerRequest(target, AdminAction.trace);
|
||||
}else{
|
||||
ui.traces.show(target, netServer.admins.getTrace(Net.getConnection(target.clientid).address));
|
||||
ui.traces.show(target, netServer.admins.getTraceByID(target.uuid));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,15 +1,14 @@
|
||||
package io.anuke.mindustry.net;
|
||||
|
||||
import com.badlogic.gdx.utils.ByteArray;
|
||||
import com.badlogic.gdx.utils.TimeUtils;
|
||||
import io.anuke.mindustry.content.Weapons;
|
||||
import io.anuke.mindustry.content.blocks.Blocks;
|
||||
import io.anuke.mindustry.entities.Player;
|
||||
import io.anuke.mindustry.game.GameMode;
|
||||
import io.anuke.mindustry.game.Team;
|
||||
import io.anuke.mindustry.io.Version;
|
||||
import io.anuke.mindustry.resource.Upgrade;
|
||||
import io.anuke.mindustry.world.Tile;
|
||||
import io.anuke.mindustry.content.blocks.Blocks;
|
||||
import io.anuke.mindustry.world.blocks.types.BlockPart;
|
||||
import io.anuke.ucore.core.Timers;
|
||||
import io.anuke.ucore.entities.Entities;
|
||||
@@ -22,7 +21,7 @@ import static io.anuke.mindustry.Vars.*;
|
||||
|
||||
public class NetworkIO {
|
||||
|
||||
public static void writeWorld(Player player, ByteArray upgrades, OutputStream os){
|
||||
public static void writeWorld(Player player, OutputStream os){
|
||||
|
||||
try(DataOutputStream stream = new DataOutputStream(os)){
|
||||
|
||||
@@ -41,10 +40,9 @@ public class NetworkIO {
|
||||
stream.writeInt(player.id); //player remap ID
|
||||
stream.writeBoolean(player.isAdmin);
|
||||
|
||||
stream.writeByte(upgrades.size); //upgrade data
|
||||
|
||||
for(int i = 0; i < upgrades.size; i ++){
|
||||
stream.writeByte(upgrades.get(i));
|
||||
stream.writeByte(player.upgrades.size);
|
||||
for(Upgrade u : player.upgrades){
|
||||
stream.writeByte(u.id);
|
||||
}
|
||||
|
||||
//--MAP DATA--
|
||||
@@ -114,16 +112,13 @@ public class NetworkIO {
|
||||
int pid = stream.readInt();
|
||||
boolean admin = stream.readBoolean();
|
||||
|
||||
control.upgrades().getWeapons().clear();
|
||||
control.upgrades().getWeapons().add(Weapons.blaster);
|
||||
|
||||
byte weapons = stream.readByte();
|
||||
|
||||
for(int i = 0; i < weapons; i ++){
|
||||
control.upgrades().getWeapons().add(Upgrade.getByID(stream.readByte()));
|
||||
player.upgrades.add(Upgrade.getByID(stream.readByte()));
|
||||
}
|
||||
|
||||
player.weapon = control.upgrades().getWeapons().peek();
|
||||
player.weapon = Weapons.blaster;
|
||||
|
||||
Entities.clear();
|
||||
player.id = pid;
|
||||
|
||||
@@ -350,7 +350,7 @@ public class Packets {
|
||||
}
|
||||
|
||||
public enum KickReason{
|
||||
kick, invalidPassword, clientOutdated, serverOutdated, banned, gameover(true), recentKick;
|
||||
kick, invalidPassword, clientOutdated, serverOutdated, banned, gameover(true), recentKick, nameInUse, idInUse;
|
||||
public final boolean quiet;
|
||||
|
||||
KickReason(){ quiet = false; }
|
||||
|
||||
Reference in New Issue
Block a user