Skip to content

Commit bae81e4

Browse files
Use signed long for party size
1 parent 34d3df2 commit bae81e4

File tree

2 files changed

+26
-6
lines changed

2 files changed

+26
-6
lines changed

src/main/java/net/dv8tion/jda/core/entities/EntityBuilder.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -653,11 +653,11 @@ public static Game createGame(JSONObject gameJson)
653653
JSONObject obj = gameJson.getJSONObject("party");
654654
String partyId = obj.isNull("id") ? null : obj.getString("id");
655655
JSONArray sizeArr = obj.isNull("size") ? null : obj.getJSONArray("size");
656-
int size = 0, max = 0;
656+
long size = 0, max = 0;
657657
if (sizeArr != null && sizeArr.length() > 0)
658658
{
659-
size = sizeArr.getInt(0);
660-
max = sizeArr.length() > 1 ? sizeArr.getInt(1) : 0;
659+
size = sizeArr.getLong(0);
660+
max = sizeArr.isNull(1) ? 0 : sizeArr.getLong(1);
661661
}
662662
party = new RichPresence.Party(partyId, size, max);
663663
}

src/main/java/net/dv8tion/jda/core/entities/RichPresence.java

+23-3
Original file line numberDiff line numberDiff line change
@@ -399,11 +399,11 @@ public int hashCode()
399399
public static class Party
400400
{
401401
protected final String id;
402-
protected final int size;
402+
protected final long size;
403403

404-
protected final int max;
404+
protected final long max;
405405

406-
public Party(String id, int size, int max)
406+
public Party(String id, long size, long max)
407407
{
408408
this.id = id;
409409
this.size = size;
@@ -427,6 +427,16 @@ public String getId()
427427
* @return The current size of this party, or {@code 0} if unset
428428
*/
429429
public int getSize()
430+
{
431+
return (int)size;
432+
}
433+
434+
/**
435+
* The current size of this party, or {@code 0} if unset
436+
*
437+
* @return The current size of this party, or {@code 0} if unset
438+
*/
439+
public long getSizeAsLong()
430440
{
431441
return size;
432442
}
@@ -437,6 +447,16 @@ public int getSize()
437447
* @return The maximum size of this party, or {@code 0} if unset
438448
*/
439449
public int getMax()
450+
{
451+
return (int)max;
452+
}
453+
454+
/**
455+
* The maximum size of this party, or {@code 0} if unset
456+
*
457+
* @return The maximum size of this party, or {@code 0} if unset
458+
*/
459+
public long getMaxAsLong()
440460
{
441461
return max;
442462
}

0 commit comments

Comments
 (0)