Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d1c6504973 | ||
|
|
939505c861 |
14
build.gradle
14
build.gradle
@@ -63,11 +63,17 @@ tasks.register('containerJar', Jar) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 3. Fabric nested jars (Fabric Loader 가 META-INF/jars/ 를 스캔해서
|
// 3. Fabric nested jars. Fabric Loader 는 META-INF/jars/ 를 자동 스캔하지
|
||||||
// depends.minecraft 매칭되는 jar 만 활성화).
|
// 않고 outer fabric.mod.json 의 "jars" 배열에 명시된 파일만 처리하므로,
|
||||||
|
// container-resources/fabric.mod.json 의 jars 항목과 일치하는 고정 파일명
|
||||||
|
// (버전 suffix 제거) 으로 넣는다.
|
||||||
into('META-INF/jars') {
|
into('META-INF/jars') {
|
||||||
from project(':fabric-1216').tasks.named('remapJar').flatMap { it.archiveFile }
|
from(project(':fabric-1216').tasks.named('remapJar').flatMap { it.archiveFile }) {
|
||||||
from project(':fabric-2612').tasks.named('remapJar').flatMap { it.archiveFile }
|
rename '.+\\.jar', 'chat_answer-fabric-1216.jar'
|
||||||
|
}
|
||||||
|
from(project(':fabric-2612').tasks.named('remapJar').flatMap { it.archiveFile }) {
|
||||||
|
rename '.+\\.jar', 'chat_answer-fabric-2612.jar'
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -38,16 +38,22 @@ public final class ChatAnswerCore {
|
|||||||
* 호출이 일어나지 않아 0b 로 유지되고, 모드가 있으면 첫 로그인 직후 1b 로 갱신.
|
* 호출이 일어나지 않아 0b 로 유지되고, 모드가 있으면 첫 로그인 직후 1b 로 갱신.
|
||||||
*/
|
*/
|
||||||
public static void onPlayerJoin(ServerPlayer player) {
|
public static void onPlayerJoin(ServerPlayer player) {
|
||||||
|
String name = player.getName().getString();
|
||||||
|
LOG.info("[{}] onPlayerJoin fired for {}", MOD_ID, name);
|
||||||
MinecraftServer server = player.level().getServer();
|
MinecraftServer server = player.level().getServer();
|
||||||
if (server == null) return;
|
if (server == null) {
|
||||||
|
LOG.warn("[{}] onPlayerJoin: server is null, skipping active-flag set for {}", MOD_ID, name);
|
||||||
|
return;
|
||||||
|
}
|
||||||
CommandSourceStack source = server.createCommandSourceStack().withSuppressedOutput();
|
CommandSourceStack source = server.createCommandSourceStack().withSuppressedOutput();
|
||||||
try {
|
try {
|
||||||
server.getCommands().performPrefixedCommand(
|
server.getCommands().performPrefixedCommand(
|
||||||
source,
|
source,
|
||||||
"data modify storage chat_answer:status active set value 1b"
|
"data modify storage chat_answer:status active set value 1b"
|
||||||
);
|
);
|
||||||
|
LOG.info("[{}] active=1b set after {} joined", MOD_ID, name);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
LOG.debug("[{}] failed to set active flag: {}", MOD_ID, e.toString());
|
LOG.warn("[{}] failed to set active flag for {}: {}", MOD_ID, name, e.toString(), e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -8,6 +8,10 @@
|
|||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"icon": "assets/chat_answer/icon.png",
|
"icon": "assets/chat_answer/icon.png",
|
||||||
"environment": "*",
|
"environment": "*",
|
||||||
|
"jars": [
|
||||||
|
{ "file": "META-INF/jars/chat_answer-fabric-1216.jar" },
|
||||||
|
{ "file": "META-INF/jars/chat_answer-fabric-2612.jar" }
|
||||||
|
],
|
||||||
"depends": {
|
"depends": {
|
||||||
"fabricloader": ">=0.16.0",
|
"fabricloader": ">=0.16.0",
|
||||||
"java": ">=21"
|
"java": ">=21"
|
||||||
|
|||||||
@@ -4,15 +4,26 @@ import kr.tkrmagid.chatanswer.core.ChatAnswerCore;
|
|||||||
import net.fabricmc.api.ModInitializer;
|
import net.fabricmc.api.ModInitializer;
|
||||||
import net.fabricmc.fabric.api.message.v1.ServerMessageEvents;
|
import net.fabricmc.fabric.api.message.v1.ServerMessageEvents;
|
||||||
import net.fabricmc.fabric.api.networking.v1.ServerPlayConnectionEvents;
|
import net.fabricmc.fabric.api.networking.v1.ServerPlayConnectionEvents;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
public final class ChatAnswerFabric implements ModInitializer {
|
public final class ChatAnswerFabric implements ModInitializer {
|
||||||
|
private static final Logger LOG = LoggerFactory.getLogger(ChatAnswerCore.MOD_ID);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onInitialize() {
|
public void onInitialize() {
|
||||||
ServerMessageEvents.ALLOW_CHAT_MESSAGE.register((message, sender, params) ->
|
LOG.info("[{}] Fabric entrypoint onInitialize starting", ChatAnswerCore.MOD_ID);
|
||||||
ChatAnswerCore.handleChat(sender, message.signedContent())
|
try {
|
||||||
);
|
ServerMessageEvents.ALLOW_CHAT_MESSAGE.register((message, sender, params) ->
|
||||||
ServerPlayConnectionEvents.JOIN.register((handler, sender, server) ->
|
ChatAnswerCore.handleChat(sender, message.signedContent())
|
||||||
ChatAnswerCore.onPlayerJoin(handler.player)
|
);
|
||||||
);
|
ServerPlayConnectionEvents.JOIN.register((handler, sender, server) ->
|
||||||
|
ChatAnswerCore.onPlayerJoin(handler.player)
|
||||||
|
);
|
||||||
|
LOG.info("[{}] Fabric entrypoint registered: ALLOW_CHAT_MESSAGE + JOIN", ChatAnswerCore.MOD_ID);
|
||||||
|
} catch (Throwable t) {
|
||||||
|
LOG.error("[{}] Fabric entrypoint event registration failed", ChatAnswerCore.MOD_ID, t);
|
||||||
|
throw t;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,15 +4,26 @@ import kr.tkrmagid.chatanswer.core.ChatAnswerCore;
|
|||||||
import net.fabricmc.api.ModInitializer;
|
import net.fabricmc.api.ModInitializer;
|
||||||
import net.fabricmc.fabric.api.message.v1.ServerMessageEvents;
|
import net.fabricmc.fabric.api.message.v1.ServerMessageEvents;
|
||||||
import net.fabricmc.fabric.api.networking.v1.ServerPlayConnectionEvents;
|
import net.fabricmc.fabric.api.networking.v1.ServerPlayConnectionEvents;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
public final class ChatAnswerFabric implements ModInitializer {
|
public final class ChatAnswerFabric implements ModInitializer {
|
||||||
|
private static final Logger LOG = LoggerFactory.getLogger(ChatAnswerCore.MOD_ID);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onInitialize() {
|
public void onInitialize() {
|
||||||
ServerMessageEvents.ALLOW_CHAT_MESSAGE.register((message, sender, params) ->
|
LOG.info("[{}] Fabric entrypoint onInitialize starting", ChatAnswerCore.MOD_ID);
|
||||||
ChatAnswerCore.handleChat(sender, message.signedContent())
|
try {
|
||||||
);
|
ServerMessageEvents.ALLOW_CHAT_MESSAGE.register((message, sender, params) ->
|
||||||
ServerPlayConnectionEvents.JOIN.register((handler, sender, server) ->
|
ChatAnswerCore.handleChat(sender, message.signedContent())
|
||||||
ChatAnswerCore.onPlayerJoin(handler.player)
|
);
|
||||||
);
|
ServerPlayConnectionEvents.JOIN.register((handler, sender, server) ->
|
||||||
|
ChatAnswerCore.onPlayerJoin(handler.player)
|
||||||
|
);
|
||||||
|
LOG.info("[{}] Fabric entrypoint registered: ALLOW_CHAT_MESSAGE + JOIN", ChatAnswerCore.MOD_ID);
|
||||||
|
} catch (Throwable t) {
|
||||||
|
LOG.error("[{}] Fabric entrypoint event registration failed", ChatAnswerCore.MOD_ID, t);
|
||||||
|
throw t;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ org.gradle.parallel=true
|
|||||||
|
|
||||||
# ───── mod metadata ─────────────────────────────────────────────────────────
|
# ───── mod metadata ─────────────────────────────────────────────────────────
|
||||||
mod_id=chat_answer
|
mod_id=chat_answer
|
||||||
mod_version=1.3.0
|
mod_version=1.3.2
|
||||||
mod_group=kr.tkrmagid.chatanswer
|
mod_group=kr.tkrmagid.chatanswer
|
||||||
mod_name=채팅정답
|
mod_name=채팅정답
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user