Fixed compilation errors / Re-added basic trace dialog
This commit is contained in:
@@ -89,13 +89,8 @@ trace = Trace Player
|
|||||||
trace.playername = Player name: [accent]{0}
|
trace.playername = Player name: [accent]{0}
|
||||||
trace.ip = IP: [accent]{0}
|
trace.ip = IP: [accent]{0}
|
||||||
trace.id = Unique ID: [accent]{0}
|
trace.id = Unique ID: [accent]{0}
|
||||||
trace.android = Android Client: [accent]{0}
|
trace.mobile = Mobile Client: [accent]{0}
|
||||||
trace.modclient = Custom Client: [accent]{0}
|
trace.modclient = Custom Client: [accent]{0}
|
||||||
trace.totalblocksbroken = Total blocks broken: [accent]{0}
|
|
||||||
trace.structureblocksbroken = Structure blocks broken: [accent]{0}
|
|
||||||
trace.lastblockbroken = Last block broken: [accent]{0}
|
|
||||||
trace.totalblocksplaced = Total blocks placed: [accent]{0}
|
|
||||||
trace.lastblockplaced = Last block placed: [accent]{0}
|
|
||||||
invalidid = Invalid client ID! Submit a bug report.
|
invalidid = Invalid client ID! Submit a bug report.
|
||||||
server.bans = Bans
|
server.bans = Bans
|
||||||
server.bans.none = No banned players found!
|
server.bans.none = No banned players found!
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ import io.anuke.mindustry.entities.type.Player;
|
|||||||
import io.anuke.mindustry.game.Version;
|
import io.anuke.mindustry.game.Version;
|
||||||
import io.anuke.mindustry.gen.Call;
|
import io.anuke.mindustry.gen.Call;
|
||||||
import io.anuke.mindustry.gen.RemoteReadClient;
|
import io.anuke.mindustry.gen.RemoteReadClient;
|
||||||
|
import io.anuke.mindustry.net.Administration.TraceInfo;
|
||||||
import io.anuke.mindustry.net.*;
|
import io.anuke.mindustry.net.*;
|
||||||
import io.anuke.mindustry.net.Net.SendMode;
|
import io.anuke.mindustry.net.Net.SendMode;
|
||||||
import io.anuke.mindustry.net.Packets.*;
|
import io.anuke.mindustry.net.Packets.*;
|
||||||
@@ -158,6 +159,13 @@ public class NetClient implements ApplicationListener{
|
|||||||
return "[#" + player.color.toString().toUpperCase() + "]" + name;
|
return "[#" + player.color.toString().toUpperCase() + "]" + name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Remote(variants = Variant.one)
|
||||||
|
public static void onTraceInfo(Player player, TraceInfo info){
|
||||||
|
if(player != null){
|
||||||
|
ui.traces.show(player, info);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Remote(variants = Variant.one, priority = PacketPriority.high)
|
@Remote(variants = Variant.one, priority = PacketPriority.high)
|
||||||
public static void onKick(KickReason reason){
|
public static void onKick(KickReason reason){
|
||||||
netClient.disconnectQuietly();
|
netClient.disconnectQuietly();
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ import io.anuke.mindustry.gen.Call;
|
|||||||
import io.anuke.mindustry.gen.RemoteReadServer;
|
import io.anuke.mindustry.gen.RemoteReadServer;
|
||||||
import io.anuke.mindustry.net.*;
|
import io.anuke.mindustry.net.*;
|
||||||
import io.anuke.mindustry.net.Administration.PlayerInfo;
|
import io.anuke.mindustry.net.Administration.PlayerInfo;
|
||||||
|
import io.anuke.mindustry.net.Administration.TraceInfo;
|
||||||
import io.anuke.mindustry.net.Packets.*;
|
import io.anuke.mindustry.net.Packets.*;
|
||||||
import io.anuke.mindustry.world.Tile;
|
import io.anuke.mindustry.world.Tile;
|
||||||
|
|
||||||
@@ -355,11 +356,12 @@ public class NetServer implements ApplicationListener{
|
|||||||
netServer.kick(other.con.id, KickReason.kick);
|
netServer.kick(other.con.id, KickReason.kick);
|
||||||
Log.info("&lc{0} has kicked {1}.", player.name, other.name);
|
Log.info("&lc{0} has kicked {1}.", player.name, other.name);
|
||||||
}else if(action == AdminAction.trace){
|
}else if(action == AdminAction.trace){
|
||||||
|
TraceInfo info = new TraceInfo(other.con.address, other.uuid, other.con.modclient, other.con.mobile);
|
||||||
//TODO implement
|
//TODO implement
|
||||||
if(player.con != null){
|
if(player.con != null){
|
||||||
//Call.onTraceInfo(player.con.id, other.con.trace);
|
Call.onTraceInfo(player.con.id, other, info);
|
||||||
}else{
|
}else{
|
||||||
//NetClient.onTraceInfo(other.con.trace);
|
NetClient.onTraceInfo(other, info);
|
||||||
}
|
}
|
||||||
Log.info("&lc{0} has requested trace info of {1}.", player.name, other.name);
|
Log.info("&lc{0} has requested trace info of {1}.", player.name, other.name);
|
||||||
}
|
}
|
||||||
@@ -478,7 +480,7 @@ public class NetServer implements ApplicationListener{
|
|||||||
|
|
||||||
sent++;
|
sent++;
|
||||||
|
|
||||||
if(syncStream.position() > maxSnapshotSize){
|
if(syncStream.size() > maxSnapshotSize){
|
||||||
dataStream.close();
|
dataStream.close();
|
||||||
byte[] syncBytes = syncStream.toByteArray();
|
byte[] syncBytes = syncStream.toByteArray();
|
||||||
Call.onEntitySnapshot(player.con.id, (byte)group.getID(), (short)sent, (short)syncBytes.length, Net.compressSnapshot(syncBytes));
|
Call.onEntitySnapshot(player.con.id, (byte)group.getID(), (short)sent, (short)syncBytes.length, Net.compressSnapshot(syncBytes));
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ import io.anuke.mindustry.entities.traits.BuilderTrait.BuildRequest;
|
|||||||
import io.anuke.mindustry.entities.traits.ShooterTrait;
|
import io.anuke.mindustry.entities.traits.ShooterTrait;
|
||||||
import io.anuke.mindustry.entities.type.*;
|
import io.anuke.mindustry.entities.type.*;
|
||||||
import io.anuke.mindustry.game.Team;
|
import io.anuke.mindustry.game.Team;
|
||||||
|
import io.anuke.mindustry.net.Administration.TraceInfo;
|
||||||
import io.anuke.mindustry.net.Packets.AdminAction;
|
import io.anuke.mindustry.net.Packets.AdminAction;
|
||||||
import io.anuke.mindustry.net.Packets.KickReason;
|
import io.anuke.mindustry.net.Packets.KickReason;
|
||||||
import io.anuke.mindustry.type.*;
|
import io.anuke.mindustry.type.*;
|
||||||
@@ -281,6 +282,19 @@ public class TypeIO{
|
|||||||
return bytes;
|
return bytes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@WriteClass(TraceInfo.class)
|
||||||
|
public static void writeTraceInfo(ByteBuffer buffer, TraceInfo trace){
|
||||||
|
writeString(buffer, trace.ip);
|
||||||
|
writeString(buffer, trace.uuid);
|
||||||
|
buffer.put(trace.modded ? (byte)1 : 0);
|
||||||
|
buffer.put(trace.mobile ? (byte)1 : 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
@ReadClass(TraceInfo.class)
|
||||||
|
public static TraceInfo readTraceInfo(ByteBuffer buffer){
|
||||||
|
return new TraceInfo(readString(buffer), readString(buffer), buffer.get() == 1, buffer.get() == 1);
|
||||||
|
}
|
||||||
|
|
||||||
public static void writeStringData(DataOutput buffer, String string) throws IOException{
|
public static void writeStringData(DataOutput buffer, String string) throws IOException{
|
||||||
if(string != null){
|
if(string != null){
|
||||||
byte[] bytes = string.getBytes(charset);
|
byte[] bytes = string.getBytes(charset);
|
||||||
|
|||||||
@@ -285,4 +285,16 @@ public class Administration{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static class TraceInfo{
|
||||||
|
public String ip, uuid;
|
||||||
|
public boolean modded, mobile;
|
||||||
|
|
||||||
|
public TraceInfo(String ip, String uuid, boolean modded, boolean mobile){
|
||||||
|
this.ip = ip;
|
||||||
|
this.uuid = uuid;
|
||||||
|
this.modded = modded;
|
||||||
|
this.mobile = mobile;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,21 +1,26 @@
|
|||||||
package io.anuke.mindustry.ui.dialogs;
|
package io.anuke.mindustry.ui.dialogs;
|
||||||
|
|
||||||
|
import io.anuke.arc.Core;
|
||||||
|
import io.anuke.arc.scene.ui.layout.Table;
|
||||||
|
import io.anuke.mindustry.entities.type.Player;
|
||||||
|
import io.anuke.mindustry.net.Administration.TraceInfo;
|
||||||
|
|
||||||
public class TraceDialog extends FloatingDialog{
|
public class TraceDialog extends FloatingDialog{
|
||||||
|
|
||||||
public TraceDialog(){
|
public TraceDialog(){
|
||||||
super("$trace");
|
super("$trace");
|
||||||
|
|
||||||
addCloseButton();
|
addCloseButton();
|
||||||
|
setFillParent(false);
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
public void show(Player player, SessionInfo info){
|
public void show(Player player, TraceInfo info){
|
||||||
cont.clear();
|
cont.clear();
|
||||||
|
|
||||||
Table table = new Table("clear");
|
Table table = new Table("clear");
|
||||||
table.margin(14);
|
table.margin(14);
|
||||||
table.defaults().pad(1);
|
table.defaults().pad(1);
|
||||||
|
|
||||||
/*
|
|
||||||
table.defaults().left();
|
table.defaults().left();
|
||||||
table.add(Core.bundle.format("trace.playername", player.name));
|
table.add(Core.bundle.format("trace.playername", player.name));
|
||||||
table.row();
|
table.row();
|
||||||
@@ -23,33 +28,16 @@ public class TraceDialog extends FloatingDialog{
|
|||||||
table.row();
|
table.row();
|
||||||
table.add(Core.bundle.format("trace.id", info.uuid));
|
table.add(Core.bundle.format("trace.id", info.uuid));
|
||||||
table.row();
|
table.row();
|
||||||
table.add(Core.bundle.format("trace.modclient", info.modclient));
|
table.add(Core.bundle.format("trace.modclient", info.modded));
|
||||||
table.row();
|
table.row();
|
||||||
table.add(Core.bundle.format("trace.android", info.android));
|
table.add(Core.bundle.format("trace.mobile", info.mobile));
|
||||||
table.row();
|
table.row();
|
||||||
|
|
||||||
table.add().pad(5);
|
table.add().pad(5);
|
||||||
table.row();
|
table.row();
|
||||||
|
|
||||||
//disabled until further notice
|
|
||||||
/*
|
|
||||||
table.add(Core.bundle.format("trace.totalblocksbroken", info.totalBlocksBroken));
|
|
||||||
table.row();
|
|
||||||
table.add(Core.bundle.format("trace.structureblocksbroken", info.structureBlocksBroken));
|
|
||||||
table.row();
|
|
||||||
table.add(Core.bundle.format("trace.lastblockbroken", info.lastBlockBroken.localizedName));
|
|
||||||
table.row();
|
|
||||||
|
|
||||||
table.add().pad(5);
|
|
||||||
table.row();
|
|
||||||
|
|
||||||
table.add(Core.bundle.format("trace.totalblocksplaced", info.totalBlocksPlaced));
|
|
||||||
table.row();
|
|
||||||
table.add(Core.bundle.format("trace.lastblockplaced", info.lastBlockPlaced.localizedName));
|
|
||||||
table.row();
|
|
||||||
|
|
||||||
cont.add(table);
|
cont.add(table);
|
||||||
|
|
||||||
show();
|
show();
|
||||||
}*/
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -128,7 +128,7 @@ public class PlayerListFragment extends Fragment{
|
|||||||
.touchable(() -> Net.client() ? Touchable.disabled : Touchable.enabled)
|
.touchable(() -> Net.client() ? Touchable.disabled : Touchable.enabled)
|
||||||
.checked(user.isAdmin);
|
.checked(user.isAdmin);
|
||||||
|
|
||||||
t.addImageButton("icon-zoom-small", "clear-partial", 14 * 2, () -> ui.showError("Currently unimplemented.")/*Call.onAdminRequest(user, AdminAction.trace)*/);
|
t.addImageButton("icon-zoom-small", "clear-partial", 14 * 2, () -> Call.onAdminRequest(user, AdminAction.trace));
|
||||||
|
|
||||||
}).padRight(12).size(bs + 10f, bs);
|
}).padRight(12).size(bs + 10f, bs);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user