Merge branch 'master' of https://github.com/Anuken/Mindustry into 4.0

This commit is contained in:
Anuken
2018-04-14 20:45:46 -04:00
3 changed files with 84 additions and 8 deletions

View File

@@ -81,6 +81,8 @@ public class NetServer extends Module{
return;
}
Log.info("Recieved connect packet for player '{0}' / UUID {1} / IP {2}", packet.name, uuid, trace.ip);
String ip = Net.getConnection(id).address;
admins.updatePlayerJoined(uuid, ip, packet.name);
@@ -94,8 +96,6 @@ public class NetServer extends Module{
trace.modclient = true;
}
Log.info("Sending data to player '{0}' / {1}", packet.name, id);
Player player = new Player();
player.isAdmin = admins.isAdmin(uuid, ip);
player.clientid = id;
@@ -165,12 +165,12 @@ public class NetServer extends Module{
TraceInfo info = admins.getTrace(Net.getConnection(id).address);
Weapon weapon = Upgrade.getByID((byte)packet.data);
float wtrc = 60;
float wtrc = 80;
if(!Timers.get("fastshoot-" + id + "-" + weapon.id, wtrc)){
info.fastShots.getAndIncrement(weapon.id, 0, 1);
if(info.fastShots.get(weapon.id, 0) > (int)(wtrc / (weapon.getReload() / 2f)) + 2){
if(info.fastShots.get(weapon.id, 0) > (int)(wtrc / (weapon.getReload() / 2f)) + 6){
kick(id, KickReason.kick);
}
}else{

View File

@@ -184,6 +184,18 @@ public class Administration {
return result;
}
public Array<PlayerInfo> findByIPs(String ip){
Array<PlayerInfo> result = new Array<>();
for(PlayerInfo info : playerInfo.values()){
if(info.ips.contains(ip, false)){
result.add(info);
}
}
return result;
}
public PlayerInfo getInfo(String id){
return getCreateInfo(id);
}