Merge remote-tracking branch 'upstream/master' into hi-phil-swift-here-for-flex-tape-the-super-strong-waterproof-tape

This commit is contained in:
ThatGamerBlue
2021-03-10 16:32:29 +00:00
22 changed files with 313 additions and 125 deletions

View File

@@ -43,10 +43,7 @@ public class ColorTypeAdapter extends TypeAdapter<Color>
}
int rgba = value.getRGB();
out.beginObject()
.name("value")
.value(rgba)
.endObject();
out.value(String.format("#%08X", rgba));
}
@Override
@@ -57,7 +54,18 @@ public class ColorTypeAdapter extends TypeAdapter<Color>
case NULL:
in.nextNull();
return null;
case STRING:
{
String value = in.nextString();
if (value.charAt(0) == '#')
{
value = value.substring(1);
}
int intValue = Integer.parseUnsignedInt(value, 16);
return new Color(intValue, true);
}
case BEGIN_OBJECT:
{
in.beginObject();
double value = 0;
while (in.peek() != JsonToken.END_OBJECT)
@@ -74,6 +82,7 @@ public class ColorTypeAdapter extends TypeAdapter<Color>
}
in.endObject();
return new Color((int) value, true);
}
}
return null; // throws
}

View File

@@ -43,12 +43,7 @@ public class InstantTypeAdapter extends TypeAdapter<Instant>
return;
}
out.beginObject()
.name("seconds")
.value(value.getEpochSecond())
.name("nanos")
.value(value.getNano())
.endObject();
out.value(value.toEpochMilli());
}
@Override
@@ -60,6 +55,12 @@ public class InstantTypeAdapter extends TypeAdapter<Instant>
return null;
}
if (in.peek() == JsonToken.NUMBER)
{
long jsTime = in.nextLong();
return Instant.ofEpochMilli(jsTime);
}
long seconds = 0;
int nanos = 0;
in.beginObject();

View File

@@ -24,7 +24,6 @@
*/
package net.runelite.http.api.item;
import java.time.Instant;
import lombok.Data;
@Data
@@ -33,5 +32,5 @@ public class ItemPrice
private int id;
private String name;
private int price;
private Instant time;
private int wikiPrice;
}