Add player ping and server tps to ban metadata
This commit is contained in:
parent
a8c41f8904
commit
f92eae067f
@ -3,6 +3,7 @@ package mineplex.core.antihack.logging.builtin;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.google.gson.JsonElement;
|
||||
@ -18,6 +19,7 @@ public class PlayerInfoMetadata extends AnticheatMetadata
|
||||
private static final String KEY_UUID = "uuid";
|
||||
private static final String KEY_ACCOUNT_ID = "accountid";
|
||||
private static final String KEY_NAME = "name";
|
||||
private static final String KEY_PING = "ping";
|
||||
|
||||
private final CoreClientManager _clientManager = require(CoreClientManager.class);
|
||||
|
||||
@ -38,6 +40,7 @@ public class PlayerInfoMetadata extends AnticheatMetadata
|
||||
{
|
||||
object.addProperty(KEY_NAME, bPlayer.getName());
|
||||
object.addProperty(KEY_ACCOUNT_ID, _clientManager.getAccountId(bPlayer));
|
||||
object.addProperty(KEY_PING, Math.min(((CraftPlayer) bPlayer).getHandle().ping, 1000));
|
||||
}
|
||||
|
||||
return object;
|
||||
|
@ -7,12 +7,14 @@ import com.google.gson.JsonObject;
|
||||
|
||||
import mineplex.core.antihack.logging.AnticheatMetadata;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import net.minecraft.server.v1_8_R3.MinecraftServer;
|
||||
|
||||
public class ServerInfoMetadata extends AnticheatMetadata
|
||||
{
|
||||
private static final String KEY_SERVER_NAME = "server-name";
|
||||
private static final String KEY_SERVER_REGION = "server-region";
|
||||
private static final String KEY_SERVER_GROUP = "server-group";
|
||||
private static final String KEY_SERVER_TPS = "";
|
||||
|
||||
@Override
|
||||
public String getId()
|
||||
@ -27,6 +29,7 @@ public class ServerInfoMetadata extends AnticheatMetadata
|
||||
info.addProperty(KEY_SERVER_NAME, UtilServer.getServerName());
|
||||
info.addProperty(KEY_SERVER_REGION, UtilServer.getRegion().name());
|
||||
info.addProperty(KEY_SERVER_GROUP, UtilServer.getGroup());
|
||||
info.addProperty(KEY_SERVER_TPS, MinecraftServer.getServer().recentTps[0]);
|
||||
return info;
|
||||
}
|
||||
|
||||
@ -35,4 +38,4 @@ public class ServerInfoMetadata extends AnticheatMetadata
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user