Add some colour to the skin server info window

This commit is contained in:
Sollace 2018-07-26 17:25:47 +02:00
parent 834c5c6daa
commit c1676bf778
4 changed files with 18 additions and 14 deletions

View file

@ -9,7 +9,6 @@ import java.util.concurrent.CompletableFuture;
import javax.annotation.Nullable;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.logging.log4j.util.Strings;
import com.google.gson.JsonParseException;
@ -64,7 +63,7 @@ public abstract class AbstractSkinServer implements SkinServer {
@Override
public String toString() {
return new ToStringBuilder(this, IndentedToStringStyle.INSTANCE)
return new IndentedToStringStyle.Builder(this)
.append("address", address)
.build();
}

View file

@ -4,7 +4,6 @@ import java.io.IOException;
import java.net.URI;
import java.util.Locale;
import java.util.Map;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.http.HttpStatus;
import com.google.common.collect.ImmutableMap;
@ -76,11 +75,4 @@ public class BethlehemSkinServer extends AbstractSkinServer {
private String getPath(GameProfile profile) {
return String.format("%s/profile/%s", address, UUIDTypeAdapter.fromUUID(profile.getId()));
}
@Override
public String toString() {
return new ToStringBuilder(this, IndentedToStringStyle.INSTANCE)
.append("address", address)
.build();
}
}

View file

@ -1,20 +1,34 @@
package com.voxelmodpack.hdskins.skins;
import org.apache.commons.lang3.SystemUtils;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import static net.minecraft.util.text.TextFormatting.*;
public class IndentedToStringStyle extends ToStringStyle {
private static final long serialVersionUID = 2031593562293731492L;
public static final ToStringStyle INSTANCE = new IndentedToStringStyle();
private static final ToStringStyle INSTANCE = new IndentedToStringStyle();
private IndentedToStringStyle() {
this.setFieldNameValueSeparator(": " + RESET + ITALIC);
this.setContentStart(null);
this.setFieldSeparator(SystemUtils.LINE_SEPARATOR + " ");
this.setFieldSeparator(SystemUtils.LINE_SEPARATOR + " " + RESET + YELLOW);
this.setFieldSeparatorAtStart(true);
this.setContentEnd(null);
this.setUseIdentityHashCode(false);
this.setUseShortClassName(true);
}
public static class Builder extends ToStringBuilder {
public Builder(Object o) {
super(o, IndentedToStringStyle.INSTANCE);
}
public String build() {
return YELLOW + super.build();
}
}
}

View file

@ -11,7 +11,6 @@ import com.mojang.authlib.yggdrasil.response.MinecraftTexturesPayload;
import com.mojang.util.UUIDTypeAdapter;
import net.minecraft.util.Session;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.http.HttpStatus;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@ -130,7 +129,7 @@ public class LegacySkinServer extends AbstractSkinServer {
@Override
public String toString() {
return new ToStringBuilder(this, IndentedToStringStyle.INSTANCE)
return new IndentedToStringStyle.Builder(this)
.append("address", address)
.append("gateway", gateway)
.build();