aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/kr/syeyoung/dungeonsguide/party
diff options
context:
space:
mode:
authorsyeyoung <cyong06@naver.com>2021-08-08 22:52:47 +0900
committersyeyoung <cyong06@naver.com>2021-08-08 22:52:47 +0900
commitfe40f939fbc997c0b5cd7dedb9d1cb83faa398d1 (patch)
treea7fdd92ae46143a0ea2757f433443ea4e9dd0da9 /src/main/java/kr/syeyoung/dungeonsguide/party
parentdb58612b03889d5911c99f5b3878b31f9b4f9e92 (diff)
downloadSkyblock-Dungeons-Guide-fe40f939fbc997c0b5cd7dedb9d1cb83faa398d1.tar.gz
Skyblock-Dungeons-Guide-fe40f939fbc997c0b5cd7dedb9d1cb83faa398d1.tar.bz2
Skyblock-Dungeons-Guide-fe40f939fbc997c0b5cd7dedb9d1cb83faa398d1.zip
- Implement RPC with new Game SDK
Diffstat (limited to 'src/main/java/kr/syeyoung/dungeonsguide/party')
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/party/PartyInviteViewer.java16
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/party/PartyJoinRequest.java10
2 files changed, 19 insertions, 7 deletions
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/party/PartyInviteViewer.java b/src/main/java/kr/syeyoung/dungeonsguide/party/PartyInviteViewer.java
index a045ea22..8588fca1 100644
--- a/src/main/java/kr/syeyoung/dungeonsguide/party/PartyInviteViewer.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/party/PartyInviteViewer.java
@@ -19,6 +19,8 @@
package kr.syeyoung.dungeonsguide.party;
import kr.syeyoung.dungeonsguide.DungeonsGuide;
+import kr.syeyoung.dungeonsguide.RichPresenceManager;
+import kr.syeyoung.dungeonsguide.gamesdk.jna.enumuration.EDiscordActivityJoinRequestReply;
import kr.syeyoung.dungeonsguide.utils.TextUtils;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer;
@@ -106,21 +108,21 @@ public class PartyInviteViewer {
if (joinRequest.getAcceptRect().contains(mouseX, mouseY)) {
joinRequest.setReply(PartyJoinRequest.Reply.ACCEPT);
joinRequest.setTtl(60);
-// DiscordRPC.discordRespond(joinRequest.getDiscordUser().userId, DiscordRPC.DiscordReply.YES);
+ RichPresenceManager.INSTANCE.respond(joinRequest.getDiscordUser().id, EDiscordActivityJoinRequestReply.DiscordActivityJoinRequestReply_Yes);
return;
}
if (joinRequest.getDenyRect().contains(mouseX, mouseY)) {
joinRequest.setReply(PartyJoinRequest.Reply.DENY);
joinRequest.setTtl(60);
-// DiscordRPC.discordRespond(joinRequest.getDiscordUser().userId, DiscordRPC.DiscordReply.NO);
+ RichPresenceManager.INSTANCE.respond(joinRequest.getDiscordUser().id, EDiscordActivityJoinRequestReply.DiscordActivityJoinRequestReply_No);
return;
}
if (joinRequest.getIgnoreRect().contains(mouseX, mouseY)) {
joinRequest.setReply(PartyJoinRequest.Reply.IGNORE);
joinRequest.setTtl(60);
-// DiscordRPC.discordRespond(joinRequest.getDiscordUser().userId, DiscordRPC.DiscordReply.IGNORE);
+ RichPresenceManager.INSTANCE.respond(joinRequest.getDiscordUser().id, EDiscordActivityJoinRequestReply.DiscordActivityJoinRequestReply_Ignore);
return;
}
@@ -194,7 +196,7 @@ public class PartyInviteViewer {
Gui.drawRect(0, 0,width,height, 0xFF23272a);
Gui.drawRect(2, 2, width-2, height-2, 0XFF2c2f33);
{
- String avatar = "https://cdn.discordapp.com/avatars/"+partyJoinRequest.getDiscordUser().id.longValue()+"/"+partyJoinRequest.getDiscordUser().avatar+".png";
+ String avatar = "https://cdn.discordapp.com/avatars/"+partyJoinRequest.getDiscordUser().id.longValue()+"/"+partyJoinRequest.getAvatar()+".png";
Future<LoadedImage> loadedImageFuture = loadImage(avatar);
LoadedImage loadedImage = null;
if (loadedImageFuture.isDone()) {
@@ -236,12 +238,12 @@ public class PartyInviteViewer {
GlStateManager.pushMatrix();
GlStateManager.scale(3.0,3.0,1.0);
- fr.drawString(partyJoinRequest.getDiscordUser().username+"", 0,0, 0xFFFFFFFF, true);
+ fr.drawString(partyJoinRequest.getUsername()+"", 0,0, 0xFFFFFFFF, true);
GlStateManager.popMatrix();
GlStateManager.pushMatrix();
- GlStateManager.translate(fr.getStringWidth(partyJoinRequest.getDiscordUser().username+"") * 3 + 1, (int)(fr.FONT_HEIGHT*1.5), 0);
- fr.drawString("#"+partyJoinRequest.getDiscordUser().discriminator, 0,0,0xFFaaaaaa, true);
+ GlStateManager.translate(fr.getStringWidth(partyJoinRequest.getUsername()+"") * 3 + 1, (int)(fr.FONT_HEIGHT*1.5), 0);
+ fr.drawString("#"+partyJoinRequest.getDiscriminator(), 0,0,0xFFaaaaaa, true);
GlStateManager.popMatrix();
GlStateManager.pushMatrix();
GlStateManager.translate(0, fr.FONT_HEIGHT * 3 + 5, 0);
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/party/PartyJoinRequest.java b/src/main/java/kr/syeyoung/dungeonsguide/party/PartyJoinRequest.java
index 06b04e20..ac2b9561 100644
--- a/src/main/java/kr/syeyoung/dungeonsguide/party/PartyJoinRequest.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/party/PartyJoinRequest.java
@@ -18,6 +18,7 @@
package kr.syeyoung.dungeonsguide.party;
+import kr.syeyoung.dungeonsguide.gamesdk.GameSDK;
import kr.syeyoung.dungeonsguide.gamesdk.jna.datastruct.DiscordUser;
import lombok.AllArgsConstructor;
import lombok.Data;
@@ -28,6 +29,15 @@ import java.awt.*;
@Data
public class PartyJoinRequest {
private DiscordUser discordUser;
+
+ public void setDiscordUser(DiscordUser discordUser) {
+ this.discordUser = discordUser;
+ username = GameSDK.readString(discordUser.username);
+ discriminator = GameSDK.readString(discordUser.discriminator);
+ avatar = GameSDK.readString(discordUser.avatar);
+ }
+
+ private String username, discriminator, avatar;
private long expire;
private Rectangle wholeRect = new Rectangle();