forked from TuxCoding/FastLogin
Add toString methods to all relevant classes
This commit is contained in:
@ -12,6 +12,7 @@ import com.github.games647.fastlogin.core.shared.LoginSource;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.net.InetSocketAddress;
|
||||
import java.security.PublicKey;
|
||||
import java.util.Arrays;
|
||||
import java.util.Random;
|
||||
|
||||
import org.apache.commons.lang.ArrayUtils;
|
||||
@ -96,4 +97,15 @@ public class ProtocolLibLoginSource implements LoginSource {
|
||||
public byte[] getVerifyToken() {
|
||||
return ArrayUtils.clone(verifyToken);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return this.getClass().getSimpleName() + '{' +
|
||||
"packetEvent=" + packetEvent +
|
||||
", player=" + player +
|
||||
", random=" + random +
|
||||
", serverId='" + serverId + '\'' +
|
||||
", verifyToken=" + Arrays.toString(verifyToken) +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
@ -32,4 +32,11 @@ public class ProtocolLoginSource implements LoginSource {
|
||||
public PlayerLoginStartEvent getLoginStartEvent() {
|
||||
return loginStartEvent;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return this.getClass().getSimpleName() + '{' +
|
||||
"loginStartEvent=" + loginStartEvent +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
@ -31,4 +31,13 @@ public class BungeeLoginSession extends LoginSession {
|
||||
public void setAlreadyLogged(boolean alreadyLogged) {
|
||||
this.alreadyLogged = alreadyLogged;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return this.getClass().getSimpleName() + '{' +
|
||||
"alreadySaved=" + alreadySaved +
|
||||
", alreadyLogged=" + alreadyLogged +
|
||||
", registered=" + registered +
|
||||
"} " + super.toString();
|
||||
}
|
||||
}
|
||||
|
@ -33,4 +33,11 @@ public class BungeeLoginSource implements LoginSource {
|
||||
public PendingConnection getConnection() {
|
||||
return connection;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return this.getClass().getSimpleName() + '{' +
|
||||
"connection=" + connection +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
@ -7,6 +7,7 @@ import java.util.UUID;
|
||||
import java.util.concurrent.ConcurrentMap;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.logging.Level;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
@ -14,6 +15,8 @@ import org.slf4j.impl.JDK14LoggerAdapter;
|
||||
|
||||
public class CommonUtil {
|
||||
|
||||
private static final Pattern UUID_PATTERN = Pattern.compile("(\\w{8})(\\w{4})(\\w{4})(\\w{4})(\\w{12})");
|
||||
|
||||
private static final char COLOR_CHAR = '&';
|
||||
private static final char TRANSLATED_CHAR = '§';
|
||||
|
||||
@ -34,15 +37,7 @@ public class CommonUtil {
|
||||
}
|
||||
|
||||
public static UUID parseId(String withoutDashes) {
|
||||
if (withoutDashes == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return UUID.fromString(withoutDashes.substring(0, 8)
|
||||
+ '-' + withoutDashes.substring(8, 12)
|
||||
+ '-' + withoutDashes.substring(12, 16)
|
||||
+ '-' + withoutDashes.substring(16, 20)
|
||||
+ '-' + withoutDashes.substring(20, 32));
|
||||
return UUID.fromString(UUID_PATTERN.matcher(withoutDashes).replaceAll("$1-$2-$3-$4-$5"));
|
||||
}
|
||||
|
||||
public static String toMojangId(UUID uuid) {
|
||||
|
@ -75,4 +75,16 @@ public class PlayerProfile {
|
||||
public synchronized void setLastLogin(Instant lastLogin) {
|
||||
this.lastLogin = lastLogin;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return this.getClass().getSimpleName() + '{' +
|
||||
"playerName='" + playerName + '\'' +
|
||||
", userId=" + userId +
|
||||
", uuid=" + uuid +
|
||||
", premium=" + premium +
|
||||
", lastIp='" + lastIp + '\'' +
|
||||
", lastLogin=" + lastLogin +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
@ -14,4 +14,12 @@ public class GameProfile {
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return this.getClass().getSimpleName() + '{' +
|
||||
"id=" + id +
|
||||
", name='" + name + '\'' +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
@ -16,4 +16,13 @@ public class SkinProperties {
|
||||
public String getSignature() {
|
||||
return signature;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return this.getClass().getSimpleName() + '{' +
|
||||
"name='" + name + '\'' +
|
||||
", value='" + value + '\'' +
|
||||
", signature='" + signature + '\'' +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
@ -20,4 +20,13 @@ public class VerificationReply {
|
||||
public SkinProperties[] getProperties() {
|
||||
return Arrays.copyOf(properties, properties.length);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return this.getClass().getSimpleName() + '{' +
|
||||
"id=" + id +
|
||||
", name='" + name + '\'' +
|
||||
", properties=" + Arrays.toString(properties) +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
@ -53,4 +53,14 @@ public abstract class LoginSession {
|
||||
public synchronized void setUuid(UUID uuid) {
|
||||
this.uuid = uuid;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return this.getClass().getSimpleName() + '{' +
|
||||
"username='" + username + '\'' +
|
||||
", profile=" + profile +
|
||||
", uuid=" + uuid +
|
||||
", registered=" + registered +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user