diff options
author | syeyoung <cyoung06@naver.com> | 2021-11-28 20:56:14 +0900 |
---|---|---|
committer | syeyoung <cyoung06@naver.com> | 2021-11-28 20:56:14 +0900 |
commit | 578ea678a1569a52c1bbb2ec11a1b347324569a7 (patch) | |
tree | c7d75b68ada7ef2a45cf2ddd9722fd2b564a603a /src/main/java/kr/syeyoung/dungeonsguide | |
parent | 92e274dcaff56ea6cc49f600ff84f5cec304be57 (diff) | |
download | Skyblock-Dungeons-Guide-578ea678a1569a52c1bbb2ec11a1b347324569a7.tar.gz Skyblock-Dungeons-Guide-578ea678a1569a52c1bbb2ec11a1b347324569a7.tar.bz2 Skyblock-Dungeons-Guide-578ea678a1569a52c1bbb2ec11a1b347324569a7.zip |
- Disable ask-to-join while not being able to invite player
Diffstat (limited to 'src/main/java/kr/syeyoung/dungeonsguide')
-rw-r--r-- | src/main/java/kr/syeyoung/dungeonsguide/chat/PartyManager.java | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/chat/PartyManager.java b/src/main/java/kr/syeyoung/dungeonsguide/chat/PartyManager.java index 2a2207f0..72261ae9 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/chat/PartyManager.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/chat/PartyManager.java @@ -94,6 +94,7 @@ public class PartyManager implements StompMessageHandler { || str.equals("§cYou are not allowed to invite players.§r")) { getPartyContext(true).setAllInvite(false); a.put("type", "allinvite_off"); + potentialInvitenessChange(); } return ChatProcessResult.NONE; }); @@ -161,6 +162,7 @@ public class PartyManager implements StompMessageHandler { if (old.getPartyID() == null) { joinedParty(); } + potentialInvitenessChange(); } } return ChatProcessResult.NONE; @@ -233,6 +235,7 @@ public class PartyManager implements StompMessageHandler { getPartyContext(true).addPartyModerator(oldLeader); } a.put("type", "party_transfer"); + potentialInvitenessChange(); } else if (str.endsWith("§eto Party Leader§r")) { // §a[VIP§r§6+§r§a] syeyoung§r§e has promoted §r§b[MVP§r§f+§r§b] apotato321 §r§eto Party Leader§r String[] messageSplit = TextUtils.stripColor(str).split(" "); @@ -255,6 +258,7 @@ public class PartyManager implements StompMessageHandler { getPartyContext(true).addPartyModerator(oldLeader); } a.put("type", "party_transfer"); + potentialInvitenessChange(); } else if (str.endsWith("§r§eto Party Moderator§r")) { // §b[MVP§r§f+§r§b] apotato321§r§e has promoted §r§a[VIP§r§6+§r§a] syeyoung §r§eto Party Moderator§r String[] messageSplit = TextUtils.stripColor(str).split(" "); @@ -277,6 +281,7 @@ public class PartyManager implements StompMessageHandler { getPartyContext(true).addPartyModerator(newModerator); } a.put("type", "party_promotion"); + potentialInvitenessChange(); } else if (str.endsWith("§r§eto Party Member§r")) { String[] messageSplit = TextUtils.stripColor(str).split(" "); String oldLeader = null; @@ -298,6 +303,7 @@ public class PartyManager implements StompMessageHandler { getPartyContext(true).addPartyMember(newMember); } a.put("type", "party_demotion"); + potentialInvitenessChange(); } return ChatProcessResult.NONE; }); @@ -331,6 +337,7 @@ public class PartyManager implements StompMessageHandler { joined = false; getPartyContext().setRawMemberComplete(true); joinedParty(); + potentialInvitenessChange(); } return ChatProcessResult.NONE; }}); @@ -340,7 +347,9 @@ public class PartyManager implements StompMessageHandler { String username = TextUtils.stripColor(str).split(" ")[3]; if (username.equalsIgnoreCase(Minecraft.getMinecraft().getSession().getUsername())) { partyContext = new PartyContext(); - requestPartyList((str2) -> {}); + requestPartyList((str2) -> { + potentialInvitenessChange(); + }); } else { getPartyContext(true).setMemberComplete(false); requestPartyList((str2) -> {}); @@ -578,4 +587,8 @@ public class PartyManager implements StompMessageHandler { .header("destination", "/app/party.askedtojoin") .payload(new JSONObject().put("token", secret).toString())); } + + private void potentialInvitenessChange() { + if (askToJoinSecret != null && !canInvite()) askToJoinSecret = null; + } } |