Add some colour to the skin server info window

This commit is contained in:
Sollace 2018-07-26 17:25:47 +02:00
parent 01bdac7ed8
commit 485ef8e3fc
5 changed files with 23 additions and 13 deletions

View file

@ -8,7 +8,6 @@ import com.mojang.authlib.yggdrasil.response.MinecraftTexturesPayload;
import com.mojang.util.UUIDTypeAdapter;
import com.voxelmodpack.hdskins.HDSkinManager;
import net.minecraft.util.Session;
import org.apache.commons.lang3.builder.ToStringBuilder;
import java.io.IOException;
import java.util.Locale;
@ -29,8 +28,8 @@ public class BethlehemSkinServer implements SkinServer {
@Override
public MinecraftTexturesPayload loadProfileData(GameProfile profile) throws IOException {
// TODO: Fix this
try (MoreHttpResponses response = new NetClient("GET", getPath(profile)).send()) {
if (!response.ok()) {
throw new IOException(response.getResponse().getStatusLine().getReasonPhrase());
}
@ -85,7 +84,7 @@ public class BethlehemSkinServer implements SkinServer {
@Override
public String toString() {
return new ToStringBuilder(this, IndentedToStringStyle.INSTANCE)
return new IndentedToStringStyle.Builder(this)
.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

@ -10,7 +10,6 @@ import com.mojang.util.UUIDTypeAdapter;
import com.voxelmodpack.hdskins.HDSkinManager;
import com.voxelmodpack.hdskins.upload.ThreadMultipartPostUpload;
import net.minecraft.util.Session;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@ -140,9 +139,9 @@ public class LegacySkinServer implements SkinServer {
@Override
public String toString() {
return new ToStringBuilder(this, IndentedToStringStyle.INSTANCE)
.append("address", this.address)
.append("gateway", this.gateway)
return new IndentedToStringStyle.Builder(this)
.append("address", address)
.append("gateway", gateway)
.build();
}
}

View file

@ -49,5 +49,4 @@ public class NetClient {
return MoreHttpResponses.execute(HDSkinManager.httpClient, request);
}
}

View file

@ -11,7 +11,6 @@ import com.mojang.util.UUIDTypeAdapter;
import com.voxelmodpack.hdskins.HDSkinManager;
import net.minecraft.client.Minecraft;
import net.minecraft.util.Session;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.http.HttpHeaders;
import org.apache.http.NameValuePair;
import org.apache.http.client.methods.HttpGet;
@ -208,8 +207,8 @@ public class ValhallaSkinServer implements SkinServer {
@Override
public String toString() {
return new ToStringBuilder(this, IndentedToStringStyle.INSTANCE)
.append("address", this.address)
return new IndentedToStringStyle.Builder(this)
.append("address", address)
.toString();
}