From 53e092967e71031c14b00869123917029732bc0f Mon Sep 17 00:00:00 2001 From: Hydrox6 Date: Wed, 18 Aug 2021 23:59:47 +0100 Subject: [PATCH 1/8] roof removal: fix ardougne castle 1st floor --- .../net/runelite/client/plugins/roofremoval/overrides.jsonc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/roofremoval/overrides.jsonc b/runelite-client/src/main/resources/net/runelite/client/plugins/roofremoval/overrides.jsonc index b359eea839..b831d41f43 100644 --- a/runelite-client/src/main/resources/net/runelite/client/plugins/roofremoval/overrides.jsonc +++ b/runelite-client/src/main/resources/net/runelite/client/plugins/roofremoval/overrides.jsonc @@ -456,7 +456,7 @@ "rx2": 29, "ry2": 35, "z1": 0, - "z2": 0 + "z2": 1 }, { "rx1": 16, @@ -464,7 +464,7 @@ "rx2": 19, "ry2": 37, "z1": 0, - "z2": 0 + "z2": 1 } ], "12854": [ // Varrock Castle From 196bdcd4e56a39725193e5ef007b3ccd27055a7f Mon Sep 17 00:00:00 2001 From: Runelite auto updater Date: Thu, 19 Aug 2021 18:05:51 +0000 Subject: [PATCH 2/8] Release 1.7.20 --- cache-client/pom.xml | 2 +- cache-updater/pom.xml | 2 +- cache/pom.xml | 2 +- http-api/pom.xml | 2 +- http-service/pom.xml | 2 +- pom.xml | 4 ++-- runelite-api/pom.xml | 2 +- runelite-client/pom.xml | 2 +- runelite-jshell/pom.xml | 2 +- runelite-script-assembler-plugin/pom.xml | 2 +- 10 files changed, 11 insertions(+), 11 deletions(-) diff --git a/cache-client/pom.xml b/cache-client/pom.xml index 12c1159da0..2a5ec34b95 100644 --- a/cache-client/pom.xml +++ b/cache-client/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.7.20-SNAPSHOT + 1.7.20 cache-client diff --git a/cache-updater/pom.xml b/cache-updater/pom.xml index aad8636265..3b126d2e4e 100644 --- a/cache-updater/pom.xml +++ b/cache-updater/pom.xml @@ -28,7 +28,7 @@ net.runelite runelite-parent - 1.7.20-SNAPSHOT + 1.7.20 Cache Updater diff --git a/cache/pom.xml b/cache/pom.xml index 284f8400e4..0da293a0bd 100644 --- a/cache/pom.xml +++ b/cache/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.7.20-SNAPSHOT + 1.7.20 cache diff --git a/http-api/pom.xml b/http-api/pom.xml index 771d3ffc7c..c88ae9dd74 100644 --- a/http-api/pom.xml +++ b/http-api/pom.xml @@ -28,7 +28,7 @@ net.runelite runelite-parent - 1.7.20-SNAPSHOT + 1.7.20 Web API diff --git a/http-service/pom.xml b/http-service/pom.xml index da3df117cc..fc15181539 100644 --- a/http-service/pom.xml +++ b/http-service/pom.xml @@ -28,7 +28,7 @@ net.runelite runelite-parent - 1.7.20-SNAPSHOT + 1.7.20 Web Service diff --git a/pom.xml b/pom.xml index ece2d18926..d87e0d4adf 100644 --- a/pom.xml +++ b/pom.xml @@ -28,7 +28,7 @@ net.runelite runelite-parent - 1.7.20-SNAPSHOT + 1.7.20 pom RuneLite @@ -61,7 +61,7 @@ https://github.com/runelite/runelite scm:git:git://github.com/runelite/runelite scm:git:git@github.com:runelite/runelite - HEAD + runelite-parent-1.7.20 diff --git a/runelite-api/pom.xml b/runelite-api/pom.xml index 52744d2493..5c6cf07f3e 100644 --- a/runelite-api/pom.xml +++ b/runelite-api/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.7.20-SNAPSHOT + 1.7.20 runelite-api diff --git a/runelite-client/pom.xml b/runelite-client/pom.xml index 76e771ba54..cb885fa03e 100644 --- a/runelite-client/pom.xml +++ b/runelite-client/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.7.20-SNAPSHOT + 1.7.20 client diff --git a/runelite-jshell/pom.xml b/runelite-jshell/pom.xml index 3bbf60812e..7b8e93ed80 100644 --- a/runelite-jshell/pom.xml +++ b/runelite-jshell/pom.xml @@ -30,7 +30,7 @@ net.runelite runelite-parent - 1.7.20-SNAPSHOT + 1.7.20 jshell diff --git a/runelite-script-assembler-plugin/pom.xml b/runelite-script-assembler-plugin/pom.xml index ad89e23a34..b6c636e4b9 100644 --- a/runelite-script-assembler-plugin/pom.xml +++ b/runelite-script-assembler-plugin/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.7.20-SNAPSHOT + 1.7.20 script-assembler-plugin From d530400238967ef93e7bf54dc19756fcc0641e13 Mon Sep 17 00:00:00 2001 From: Runelite auto updater Date: Thu, 19 Aug 2021 18:05:56 +0000 Subject: [PATCH 3/8] Bump for 1.7.21-SNAPSHOT --- cache-client/pom.xml | 2 +- cache-updater/pom.xml | 2 +- cache/pom.xml | 2 +- http-api/pom.xml | 2 +- http-service/pom.xml | 2 +- pom.xml | 4 ++-- runelite-api/pom.xml | 2 +- runelite-client/pom.xml | 2 +- runelite-jshell/pom.xml | 2 +- runelite-script-assembler-plugin/pom.xml | 2 +- 10 files changed, 11 insertions(+), 11 deletions(-) diff --git a/cache-client/pom.xml b/cache-client/pom.xml index 2a5ec34b95..f05a9be5e7 100644 --- a/cache-client/pom.xml +++ b/cache-client/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.7.20 + 1.7.21-SNAPSHOT cache-client diff --git a/cache-updater/pom.xml b/cache-updater/pom.xml index 3b126d2e4e..1ddc09db1d 100644 --- a/cache-updater/pom.xml +++ b/cache-updater/pom.xml @@ -28,7 +28,7 @@ net.runelite runelite-parent - 1.7.20 + 1.7.21-SNAPSHOT Cache Updater diff --git a/cache/pom.xml b/cache/pom.xml index 0da293a0bd..7e278ae7cb 100644 --- a/cache/pom.xml +++ b/cache/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.7.20 + 1.7.21-SNAPSHOT cache diff --git a/http-api/pom.xml b/http-api/pom.xml index c88ae9dd74..7b5d93af81 100644 --- a/http-api/pom.xml +++ b/http-api/pom.xml @@ -28,7 +28,7 @@ net.runelite runelite-parent - 1.7.20 + 1.7.21-SNAPSHOT Web API diff --git a/http-service/pom.xml b/http-service/pom.xml index fc15181539..1f18ef51ad 100644 --- a/http-service/pom.xml +++ b/http-service/pom.xml @@ -28,7 +28,7 @@ net.runelite runelite-parent - 1.7.20 + 1.7.21-SNAPSHOT Web Service diff --git a/pom.xml b/pom.xml index d87e0d4adf..c4e8868379 100644 --- a/pom.xml +++ b/pom.xml @@ -28,7 +28,7 @@ net.runelite runelite-parent - 1.7.20 + 1.7.21-SNAPSHOT pom RuneLite @@ -61,7 +61,7 @@ https://github.com/runelite/runelite scm:git:git://github.com/runelite/runelite scm:git:git@github.com:runelite/runelite - runelite-parent-1.7.20 + HEAD diff --git a/runelite-api/pom.xml b/runelite-api/pom.xml index 5c6cf07f3e..ae8387869e 100644 --- a/runelite-api/pom.xml +++ b/runelite-api/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.7.20 + 1.7.21-SNAPSHOT runelite-api diff --git a/runelite-client/pom.xml b/runelite-client/pom.xml index cb885fa03e..6b4e296b12 100644 --- a/runelite-client/pom.xml +++ b/runelite-client/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.7.20 + 1.7.21-SNAPSHOT client diff --git a/runelite-jshell/pom.xml b/runelite-jshell/pom.xml index 7b8e93ed80..13c079b344 100644 --- a/runelite-jshell/pom.xml +++ b/runelite-jshell/pom.xml @@ -30,7 +30,7 @@ net.runelite runelite-parent - 1.7.20 + 1.7.21-SNAPSHOT jshell diff --git a/runelite-script-assembler-plugin/pom.xml b/runelite-script-assembler-plugin/pom.xml index b6c636e4b9..477a7ad7a8 100644 --- a/runelite-script-assembler-plugin/pom.xml +++ b/runelite-script-assembler-plugin/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.7.20 + 1.7.21-SNAPSHOT script-assembler-plugin From aab1ca31dc4820644fcc4ac616756763d89798b0 Mon Sep 17 00:00:00 2001 From: Max Weber Date: Thu, 19 Aug 2021 22:08:45 -0600 Subject: [PATCH 4/8] rl-api: expose actor pose anim source setters --- .../src/main/java/net/runelite/api/Actor.java | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/runelite-api/src/main/java/net/runelite/api/Actor.java b/runelite-api/src/main/java/net/runelite/api/Actor.java index 7a5373c34e..857fdc3720 100644 --- a/runelite-api/src/main/java/net/runelite/api/Actor.java +++ b/runelite-api/src/main/java/net/runelite/api/Actor.java @@ -158,6 +158,8 @@ public interface Actor extends Renderable */ int getIdleRotateLeft(); + void setIdleRotateLeft(int animationID); + /** * Animation used for rotating right if the actor is also not walking * @@ -166,6 +168,8 @@ public interface Actor extends Renderable */ int getIdleRotateRight(); + void setIdleRotateRight(int animationID); + /** * Animation used for walking * @@ -174,6 +178,8 @@ public interface Actor extends Renderable */ int getWalkAnimation(); + void setWalkAnimation(int animationID); + /** * Animation used for rotating left while walking * @@ -182,6 +188,8 @@ public interface Actor extends Renderable */ int getWalkRotateLeft(); + void setWalkRotateLeft(int animationID); + /** * Animation used for rotating right while walking * @@ -190,6 +198,8 @@ public interface Actor extends Renderable */ int getWalkRotateRight(); + void setWalkRotateRight(int animationID); + /** * Animation used for an about-face while walking * @@ -198,6 +208,8 @@ public interface Actor extends Renderable */ int getWalkRotate180(); + void setWalkRotate180(int animationID); + /** * Animation used for running * @@ -206,6 +218,8 @@ public interface Actor extends Renderable */ int getRunAnimation(); + void setRunAnimation(int animationID); + /** * Sets an animation for the actor to perform. * From 60d135c7dd127adad84046155c0de150439ebd4e Mon Sep 17 00:00:00 2001 From: TheStonedTurtle <29030969+TheStonedTurtle@users.noreply.github.com> Date: Sat, 21 Aug 2021 08:35:10 -0700 Subject: [PATCH 5/8] CrypticClue: Fix hosidius fruit store crates highlighting (#14051) --- .../runelite/client/plugins/cluescrolls/clues/CrypticClue.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/CrypticClue.java b/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/CrypticClue.java index 4884119467..0e8ce89b34 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/CrypticClue.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/CrypticClue.java @@ -322,7 +322,7 @@ public class CrypticClue extends ClueScroll implements TextClueScroll, NpcClueSc new CrypticClue("Has no one told you it is rude to ask a lady her age?", "Mawrth", new WorldPoint(2333, 3165, 0), "Talk to Mawrth in Lletya."), new CrypticClue("Elvish onions.", new WorldPoint(3303, 6092, 0), "Dig in the onion patch east of the Prifddinas allotments."), new CrypticClue("Dig by the Giant's Den entrance, looking out over Lake Molch.", new WorldPoint(1418, 3591, 0), "South-east of Lake Molch in Zeah, outside the cave entrance."), - new CrypticClue("Search the crates in the fruit store just east of the Hosidius town centre.", CRATES_27533, new WorldPoint(1798, 3612, 0), "Search the crates in the back room of the Hosidius fruit store."), + new CrypticClue("Search the crates in the fruit store just east of the Hosidius town centre.", CRATES_27533, new WorldPoint(1799, 3613, 0), "Search the crates in the back room of the Hosidius fruit store."), new CrypticClue("A graceful man of many colours, his crates must be full of many delights.", "Hill Giant", CRATE_42067, new WorldPoint(1506, 3590, 2), "Kill any Hill Giant for a medium key. Then search the crate on the top floor of Osten's clothing shop in Shayzien."), new CrypticClue("Search the basket of apples in an orchard, south of the unknown grave surrounded by white roses.", APPLE_BASKET, new WorldPoint(1718, 3626, 0), "Search the middle apple basket in the apple orchard north of Hosidius."), new CrypticClue("Dig in the lair of red wings, within the temple of the Sun and Moon.", new WorldPoint(1820, 9935, 0), "Forthos Dungeon. In the center of the red dragons.") From d0714b501675c7b4446a5a9dff1e1214fbc78379 Mon Sep 17 00:00:00 2001 From: Adam Date: Fri, 20 Aug 2021 15:43:46 -0400 Subject: [PATCH 6/8] api: add type parameter to Comparable --- runelite-api/src/main/java/net/runelite/api/Nameable.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runelite-api/src/main/java/net/runelite/api/Nameable.java b/runelite-api/src/main/java/net/runelite/api/Nameable.java index f627d98901..b75cd7c731 100644 --- a/runelite-api/src/main/java/net/runelite/api/Nameable.java +++ b/runelite-api/src/main/java/net/runelite/api/Nameable.java @@ -27,7 +27,7 @@ package net.runelite.api; /** * Represents a chat entity that has a name. */ -public interface Nameable extends Comparable +public interface Nameable extends Comparable { /** * The name of the player. From e9c252e2271c76aa39aa6418578ea5ce371e5da7 Mon Sep 17 00:00:00 2001 From: Adam Date: Fri, 20 Aug 2021 15:45:23 -0400 Subject: [PATCH 7/8] chat channel: fix join/leave world hop detection The ChatPlayers do not implement equals or hashCode, making them unsuitable as a hashmap key. Instead just use a linked list and compare the members using the comparable interface. --- .../chatchannel/ChatChannelPlugin.java | 88 +++++++------ .../chatchannel/ChatChannelPluginTest.java | 123 ++++++++++++++++++ 2 files changed, 172 insertions(+), 39 deletions(-) create mode 100644 runelite-client/src/test/java/net/runelite/client/plugins/chatchannel/ChatChannelPluginTest.java diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/chatchannel/ChatChannelPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/chatchannel/ChatChannelPlugin.java index d58fa8ad27..e4584f60a5 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/chatchannel/ChatChannelPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/chatchannel/ChatChannelPlugin.java @@ -26,6 +26,7 @@ */ package net.runelite.client.plugins.chatchannel; +import com.google.common.annotations.VisibleForTesting; import com.google.common.base.MoreObjects; import com.google.common.base.Strings; import com.google.common.collect.Lists; @@ -36,9 +37,9 @@ import java.util.ArrayDeque; import java.util.ArrayList; import java.util.Deque; import java.util.Iterator; -import java.util.LinkedHashMap; +import java.util.LinkedList; import java.util.List; -import java.util.Map; +import java.util.ListIterator; import javax.inject.Inject; import lombok.AllArgsConstructor; import net.runelite.api.ChatLineBuffer; @@ -101,7 +102,8 @@ public class ChatChannelPlugin extends Plugin { private static final int MAX_CHATS = 10; private static final String RECENT_TITLE = "Recent FCs"; - private static final int MESSAGE_DELAY = 10; + @VisibleForTesting + static final int MESSAGE_DELAY = 10; @Inject private Client client; @@ -129,7 +131,7 @@ public class ChatChannelPlugin extends Plugin * queue of temporary messages added to the client */ private final Deque joinMessages = new ArrayDeque<>(); - private final Map activityBuffer = new LinkedHashMap<>(); + private final List activityBuffer = new LinkedList<>(); private int joinedTick; private boolean kickConfirmed = false; @@ -284,31 +286,38 @@ public class ChatChannelPlugin extends Plugin private void queueJoin(ChatPlayer member, MemberActivity.ChatType chatType) { - // attempt to filter out world hopping joins - if (!activityBuffer.containsKey(member)) + for (ListIterator iter = activityBuffer.listIterator(); iter.hasNext(); ) { - MemberActivity joinActivity = new MemberActivity(ActivityType.JOINED, chatType, - member, client.getTickCount()); - activityBuffer.put(member, joinActivity); - } - else - { - activityBuffer.remove(member); + MemberActivity activity = iter.next(); + + if (activity.getChatType() == chatType && activity.getMember().compareTo(member) == 0) + { + iter.remove(); + return; + } } + + MemberActivity activity = new MemberActivity(ActivityType.JOINED, chatType, + member, client.getTickCount()); + activityBuffer.add(activity); } private void queueLeave(ChatPlayer member, MemberActivity.ChatType chatType) { - if (!activityBuffer.containsKey(member)) + for (ListIterator iter = activityBuffer.listIterator(); iter.hasNext(); ) { - MemberActivity leaveActivity = new MemberActivity(ActivityType.LEFT, chatType, - member, client.getTickCount()); - activityBuffer.put(member, leaveActivity); - } - else - { - activityBuffer.remove(member); + MemberActivity activity = iter.next(); + + if (activity.getChatType() == chatType && activity.getMember().compareTo(member) == 0) + { + iter.remove(); + return; + } } + + MemberActivity activity = new MemberActivity(ActivityType.LEFT, chatType, + member, client.getTickCount()); + activityBuffer.add(activity); } @Subscribe @@ -386,32 +395,33 @@ public class ChatChannelPlugin extends Plugin } } - private void addActivityMessages() + @VisibleForTesting + void addActivityMessages() { if (activityBuffer.isEmpty()) { return; } - Iterator activityIt = activityBuffer.values().iterator(); - - while (activityIt.hasNext()) + for (ListIterator iter = activityBuffer.listIterator(); iter.hasNext(); ) { - MemberActivity activity = activityIt.next(); - - if (activity.getTick() < client.getTickCount() - MESSAGE_DELAY) + MemberActivity activity = iter.next(); + if (activity.getTick() >= client.getTickCount() - MESSAGE_DELAY) { - activityIt.remove(); - switch (activity.getChatType()) - { - case FRIENDS_CHAT: - addActivityMessage((FriendsChatMember) activity.getMember(), activity.getActivityType()); - break; - case CLAN_CHAT: - case GUEST_CHAT: - addClanActivityMessage((ClanChannelMember) activity.getMember(), activity.getActivityType(), activity.getChatType()); - break; - } + // everything after this is older + return; + } + + iter.remove(); + switch (activity.getChatType()) + { + case FRIENDS_CHAT: + addActivityMessage((FriendsChatMember) activity.getMember(), activity.getActivityType()); + break; + case CLAN_CHAT: + case GUEST_CHAT: + addClanActivityMessage((ClanChannelMember) activity.getMember(), activity.getActivityType(), activity.getChatType()); + break; } } } diff --git a/runelite-client/src/test/java/net/runelite/client/plugins/chatchannel/ChatChannelPluginTest.java b/runelite-client/src/test/java/net/runelite/client/plugins/chatchannel/ChatChannelPluginTest.java new file mode 100644 index 0000000000..00f5307cb4 --- /dev/null +++ b/runelite-client/src/test/java/net/runelite/client/plugins/chatchannel/ChatChannelPluginTest.java @@ -0,0 +1,123 @@ +/* + * Copyright (c) 2021, Adam + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package net.runelite.client.plugins.chatchannel; + +import com.google.inject.Guice; +import com.google.inject.testing.fieldbinder.Bind; +import com.google.inject.testing.fieldbinder.BoundFieldModule; +import javax.inject.Inject; +import net.runelite.api.ChatMessageType; +import net.runelite.api.Client; +import net.runelite.api.MessageNode; +import net.runelite.api.clan.ClanChannel; +import net.runelite.api.clan.ClanChannelMember; +import net.runelite.api.clan.ClanRank; +import net.runelite.api.clan.ClanSettings; +import net.runelite.api.events.ClanMemberJoined; +import net.runelite.api.events.ClanMemberLeft; +import net.runelite.client.callback.ClientThread; +import net.runelite.client.chat.ChatMessageManager; +import net.runelite.client.config.ChatColorConfig; +import net.runelite.client.game.ChatIconManager; +import net.runelite.client.game.chatbox.ChatboxPanelManager; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.anyString; +import org.mockito.Mock; +import static org.mockito.Mockito.lenient; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.never; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; +import org.mockito.junit.MockitoJUnitRunner; + +@RunWith(MockitoJUnitRunner.class) +public class ChatChannelPluginTest +{ + @Inject + private ChatChannelPlugin chatChannelPlugin; + + @Mock + @Bind + private Client client; + + @Mock + @Bind + private ChatIconManager chatIconManager; + + @Mock + @Bind + private ChatChannelConfig config; + + @Mock + @Bind + private ClientThread clientThread; + + @Mock + @Bind + private ChatboxPanelManager chatboxPanelManager; + + @Mock + @Bind + private ChatColorConfig chatColorConfig; + + @Mock + @Bind + private ChatMessageManager chatMessageManager; + + @Before + public void before() + { + Guice.createInjector(BoundFieldModule.of(this)).injectMembers(this); + } + + @Test + public void testJoinLeave() + { + ClanChannel channel = mock(ClanChannel.class); + ClanSettings settings = mock(ClanSettings.class); + + when(client.getClanChannel()).thenReturn(channel); + lenient().when(client.getClanSettings()).thenReturn(settings); + when(config.clanChatShowJoinLeave()).thenReturn(true); + lenient().when(client.addChatMessage(any(ChatMessageType.class), anyString(), anyString(), anyString())).thenAnswer(a -> mock(MessageNode.class)); + + ClanChannelMember member = mock(ClanChannelMember.class); + lenient().when(member.getRank()).thenReturn(ClanRank.OWNER); + chatChannelPlugin.onClanMemberLeft(new ClanMemberLeft(channel, member)); + + ClanChannelMember member2 = mock(ClanChannelMember.class); + lenient().when(member2.getRank()).thenReturn(ClanRank.OWNER); + chatChannelPlugin.onClanMemberJoined(new ClanMemberJoined(channel, member2)); + + lenient().when(client.getTickCount()).thenReturn(ChatChannelPlugin.MESSAGE_DELAY + 1); + chatChannelPlugin.addActivityMessages(); + + verify(client, never()).addChatMessage(any(ChatMessageType.class), anyString(), anyString(), anyString()); + verify(member).compareTo(member2); + } +} \ No newline at end of file From 7d89f5a52f754a2c203194c63eb52f2e03b9f55a Mon Sep 17 00:00:00 2001 From: Adam Date: Sat, 21 Aug 2021 15:18:08 -0400 Subject: [PATCH 8/8] xp updater: don't send updates for dmm, leagues, or beta worlds --- .../plugins/xpupdater/XpUpdaterPlugin.java | 74 ++++++++++++------- 1 file changed, 47 insertions(+), 27 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/xpupdater/XpUpdaterPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/xpupdater/XpUpdaterPlugin.java index 1a529b3328..73f295ccaa 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/xpupdater/XpUpdaterPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/xpupdater/XpUpdaterPlugin.java @@ -28,6 +28,7 @@ package net.runelite.client.plugins.xpupdater; import com.google.inject.Provides; import java.io.IOException; +import java.util.EnumSet; import java.util.Objects; import javax.inject.Inject; import lombok.extern.slf4j.Slf4j; @@ -132,53 +133,72 @@ public class XpUpdaterPlugin extends Plugin private void update(String username) { - String reformedUsername = username.replace(" ", "_"); + EnumSet worldTypes = client.getWorldType(); + username = username.replace(" ", "_"); + updateCml(username, worldTypes); + updateTempleosrs(username, worldTypes); + updateWom(username, worldTypes); + } - if (config.cml()) + private void updateCml(String username, EnumSet worldTypes) + { + if (config.cml() + && !worldTypes.contains(WorldType.LEAGUE) + && !worldTypes.contains(WorldType.DEADMAN) + && !worldTypes.contains(WorldType.TOURNAMENT)) { HttpUrl url = new HttpUrl.Builder() - .scheme("https") - .host("crystalmathlabs.com") - .addPathSegment("tracker") - .addPathSegment("api.php") - .addQueryParameter("type", "update") - .addQueryParameter("player", reformedUsername) - .build(); + .scheme("https") + .host("crystalmathlabs.com") + .addPathSegment("tracker") + .addPathSegment("api.php") + .addQueryParameter("type", "update") + .addQueryParameter("player", username) + .build(); Request request = new Request.Builder() - .header("User-Agent", "RuneLite") - .url(url) - .build(); + .header("User-Agent", "RuneLite") + .url(url) + .build(); sendRequest("CrystalMathLabs", request); } + } - if (config.templeosrs()) + private void updateTempleosrs(String username, EnumSet worldTypes) + { + if (config.templeosrs() + && !worldTypes.contains(WorldType.LEAGUE) + && !worldTypes.contains(WorldType.DEADMAN) + && !worldTypes.contains(WorldType.TOURNAMENT)) { HttpUrl url = new HttpUrl.Builder() - .scheme("https") - .host("templeosrs.com") - .addPathSegment("php") - .addPathSegment("add_datapoint.php") - .addQueryParameter("player", reformedUsername) - .build(); + .scheme("https") + .host("templeosrs.com") + .addPathSegment("php") + .addPathSegment("add_datapoint.php") + .addQueryParameter("player", username) + .build(); Request request = new Request.Builder() - .header("User-Agent", "RuneLite") - .url(url) - .build(); + .header("User-Agent", "RuneLite") + .url(url) + .build(); sendRequest("TempleOSRS", request); } + } - if (config.wiseoldman()) + private void updateWom(String username, EnumSet worldTypes) + { + if (config.wiseoldman() + && !worldTypes.contains(WorldType.LEAGUE) + && !worldTypes.contains(WorldType.DEADMAN) + && !worldTypes.contains(WorldType.TOURNAMENT)) { - final boolean leagueWorld = client.getWorldType().contains(WorldType.LEAGUE); - final String host = leagueWorld ? "trailblazer.wiseoldman.net" : "wiseoldman.net"; - HttpUrl url = new HttpUrl.Builder() .scheme("https") - .host(host) + .host("wiseoldman.net") .addPathSegment("api") .addPathSegment("players") .addPathSegment("track")