Compare commits

..

9 Commits

Author SHA1 Message Date
kohlerpop1
42f9fe360b Removal of debug print statements! 2025-04-25 16:58:24 -04:00
GitHub Action
dff226740c Update version in pom.xml 2025-04-25 19:42:02 +00:00
David Kohler
951d30e6a7 Merge pull request #124 from jwdeveloper/develop-1.10.1
Add additional helper methods back to TikTokLinkMicBattleEvent!
2025-04-25 15:40:08 -04:00
kohlerpop1
1df912b722 Add additional helper methods back to TikTokLinkMicBattleEvent! 2025-04-25 15:37:22 -04:00
GitHub Action
4aec20cc35 Update version in pom.xml 2025-04-17 21:47:42 +00:00
kohlerpop1
d877d38db6 MINOR 2025-04-17 17:45:25 -04:00
David Kohler
db199e9a64 MINOR 2025-04-17 17:39:03 -04:00
David Kohler
1c56cf35f0 MINOR 2025-04-17 17:33:10 -04:00
David Kohler
225cb2df11 Merge pull request #123 from jwdeveloper/develop-1.10.0
Adapt everything to newly updated proto and fix all mappings for those events
2025-04-17 17:32:17 -04:00
13 changed files with 49 additions and 15 deletions

View File

@@ -46,7 +46,7 @@ jobs:
run: mkdir staging && cp Client/target/Client-${{steps.version.outputs.version_tag}}-all.jar staging run: mkdir staging && cp Client/target/Client-${{steps.version.outputs.version_tag}}-all.jar staging
- name: 5 set up a cache for maven - name: 5 set up a cache for maven
uses: actions/cache@v2 uses: actions/cache@v3
with: with:
path: ~/.m2 path: ~/.m2
key: ${{runner.os}}-m2-${{hashFiles('**/pom.xml')}} key: ${{runner.os}}-m2-${{hashFiles('**/pom.xml')}}

View File

@@ -5,7 +5,7 @@
<parent> <parent>
<artifactId>TikTokLiveJava</artifactId> <artifactId>TikTokLiveJava</artifactId>
<groupId>io.github.jwdeveloper.tiktok</groupId> <groupId>io.github.jwdeveloper.tiktok</groupId>
<version>1.9.2-Release</version> <version>1.10.1-Release</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<artifactId>API</artifactId> <artifactId>API</artifactId>

View File

@@ -51,7 +51,6 @@ public class TikTokLinkMicArmiesEvent extends TikTokHeaderEvent {
public TikTokLinkMicArmiesEvent(WebcastLinkMicArmies msg) { public TikTokLinkMicArmiesEvent(WebcastLinkMicArmies msg) {
super(msg.getCommon()); super(msg.getCommon());
System.out.println(msg);
battleId = msg.getBattleId(); battleId = msg.getBattleId();
armies = new HashMap<>(); armies = new HashMap<>();
picture = Picture.map(msg.getGifIconImage()); picture = Picture.map(msg.getGifIconImage());

View File

@@ -51,7 +51,6 @@ public class TikTokLinkMicBattleEvent extends TikTokHeaderEvent
public TikTokLinkMicBattleEvent(WebcastLinkMicBattle msg) { public TikTokLinkMicBattleEvent(WebcastLinkMicBattle msg) {
super(msg.getCommon()); super(msg.getCommon());
System.out.println(msg);
battleId = msg.getBattleId(); battleId = msg.getBattleId();
finished = msg.getAction() == BattleAction.BATTLE_ACTION_FINISH; finished = msg.getAction() == BattleAction.BATTLE_ACTION_FINISH;
battleType = msg.getBattleSetting().getBattleType(); battleType = msg.getBattleSetting().getBattleType();
@@ -128,4 +127,37 @@ public class TikTokLinkMicBattleEvent extends TikTokHeaderEvent
int referencePoints = teams.get(0).getTotalPoints(); int referencePoints = teams.get(0).getTotalPoints();
return teams.stream().allMatch(team -> team.getTotalPoints() == referencePoints); return teams.stream().allMatch(team -> team.getTotalPoints() == referencePoints);
} }
/**
* @param battleHostName name of host to search
* @return Team instance containing name of host or null if no team found */
public Team getTeam(String battleHostName) {
List<Team> list = getTeams(battleHostName);
return list.isEmpty() ? null : list.get(0);
}
/**
* @param battleHostName name of host to search
* @return Team instances not containing name of host */
public List<Team> getOpponentTeams(String battleHostName) {
List<Team> list = getTeams(battleHostName);
return list.isEmpty() ? null : list;
}
/**
* @param battleHostName name of host to search
* @return {@link List<Team>} with host team first, then opponent teams
* <p> If host is in neither or teams is empty, returns empty
* <p> Otherwise always teams.length in length;
*/
public List<Team> getTeams(String battleHostName) {
if (teams.isEmpty() || teams.stream().noneMatch(team -> team.contains(battleHostName)))
return Collections.EMPTY_LIST;
Team hostTeam = teams.stream().filter(team -> team.contains(battleHostName)).findFirst().orElseThrow();
List<Team> opponentTeams = teams.stream().filter(team -> !team.contains(battleHostName)).toList();
List<Team> teams = new ArrayList<>();
teams.add(hostTeam);
teams.addAll(opponentTeams);
return teams;
}
} }

View File

@@ -81,4 +81,8 @@ public class Team {
this(anchorInfo); this(anchorInfo);
this.winStreak = (int) battleCombo.getComboCount(); this.winStreak = (int) battleCombo.getComboCount();
} }
public boolean contains(String name) {
return hosts.stream().anyMatch(user -> user.getName().equals(name));
}
} }

