Skip to content

Commit 78d31ce

Browse files
RobotHanzoCopilot
andcommitted
migrate to kotlin (#39)
* migrate to kotlin * update workflow to use jdk 25 * Update src/main/kotlin/dev/robothanzo/werewolf/config/WebSocketConfig.kt Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * refactor: streamline collections usage and enhance WebSocket session management * refactor: optimize mutable collections and improve string interpolation across services * fix compile issues --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent bfb01f3 commit 78d31ce

104 files changed

Lines changed: 6236 additions & 6175 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/build.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@ jobs:
1111

1212
steps:
1313
- uses: actions/checkout@v3
14-
- name: Set up JDK 21
14+
- name: Set up JDK 25
1515
uses: actions/setup-java@v3
1616
with:
1717
distribution: adopt
18-
java-version: 21
18+
java-version: 25
1919
cache: gradle
2020
- name: Grant execute permission for gradlew
2121
run: chmod +x gradlew

.idea/kotlinc.xml

Lines changed: 10 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/modules.xml

Lines changed: 0 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/modules/dev.robothanzo.werewolf.WerewolfHelper.main.iml

Lines changed: 0 additions & 8 deletions
This file was deleted.

build.gradle.kts

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ plugins {
22
java
33
id("org.springframework.boot") version "4.0.2"
44
id("io.spring.dependency-management") version "1.1.7"
5+
kotlin("jvm") version "2.3.0"
6+
kotlin("plugin.spring") version "2.3.0"
57
}
68

79
group = "dev.robothanzo.werewolf"
@@ -20,11 +22,15 @@ dependencies {
2022
implementation("org.springframework.boot:spring-boot-starter-websocket")
2123
implementation("org.springframework.boot:spring-boot-starter-security")
2224
implementation("org.mongodb:mongodb-spring-session:4.0.0-rc1")
23-
25+
26+
// Kotlin
27+
implementation("com.fasterxml.jackson.module:jackson-module-kotlin")
28+
implementation("org.jetbrains.kotlin:kotlin-reflect")
29+
2430
// Discord
2531
implementation("net.dv8tion:JDA:6.3.0")
2632
implementation("club.minnced:discord-webhooks:0.8.4")
27-
implementation("com.github.RobotHanzo:JDAInteractions:v0.1.4")
33+
implementation("com.github.RobotHanzo:JDAInteractions:0.2.0")
2834
implementation("com.github.Mokulu:discord-oauth2-api:1.0.4")
2935

3036
// JDA Audio supplements
@@ -54,6 +60,13 @@ tasks {
5460
options.encoding = Charsets.UTF_8.name()
5561
}
5662

63+
compileKotlin {
64+
compilerOptions {
65+
freeCompilerArgs.addAll("-Xjsr305=strict")
66+
jvmTarget.set(org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_25)
67+
}
68+
}
69+
5770
bootJar {
5871
mainClass.set("dev.robothanzo.werewolf.WerewolfApplication")
5972
}

build_output.txt

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
WARNING: A restricted method in java.lang.System has been called
2+
WARNING: java.lang.System::load has been called by net.rubygrapefruit.platform.internal.NativeLibraryLoader in an unnamed module (file:/C:/Users/Nathan%20Lee/.gradle/wrapper/dists/gradle-9.3.1-bin/23ovyewtku6u96viwx3xl3oks/gradle-9.3.1/lib/native-platform-0.22-milestone-29.jar)
3+
WARNING: Use --enable-native-access=ALL-UNNAMED to avoid a warning for callers in this module
4+
WARNING: Restricted methods will be blocked in a future release unless native access is enabled
5+
6+
Starting a Gradle Daemon (subsequent builds will be faster)
7+
> Task :checkKotlinGradlePluginConfigurationErrors SKIPPED
8+
9+
> Task :compileKotlin FAILED
10+
e: file:///C:/Users/Nathan%20Lee/Coding%20Projects/Java%20Projects/WerewolfHelper/src/main/kotlin/dev/robothanzo/werewolf/commands/Poll.kt:45:17 Argument type mismatch: actual type is 'Runnable', but 'Function0<Unit>?' was expected.
11+
12+
FAILURE: Build failed with an exception.
13+
14+
* What went wrong:
15+
Execution failed for task ':compileKotlin'.
16+
> A failure occurred while executing org.jetbrains.kotlin.compilerRunner.GradleCompilerRunnerWithWorkers$GradleKotlinCompilerWorkAction
17+
> Compilation error. See log for more details
18+
19+
* Try:
20+
> Run with --stacktrace option to get the stack trace.
21+
> Run with --info or --debug option to get more log output.
22+
> Run with --scan to get full insights from a Build Scan (powered by Develocity).
23+
> Get more help at https://help.gradle.org.
24+
25+
BUILD FAILED in 35s
26+
1 actionable task: 1 executed

src/dashboard/src/features/game/hooks/useGameState.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,6 @@ export const useGameState = (guildId: string | undefined, user: User | null) =>
3535

3636
const [showSessionExpired, setShowSessionExpired] = useState(false);
3737

38-
// Helpers to update overlay
39-
const setOverlayVisible = (visible: boolean) => setOverlayState(prev => ({...prev, visible}));
40-
4138
// Helper to map session data to GameState players
4239
const mapSessionToPlayers = (sessionData: any): Player[] => {
4340
return sessionData.players.map((player: any) => ({

src/main/java/dev/robothanzo/werewolf/WerewolfApplication.java

Lines changed: 0 additions & 120 deletions
This file was deleted.

src/main/java/dev/robothanzo/werewolf/audio/Audio.java

Lines changed: 0 additions & 56 deletions
This file was deleted.

src/main/java/dev/robothanzo/werewolf/audio/AudioPlayerSendHandler.java

Lines changed: 0 additions & 32 deletions
This file was deleted.

0 commit comments

Comments
 (0)