Skip to content

Commit 9d3398e

Browse files
committed
Add kotlin stuff
1 parent 7cad165 commit 9d3398e

File tree

23 files changed

+3657
-13
lines changed

23 files changed

+3657
-13
lines changed

build.gradle

Lines changed: 49 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
//file:noinspection UnnecessaryQualifiedReference
22
//file:noinspection GroovyAssignabilityCheck
33

4+
45
plugins {
56
id "dev.architectury.architectury-pack200" version "0.1.3"
6-
id "gg.essential.loom" version "0.10.0.4"
7+
id 'org.jetbrains.kotlin.jvm' version '1.6.10'
8+
id "cc.polyfrost.loom" version "0.10.0.5"
79
id "net.kyori.blossom" version "1.3.0"
810
id "java"
9-
id 'maven-publish'
11+
id 'org.jetbrains.kotlin.plugin.serialization' version '1.6.10'
1012
}
1113

1214
version = mod_version
@@ -55,6 +57,19 @@ repositories {
5557
mavenCentral()
5658
maven { url 'https://repo.polyfrost.cc/releases' }
5759
maven { url 'https://jitpack.io' }
60+
maven { url 'https://repo.essential.gg/repository/maven-public' }
61+
}
62+
63+
static String ktor(String module, String version, boolean addSuffix) {
64+
return "io.ktor:ktor-" + module + (addSuffix ? "-jvm" : "") + (version != null ? ":" + version : "");
65+
}
66+
67+
static String ktorClient(String module, String version) {
68+
return ktor("client-" + module, version, true);
69+
}
70+
71+
static String ktorServer(String module, String version) {
72+
return ktor("server-" + module, version, true);
5873
}
5974

6075
dependencies {
@@ -67,16 +82,39 @@ dependencies {
6782
include("org.java-websocket:Java-WebSocket:1.5.3")
6883
include('org.reflections:reflections:0.10.2')
6984
include("org.json:json:20220924")
70-
include ('org.slick2d:slick2d-core:1.0.2') {
85+
include('org.slick2d:slick2d-core:1.0.2') {
7186
exclude module: 'lwjgl'
7287
}
7388
include('com.github.JnCrMx:discord-game-sdk4j:v0.5.5')
89+
include("gg.essential:elementa-1.8.9-forge:590")
7490

7591
compileOnly('org.spongepowered:mixin:0.7.11-SNAPSHOT')
7692

7793

7894
compileOnly(files('libs/Hytils-Reborn-1.6.0-beta4.jar'))
7995
compileOnly("me.djtheredstoner:DevAuth-forge-legacy:1.1.0")
96+
97+
include(platform(ktor("bom", "2.2.4", false)))
98+
99+
include(ktor("serialization-kotlinx-json", null, true))
100+
include(ktor("serialization-gson", null, true))
101+
102+
include(ktorClient("core", null))
103+
include(ktorClient("cio", null))
104+
include(ktorClient("content-negotiation", null))
105+
include(ktorClient("encoding", null))
106+
107+
include(ktorServer("core", null))
108+
include(ktorServer("cio", null))
109+
include(ktorServer("content-negotiation", null))
110+
include(ktorServer("compression", null))
111+
include(ktorServer("cors", null))
112+
include(ktorServer("conditional-headers", null))
113+
include(ktorServer("auto-head-response", null))
114+
include(ktorServer("default-headers", null))
115+
include(ktorServer("host-common", null))
116+
include(ktorServer("auth", null))
117+
80118
}
81119

82120
processResources {
@@ -121,7 +159,7 @@ jar {
121159
'ModSide': 'CLIENT',
122160
'ForceLoadAsMod': true,
123161
'FMLAT': "hysentials_at.cfg",
124-
'MixinConfigs': ["mixins.hysentials.json", "mixins.hytils.json"],
162+
'MixinConfigs': ["mixins.hysentials.json"],
125163
"TweakOrder": "0",
126164
'TweakClass': "cc.polyfrost.oneconfig.loader.stage0.LaunchWrapperTweaker"
127165
)
@@ -131,3 +169,10 @@ jar {
131169
remapJar {
132170
destinationDirectory = file("C:\\Users\\griff\\Desktop\\games\\MultiMC\\instances\\1.8.9\\.minecraft\\mods")
133171
}
172+
173+
compileKotlin {
174+
kotlinOptions {
175+
jvmTarget = "1.8"
176+
freeCompilerArgs = ['-Xjvm-default=compatibility']
177+
}
178+
}

gradle.properties

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,7 @@ mod_name = Hysentials
88
mod_id = hysentials
99
mod_version = 1.1.0-beta2
1010

11-
loom.platform = forge
11+
loom.platform = forge
12+
13+
redsoneRepositoryUsername={token}
14+
redsoneRepositoryPassword={secret}

src/main/java/cc/woverflow/hysentials/Hysentials.java

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import cc.polyfrost.oneconfig.events.EventManager;
44
import cc.polyfrost.oneconfig.libs.universal.ChatColor;
55
import cc.polyfrost.oneconfig.libs.universal.UChat;
6+
import cc.woverflow.hysentials.gui.UpdateChecker;
67
import cc.woverflow.hysentials.guis.club.ClubDashboardHandler;
78
import cc.woverflow.hysentials.handlers.chat.modules.misc.Limit256;
89
import cc.woverflow.hysentials.util.MUtils;
@@ -76,8 +77,9 @@ public class Hysentials {
7677

7778
@Mod.Instance(MOD_ID)
7879
public static Hysentials INSTANCE;
80+
public static File jarFile;
7981

80-
public File modDir = new File("OVERFLOW", MOD_NAME);
82+
public static String modDir = "./config/hysentials";
8183

8284
private HysentialsConfig config;
8385
private final Logger logger = LogManager.getLogger("Hysentials");
@@ -106,11 +108,13 @@ public class Hysentials {
106108
public CubitCompanion cubitCompanion;
107109

108110

111+
109112
@Mod.EventHandler
110113
public void onFMLPreInitialization(FMLPreInitializationEvent event) {
111-
if (!modDir.exists() && !modDir.mkdirs()) {
114+
if (!new File(modDir).exists() && !new File(modDir).mkdirs()) {
112115
throw new RuntimeException("Failed to create mod directory! Please report this to Ender#9967");
113116
}
117+
jarFile = event.getSourceFile();
114118
}
115119

116120
@Mod.EventHandler
@@ -123,6 +127,8 @@ public void init(FMLInitializationEvent event) {
123127
sbBoxes = new JsonData("./config/hysentials/lines.json", new JSONObject().put("lines", new JSONArray()));
124128
rankColors = new JsonData("/assets/minecraft/textures/icons/colors.json", "./config/hysentials/color.jsonn", true);
125129

130+
HysentialsKt.Companion.init();
131+
126132
try {
127133
System.setProperty("file.encoding", "UTF-8");
128134
Field charset = Charset.class.getDeclaredField("defaultCharset");
@@ -135,6 +141,7 @@ public void init(FMLInitializationEvent event) {
135141
try {
136142
SSLStore store = new SSLStore();
137143
store.load("/ssl/hysentials.der");
144+
store.load("/ssl/socket.der");
138145
SSLContext context = store.finish();
139146
SSLContext.setDefault(context);
140147
HttpsURLConnection.setDefaultSSLSocketFactory(context.getSocketFactory());

0 commit comments

Comments
 (0)