View File

@@ -5,7 +5,7 @@
<parent> <parent>
<artifactId>TikTokLiveJava</artifactId> <artifactId>TikTokLiveJava</artifactId>
<groupId>io.github.jwdeveloper.tiktok</groupId> <groupId>io.github.jwdeveloper.tiktok</groupId>
<version>1.9.2-Release</version> <version>1.10.1-Release</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>

View File

@@ -30,7 +30,6 @@ import io.github.jwdeveloper.tiktok.data.models.gifts.Gift;
import io.github.jwdeveloper.tiktok.data.models.gifts.GiftComboStateType; import io.github.jwdeveloper.tiktok.data.models.gifts.GiftComboStateType;
import io.github.jwdeveloper.tiktok.gifts.TikTokGiftsManager; import io.github.jwdeveloper.tiktok.gifts.TikTokGiftsManager;
import io.github.jwdeveloper.tiktok.mappers.handlers.TikTokGiftEventHandler; import io.github.jwdeveloper.tiktok.mappers.handlers.TikTokGiftEventHandler;
import io.github.jwdeveloper.tiktok.messages.data.GiftStruct;
import io.github.jwdeveloper.tiktok.messages.data.Image; import io.github.jwdeveloper.tiktok.messages.data.Image;
import io.github.jwdeveloper.tiktok.messages.data.User; import io.github.jwdeveloper.tiktok.messages.data.User;
import io.github.jwdeveloper.tiktok.messages.webcast.WebcastGiftMessage; import io.github.jwdeveloper.tiktok.messages.webcast.WebcastGiftMessage;
@@ -111,7 +110,7 @@ class TikTokGiftEventHandlerTest {
int userId, int userId,
boolean streakable) { boolean streakable) {
var builder = WebcastGiftMessage.newBuilder(); var builder = WebcastGiftMessage.newBuilder();
var giftBuilder = GiftStruct.newBuilder(); var giftBuilder = io.github.jwdeveloper.tiktok.messages.data.Gift.newBuilder();
var userBuilder = User.newBuilder(); var userBuilder = User.newBuilder();

View File

@@ -70,7 +70,7 @@ Maven
<dependency> <dependency>
<groupId>com.github.jwdeveloper.TikTok-Live-Java</groupId> <groupId>com.github.jwdeveloper.TikTok-Live-Java</groupId>
<artifactId>Client</artifactId> <artifactId>Client</artifactId>
<version>1.9.2-Release</version> <version>1.10.0-Release</version>
<scope>compile</scope> <scope>compile</scope>
</dependency> </dependency>
</dependencies> </dependencies>
@@ -87,7 +87,7 @@ dependencyResolutionManagement {
} }
dependencies { dependencies {
implementation 'com.github.jwdeveloper.TikTok-Live-Java:Client:1.9.2-Release' implementation 'com.github.jwdeveloper.TikTok-Live-Java:Client:1.10.0-Release'
} }
``` ```

View File

@@ -41,7 +41,7 @@
<parent> <parent>
<artifactId>TikTokLiveJava</artifactId> <artifactId>TikTokLiveJava</artifactId>
<groupId>io.github.jwdeveloper.tiktok</groupId> <groupId>io.github.jwdeveloper.tiktok</groupId>
<version>1.9.2-Release</version> <version>1.10.1-Release</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>

View File

@@ -6,7 +6,7 @@
<parent> <parent>
<groupId>io.github.jwdeveloper.tiktok</groupId> <groupId>io.github.jwdeveloper.tiktok</groupId>
<artifactId>TikTokLiveJava</artifactId> <artifactId>TikTokLiveJava</artifactId>
<version>1.9.2-Release</version> <version>1.10.1-Release</version>
</parent> </parent>

View File

@@ -5,7 +5,7 @@
<parent> <parent>
<artifactId>TikTokLiveJava</artifactId> <artifactId>TikTokLiveJava</artifactId>
<groupId>io.github.jwdeveloper.tiktok</groupId> <groupId>io.github.jwdeveloper.tiktok</groupId>
<version>1.9.2-Release</version> <version>1.10.1-Release</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<artifactId>extension-recorder</artifactId> <artifactId>extension-recorder</artifactId>

View File

@@ -7,7 +7,7 @@
<groupId>io.github.jwdeveloper.tiktok</groupId> <groupId>io.github.jwdeveloper.tiktok</groupId>
<artifactId>TikTokLiveJava</artifactId> <artifactId>TikTokLiveJava</artifactId>
<packaging>pom</packaging> <packaging>pom</packaging>
<version>1.9.2-Release</version> <version>1.10.1-Release</version>
<modules> <modules>
<module>API</module> <module>API</module>
<module>Client</module> <module>Client</module>

View File

@@ -5,7 +5,7 @@
<parent> <parent>
<artifactId>TikTokLiveJava</artifactId> <artifactId>TikTokLiveJava</artifactId>
<groupId>io.github.jwdeveloper.tiktok</groupId> <groupId>io.github.jwdeveloper.tiktok</groupId>
<version>1.9.2-Release</version> <version>1.10.1-Release</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>