[FEATURE] Улучшение API Client/FeaturesManager

This commit is contained in:
Gravita 2021-02-07 21:42:04 +07:00
parent bac794b912
commit d0f13743ed
2 changed files with 17 additions and 1 deletions

View file

@ -14,7 +14,7 @@ public FeaturesManager(LaunchServer server) {
this.server = server; this.server = server;
map = new HashMap<>(); map = new HashMap<>();
addFeatureInfo("version", Version.getVersion().getVersionString()); addFeatureInfo("version", Version.getVersion().getVersionString());
addFeatureInfo("projectName", server.config.projectName);
} }
public Map<String, String> getMap() { public Map<String, String> getMap() {

View file

@ -32,6 +32,8 @@ public class Client {
public transient Map<String, Object> properties; public transient Map<String, Object> properties;
public Map<String, String> serializableProperties;
public transient AtomicInteger refCount = new AtomicInteger(1); public transient AtomicInteger refCount = new AtomicInteger(1);
public Client(UUID session) { public Client(UUID session) {
@ -55,6 +57,7 @@ public void updateAuth(LaunchServer server) {
else auth = server.config.getAuthProviderPair(auth_id); else auth = server.config.getAuthProviderPair(auth_id);
} }
@Deprecated
public enum Type { public enum Type {
SERVER, SERVER,
USER USER
@ -65,6 +68,9 @@ public static class TrustLevel {
public boolean keyChecked; public boolean keyChecked;
public byte[] publicKey; public byte[] publicKey;
public HardwareReportRequest.HardwareInfo hardwareInfo; public HardwareReportRequest.HardwareInfo hardwareInfo;
// May be used later
public double rating;
public long latestMillis;
} }
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
@ -77,4 +83,14 @@ public <T> void setProperty(String name, T object) {
if (properties == null) properties = new HashMap<>(); if (properties == null) properties = new HashMap<>();
properties.put(name, object); properties.put(name, object);
} }
public String getSerializableProperty(String name) {
if (serializableProperties == null) serializableProperties = new HashMap<>();
return serializableProperties.get(name);
}
public void setSerializableProperty(String name, String value) {
if (serializableProperties == null) serializableProperties = new HashMap<>();
properties.put(name, value);
}
} }