Seq.
This commit is contained in:
@@ -20,11 +20,11 @@ import static mindustry.game.EventType.*;
|
||||
public class Administration{
|
||||
/** All player info. Maps UUIDs to info. This persists throughout restarts. */
|
||||
private ObjectMap<String, PlayerInfo> playerInfo = new ObjectMap<>();
|
||||
private Array<String> bannedIPs = new Array<>();
|
||||
private Array<String> whitelist = new Array<>();
|
||||
private Array<ChatFilter> chatFilters = new Array<>();
|
||||
private Array<ActionFilter> actionFilters = new Array<>();
|
||||
private Array<String> subnetBans = new Array<>();
|
||||
private Seq<String> bannedIPs = new Seq<>();
|
||||
private Seq<String> whitelist = new Seq<>();
|
||||
private Seq<ChatFilter> chatFilters = new Seq<>();
|
||||
private Seq<ActionFilter> actionFilters = new Seq<>();
|
||||
private Seq<String> subnetBans = new Seq<>();
|
||||
private IntIntMap lastPlaced = new IntIntMap();
|
||||
|
||||
public Administration(){
|
||||
@@ -97,7 +97,7 @@ public class Administration{
|
||||
});
|
||||
}
|
||||
|
||||
public Array<String> getSubnetBans(){
|
||||
public Seq<String> getSubnetBans(){
|
||||
return subnetBans;
|
||||
}
|
||||
|
||||
@@ -256,8 +256,8 @@ public class Administration{
|
||||
/**
|
||||
* Returns list of all players with admin status
|
||||
*/
|
||||
public Array<PlayerInfo> getAdmins(){
|
||||
Array<PlayerInfo> result = new Array<>();
|
||||
public Seq<PlayerInfo> getAdmins(){
|
||||
Seq<PlayerInfo> result = new Seq<>();
|
||||
for(PlayerInfo info : playerInfo.values()){
|
||||
if(info.admin){
|
||||
result.add(info);
|
||||
@@ -269,8 +269,8 @@ public class Administration{
|
||||
/**
|
||||
* Returns list of all players which are banned
|
||||
*/
|
||||
public Array<PlayerInfo> getBanned(){
|
||||
Array<PlayerInfo> result = new Array<>();
|
||||
public Seq<PlayerInfo> getBanned(){
|
||||
Seq<PlayerInfo> result = new Seq<>();
|
||||
for(PlayerInfo info : playerInfo.values()){
|
||||
if(info.banned){
|
||||
result.add(info);
|
||||
@@ -282,7 +282,7 @@ public class Administration{
|
||||
/**
|
||||
* Returns all banned IPs. This does not include the IPs of ID-banned players.
|
||||
*/
|
||||
public Array<String> getBannedIPs(){
|
||||
public Seq<String> getBannedIPs(){
|
||||
return bannedIPs;
|
||||
}
|
||||
|
||||
@@ -384,8 +384,8 @@ public class Administration{
|
||||
return result;
|
||||
}
|
||||
|
||||
public Array<PlayerInfo> findByIPs(String ip){
|
||||
Array<PlayerInfo> result = new Array<>();
|
||||
public Seq<PlayerInfo> findByIPs(String ip){
|
||||
Seq<PlayerInfo> result = new Seq<>();
|
||||
|
||||
for(PlayerInfo info : playerInfo.values()){
|
||||
if(info.ips.contains(ip, false)){
|
||||
@@ -413,7 +413,7 @@ public class Administration{
|
||||
return null;
|
||||
}
|
||||
|
||||
public Array<PlayerInfo> getWhitelisted(){
|
||||
public Seq<PlayerInfo> getWhitelisted(){
|
||||
return playerInfo.values().toArray().select(p -> isWhitelisted(p.id, p.adminUsid));
|
||||
}
|
||||
|
||||
@@ -440,9 +440,9 @@ public class Administration{
|
||||
if(!loadLegacy()){
|
||||
//load default data
|
||||
playerInfo = Core.settings.getJson("player-data", ObjectMap.class, ObjectMap::new);
|
||||
bannedIPs = Core.settings.getJson("ip-bans", Array.class, Array::new);
|
||||
whitelist = Core.settings.getJson("whitelist-ids", Array.class, Array::new);
|
||||
subnetBans = Core.settings.getJson("banned-subnets", Array.class, Array::new);
|
||||
bannedIPs = Core.settings.getJson("ip-bans", Seq.class, Seq::new);
|
||||
whitelist = Core.settings.getJson("whitelist-ids", Seq.class, Seq::new);
|
||||
subnetBans = Core.settings.getJson("banned-subnets", Seq.class, Seq::new);
|
||||
}else{
|
||||
//save over loaded legacy data
|
||||
save();
|
||||
@@ -631,8 +631,8 @@ public class Administration{
|
||||
public static class PlayerInfo{
|
||||
public String id;
|
||||
public String lastName = "<unknown>", lastIP = "<unknown>";
|
||||
public Array<String> ips = new Array<>();
|
||||
public Array<String> names = new Array<>();
|
||||
public Seq<String> ips = new Seq<>();
|
||||
public Seq<String> names = new Seq<>();
|
||||
public String adminUsid;
|
||||
public int timesKicked;
|
||||
public int timesJoined;
|
||||
|
||||
@@ -198,7 +198,7 @@ public class ArcNetProvider implements NetProvider{
|
||||
|
||||
@Override
|
||||
public void discoverServers(Cons<Host> callback, Runnable done){
|
||||
Array<InetAddress> foundAddresses = new Array<>();
|
||||
Seq<InetAddress> foundAddresses = new Seq<>();
|
||||
client.discoverHosts(port, multicastGroup, multicastPort, 3000, packet -> {
|
||||
Core.app.post(() -> {
|
||||
try{
|
||||
|
||||
@@ -23,7 +23,7 @@ public class Net{
|
||||
private boolean clientLoaded;
|
||||
private @Nullable StreamBuilder currentStream;
|
||||
|
||||
private final Array<Object> packetQueue = new Array<>();
|
||||
private final Seq<Object> packetQueue = new Seq<>();
|
||||
private final ObjectMap<Class<?>, Cons> clientListeners = new ObjectMap<>();
|
||||
private final ObjectMap<Class<?>, Cons2<NetConnection, Object>> serverListeners = new ObjectMap<>();
|
||||
private final IntMap<StreamBuilder> streams = new IntMap<>();
|
||||
|
||||
@@ -27,7 +27,7 @@ public abstract class NetConnection{
|
||||
/** Timestamp of last recieved snapshot. */
|
||||
public long lastRecievedClientTime;
|
||||
/** Build requests that have been recently rejected. This is cleared every snapshot. */
|
||||
public Array<BuildRequest> rejectedRequests = new Array<>();
|
||||
public Seq<BuildRequest> rejectedRequests = new Seq<>();
|
||||
|
||||
public boolean hasConnected, hasBegunConnecting, hasDisconnected;
|
||||
public float viewWidth, viewHeight, viewX, viewY;
|
||||
|
||||
@@ -159,7 +159,7 @@ public class Packets{
|
||||
public static class ConnectPacket implements Packet{
|
||||
public int version;
|
||||
public String versionType;
|
||||
public Array<String> mods;
|
||||
public Seq<String> mods;
|
||||
public String name, uuid, usid;
|
||||
public boolean mobile;
|
||||
public int color;
|
||||
@@ -196,7 +196,7 @@ public class Packets{
|
||||
mobile = buffer.get() == 1;
|
||||
color = buffer.getInt();
|
||||
int totalMods = buffer.get();
|
||||
mods = new Array<>(totalMods);
|
||||
mods = new Seq<>(totalMods);
|
||||
for(int i = 0; i < totalMods; i++){
|
||||
mods.add(TypeIO.readString(buffer));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user