mirror of
https://github.com/xzb23/Minecraft-Command-Permission-Control.git
synced 2026-11-22 00:34:36 +08:00
新增游戏内配置界面
This commit is contained in:
4 files changed
+29
-2
No files matched your search
@@ -1,6 +1,12 @@
|
||||
package com.ataku.stopcheat;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.neoforged.api.distmarker.Dist;
|
||||
import net.neoforged.fml.ModContainer;
|
||||
import net.neoforged.fml.loading.FMLEnvironment;
|
||||
import net.neoforged.neoforge.client.gui.ConfigurationScreen;
|
||||
import net.neoforged.neoforge.client.gui.IConfigScreenFactory;
|
||||
import net.neoforged.neoforge.common.ModConfigSpec;
|
||||
|
||||
// An example config class. This is not required, but it's a good idea to have one to keep your config organized.
|
||||
@@ -27,4 +33,11 @@ public class Config {
|
||||
|
||||
|
||||
static final ModConfigSpec SPEC = BUILDER.build();
|
||||
|
||||
public static void configGUI(ModContainer container) {
|
||||
container.registerExtensionPoint(
|
||||
IConfigScreenFactory.class,
|
||||
ConfigurationScreen::new
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,8 @@
|
||||
package com.ataku.stopcheat;
|
||||
|
||||
import net.neoforged.api.distmarker.Dist;
|
||||
import net.neoforged.fml.event.config.ModConfigEvent;
|
||||
import net.neoforged.fml.loading.FMLEnvironment;
|
||||
import net.neoforged.neoforge.event.entity.player.PlayerEvent;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
@@ -35,6 +37,10 @@ public class stopcheat {
|
||||
NeoForge.EVENT_BUS.addListener(this::loadl10nandconfig);
|
||||
// 注册配置文件
|
||||
modContainer.registerConfig(ModConfig.Type.COMMON, Config.SPEC);
|
||||
|
||||
// 游戏内配置界面
|
||||
if (FMLEnvironment.dist == Dist.DEDICATED_SERVER){return;} //专用服务端不注册
|
||||
else {Config.configGUI(modContainer);}
|
||||
}
|
||||
|
||||
private void commonSetup(FMLCommonSetupEvent event) {
|
||||
|
||||
@@ -3,5 +3,9 @@
|
||||
"aza.stopcheat.warn.config.stopindex": "{} configuration unavailable, args_STOPINDEX error, reset to 0",
|
||||
"aza.stopcheat.log.intercept": "{} used {} command and was intercepted",
|
||||
"aza.stopcheat.broadcast.reload": "Configuration reloaded",
|
||||
"aza.stopcheat.broadcast.cheat": "§cNo cheating allowed (>v0"
|
||||
"aza.stopcheat.broadcast.cheat": "§cNo cheating allowed (>v0",
|
||||
|
||||
"stopcheat.configuration.version": "Config Version",
|
||||
"stopcheat.configuration.blacked_commands": "Blacklisted Commands",
|
||||
"stopcheat.configuration.pass_users": "Bypass Users"
|
||||
}
|
||||
@@ -3,5 +3,9 @@
|
||||
"aza.stopcheat.warn.config.stopindex": "{} 配置不可用, args_STOPINDEX错误,重置为0",
|
||||
"aza.stopcheat.log.intercept": "{} 使用 {} 命令被拦截",
|
||||
"aza.stopcheat.broadcast.reload": "配置重载完成",
|
||||
"aza.stopcheat.broadcast.cheat": "§c不准作弊哦(>v0"
|
||||
"aza.stopcheat.broadcast.cheat": "§c不准作弊哦(>v0",
|
||||
|
||||
"stopcheat.configuration.version": "配置文件版本",
|
||||
"stopcheat.configuration.blacked_commands": "禁用指令列表",
|
||||
"stopcheat.configuration.pass_users": "白名单玩家"
|
||||
}
|
||||
Reference in new issue
Block a user