mirror of
https://github.com/MineLittlePony/MineLittlePony.git
synced 2024-11-30 07:57:59 +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.mojang.util.UUIDTypeAdapter;
|
||||||
import com.voxelmodpack.hdskins.HDSkinManager;
|
import com.voxelmodpack.hdskins.HDSkinManager;
|
||||||
import net.minecraft.util.Session;
|
import net.minecraft.util.Session;
|
||||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
@ -29,8 +28,8 @@ public class BethlehemSkinServer implements SkinServer {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public MinecraftTexturesPayload loadProfileData(GameProfile profile) throws IOException {
|
public MinecraftTexturesPayload loadProfileData(GameProfile profile) throws IOException {
|
||||||
|
// TODO: Fix this
|
||||||
try (MoreHttpResponses response = new NetClient("GET", getPath(profile)).send()) {
|
try (MoreHttpResponses response = new NetClient("GET", getPath(profile)).send()) {
|
||||||
|
|
||||||
if (!response.ok()) {
|
if (!response.ok()) {
|
||||||
throw new IOException(response.getResponse().getStatusLine().getReasonPhrase());
|
throw new IOException(response.getResponse().getStatusLine().getReasonPhrase());
|
||||||
}
|
}
|
||||||
|
@ -85,7 +84,7 @@ public class BethlehemSkinServer implements SkinServer {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return new ToStringBuilder(this, IndentedToStringStyle.INSTANCE)
|
return new IndentedToStringStyle.Builder(this)
|
||||||
.append("address", address)
|
.append("address", address)
|
||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,20 +1,34 @@
|
||||||
package com.voxelmodpack.hdskins.skins;
|
package com.voxelmodpack.hdskins.skins;
|
||||||
|
|
||||||
import org.apache.commons.lang3.SystemUtils;
|
import org.apache.commons.lang3.SystemUtils;
|
||||||
|
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||||
|
|
||||||
|
import static net.minecraft.util.text.TextFormatting.*;
|
||||||
|
|
||||||
public class IndentedToStringStyle extends ToStringStyle {
|
public class IndentedToStringStyle extends ToStringStyle {
|
||||||
|
|
||||||
private static final long serialVersionUID = 2031593562293731492L;
|
private static final long serialVersionUID = 2031593562293731492L;
|
||||||
|
|
||||||
public static final ToStringStyle INSTANCE = new IndentedToStringStyle();
|
private static final ToStringStyle INSTANCE = new IndentedToStringStyle();
|
||||||
|
|
||||||
private IndentedToStringStyle() {
|
private IndentedToStringStyle() {
|
||||||
|
this.setFieldNameValueSeparator(": " + RESET + ITALIC);
|
||||||
this.setContentStart(null);
|
this.setContentStart(null);
|
||||||
this.setFieldSeparator(SystemUtils.LINE_SEPARATOR + " ");
|
this.setFieldSeparator(SystemUtils.LINE_SEPARATOR + " " + RESET + YELLOW);
|
||||||
this.setFieldSeparatorAtStart(true);
|
this.setFieldSeparatorAtStart(true);
|
||||||
this.setContentEnd(null);
|
this.setContentEnd(null);
|
||||||
this.setUseIdentityHashCode(false);
|
this.setUseIdentityHashCode(false);
|
||||||
this.setUseShortClassName(true);
|
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.HDSkinManager;
|
||||||
import com.voxelmodpack.hdskins.upload.ThreadMultipartPostUpload;
|
import com.voxelmodpack.hdskins.upload.ThreadMultipartPostUpload;
|
||||||
import net.minecraft.util.Session;
|
import net.minecraft.util.Session;
|
||||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
|
||||||
import org.apache.logging.log4j.LogManager;
|
import org.apache.logging.log4j.LogManager;
|
||||||
import org.apache.logging.log4j.Logger;
|
import org.apache.logging.log4j.Logger;
|
||||||
|
|
||||||
|
@ -140,9 +139,9 @@ public class LegacySkinServer implements SkinServer {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return new ToStringBuilder(this, IndentedToStringStyle.INSTANCE)
|
return new IndentedToStringStyle.Builder(this)
|
||||||
.append("address", this.address)
|
.append("address", address)
|
||||||
.append("gateway", this.gateway)
|
.append("gateway", gateway)
|
||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,5 +49,4 @@ public class NetClient {
|
||||||
|
|
||||||
return MoreHttpResponses.execute(HDSkinManager.httpClient, request);
|
return MoreHttpResponses.execute(HDSkinManager.httpClient, request);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,7 +11,6 @@ import com.mojang.util.UUIDTypeAdapter;
|
||||||
import com.voxelmodpack.hdskins.HDSkinManager;
|
import com.voxelmodpack.hdskins.HDSkinManager;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.util.Session;
|
import net.minecraft.util.Session;
|
||||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
|
||||||
import org.apache.http.HttpHeaders;
|
import org.apache.http.HttpHeaders;
|
||||||
import org.apache.http.NameValuePair;
|
import org.apache.http.NameValuePair;
|
||||||
import org.apache.http.client.methods.HttpGet;
|
import org.apache.http.client.methods.HttpGet;
|
||||||
|
@ -208,8 +207,8 @@ public class ValhallaSkinServer implements SkinServer {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return new ToStringBuilder(this, IndentedToStringStyle.INSTANCE)
|
return new IndentedToStringStyle.Builder(this)
|
||||||
.append("address", this.address)
|
.append("address", address)
|
||||||
.toString();
|
.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue