mirror of
https://github.com/MineLittlePony/MineLittlePony.git
synced 2024-11-26 22:38:00 +01:00
Add some colour to the skin server info window
This commit is contained in:
parent
01bdac7ed8
commit
485ef8e3fc
5 changed files with 23 additions and 13 deletions
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -49,5 +49,4 @@ public class NetClient {
|
|||
|
||||
return MoreHttpResponses.execute(HDSkinManager.httpClient, request);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue