Skip to content

Commit df77997

Browse files
committed
1.1.2
1 parent 08165dd commit df77997

5 files changed

Lines changed: 36 additions & 47 deletions

File tree

.github/workflows/dev_build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: Development Build
22
on: push
33

44
env:
5-
APP_VERSION: "1.1.1"
5+
APP_VERSION: "1.1.2"
66
MC: "1.21.8"
77

88
jobs:

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ yarn_mappings=1.21.8+build.1
66
loader_version=0.16.14
77

88
# Mod Properties
9-
mod_version=1.21.8_1.1.0
9+
mod_version=1.21.8_1.1.2
1010
maven_group=com.nekiplay.hypixelcry
1111
archives_base_name=hypixel-cry
1212

src/main/java/com/nekiplay/hypixelcry/HypixelCry.java

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
import java.io.File;
3030
import java.nio.charset.StandardCharsets;
3131
import java.nio.file.Files;
32+
import java.util.ArrayList;
3233

3334
public class HypixelCry implements ClientModInitializer {
3435
public static final String MOD_ID = "hypixelcry";
@@ -122,16 +123,24 @@ public void onInitializeClient() {
122123
loadStartupScripts(scriptsDir);
123124
}
124125

126+
private ArrayList<String> startUpScriptNames = new ArrayList<String>() {{
127+
add("autoload.lua");
128+
add("startup.lua");
129+
add("init.lua");
130+
}};
131+
125132
private void loadStartupScripts(File dir) {
126133
// Автозагрузка скриптов при старте
127-
File autoLoadScript = new File(dir, "autoload.lua");
128-
if (autoLoadScript.exists()) {
129-
try {
130-
LUA_MANAGER.executeScript(autoLoadScript);
131-
System.out.println("Autoload script executed successfully");
132-
} catch (Exception e) {
133-
System.out.println("Error executing autoload script: " + e.getMessage());
134-
e.printStackTrace();
134+
for (String name : startUpScriptNames) {
135+
File autoLoadScript = new File(dir, name);
136+
if (autoLoadScript.exists()) {
137+
try {
138+
LUA_MANAGER.executeScript(autoLoadScript);
139+
System.out.println("Autoload script executed successfully");
140+
} catch (Exception e) {
141+
System.out.println("Error executing autoload script: " + e.getMessage());
142+
e.printStackTrace();
143+
}
135144
}
136145
}
137146
}

src/main/java/com/nekiplay/hypixelcry/config/NEUConfig.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
public class NEUConfig extends Config {
1919
@Override
2020
public StructuredText getTitle() {
21-
return StructuredText.of("§6Hypixel Cry §7v" + "1.1.1");
21+
return StructuredText.of("§6Hypixel Cry §7v" + "1.1.2");
2222
}
2323

2424
@Override

src/main/kotlin/com/nekiplay/hypixelcry/features/lua/LuaManager.kt

Lines changed: 16 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,8 @@ class LuaManager() {
5252
"libs/",
5353
"lib/",
5454
configDir.resolve("hypixelcry/scripts/libs/").toString() + "/",
55-
configDir.resolve("hypixelcry/scripts/lib/").toString() + "/"
55+
configDir.resolve("hypixelcry/scripts/lib/").toString() + "/",
56+
configDir.resolve("hypixelcry/scripts/").toString() + "/"
5657
)
5758

5859
private val moduleSearchPaths = CopyOnWriteArrayList<String>().apply {
@@ -206,17 +207,6 @@ class LuaManager() {
206207
return file
207208
}
208209
}
209-
210-
// Check module/init.* structure
211-
val moduleDir = File("$path$baseName/")
212-
if (moduleDir.exists() && moduleDir.isDirectory) {
213-
for (ext in luaExtensions) {
214-
val initFile = File(moduleDir, "init$ext")
215-
if (initFile.exists() && initFile.isFile) {
216-
return initFile
217-
}
218-
}
219-
}
220210
}
221211
return null
222212
}
@@ -225,17 +215,15 @@ class LuaManager() {
225215
fun addClientTickCallback(callback: LuaValue): Boolean {
226216
if (!callback.isfunction()) return false
227217
synchronized(callbacksLock) {
228-
clientTickCallbacks.add(callback)
218+
return clientTickCallbacks.add(callback)
229219
}
230-
return true
231220
}
232221

233222
fun addWorldRendererCallback(callback: LuaValue): Boolean {
234223
if (!callback.isfunction()) return false
235224
synchronized(callbacksLock) {
236-
renderWorldCallbacks.add(callback)
225+
return renderWorldCallbacks.add(callback)
237226
}
238-
return false
239227
}
240228

241229
fun addKeyEventCallback(callback: LuaValue): Boolean {
@@ -252,18 +240,24 @@ class LuaManager() {
252240
}
253241
}
254242
fun removeWorldRendererCallback(callback: LuaValue): Boolean {
255-
return renderWorldCallbacks.remove(callback)
243+
synchronized(callbacksLock) {
244+
return renderWorldCallbacks.remove(callback)
245+
}
256246
}
257247

258248
fun removeKeyEventCallback(callback: LuaValue): Boolean {
259-
return keyEventCallbacks.remove(callback)
249+
synchronized(callbacksLock) {
250+
return keyEventCallbacks.remove(callback)
251+
}
260252
}
261253

262254
// Methods to clear all callbacks
263255
fun clearAllCallbacks() {
264-
clientTickCallbacks.clear()
265-
renderWorldCallbacks.clear()
266-
keyEventCallbacks.clear()
256+
synchronized(callbacksLock) {
257+
clientTickCallbacks.clear()
258+
renderWorldCallbacks.clear()
259+
keyEventCallbacks.clear()
260+
}
267261
}
268262

269263
// Callback methods
@@ -311,20 +305,6 @@ class LuaManager() {
311305
}
312306
}
313307

314-
fun addModuleSearchPath(path: String) {
315-
val normalizedPath = if (path.endsWith("/")) path else "$path/"
316-
moduleSearchPaths.add(normalizedPath)
317-
}
318-
319-
fun removeModuleSearchPath(path: String) {
320-
val normalizedPath = if (path.endsWith("/")) path else "$path/"
321-
moduleSearchPaths.remove(normalizedPath)
322-
}
323-
324-
fun getModuleSearchPaths(): List<String> {
325-
return moduleSearchPaths.toList()
326-
}
327-
328308
fun executeScript(file: File): Any {
329309
if (!file.exists() || !file.isFile) {
330310
throw FileNotFoundException("Script file not found: ${file.path}")
@@ -416,7 +396,7 @@ class LuaManager() {
416396
return scriptCallbacks.keys.toList()
417397
}
418398

419-
public fun restoreGlobals() {
399+
fun restoreGlobals() {
420400
persistentGlobals.forEach { (name, value) ->
421401
globals.set(name, value)
422402
}

0 commit comments

Comments
 (0)