From f8f731f9275224541b283c9e7c7599505c773c80 Mon Sep 17 00:00:00 2001 From: Coldsmile Date: Fri, 31 Jul 2026 19:07:50 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=AE=8C=E5=96=84=20TPA=20=E5=B9=B6?= =?UTF-8?q?=E6=95=B4=E7=90=86=E6=8F=92=E4=BB=B6=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 28 +- build.gradle | 2 +- .../cn/infstar/essentialsC/EssentialsC.java | 6 + .../essentialsC/FeatureConfigManager.java | 149 +++++++ .../cn/infstar/essentialsC/LangManager.java | 138 +++++- .../essentialsC/admin/AdminModeManager.java | 6 +- .../commands/BlocksMenuCommand.java | 83 ++-- .../essentialsC/commands/HelpCommand.java | 2 + .../essentialsC/commands/TpAcceptCommand.java | 25 +- .../essentialsC/commands/TpDenyCommand.java | 19 +- .../essentialsC/commands/TpIgnoreCommand.java | 4 +- .../essentialsC/commands/TpaAllCommand.java | 19 +- .../essentialsC/commands/TpaCommand.java | 71 ++- .../listeners/JeiRecipeSyncListener.java | 7 +- .../skinbridge/MineSkinGateway.java | 2 +- .../skinbridge/SkinBridgeManager.java | 46 +- .../teleport/TeleportRequestManager.java | 421 ++++++++++++------ src/main/resources/blocks-menu.yml | 73 +++ src/main/resources/config.yml | 184 ++------ src/main/resources/lang/en_US.yml | 410 ++++++++--------- src/main/resources/lang/zh_CN.yml | 410 ++++++++--------- src/main/resources/modules.yml | 2 +- src/main/resources/skin-bridge.yml | 64 +++ 23 files changed, 1289 insertions(+), 882 deletions(-) create mode 100644 src/main/java/cn/infstar/essentialsC/FeatureConfigManager.java create mode 100644 src/main/resources/blocks-menu.yml create mode 100644 src/main/resources/skin-bridge.yml diff --git a/README.md b/README.md index 50aa56f..07ab8c7 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ - 最低支持版本为 `Paper 1.21.11` - 已适配 `Paper 26.2` - 构建环境固定为 `Java 21` -- 配置、模块开关与文本分离:行为配置放在 `config.yml`,模块开关放在 `modules.yml`,提示文本放在 `lang/` +- 配置按职责拆分:主行为配置、模块开关、SkinBridge、菜单布局、维护模式和语言文本分别管理 - 支持运行期模块开关,避免为不同功能组合构建多个插件版本 ## 主要功能 @@ -76,14 +76,14 @@ 1. 从 [Releases](https://github.com/Coldsmiles/EssentialsC/releases) 下载所需版本。 2. 将插件放入服务端的 `plugins/` 目录。 3. 启动一次服务端以生成配置文件。 -4. 按需修改 `plugins/EssentialsC/config.yml` 与 `plugins/EssentialsC/lang/` 下的语言文件。 +4. 按需修改 `plugins/EssentialsC/` 下的配置文件与 `lang/` 语言文件。 5. 如有需要,使用权限插件为玩家授权。 ## 配置说明 -当前配置结构以“行为配置”和“文本配置”分离为原则: +当前配置按功能职责拆分,避免所有设置堆积在一个文件中: -SkinBridge 默认关闭。使用前需同时将 `modules.yml` 中的 `modules.skin-bridge.enabled` 与 `config.yml` 中的 `skin-bridge.enabled` 设为 `true`,在 `skin-bridge.mineskin.api-key` 中配置 MineSkin API Key,并至少启用一个 Provider。真实密钥只应填写在服务器运行目录的 `config.yml` 中,不要写入源码或提交到公开仓库。该模块不再要求安装 SkinsRestorer。`skin-bridge.send-player-message` 控制是否向玩家发送检测、匹配和同步结果提示。`skin-bridge.providers` 下的键名可自由命名,会显示在日志和 `/essc skin status <玩家>` 中;建议使用小写英文、数字和连字符,避免使用点号。控制台可使用 `/essc skin status <玩家>` 与 `/essc skin refresh <玩家>` 进行验证。 +SkinBridge 默认关闭。使用前需同时启用 `modules.yml` 中的 `modules.skin-bridge.enabled` 和 `skin-bridge.yml` 中的 `enabled`,填写 `mineskin.api-key`,并至少启用一个 Provider。真实密钥只应填写在服务器运行目录的 `skin-bridge.yml` 中,不要写入源码或提交到公开仓库。该模块不要求安装 SkinsRestorer。`send-player-message` 控制是否向玩家发送检测、匹配和同步结果提示;`providers` 下的键名可自由命名,并会显示在日志和 `/essc skin status <玩家>` 中。 - `config.yml` - 语言选择 @@ -91,10 +91,14 @@ SkinBridge 默认关闭。使用前需同时将 `modules.yml` 中的 `modules.sk - JEI 同步开关 - 掉落控制 - TPSBar 模式 - - SkinBridge Provider、缓存和超时配置 - - 便捷菜单布局 + - TPA 请求、预热、冷却和音效 - `modules.yml` - 功能模块开关 +- `skin-bridge.yml` + - MineSkin API 与队列设置 + - Provider、缓存和检测设置 +- `blocks-menu.yml` + - 便捷菜单分区、槽位、材质和权限 - `maintenance.yml` - 维护模式状态 - 维护 MOTD @@ -110,7 +114,7 @@ SkinBridge 默认关闭。使用前需同时将 `modules.yml` 中的 `modules.sk - 管理模式文本 - TPSBar 文本 -配置文件包含 `config-version`,后续如有结构升级,可基于版本号进行迁移与重建。 +配置文件包含 `config-version`。从旧结构升级时,插件会备份主配置,并自动把 SkinBridge 与便捷菜单节点迁移到独立文件。 ## 权限示例 @@ -128,6 +132,16 @@ essentialsc.command.feed essentialsc.command.repair essentialsc.command.vanish essentialsc.command.seen +essentialsc.command.tpa +essentialsc.command.tpahere +essentialsc.command.tpaall +essentialsc.command.tpaccept +essentialsc.command.tpdeny +essentialsc.command.tpignore +essentialsc.tpa.bypass-warmup +essentialsc.tpa.bypass-cooldown +# 使用数字覆盖玩家预热时间,例如 3 秒 +essentialsc.tpa.warmup.3 essentialsc.command.admin essentialsc.command.tpsbar essentialsc.command.maintenance diff --git a/build.gradle b/build.gradle index 9e99b6a..36eeaa2 100644 --- a/build.gradle +++ b/build.gradle @@ -8,7 +8,7 @@ plugins { } group = 'cn.infstar' -version = '1.7.0' +version = '1.4.0' repositories { mavenCentral() diff --git a/src/main/java/cn/infstar/essentialsC/EssentialsC.java b/src/main/java/cn/infstar/essentialsC/EssentialsC.java index 4228857..08fdaa3 100644 --- a/src/main/java/cn/infstar/essentialsC/EssentialsC.java +++ b/src/main/java/cn/infstar/essentialsC/EssentialsC.java @@ -36,6 +36,7 @@ public final class EssentialsC extends JavaPlugin { private static LangManager langManager; private ModuleManager moduleManager; + private FeatureConfigManager featureConfigManager; private AdminModeManager adminModeManager; private MaintenanceManager maintenanceManager; private TeleportRequestManager teleportRequestManager; @@ -54,6 +55,7 @@ public final class EssentialsC extends JavaPlugin { public void onEnable() { langManager = new LangManager(this); moduleManager = new ModuleManager(this); + featureConfigManager = new FeatureConfigManager(this); reloadRuntimeModules(); registerCommands(); @@ -96,6 +98,10 @@ public final class EssentialsC extends JavaPlugin { return moduleManager; } + public FeatureConfigManager getFeatureConfigManager() { + return featureConfigManager; + } + public MaintenanceManager getMaintenanceManager() { return maintenanceManager; } diff --git a/src/main/java/cn/infstar/essentialsC/FeatureConfigManager.java b/src/main/java/cn/infstar/essentialsC/FeatureConfigManager.java new file mode 100644 index 0000000..6b7a042 --- /dev/null +++ b/src/main/java/cn/infstar/essentialsC/FeatureConfigManager.java @@ -0,0 +1,149 @@ +package cn.infstar.essentialsC; + +import org.bukkit.configuration.ConfigurationSection; +import org.bukkit.configuration.file.FileConfiguration; +import org.bukkit.configuration.file.YamlConfiguration; + +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.nio.charset.StandardCharsets; + +/** + * 管理体积较大的独立功能配置,并负责从旧版 config.yml 迁移数据。 + */ +public final class FeatureConfigManager { + + private static final int MAIN_CONFIG_VERSION = 2; + + private final EssentialsC plugin; + private final File skinBridgeFile; + private final File blocksMenuFile; + private FileConfiguration skinBridgeConfig; + private FileConfiguration blocksMenuConfig; + + public FeatureConfigManager(EssentialsC plugin) { + this.plugin = plugin; + this.skinBridgeFile = new File(plugin.getDataFolder(), "skin-bridge.yml"); + this.blocksMenuFile = new File(plugin.getDataFolder(), "blocks-menu.yml"); + reload(); + } + + public void reload() { + ensureResource(skinBridgeFile, "skin-bridge.yml"); + ensureResource(blocksMenuFile, "blocks-menu.yml"); + + skinBridgeConfig = loadWithDefaults(skinBridgeFile, "skin-bridge.yml"); + blocksMenuConfig = loadWithDefaults(blocksMenuFile, "blocks-menu.yml"); + migrateLegacyMainConfig(); + migrateLegacyDebugSettings(); + updateMainConfigVersion(); + saveSkinBridgeConfig(); + saveBlocksMenuConfig(); + } + + public FileConfiguration getSkinBridgeConfig() { + return skinBridgeConfig; + } + + public FileConfiguration getBlocksMenuConfig() { + return blocksMenuConfig; + } + + public void saveSkinBridgeConfig() { + save(skinBridgeConfig, skinBridgeFile); + } + + public void saveBlocksMenuConfig() { + save(blocksMenuConfig, blocksMenuFile); + } + + private void migrateLegacyMainConfig() { + FileConfiguration mainConfig = plugin.getConfig(); + boolean migrated = false; + + if (mainConfig.contains("skin-bridge", true)) { + copySection(mainConfig.getConfigurationSection("skin-bridge"), skinBridgeConfig); + mainConfig.set("skin-bridge", null); + migrated = true; + } + if (mainConfig.contains("blocks-menu", true)) { + copySection(mainConfig.getConfigurationSection("blocks-menu"), blocksMenuConfig); + mainConfig.set("blocks-menu", null); + migrated = true; + } + + if (!migrated) { + return; + } + + mainConfig.set("config-version", MAIN_CONFIG_VERSION); + plugin.saveConfig(); + plugin.getLogger().info("已将 SkinBridge 与便捷菜单配置迁移到独立配置文件。"); + } + + private void migrateLegacyDebugSettings() { + FileConfiguration mainConfig = plugin.getConfig(); + boolean hasJeiDebug = mainConfig.contains("jei-sync.debug", true); + boolean hasSkinBridgeDebug = skinBridgeConfig.contains("debug", true); + if (!hasJeiDebug && !hasSkinBridgeDebug) { + return; + } + + boolean debugEnabled = mainConfig.getBoolean("debug", false) + || mainConfig.getBoolean("jei-sync.debug", false) + || skinBridgeConfig.getBoolean("debug", false); + mainConfig.set("debug", debugEnabled); + mainConfig.set("jei-sync.debug", null); + skinBridgeConfig.set("debug", null); + plugin.saveConfig(); + plugin.getLogger().info("已将独立功能调试开关合并到 config.yml 的全局 debug。"); + } + + private void updateMainConfigVersion() { + if (plugin.getConfig().getInt("config-version", 0) >= MAIN_CONFIG_VERSION) { + return; + } + plugin.getConfig().set("config-version", MAIN_CONFIG_VERSION); + plugin.saveConfig(); + } + + private void copySection(ConfigurationSection source, FileConfiguration target) { + if (source == null) { + return; + } + for (String path : source.getKeys(true)) { + if (!source.isConfigurationSection(path)) { + target.set(path, source.get(path)); + } + } + } + + private FileConfiguration loadWithDefaults(File file, String resourcePath) { + YamlConfiguration config = YamlConfiguration.loadConfiguration(file); + InputStream defaultsStream = plugin.getResource(resourcePath); + if (defaultsStream != null) { + YamlConfiguration defaults = YamlConfiguration.loadConfiguration( + new InputStreamReader(defaultsStream, StandardCharsets.UTF_8) + ); + config.setDefaults(defaults); + config.options().copyDefaults(true); + } + return config; + } + + private void ensureResource(File file, String resourcePath) { + if (!file.exists()) { + plugin.saveResource(resourcePath, false); + } + } + + private void save(FileConfiguration config, File file) { + try { + config.save(file); + } catch (IOException exception) { + plugin.getLogger().warning("保存 " + file.getName() + " 失败: " + exception.getMessage()); + } + } +} diff --git a/src/main/java/cn/infstar/essentialsC/LangManager.java b/src/main/java/cn/infstar/essentialsC/LangManager.java index 923ca9b..0618878 100644 --- a/src/main/java/cn/infstar/essentialsC/LangManager.java +++ b/src/main/java/cn/infstar/essentialsC/LangManager.java @@ -1,5 +1,8 @@ package cn.infstar.essentialsC; +import net.kyori.adventure.text.Component; +import net.kyori.adventure.text.minimessage.MiniMessage; +import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer; import org.bukkit.ChatColor; import org.bukkit.configuration.file.FileConfiguration; import org.bukkit.configuration.file.YamlConfiguration; @@ -15,10 +18,22 @@ import java.nio.file.StandardCopyOption; import java.util.ArrayList; import java.util.List; import java.util.Map; +import java.util.regex.Matcher; +import java.util.regex.Pattern; public class LangManager { - private static final int CURRENT_CONFIG_VERSION = 2; + private static final int CURRENT_CONFIG_VERSION = 3; + private static final Pattern HEX_COLOR_PATTERN = Pattern.compile("(?i)&#([0-9a-f]{6})"); + private static final MiniMessage MINI_MESSAGE = MiniMessage.miniMessage(); + private static final Map THEME_COLORS = Map.of( + "&a", "�fb9a", + "&b", "ᒦff", + "&c", "&#ff7e5e", + "&d", "&#c160ff", + "&e", "&#ffc43b", + "&6", "&#f5c962" + ); private final JavaPlugin plugin; private FileConfiguration config; @@ -32,7 +47,7 @@ public class LangManager { } public String getPrefix() { - return translateColorCodes(langFile.getString("prefix", "&6[EssentialsC] &r")); + return renderToLegacy(langFile.getString("prefix", "&6[EssentialsC] &r")); } public String getString(String path) { @@ -40,11 +55,42 @@ public class LangManager { if (value == null) { return translateColorCodes("&c缺少语言文本: " + path); } - return translateColorCodes(value); + return renderToLegacy(value); } public String getString(String path, Map placeholders) { - return applyPlaceholders(getString(path), placeholders); + String value = langFile.getString(path); + if (value == null) { + return translateColorCodes("&c缺少语言文本: " + path); + } + return renderToLegacy(applyPlaceholders(value, placeholders)); + } + + public Component getComponent(String path) { + return getComponent(path, Map.of()); + } + + public Component getComponent(String path, Map placeholders) { + String value = langFile.getString(path); + if (value == null) { + return LegacyComponentSerializer.legacySection() + .deserialize(translateColorCodes("&c缺少语言文本: " + path)); + } + + return renderToComponent(applyPlaceholders(value, placeholders)); + } + + public Component getPrefixedComponent(String path) { + return getPrefixedComponent(path, Map.of()); + } + + public Component getPrefixedComponent(String path, Map placeholders) { + String value = langFile.getString(path); + if (value == null) { + return LegacyComponentSerializer.legacySection() + .deserialize(getPrefix() + translateColorCodes("&c缺少语言文本: " + path)); + } + return renderToComponent(langFile.getString("prefix", "") + applyPlaceholders(value, placeholders)); } public String getPrefixedString(String path) { @@ -63,7 +109,7 @@ public class LangManager { List translated = new ArrayList<>(); for (String value : values) { - translated.add(translateColorCodes(value)); + translated.add(renderToLegacy(value)); } return translated; } @@ -100,7 +146,7 @@ public class LangManager { private void migrateConfigIfNeeded(File configFile) { FileConfiguration existingConfig = YamlConfiguration.loadConfiguration(configFile); int existingVersion = existingConfig.getInt("config-version", 0); - if (existingVersion <= 0 || existingVersion >= CURRENT_CONFIG_VERSION) { + if (existingVersion >= CURRENT_CONFIG_VERSION) { return; } @@ -111,14 +157,27 @@ public class LangManager { Files.copy(configFile.toPath(), backupFile.toPath(), StandardCopyOption.REPLACE_EXISTING); InputStream defaultConfigStream = plugin.getResource("config.yml"); if (defaultConfigStream != null) { - YamlConfiguration defaultConfig = YamlConfiguration.loadConfiguration( + YamlConfiguration migratedConfig = YamlConfiguration.loadConfiguration( new InputStreamReader(defaultConfigStream, StandardCharsets.UTF_8) ); - existingConfig.setDefaults(defaultConfig); - existingConfig.options().copyDefaults(true); + for (String path : existingConfig.getKeys(true)) { + boolean migratedFeaturePath = path.startsWith("skin-bridge.") || path.startsWith("blocks-menu."); + if (!existingConfig.isConfigurationSection(path) + && (migratedConfig.contains(path) || migratedFeaturePath)) { + migratedConfig.set(path, existingConfig.get(path)); + } + } + boolean debugEnabled = existingConfig.getBoolean("debug", false) + || existingConfig.getBoolean("jei-sync.debug", false) + || existingConfig.getBoolean("skin-bridge.debug", false); + migratedConfig.set("debug", debugEnabled); + migratedConfig.set("jei-sync.debug", null); + migratedConfig.set("config-version", CURRENT_CONFIG_VERSION); + migratedConfig.save(configFile); + } else { + existingConfig.set("config-version", CURRENT_CONFIG_VERSION); + existingConfig.save(configFile); } - existingConfig.set("config-version", CURRENT_CONFIG_VERSION); - existingConfig.save(configFile); plugin.getLogger().info("已将 config.yml 从版本 " + existingVersion + " 迁移到 " + CURRENT_CONFIG_VERSION + ",备份文件: " + backupFile.getName()); @@ -175,12 +234,65 @@ public class LangManager { private String applyPlaceholders(String value, Map placeholders) { String result = value; for (Map.Entry entry : placeholders.entrySet()) { - result = result.replace("{" + entry.getKey() + "}", entry.getValue()); + result = result.replace("{" + entry.getKey() + "}", escapeMiniMessageReplacement(entry.getValue())); } return result; } + private String escapeMiniMessageReplacement(String value) { + if (value == null) { + return ""; + } + return value.replace("\\", "\\\\").replace("<", "\\<"); + } + private String translateColorCodes(String text) { - return text == null ? "" : ChatColor.translateAlternateColorCodes('&', text); + if (text == null) { + return ""; + } + + String themedText = text; + for (Map.Entry color : THEME_COLORS.entrySet()) { + themedText = themedText.replace(color.getKey(), color.getValue()); + } + return ChatColor.translateAlternateColorCodes('&', expandHexColors(themedText)); + } + + private String expandHexColors(String text) { + Matcher matcher = HEX_COLOR_PATTERN.matcher(text); + StringBuilder result = new StringBuilder(); + while (matcher.find()) { + String hex = matcher.group(1); + StringBuilder legacyHex = new StringBuilder("&x"); + for (char digit : hex.toCharArray()) { + legacyHex.append('&').append(digit); + } + matcher.appendReplacement(result, Matcher.quoteReplacement(legacyHex.toString())); + } + matcher.appendTail(result); + return result.toString(); + } + + private String renderToLegacy(String text) { + return LegacyComponentSerializer.legacySection().serialize(renderToComponent(text)); + } + + private Component renderToComponent(String text) { + if (text == null) { + return Component.empty(); + } + if (looksLikeMiniMessage(text)) { + try { + return MINI_MESSAGE.deserialize(text); + } catch (RuntimeException ignored) { + // 配置中 MiniMessage 语法错误时回退到旧颜色码解析,避免消息完全不可用。 + } + } + return LegacyComponentSerializer.legacySection().deserialize(translateColorCodes(text)); + } + + private boolean looksLikeMiniMessage(String text) { + int open = text.indexOf('<'); + return open >= 0 && text.indexOf('>', open) > open; } } diff --git a/src/main/java/cn/infstar/essentialsC/admin/AdminModeManager.java b/src/main/java/cn/infstar/essentialsC/admin/AdminModeManager.java index 5b52ee4..ee9ec3c 100644 --- a/src/main/java/cn/infstar/essentialsC/admin/AdminModeManager.java +++ b/src/main/java/cn/infstar/essentialsC/admin/AdminModeManager.java @@ -1,8 +1,6 @@ package cn.infstar.essentialsC.admin; import cn.infstar.essentialsC.EssentialsC; -import net.kyori.adventure.text.Component; -import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer; import org.bukkit.GameMode; import org.bukkit.Material; import org.bukkit.attribute.Attribute; @@ -270,9 +268,7 @@ public final class AdminModeManager implements Listener { } private void sendActionBar(Player player) { - String text = EssentialsC.getLangManager().getString("admin-mode.actionbar"); - Component component = LegacyComponentSerializer.legacyAmpersand().deserialize(text); - player.sendActionBar(component); + player.sendActionBar(EssentialsC.getLangManager().getComponent("admin-mode.actionbar")); } private float getAdminFlySpeed() { diff --git a/src/main/java/cn/infstar/essentialsC/commands/BlocksMenuCommand.java b/src/main/java/cn/infstar/essentialsC/commands/BlocksMenuCommand.java index 7ecc0a9..9eeba29 100644 --- a/src/main/java/cn/infstar/essentialsC/commands/BlocksMenuCommand.java +++ b/src/main/java/cn/infstar/essentialsC/commands/BlocksMenuCommand.java @@ -5,6 +5,7 @@ import org.bukkit.ChatColor; import org.bukkit.Material; import org.bukkit.NamespacedKey; import org.bukkit.Sound; +import org.bukkit.configuration.file.FileConfiguration; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; @@ -60,7 +61,8 @@ public class BlocksMenuCommand extends BaseCommand implements Listener { private void openMenu(Player player) { Inventory menu = new BlocksMenuHolder(getLang().getString("blocks-menu.title")).getInventory(); - var sectionsConfig = plugin.getConfig().getConfigurationSection("blocks-menu.sections"); + FileConfiguration menuConfig = plugin.getFeatureConfigManager().getBlocksMenuConfig(); + var sectionsConfig = menuConfig.getConfigurationSection("sections"); if (sectionsConfig != null) { int visibleSections = renderSections(menu, player, sectionsConfig); if (visibleSections > 1) { @@ -75,7 +77,7 @@ public class BlocksMenuCommand extends BaseCommand implements Listener { return; } - var itemsConfig = plugin.getConfig().getConfigurationSection("blocks-menu.items"); + var itemsConfig = menuConfig.getConfigurationSection("items"); if (itemsConfig == null) { return; } @@ -253,66 +255,69 @@ public class BlocksMenuCommand extends BaseCommand implements Listener { } private void addConfigDefaults() { - plugin.getConfig().addDefault("blocks-menu.layout-version", 2); + FileConfiguration config = plugin.getFeatureConfigManager().getBlocksMenuConfig(); + config.addDefault("config-version", 1); + config.addDefault("layout-version", 2); - addMenuItemDefaults("blocks-menu.sections.blocks.items.workbench", 10, "CRAFTING_TABLE", + addMenuItemDefaults(config, "sections.blocks.items.workbench", 10, "CRAFTING_TABLE", "essentialsc.command.workbench", "workbench"); - addMenuItemDefaults("blocks-menu.sections.blocks.items.enderchest", 11, "ENDER_CHEST", + addMenuItemDefaults(config, "sections.blocks.items.enderchest", 11, "ENDER_CHEST", "essentialsc.command.enderchest", "enderchest"); - addMenuItemDefaults("blocks-menu.sections.blocks.items.anvil", 12, "ANVIL", + addMenuItemDefaults(config, "sections.blocks.items.anvil", 12, "ANVIL", "essentialsc.command.anvil", "anvil"); - addMenuItemDefaults("blocks-menu.sections.blocks.items.grindstone", 19, "GRINDSTONE", + addMenuItemDefaults(config, "sections.blocks.items.grindstone", 19, "GRINDSTONE", "essentialsc.command.grindstone", "grindstone"); - addMenuItemDefaults("blocks-menu.sections.blocks.items.smithingtable", 20, "SMITHING_TABLE", + addMenuItemDefaults(config, "sections.blocks.items.smithingtable", 20, "SMITHING_TABLE", "essentialsc.command.smithingtable", "smithingtable"); - addMenuItemDefaults("blocks-menu.sections.blocks.items.stonecutter", 21, "STONECUTTER", + addMenuItemDefaults(config, "sections.blocks.items.stonecutter", 21, "STONECUTTER", "essentialsc.command.stonecutter", "stonecutter"); - addMenuItemDefaults("blocks-menu.sections.blocks.items.loom", 28, "LOOM", + addMenuItemDefaults(config, "sections.blocks.items.loom", 28, "LOOM", "essentialsc.command.loom", "loom"); - addMenuItemDefaults("blocks-menu.sections.blocks.items.cartographytable", 29, "CARTOGRAPHY_TABLE", + addMenuItemDefaults(config, "sections.blocks.items.cartographytable", 29, "CARTOGRAPHY_TABLE", "essentialsc.command.cartographytable", "cartographytable"); - addMenuItemDefaults("blocks-menu.sections.shortcuts.items.nightvision", 14, "TINTED_GLASS", + addMenuItemDefaults(config, "sections.shortcuts.items.nightvision", 14, "TINTED_GLASS", "essentialsc.command.nightvision", "nightvision"); - addMenuItemDefaults("blocks-menu.sections.shortcuts.items.glow", 15, "GLOWSTONE", + addMenuItemDefaults(config, "sections.shortcuts.items.glow", 15, "GLOWSTONE", "essentialsc.command.glow", "glow"); - plugin.getConfig().options().copyDefaults(true); - migrateLayoutIfNeeded(); - plugin.saveConfig(); + config.options().copyDefaults(true); + migrateLayoutIfNeeded(config); + plugin.getFeatureConfigManager().saveBlocksMenuConfig(); } - private void migrateLayoutIfNeeded() { - boolean hasStoredLayoutVersion = plugin.getConfig().contains("blocks-menu.layout-version", true); - if (hasStoredLayoutVersion && plugin.getConfig().getInt("blocks-menu.layout-version", 0) >= 2) { + private void migrateLayoutIfNeeded(FileConfiguration config) { + boolean hasStoredLayoutVersion = config.contains("layout-version", true); + if (hasStoredLayoutVersion && config.getInt("layout-version", 0) >= 2) { return; } - applySlot("blocks", "workbench", 10); - applySlot("blocks", "enderchest", 11); - applySlot("blocks", "anvil", 12); - applySlot("blocks", "grindstone", 19); - applySlot("blocks", "smithingtable", 20); - applySlot("blocks", "stonecutter", 21); - applySlot("blocks", "loom", 28); - applySlot("blocks", "cartographytable", 29); - applySlot("shortcuts", "nightvision", 14); - applySlot("shortcuts", "glow", 15); + applySlot(config, "blocks", "workbench", 10); + applySlot(config, "blocks", "enderchest", 11); + applySlot(config, "blocks", "anvil", 12); + applySlot(config, "blocks", "grindstone", 19); + applySlot(config, "blocks", "smithingtable", 20); + applySlot(config, "blocks", "stonecutter", 21); + applySlot(config, "blocks", "loom", 28); + applySlot(config, "blocks", "cartographytable", 29); + applySlot(config, "shortcuts", "nightvision", 14); + applySlot(config, "shortcuts", "glow", 15); - plugin.getConfig().set("blocks-menu.sections.blocks.title-item", null); - plugin.getConfig().set("blocks-menu.sections.shortcuts.title-item", null); - plugin.getConfig().set("blocks-menu.layout-version", 2); + config.set("sections.blocks.title-item", null); + config.set("sections.shortcuts.title-item", null); + config.set("layout-version", 2); } - private void applySlot(String section, String key, int slot) { - plugin.getConfig().set("blocks-menu.sections." + section + ".items." + key + ".slot", slot); + private void applySlot(FileConfiguration config, String section, String key, int slot) { + config.set("sections." + section + ".items." + key + ".slot", slot); } - private void addMenuItemDefaults(String path, int slot, String material, String permission, String command) { - plugin.getConfig().addDefault(path + ".slot", slot); - plugin.getConfig().addDefault(path + ".material", material); - plugin.getConfig().addDefault(path + ".permission", permission); - plugin.getConfig().addDefault(path + ".command", command); + private void addMenuItemDefaults(FileConfiguration config, String path, int slot, String material, + String permission, String command) { + config.addDefault(path + ".slot", slot); + config.addDefault(path + ".material", material); + config.addDefault(path + ".permission", permission); + config.addDefault(path + ".command", command); } private record MenuItem(int slot, Material material, String name, List lore, String commandKey) { diff --git a/src/main/java/cn/infstar/essentialsC/commands/HelpCommand.java b/src/main/java/cn/infstar/essentialsC/commands/HelpCommand.java index a9bb704..7057d54 100644 --- a/src/main/java/cn/infstar/essentialsC/commands/HelpCommand.java +++ b/src/main/java/cn/infstar/essentialsC/commands/HelpCommand.java @@ -34,6 +34,7 @@ public class HelpCommand extends BaseCommand implements TabCompleter { } plugin.reloadConfig(); EssentialsC.getLangManager().reload(); + plugin.getFeatureConfigManager().reload(); plugin.getModuleManager().reload(); CommandRegistry.clearCache(); plugin.reloadRuntimeModules(); @@ -55,6 +56,7 @@ public class HelpCommand extends BaseCommand implements TabCompleter { } plugin.reloadConfig(); EssentialsC.getLangManager().reload(); + plugin.getFeatureConfigManager().reload(); plugin.getModuleManager().reload(); CommandRegistry.clearCache(); plugin.reloadRuntimeModules(); diff --git a/src/main/java/cn/infstar/essentialsC/commands/TpAcceptCommand.java b/src/main/java/cn/infstar/essentialsC/commands/TpAcceptCommand.java index 376a96f..149de84 100644 --- a/src/main/java/cn/infstar/essentialsC/commands/TpAcceptCommand.java +++ b/src/main/java/cn/infstar/essentialsC/commands/TpAcceptCommand.java @@ -1,7 +1,6 @@ package cn.infstar.essentialsC.commands; import cn.infstar.essentialsC.teleport.TeleportRequestManager; -import org.bukkit.Bukkit; import org.bukkit.command.Command; import org.bukkit.command.CommandSender; import org.bukkit.command.TabCompleter; @@ -20,17 +19,17 @@ public final class TpAcceptCommand extends BaseCommand implements TabCompleter { @Override protected boolean execute(Player player, String[] args) { if (args.length > 1) { - player.sendMessage(getLang().getPrefixedString("tpa.messages.usage-tpaccept")); + player.sendMessage(getLang().getPrefixedComponent("tpa.messages.usage-tpaccept")); return true; } TeleportRequestManager manager = plugin.getTeleportRequestManager(); if (manager == null) { - player.sendMessage(getLang().getPrefixedString("messages.module-disabled")); + player.sendMessage(getLang().getPrefixedComponent("messages.module-disabled")); return true; } if (manager.isIgnoringRequests(player)) { - player.sendMessage(getLang().getPrefixedString("tpa.messages.ignoring-requests")); + player.sendMessage(getLang().getPrefixedComponent("tpa.messages.ignoring-requests")); return true; } @@ -39,7 +38,9 @@ public final class TpAcceptCommand extends BaseCommand implements TabCompleter { args.length == 0 ? null : args[0] ); if (request.isEmpty()) { - player.sendMessage(getLang().getPrefixedString("tpa.messages.no-request")); + player.sendMessage(args.length == 0 + ? getLang().getPrefixedComponent("tpa.messages.no-request") + : getLang().getPrefixedComponent("tpa.messages.invalid-request", Map.of("requester", args[0]))); return true; } @@ -47,28 +48,18 @@ public final class TpAcceptCommand extends BaseCommand implements TabCompleter { Map placeholders = manager.placeholders(accepted); TeleportRequestManager.TeleportResult result = manager.accept(player, accepted); if (result.status() == TeleportRequestManager.TeleportResult.Status.EXPIRED) { - player.sendMessage(getLang().getPrefixedString("tpa.messages.expired", placeholders)); + player.sendMessage(getLang().getPrefixedComponent("tpa.messages.expired", placeholders)); return true; } if (result.status() == TeleportRequestManager.TeleportResult.Status.PLAYER_OFFLINE) { - player.sendMessage(getLang().getPrefixedString("tpa.messages.player-offline", placeholders)); - return true; - } - if (result.status() == TeleportRequestManager.TeleportResult.Status.ALREADY_WARMING_UP) { - player.sendMessage(getLang().getPrefixedString("tpa.messages.already-warming-up", placeholders)); return true; } if (result.status() == TeleportRequestManager.TeleportResult.Status.ON_COOLDOWN) { - player.sendMessage(getLang().getPrefixedString("tpa.messages.accept-cooldown", + player.sendMessage(getLang().getPrefixedComponent("tpa.messages.accept-cooldown", Map.of("seconds", String.valueOf(result.cooldownSeconds())))); return true; } - player.sendMessage(getLang().getPrefixedString("tpa.messages.accepted-target", placeholders)); - Player requester = Bukkit.getPlayer(accepted.requesterId()); - if (requester != null && requester.isOnline()) { - requester.sendMessage(getLang().getPrefixedString("tpa.messages.accepted-sender", placeholders)); - } return true; } diff --git a/src/main/java/cn/infstar/essentialsC/commands/TpDenyCommand.java b/src/main/java/cn/infstar/essentialsC/commands/TpDenyCommand.java index af3947d..2933767 100644 --- a/src/main/java/cn/infstar/essentialsC/commands/TpDenyCommand.java +++ b/src/main/java/cn/infstar/essentialsC/commands/TpDenyCommand.java @@ -1,7 +1,6 @@ package cn.infstar.essentialsC.commands; import cn.infstar.essentialsC.teleport.TeleportRequestManager; -import org.bukkit.Bukkit; import org.bukkit.command.Command; import org.bukkit.command.CommandSender; import org.bukkit.command.TabCompleter; @@ -20,17 +19,17 @@ public final class TpDenyCommand extends BaseCommand implements TabCompleter { @Override protected boolean execute(Player player, String[] args) { if (args.length > 1) { - player.sendMessage(getLang().getPrefixedString("tpa.messages.usage-tpdeny")); + player.sendMessage(getLang().getPrefixedComponent("tpa.messages.usage-tpdeny")); return true; } TeleportRequestManager manager = plugin.getTeleportRequestManager(); if (manager == null) { - player.sendMessage(getLang().getPrefixedString("messages.module-disabled")); + player.sendMessage(getLang().getPrefixedComponent("messages.module-disabled")); return true; } if (manager.isIgnoringRequests(player)) { - player.sendMessage(getLang().getPrefixedString("tpa.messages.ignoring-requests")); + player.sendMessage(getLang().getPrefixedComponent("tpa.messages.ignoring-requests")); return true; } @@ -39,23 +38,19 @@ public final class TpDenyCommand extends BaseCommand implements TabCompleter { args.length == 0 ? null : args[0] ); if (request.isEmpty()) { - player.sendMessage(getLang().getPrefixedString("tpa.messages.no-request")); + player.sendMessage(args.length == 0 + ? getLang().getPrefixedComponent("tpa.messages.no-request") + : getLang().getPrefixedComponent("tpa.messages.invalid-request", Map.of("requester", args[0]))); return true; } TeleportRequestManager.TeleportRequest denied = request.get(); TeleportRequestManager.TeleportResult result = manager.deny(player, denied); if (result.status() == TeleportRequestManager.TeleportResult.Status.EXPIRED) { - player.sendMessage(getLang().getPrefixedString("tpa.messages.expired", manager.placeholders(denied))); + player.sendMessage(getLang().getPrefixedComponent("tpa.messages.expired", manager.placeholders(denied))); return true; } - Map placeholders = manager.placeholders(denied); - player.sendMessage(getLang().getPrefixedString("tpa.messages.denied-target", placeholders)); - Player requester = Bukkit.getPlayer(denied.requesterId()); - if (requester != null && requester.isOnline()) { - requester.sendMessage(getLang().getPrefixedString("tpa.messages.denied-sender", placeholders)); - } return true; } diff --git a/src/main/java/cn/infstar/essentialsC/commands/TpIgnoreCommand.java b/src/main/java/cn/infstar/essentialsC/commands/TpIgnoreCommand.java index 9011728..dbcefe9 100644 --- a/src/main/java/cn/infstar/essentialsC/commands/TpIgnoreCommand.java +++ b/src/main/java/cn/infstar/essentialsC/commands/TpIgnoreCommand.java @@ -13,12 +13,12 @@ public final class TpIgnoreCommand extends BaseCommand { protected boolean execute(Player player, String[] args) { TeleportRequestManager manager = plugin.getTeleportRequestManager(); if (manager == null) { - player.sendMessage(getLang().getPrefixedString("messages.module-disabled")); + player.sendMessage(getLang().getPrefixedComponent("messages.module-disabled")); return true; } boolean ignoring = manager.toggleIgnoringRequests(player); - player.sendMessage(getLang().getPrefixedString(ignoring + player.sendMessage(getLang().getPrefixedComponent(ignoring ? "tpa.messages.ignore-enabled" : "tpa.messages.ignore-disabled")); return true; diff --git a/src/main/java/cn/infstar/essentialsC/commands/TpaAllCommand.java b/src/main/java/cn/infstar/essentialsC/commands/TpaAllCommand.java index 688f10c..53ad337 100644 --- a/src/main/java/cn/infstar/essentialsC/commands/TpaAllCommand.java +++ b/src/main/java/cn/infstar/essentialsC/commands/TpaAllCommand.java @@ -3,8 +3,6 @@ package cn.infstar.essentialsC.commands; import cn.infstar.essentialsC.teleport.TeleportRequestManager; import org.bukkit.entity.Player; -import java.util.Map; - public final class TpaAllCommand extends BaseCommand { public TpaAllCommand() { @@ -14,32 +12,27 @@ public final class TpaAllCommand extends BaseCommand { @Override protected boolean execute(Player player, String[] args) { if (args.length != 0) { - player.sendMessage(getLang().getPrefixedString("tpa.messages.usage-tpaall")); + player.sendMessage(getLang().getPrefixedComponent("tpa.messages.usage-tpaall")); return true; } TeleportRequestManager manager = plugin.getTeleportRequestManager(); if (manager == null) { - player.sendMessage(getLang().getPrefixedString("messages.module-disabled")); + player.sendMessage(getLang().getPrefixedComponent("messages.module-disabled")); return true; } if (manager.isIgnoringRequests(player)) { - player.sendMessage(getLang().getPrefixedString("tpa.messages.ignoring-requests")); + player.sendMessage(getLang().getPrefixedComponent("tpa.messages.ignoring-requests")); return true; } - int sent = manager.sendTeleportAllRequest(player, target -> !VanishCommand.isVanished(target)); - if (sent < 0) { - player.sendMessage(getLang().getPrefixedString("tpa.messages.send-cooldown", - Map.of("seconds", String.valueOf(manager.getSendCooldownSeconds(player))))); - return true; - } + int sent = manager.sendTeleportAllRequest(player); if (sent <= 0) { - player.sendMessage(getLang().getPrefixedString("tpa.messages.tpaall-no-targets")); + player.sendMessage(getLang().getPrefixedComponent("tpa.messages.tpaall-no-targets")); return true; } - player.sendMessage(getLang().getPrefixedString("tpa.messages.tpaall-sent")); + player.sendMessage(getLang().getPrefixedComponent("tpa.messages.tpaall-sent")); return true; } } diff --git a/src/main/java/cn/infstar/essentialsC/commands/TpaCommand.java b/src/main/java/cn/infstar/essentialsC/commands/TpaCommand.java index 356701e..33c0ee3 100644 --- a/src/main/java/cn/infstar/essentialsC/commands/TpaCommand.java +++ b/src/main/java/cn/infstar/essentialsC/commands/TpaCommand.java @@ -1,11 +1,6 @@ package cn.infstar.essentialsC.commands; import cn.infstar.essentialsC.teleport.TeleportRequestManager; -import net.kyori.adventure.text.Component; -import net.kyori.adventure.text.event.ClickEvent; -import net.kyori.adventure.text.event.HoverEvent; -import net.kyori.adventure.text.format.NamedTextColor; -import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer; import org.bukkit.Bukkit; import org.bukkit.command.Command; import org.bukkit.command.CommandSender; @@ -15,7 +10,6 @@ import org.bukkit.entity.Player; import java.util.ArrayList; import java.util.List; import java.util.Map; -import java.util.Optional; public class TpaCommand extends BaseCommand implements TabCompleter { @@ -30,7 +24,7 @@ public class TpaCommand extends BaseCommand implements TabCompleter { protected boolean sendRequest(Player player, String[] args, TeleportRequestManager.TeleportRequest.Type type) { if (args.length != 1) { - player.sendMessage(getLang().getPrefixedString(type == TeleportRequestManager.TeleportRequest.Type.TPA + player.sendMessage(getLang().getPrefixedComponent(type == TeleportRequestManager.TeleportRequest.Type.TPA ? "tpa.messages.usage-tpa" : "tpa.messages.usage-tpahere")); return true; @@ -38,82 +32,73 @@ public class TpaCommand extends BaseCommand implements TabCompleter { TeleportRequestManager manager = plugin.getTeleportRequestManager(); if (manager == null) { - player.sendMessage(getLang().getPrefixedString("messages.module-disabled")); + player.sendMessage(getLang().getPrefixedComponent("messages.module-disabled")); return true; } if (manager.isIgnoringRequests(player)) { - player.sendMessage(getLang().getPrefixedString("tpa.messages.ignoring-requests")); + player.sendMessage(getLang().getPrefixedComponent("tpa.messages.ignoring-requests")); return true; } - Player target = Bukkit.getPlayerExact(args[0]); - if (target == null || !target.isOnline() || VanishCommand.isVanished(target)) { - player.sendMessage(getLang().getPrefixedString("messages.player-not-found", Map.of("player", args[0]))); + if (args[0].equalsIgnoreCase(player.getName())) { + player.sendMessage(getLang().getPrefixedComponent("tpa.messages.self")); return true; } - if (target.getUniqueId().equals(player.getUniqueId())) { - player.sendMessage(getLang().getPrefixedString("tpa.messages.self")); + int remainingCooldown = manager.getRemainingSendCooldownSeconds(player); + if (remainingCooldown > 0) { + player.sendMessage(getLang().getPrefixedComponent("tpa.messages.send-cooldown", + Map.of("seconds", String.valueOf(remainingCooldown)))); + return true; + } + + Player target = manager.findOnlinePlayer(args[0], onlinePlayer -> + !onlinePlayer.getUniqueId().equals(player.getUniqueId()) && !manager.isVanished(onlinePlayer) + ).orElse(null); + if (target == null || !target.isOnline()) { + player.sendMessage(getLang().getPrefixedComponent("messages.player-not-found", Map.of("player", args[0]))); return true; } TeleportRequestManager.CreateRequestResult createdRequest = manager.createRequest(player, target, type); - if (createdRequest.status() == TeleportRequestManager.CreateRequestStatus.DUPLICATE) { - player.sendMessage(getLang().getPrefixedString("tpa.messages.duplicate-request", Map.of("target", target.getName()))); - return true; - } if (createdRequest.status() == TeleportRequestManager.CreateRequestStatus.ON_COOLDOWN) { - player.sendMessage(getLang().getPrefixedString("tpa.messages.send-cooldown", + player.sendMessage(getLang().getPrefixedComponent("tpa.messages.send-cooldown", Map.of("seconds", String.valueOf(createdRequest.cooldownSeconds())))); return true; } TeleportRequestManager.TeleportRequest request = createdRequest.request(); Map placeholders = manager.placeholders(request); - player.sendMessage(getLang().getPrefixedString(type == TeleportRequestManager.TeleportRequest.Type.TPA + player.sendMessage(getLang().getPrefixedComponent(type == TeleportRequestManager.TeleportRequest.Type.TPA ? "tpa.messages.sent-tpa" : "tpa.messages.sent-tpahere", placeholders)); - if (createdRequest.status() == TeleportRequestManager.CreateRequestStatus.IGNORED) { + if (createdRequest.status() == TeleportRequestManager.CreateRequestStatus.IGNORED + || createdRequest.status() == TeleportRequestManager.CreateRequestStatus.DUPLICATE) { return true; } - target.sendMessage(getLang().getPrefixedString(type == TeleportRequestManager.TeleportRequest.Type.TPA + target.sendMessage(getLang().getPrefixedComponent(type == TeleportRequestManager.TeleportRequest.Type.TPA ? "tpa.messages.received-tpa" : "tpa.messages.received-tpahere", placeholders)); manager.playRequestReceivedSound(target); - sendResponseHint(target, request, placeholders); + manager.sendResponseHint(target, placeholders); return true; } - private void sendResponseHint(Player target, TeleportRequestManager.TeleportRequest request, Map placeholders) { - String requesterName = request.requesterName(); - String acceptCommand = "/tpaccept " + requesterName; - String denyCommand = "/tpdeny " + requesterName; - - Component hint = LegacyComponentSerializer.legacySection() - .deserialize(getLang().getPrefixedString("tpa.messages.response-hint", placeholders)); - Component accept = LegacyComponentSerializer.legacySection() - .deserialize(getLang().getString("tpa.messages.accept-button")) - .clickEvent(ClickEvent.runCommand(acceptCommand)) - .hoverEvent(HoverEvent.showText(Component.text(acceptCommand, NamedTextColor.GREEN))); - Component deny = LegacyComponentSerializer.legacySection() - .deserialize(getLang().getString("tpa.messages.deny-button")) - .clickEvent(ClickEvent.runCommand(denyCommand)) - .hoverEvent(HoverEvent.showText(Component.text(denyCommand, NamedTextColor.RED))); - - target.sendMessage(hint.append(Component.space()).append(accept).append(Component.space()).append(deny)); - } - @Override public List onTabComplete(CommandSender sender, Command command, String label, String[] args) { if (args.length != 1 || !(sender instanceof Player player)) { return List.of(); } + TeleportRequestManager manager = plugin.getTeleportRequestManager(); + if (manager == null) { + return List.of(); + } String partial = args[0].toLowerCase(); List completions = new ArrayList<>(); for (Player onlinePlayer : Bukkit.getOnlinePlayers()) { if (!onlinePlayer.getUniqueId().equals(player.getUniqueId()) - && !VanishCommand.isVanished(onlinePlayer) + && !manager.isVanished(onlinePlayer) && onlinePlayer.getName().toLowerCase().startsWith(partial)) { completions.add(onlinePlayer.getName()); } diff --git a/src/main/java/cn/infstar/essentialsC/listeners/JeiRecipeSyncListener.java b/src/main/java/cn/infstar/essentialsC/listeners/JeiRecipeSyncListener.java index 8526434..ccf8425 100644 --- a/src/main/java/cn/infstar/essentialsC/listeners/JeiRecipeSyncListener.java +++ b/src/main/java/cn/infstar/essentialsC/listeners/JeiRecipeSyncListener.java @@ -32,7 +32,7 @@ public class JeiRecipeSyncListener implements Listener { plugin.saveConfig(); this.enabled = config.getBoolean("jei-sync.enabled", true); - this.debug = config.getBoolean("jei-sync.debug", config.getBoolean("debug", false)); + this.debug = config.getBoolean("debug", false); this.sendPlayerMessage = config.getBoolean("jei-sync.send-player-message", true); this.brandCheckDelayTicks = Math.max(0, config.getInt("jei-sync.brand-check-delay-ticks", 20)); this.adapter = loadAdapter(); @@ -112,10 +112,7 @@ public class JeiRecipeSyncListener implements Listener { return; } - String fullMessage = EssentialsC.getLangManager().getPrefixedString(messageKey); - net.kyori.adventure.text.Component component = - net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacyAmpersand().deserialize(fullMessage); - player.sendMessage(component); + player.sendMessage(EssentialsC.getLangManager().getPrefixedComponent(messageKey)); } private void sendFabricRecipeSync(Player player) { diff --git a/src/main/java/cn/infstar/essentialsC/skinbridge/MineSkinGateway.java b/src/main/java/cn/infstar/essentialsC/skinbridge/MineSkinGateway.java index 5595547..3da7e53 100644 --- a/src/main/java/cn/infstar/essentialsC/skinbridge/MineSkinGateway.java +++ b/src/main/java/cn/infstar/essentialsC/skinbridge/MineSkinGateway.java @@ -89,7 +89,7 @@ public final class MineSkinGateway implements SkinBridgeGateway { } Thread.sleep(POLL_INTERVAL_MILLIS); } - throw new IllegalStateException("MineSkin 生成任务超时,请增大 skin-bridge.mineskin.request-timeout-seconds。"); + throw new IllegalStateException("MineSkin 生成任务超时,请增大 skin-bridge.yml 中的 mineskin.request-timeout-seconds。"); } private HttpResponse send(HttpRequest.Builder builder) throws Exception { diff --git a/src/main/java/cn/infstar/essentialsC/skinbridge/SkinBridgeManager.java b/src/main/java/cn/infstar/essentialsC/skinbridge/SkinBridgeManager.java index 35fea51..84301a1 100644 --- a/src/main/java/cn/infstar/essentialsC/skinbridge/SkinBridgeManager.java +++ b/src/main/java/cn/infstar/essentialsC/skinbridge/SkinBridgeManager.java @@ -63,21 +63,21 @@ public final class SkinBridgeManager implements Listener { public void reload() { configurationGeneration.incrementAndGet(); - FileConfiguration config = plugin.getConfig(); + FileConfiguration config = plugin.getFeatureConfigManager().getSkinBridgeConfig(); addDefaults(config); config.options().copyDefaults(true); - plugin.saveConfig(); + plugin.getFeatureConfigManager().saveSkinBridgeConfig(); - enabled = config.getBoolean("skin-bridge.enabled", false); - debug = config.getBoolean("skin-bridge.debug", false); - sendPlayerMessage = config.getBoolean("skin-bridge.send-player-message", true); - requestTimeoutSeconds = clamp(config.getInt("skin-bridge.profile-request-timeout-seconds", 5), 1, 30); - String mineSkinEndpoint = config.getString("skin-bridge.mineskin.endpoint", "https://api.mineskin.org"); - String mineSkinApiKey = config.getString("skin-bridge.mineskin.api-key", "").trim(); - String mineSkinVisibility = config.getString("skin-bridge.mineskin.visibility", "unlisted"); - int mineSkinTimeoutSeconds = clamp(config.getInt("skin-bridge.mineskin.request-timeout-seconds", 30), 10, 180); - cacheMinutes = clamp(config.getInt("skin-bridge.cache-minutes", 120), 5, 10080); - joinDelayTicks = clamp(config.getLong("skin-bridge.join-delay-ticks", 20L), 0, 200); + enabled = config.getBoolean("enabled", false); + debug = plugin.getConfig().getBoolean("debug", false); + sendPlayerMessage = config.getBoolean("send-player-message", true); + requestTimeoutSeconds = clamp(config.getInt("profile-request-timeout-seconds", 5), 1, 30); + String mineSkinEndpoint = config.getString("mineskin.endpoint", "https://api.mineskin.org"); + String mineSkinApiKey = config.getString("mineskin.api-key", "").trim(); + String mineSkinVisibility = config.getString("mineskin.visibility", "unlisted"); + int mineSkinTimeoutSeconds = clamp(config.getInt("mineskin.request-timeout-seconds", 30), 10, 180); + cacheMinutes = clamp(config.getInt("cache-minutes", 120), 5, 10080); + joinDelayTicks = clamp(config.getLong("join-delay-ticks", 20L), 0, 200); providers = loadProviders(config); cache.clear(); gateway = loadGateway(mineSkinEndpoint, mineSkinApiKey, mineSkinVisibility, mineSkinTimeoutSeconds); @@ -322,7 +322,7 @@ public final class SkinBridgeManager implements Listener { } private List loadProviders(FileConfiguration config) { - ConfigurationSection providersSection = config.getConfigurationSection("skin-bridge.providers"); + ConfigurationSection providersSection = config.getConfigurationSection("providers"); if (providersSection == null) { return List.of(); } @@ -364,16 +364,16 @@ public final class SkinBridgeManager implements Listener { } private void addDefaults(FileConfiguration config) { - config.addDefault("skin-bridge.enabled", false); - config.addDefault("skin-bridge.debug", false); - config.addDefault("skin-bridge.send-player-message", true); - config.addDefault("skin-bridge.profile-request-timeout-seconds", 5); - config.addDefault("skin-bridge.mineskin.endpoint", "https://api.mineskin.org"); - config.addDefault("skin-bridge.mineskin.api-key", ""); - config.addDefault("skin-bridge.mineskin.visibility", "unlisted"); - config.addDefault("skin-bridge.mineskin.request-timeout-seconds", 30); - config.addDefault("skin-bridge.cache-minutes", 120); - config.addDefault("skin-bridge.join-delay-ticks", 20); + config.addDefault("config-version", 1); + config.addDefault("enabled", false); + config.addDefault("send-player-message", true); + config.addDefault("profile-request-timeout-seconds", 5); + config.addDefault("mineskin.endpoint", "https://api.mineskin.org"); + config.addDefault("mineskin.api-key", ""); + config.addDefault("mineskin.visibility", "unlisted"); + config.addDefault("mineskin.request-timeout-seconds", 30); + config.addDefault("cache-minutes", 120); + config.addDefault("join-delay-ticks", 20); } private void applySkin(UUID playerId, CachedLookup resolved, long lookupGeneration) { diff --git a/src/main/java/cn/infstar/essentialsC/teleport/TeleportRequestManager.java b/src/main/java/cn/infstar/essentialsC/teleport/TeleportRequestManager.java index 1664e8b..2152202 100644 --- a/src/main/java/cn/infstar/essentialsC/teleport/TeleportRequestManager.java +++ b/src/main/java/cn/infstar/essentialsC/teleport/TeleportRequestManager.java @@ -1,11 +1,8 @@ package cn.infstar.essentialsC.teleport; import cn.infstar.essentialsC.EssentialsC; -import net.kyori.adventure.text.Component; -import net.kyori.adventure.text.event.ClickEvent; -import net.kyori.adventure.text.event.HoverEvent; -import net.kyori.adventure.text.format.NamedTextColor; -import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer; +import cn.infstar.essentialsC.commands.VanishCommand; +import net.kyori.adventure.title.Title; import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.configuration.file.FileConfiguration; @@ -15,13 +12,15 @@ import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; import org.bukkit.event.Listener; import org.bukkit.event.entity.EntityDamageEvent; -import org.bukkit.event.player.PlayerMoveEvent; import org.bukkit.event.player.PlayerJoinEvent; import org.bukkit.event.player.PlayerQuitEvent; +import org.bukkit.event.player.PlayerTeleportEvent; +import org.bukkit.permissions.PermissionAttachmentInfo; import org.bukkit.scheduler.BukkitTask; import java.io.File; import java.io.IOException; +import java.time.Duration; import java.time.Instant; import java.util.ArrayDeque; import java.util.ArrayList; @@ -30,6 +29,7 @@ import java.util.Deque; import java.util.HashMap; import java.util.HashSet; import java.util.List; +import java.util.Locale; import java.util.Map; import java.util.Optional; import java.util.Set; @@ -40,15 +40,19 @@ public final class TeleportRequestManager implements Listener { public static final String BYPASS_WARMUP_PERMISSION = "essentialsc.tpa.bypass-warmup"; public static final String BYPASS_COOLDOWN_PERMISSION = "essentialsc.tpa.bypass-cooldown"; + public static final String WARMUP_PERMISSION_PREFIX = "essentialsc.tpa.warmup."; + private static final double MOVEMENT_THRESHOLD = 0.1D; private final EssentialsC plugin; private final Map> requests = new HashMap<>(); private final Map warmups = new HashMap<>(); private final Map sendCooldowns = new HashMap<>(); private final Map acceptCooldowns = new HashMap<>(); + private final Map invulnerabilityTasks = new HashMap<>(); + private final Set warmupDamagedPlayers = new HashSet<>(); + private final Set invulnerablePlayers = new HashSet<>(); private final Set ignoringRequests = new HashSet<>(); private final File ignoreFile; - private BukkitTask cleanupTask; private int timeoutSeconds; private boolean strictTpaRequests; @@ -59,8 +63,9 @@ public final class TeleportRequestManager implements Listener { private boolean cooldownsEnabled; private int sendCooldownSeconds; private int acceptCooldownSeconds; - private double warmupMoveThreshold; private String warmupDisplay; + private int teleportInvulnerabilitySeconds; + private boolean teleportAsync; private boolean soundsEnabled; private String requestSound; private String warmupSound; @@ -83,17 +88,19 @@ public final class TeleportRequestManager implements Listener { plugin.getConfig().addDefault("tpa.cooldowns.enabled", true); plugin.getConfig().addDefault("tpa.cooldowns.cooldown-times.SEND_TELEPORT_REQUEST", 0); plugin.getConfig().addDefault("tpa.cooldowns.cooldown-times.ACCEPT_TELEPORT_REQUEST", 0); - plugin.getConfig().addDefault("tpa.warmup-move-threshold", 0.1D); plugin.getConfig().addDefault("tpa.warmup-display", "actionbar"); + plugin.getConfig().addDefault("tpa.teleport-invulnerability-seconds", 0); + plugin.getConfig().addDefault("tpa.teleport-async", true); plugin.getConfig().addDefault("tpa.sounds.enabled", true); plugin.getConfig().addDefault("tpa.sounds.request-received", "entity.experience_orb.pickup"); plugin.getConfig().addDefault("tpa.sounds.warmup", "block.note_block.banjo"); plugin.getConfig().addDefault("tpa.sounds.cancelled", "entity.item.break"); plugin.getConfig().addDefault("tpa.sounds.complete", "entity.enderman.teleport"); + plugin.getConfig().set("tpa.warmup-move-threshold", null); plugin.getConfig().options().copyDefaults(true); plugin.saveConfig(); - timeoutSeconds = Math.max(5, plugin.getConfig().getInt("tpa.timeout-seconds", 60)); + timeoutSeconds = Math.max(0, plugin.getConfig().getInt("tpa.timeout-seconds", 60)); strictTpaRequests = plugin.getConfig().getBoolean("tpa.strict-tpa-requests", false); strictTpaHereRequests = plugin.getConfig().getBoolean("tpa.strict-tpahere-requests", true); warmupSeconds = Math.max(0, plugin.getConfig().getInt("tpa.warmup-seconds", 5)); @@ -102,15 +109,16 @@ public final class TeleportRequestManager implements Listener { cooldownsEnabled = plugin.getConfig().getBoolean("tpa.cooldowns.enabled", true); sendCooldownSeconds = Math.max(0, plugin.getConfig().getInt("tpa.cooldowns.cooldown-times.SEND_TELEPORT_REQUEST", 0)); acceptCooldownSeconds = Math.max(0, plugin.getConfig().getInt("tpa.cooldowns.cooldown-times.ACCEPT_TELEPORT_REQUEST", 0)); - warmupMoveThreshold = Math.max(0.0D, plugin.getConfig().getDouble("tpa.warmup-move-threshold", 0.1D)); - warmupDisplay = plugin.getConfig().getString("tpa.warmup-display", "actionbar").toLowerCase(); + warmupDisplay = plugin.getConfig().getString("tpa.warmup-display", "actionbar").toLowerCase(Locale.ROOT); + teleportInvulnerabilitySeconds = Math.max(0, + plugin.getConfig().getInt("tpa.teleport-invulnerability-seconds", 0)); + teleportAsync = plugin.getConfig().getBoolean("tpa.teleport-async", true); soundsEnabled = plugin.getConfig().getBoolean("tpa.sounds.enabled", true); requestSound = plugin.getConfig().getString("tpa.sounds.request-received", "entity.experience_orb.pickup"); warmupSound = plugin.getConfig().getString("tpa.sounds.warmup", "block.note_block.banjo"); cancelSound = plugin.getConfig().getString("tpa.sounds.cancelled", "entity.item.break"); completeSound = plugin.getConfig().getString("tpa.sounds.complete", "entity.enderman.teleport"); loadIgnoringRequests(); - startCleanupTask(); } public void shutdown() { @@ -118,7 +126,7 @@ public final class TeleportRequestManager implements Listener { sendCooldowns.clear(); acceptCooldowns.clear(); cancelAllWarmups(); - cancelCleanupTask(); + clearAllInvulnerability(); saveIgnoringRequests(); } @@ -136,6 +144,9 @@ public final class TeleportRequestManager implements Listener { if (existingRequest.isPresent() && existingRequest.get().type() == type && !existingRequest.get().hasExpired()) { + if (applyCooldown) { + startCooldown(requester, sendCooldowns, sendCooldownSeconds); + } return new CreateRequestResult(CreateRequestStatus.DUPLICATE, existingRequest.get()); } @@ -151,7 +162,7 @@ public final class TeleportRequestManager implements Listener { TeleportRequest.Status.PENDING ); - if (isIgnoringRequests(target)) { + if (isIgnoringRequests(target) || isVanished(target)) { request.setStatus(TeleportRequest.Status.IGNORED); if (applyCooldown) { startCooldown(requester, sendCooldowns, sendCooldownSeconds); @@ -225,35 +236,44 @@ public final class TeleportRequestManager implements Listener { return TeleportResult.onCooldown(acceptCooldown.seconds()); } + removeIncomingByRequester(target, request.requesterName()); if (request.hasExpired()) { - removeIncomingByRequester(target, request.requesterName()); return TeleportResult.EXPIRED; } + request.setStatus(TeleportRequest.Status.ACCEPTED); + Map placeholders = placeholders(request); + target.sendMessage(plugin.getLangManager().getPrefixedComponent("tpa.messages.accepted-target", placeholders)); + Player requester = Bukkit.getPlayer(request.requesterId()); - Player currentTarget = Bukkit.getPlayer(request.targetId()); - if (requester == null || currentTarget == null || !requester.isOnline() || !currentTarget.isOnline()) { + if (requester == null || !requester.isOnline()) { + target.sendMessage(plugin.getLangManager().getPrefixedComponent("tpa.messages.player-offline", placeholders)); return TeleportResult.PLAYER_OFFLINE; } + requester.sendMessage(plugin.getLangManager().getPrefixedComponent("tpa.messages.accepted-sender", placeholders)); - TeleportPlan plan = createTeleportPlan(request, requester, currentTarget); + TeleportPlan plan = createTeleportPlan(request, requester, target); Player teleporter = plan.teleporter(); + int playerWarmupSeconds = getTeleportWarmupSeconds(teleporter); + if (playerWarmupSeconds <= 0 || teleporter.hasPermission(BYPASS_WARMUP_PERMISSION)) { + return executeTeleport(plan, true); + } + if (warmups.containsKey(teleporter.getUniqueId())) { - return TeleportResult.ALREADY_WARMING_UP; + teleporter.sendMessage(plugin.getLangManager().getPrefixedComponent("tpa.messages.already-warming-up")); + return TeleportResult.ACCEPTED_WITHOUT_TELEPORT; + } + OptionalIntCooldown teleporterCooldown = getRemainingCooldown(teleporter, acceptCooldowns); + if (teleporterCooldown.active()) { + sendAcceptCooldown(teleporter, teleporterCooldown.seconds()); + return TeleportResult.ACCEPTED_WITHOUT_TELEPORT; + } + if (isMoving(teleporter)) { + teleporter.sendMessage(plugin.getLangManager().getPrefixedComponent("tpa.messages.warmup-stand-still")); + return TeleportResult.ACCEPTED_WITHOUT_TELEPORT; } - removeIncomingByRequester(target, request.requesterName()); - request.setStatus(TeleportRequest.Status.ACCEPTED); - if (warmupSeconds <= 0 || teleporter.hasPermission(BYPASS_WARMUP_PERMISSION)) { - TeleportResult result = executeTeleport(plan, true); - if (result.status() == TeleportResult.Status.SUCCESS) { - startCooldown(target, acceptCooldowns, acceptCooldownSeconds); - } - return result; - } - - startWarmup(plan); - startCooldown(target, acceptCooldowns, acceptCooldownSeconds); + startWarmup(plan, playerWarmupSeconds); return TeleportResult.WARMING_UP; } @@ -265,6 +285,14 @@ public final class TeleportRequestManager implements Listener { return TeleportResult.EXPIRED; } request.setStatus(TeleportRequest.Status.DECLINED); + Map placeholders = placeholders(request); + target.sendMessage(plugin.getLangManager().getPrefixedComponent("tpa.messages.denied-target", placeholders)); + Player requester = Bukkit.getPlayer(request.requesterId()); + if (requester != null && requester.isOnline()) { + requester.sendMessage(plugin.getLangManager().getPrefixedComponent("tpa.messages.denied-sender", placeholders)); + } else { + target.sendMessage(plugin.getLangManager().getPrefixedComponent("tpa.messages.player-offline", placeholders)); + } return TeleportResult.SUCCESS; } @@ -286,6 +314,16 @@ public final class TeleportRequestManager implements Listener { return ignoringRequests.contains(player.getUniqueId()); } + public boolean isVanished(Player player) { + if (VanishCommand.isVanished(player)) { + return true; + } + return player.hasMetadata("vanished") && player.getMetadata("vanished").stream() + .map(metadata -> metadata.asBoolean()) + .findFirst() + .orElse(false); + } + public boolean toggleIgnoringRequests(Player player) { UUID uuid = player.getUniqueId(); boolean nowIgnoring; @@ -301,64 +339,52 @@ public final class TeleportRequestManager implements Listener { } public void playRequestReceivedSound(Player player) { - playConfiguredSound(player, requestSound, 0.7F, 1.0F); + playConfiguredSound(player, requestSound, 1.0F, 1.0F); } public int sendTeleportAllRequest(Player requester) { - return sendTeleportAllRequest(requester, ignored -> true); - } - - public int sendTeleportAllRequest(Player requester, Predicate targetFilter) { - OptionalIntCooldown sendCooldown = getRemainingCooldown(requester, sendCooldowns); - if (sendCooldown.active()) { - return -sendCooldown.seconds(); - } - int recipients = 0; for (Player target : Bukkit.getOnlinePlayers()) { if (target.getUniqueId().equals(requester.getUniqueId())) { continue; } - if (!targetFilter.test(target)) { - continue; - } recipients++; CreateRequestResult result = createRequest(requester, target, TeleportRequest.Type.TPAHERE, false); if (result.status() != CreateRequestStatus.SUCCESS) { continue; } Map placeholders = placeholders(result.request()); - target.sendMessage(plugin.getLangManager().getPrefixedString("tpa.messages.received-tpahere", placeholders)); - sendResponseHint(target, result.request(), placeholders); + target.sendMessage(plugin.getLangManager().getPrefixedComponent("tpa.messages.received-tpahere", placeholders)); + sendResponseHint(target, placeholders); playRequestReceivedSound(target); } - if (recipients > 0) { - startCooldown(requester, sendCooldowns, sendCooldownSeconds); - } return recipients; } - public int getSendCooldownSeconds(Player player) { + public int getRemainingSendCooldownSeconds(Player player) { return getRemainingCooldown(player, sendCooldowns).seconds(); } - private void sendResponseHint(Player target, TeleportRequest request, Map placeholders) { - String requesterName = request.requesterName(); - String acceptCommand = "/tpaccept " + requesterName; - String denyCommand = "/tpdeny " + requesterName; + public Optional findOnlinePlayer(String playerName, Predicate filter) { + Optional exactMatch = Bukkit.getOnlinePlayers().stream() + .map(Player.class::cast) + .filter(filter) + .filter(player -> player.getName().equalsIgnoreCase(playerName)) + .findFirst(); + if (exactMatch.isPresent()) { + return exactMatch; + } - Component hint = LegacyComponentSerializer.legacySection() - .deserialize(plugin.getLangManager().getPrefixedString("tpa.messages.response-hint", placeholders)); - Component accept = LegacyComponentSerializer.legacySection() - .deserialize(plugin.getLangManager().getString("tpa.messages.accept-button")) - .clickEvent(ClickEvent.runCommand(acceptCommand)) - .hoverEvent(HoverEvent.showText(Component.text(acceptCommand, NamedTextColor.GREEN))); - Component deny = LegacyComponentSerializer.legacySection() - .deserialize(plugin.getLangManager().getString("tpa.messages.deny-button")) - .clickEvent(ClickEvent.runCommand(denyCommand)) - .hoverEvent(HoverEvent.showText(Component.text(denyCommand, NamedTextColor.RED))); + String playerNameLower = playerName.toLowerCase(); + return Bukkit.getOnlinePlayers().stream() + .map(Player.class::cast) + .filter(filter) + .filter(player -> player.getName().toLowerCase().startsWith(playerNameLower)) + .findFirst(); + } - target.sendMessage(hint.append(Component.space()).append(accept).append(Component.space()).append(deny)); + public void sendResponseHint(Player target, Map placeholders) { + target.sendMessage(plugin.getLangManager().getPrefixedComponent("tpa.messages.response-buttons", placeholders)); } public int getTimeoutSeconds() { @@ -406,19 +432,40 @@ public final class TeleportRequestManager implements Listener { ); } - private void startWarmup(TeleportPlan plan) { + private int getTeleportWarmupSeconds(Player player) { + return player.getEffectivePermissions().stream() + .filter(PermissionAttachmentInfo::getValue) + .map(PermissionAttachmentInfo::getPermission) + .filter(permission -> permission.startsWith(WARMUP_PERMISSION_PREFIX)) + .map(permission -> permission.substring(WARMUP_PERMISSION_PREFIX.length())) + .mapToInt(this::parseWarmupPermission) + .filter(seconds -> seconds >= 0) + .max() + .orElse(warmupSeconds); + } + + private int parseWarmupPermission(String value) { + try { + return Integer.parseInt(value); + } catch (NumberFormatException ignored) { + return -1; + } + } + + private void startWarmup(TeleportPlan plan, int playerWarmupSeconds) { Player teleporter = plan.teleporter(); UUID uuid = teleporter.getUniqueId(); PendingTeleport pendingTeleport = new PendingTeleport( plan, teleporter.getLocation().clone(), - warmupSeconds + playerWarmupSeconds ); + warmupDamagedPlayers.remove(uuid); BukkitTask task = Bukkit.getScheduler().runTaskTimer(plugin, () -> tickWarmup(uuid), 0L, 20L); pendingTeleport.setTask(task); warmups.put(uuid, pendingTeleport); - teleporter.sendMessage(plugin.getLangManager().getPrefixedString("tpa.messages.warmup-start", - Map.of("seconds", String.valueOf(warmupSeconds)))); + teleporter.sendMessage(plugin.getLangManager().getPrefixedComponent("tpa.messages.warmup-start", + Map.of("seconds", String.valueOf(playerWarmupSeconds)))); } private void tickWarmup(UUID teleporterId) { @@ -433,17 +480,28 @@ public final class TeleportRequestManager implements Listener { return; } + if (cancelWarmupOnDamage && warmupDamagedPlayers.contains(teleporterId)) { + cancelWarmup(teleporterId, "tpa.messages.warmup-cancelled-damage", true); + return; + } + if (cancelWarmupOnMove && hasMoved(pendingTeleport.startLocation(), teleporter.getLocation())) { + cancelWarmup(teleporterId, "tpa.messages.warmup-cancelled-move", true); + return; + } + if (pendingTeleport.remainingSeconds() <= 0) { + sendWarmupStatus(teleporter, "tpa.messages.warmup-processing", Map.of()); cancelWarmup(teleporterId, null, false); TeleportResult result = executeTeleport(pendingTeleport.plan(), true); - if (result.status() == TeleportResult.Status.PLAYER_OFFLINE) { - teleporter.sendMessage(plugin.getLangManager().getPrefixedString("tpa.messages.player-offline")); + if (result.status() == TeleportResult.Status.ON_COOLDOWN) { + sendAcceptCooldown(teleporter, result.cooldownSeconds()); } return; } - sendWarmupStatus(teleporter, pendingTeleport.remainingSeconds()); - playConfiguredSound(teleporter, warmupSound, 0.5F, 1.0F); + sendWarmupStatus(teleporter, "tpa.messages.warmup-status", + Map.of("seconds", String.valueOf(pendingTeleport.remainingSeconds()))); + playConfiguredSound(teleporter, warmupSound, 1.0F, 1.0F); pendingTeleport.decrementRemainingSeconds(); } @@ -453,47 +511,143 @@ public final class TeleportRequestManager implements Listener { return TeleportResult.PLAYER_OFFLINE; } + OptionalIntCooldown acceptCooldown = getRemainingCooldown(teleporter, acceptCooldowns); + if (acceptCooldown.active()) { + return TeleportResult.onCooldown(acceptCooldown.seconds()); + } + Location destination = plan.fixedDestination(); if (destination == null && plan.dynamicTargetId() != null) { Player dynamicTarget = Bukkit.getPlayer(plan.dynamicTargetId()); if (dynamicTarget == null || !dynamicTarget.isOnline()) { - return TeleportResult.PLAYER_OFFLINE; + teleporter.sendMessage(plugin.getLangManager().getPrefixedComponent("tpa.messages.target-offline")); + return TeleportResult.TARGET_OFFLINE; } destination = dynamicTarget.getLocation().clone(); } if (destination == null) { - return TeleportResult.PLAYER_OFFLINE; + teleporter.sendMessage(plugin.getLangManager().getPrefixedComponent("tpa.messages.target-offline")); + return TeleportResult.TARGET_OFFLINE; } - teleporter.teleportAsync(destination).thenAccept(success -> { - if (!success || !notifyCompletion) { - return; + teleporter.leaveVehicle(); + teleporter.eject(); + teleporter.setFallDistance(0.0F); + startCooldown(teleporter, acceptCooldowns, acceptCooldownSeconds); + if (teleportAsync) { + try { + teleporter.teleportAsync(destination, PlayerTeleportEvent.TeleportCause.PLUGIN) + .whenComplete((success, throwable) -> { + if (!plugin.isEnabled()) { + return; + } + Bukkit.getScheduler().runTask(plugin, () -> handleTeleportCompletion( + teleporter, Boolean.TRUE.equals(success), throwable, notifyCompletion)); + }); + } catch (RuntimeException exception) { + handleTeleportCompletion(teleporter, false, exception, notifyCompletion); } - Bukkit.getScheduler().runTask(plugin, () -> { - if (teleporter.isOnline()) { - teleporter.sendMessage(plugin.getLangManager().getPrefixedString("tpa.messages.teleport-complete")); - playConfiguredSound(teleporter, completeSound, 0.7F, 1.0F); - } - }); - }); + } else { + try { + boolean success = teleporter.teleport(destination, PlayerTeleportEvent.TeleportCause.PLUGIN); + handleTeleportCompletion(teleporter, success, null, notifyCompletion); + } catch (RuntimeException exception) { + handleTeleportCompletion(teleporter, false, exception, notifyCompletion); + } + } return TeleportResult.SUCCESS; } - private void sendWarmupStatus(Player player, int seconds) { - String message = plugin.getLangManager().getString("tpa.messages.warmup-status", - Map.of("seconds", String.valueOf(seconds))); - if ("actionbar".equalsIgnoreCase(warmupDisplay)) { - player.sendActionBar(LegacyComponentSerializer.legacySection().deserialize(message)); + private void handleTeleportCompletion(Player teleporter, boolean success, Throwable throwable, + boolean notifyCompletion) { + if (!success) { + if (teleporter.isOnline()) { + teleporter.sendMessage(plugin.getLangManager().getPrefixedComponent("tpa.messages.teleport-failed")); + } + if (throwable != null) { + String detail = throwable.getMessage() == null + ? throwable.getClass().getSimpleName() + : throwable.getMessage(); + plugin.getLogger().warning("TPA 传送执行失败: " + detail); + } return; } - if (!"none".equalsIgnoreCase(warmupDisplay)) { - player.sendMessage(message); + + applyTeleportInvulnerability(teleporter); + if (notifyCompletion && teleporter.isOnline()) { + teleporter.sendMessage(plugin.getLangManager().getPrefixedComponent("tpa.messages.teleport-complete")); + playConfiguredSound(teleporter, completeSound, 1.0F, 1.0F); + } + } + + private void applyTeleportInvulnerability(Player player) { + if (teleportInvulnerabilitySeconds <= 0 || !player.isOnline()) { + return; + } + + UUID uuid = player.getUniqueId(); + BukkitTask previousTask = invulnerabilityTasks.remove(uuid); + if (previousTask != null) { + previousTask.cancel(); + } + if (player.isInvulnerable() && !invulnerablePlayers.contains(uuid)) { + return; + } + + invulnerablePlayers.add(uuid); + player.setInvulnerable(true); + BukkitTask task = Bukkit.getScheduler().runTaskLater(plugin, + () -> clearInvulnerability(uuid), teleportInvulnerabilitySeconds * 20L); + invulnerabilityTasks.put(uuid, task); + } + + private void clearInvulnerability(UUID uuid) { + BukkitTask task = invulnerabilityTasks.remove(uuid); + if (task != null) { + task.cancel(); + } + if (!invulnerablePlayers.remove(uuid)) { + return; + } + Player player = Bukkit.getPlayer(uuid); + if (player != null) { + player.setInvulnerable(false); + } + } + + private void clearAllInvulnerability() { + for (BukkitTask task : invulnerabilityTasks.values()) { + task.cancel(); + } + invulnerabilityTasks.clear(); + for (UUID uuid : new HashSet<>(invulnerablePlayers)) { + clearInvulnerability(uuid); + } + } + + private void sendAcceptCooldown(Player player, int seconds) { + player.sendMessage(plugin.getLangManager().getPrefixedComponent("tpa.messages.accept-cooldown", + Map.of("seconds", String.valueOf(seconds)))); + } + + private void sendWarmupStatus(Player player, String messagePath, Map placeholders) { + net.kyori.adventure.text.Component message = plugin.getLangManager().getPrefixedComponent(messagePath, placeholders); + switch (warmupDisplay.replace("-", "_")) { + case "actionbar", "action_bar" -> player.sendActionBar(message); + case "title" -> player.showTitle(Title.title(message, net.kyori.adventure.text.Component.empty(), + Title.Times.times(Duration.ZERO, Duration.ofSeconds(1), Duration.ofMillis(250)))); + case "subtitle" -> player.showTitle(Title.title(net.kyori.adventure.text.Component.empty(), message, + Title.Times.times(Duration.ZERO, Duration.ofSeconds(1), Duration.ofMillis(250)))); + case "none" -> { + } + default -> player.sendMessage(message); } } private void cancelWarmup(UUID teleporterId, String messagePath, boolean playSound) { PendingTeleport pendingTeleport = warmups.remove(teleporterId); + warmupDamagedPlayers.remove(teleporterId); if (pendingTeleport == null) { return; } @@ -503,9 +657,10 @@ public final class TeleportRequestManager implements Listener { Player player = Bukkit.getPlayer(teleporterId); if (player != null && player.isOnline() && messagePath != null) { - player.sendMessage(plugin.getLangManager().getPrefixedString(messagePath)); + player.sendMessage(plugin.getLangManager().getPrefixedComponent(messagePath)); + sendWarmupStatus(player, "tpa.messages.warmup-cancelled-actionbar", Map.of()); if (playSound) { - playConfiguredSound(player, cancelSound, 0.7F, 1.0F); + playConfiguredSound(player, cancelSound, 1.0F, 1.0F); } } } @@ -542,17 +697,6 @@ public final class TeleportRequestManager implements Listener { return removed; } - public void purgeExpired() { - List emptyQueues = new ArrayList<>(); - for (Map.Entry> entry : requests.entrySet()) { - entry.getValue().removeIf(TeleportRequest::hasExpired); - if (entry.getValue().isEmpty()) { - emptyQueues.add(entry.getKey()); - } - } - emptyQueues.forEach(requests::remove); - } - public Map placeholders(TeleportRequest request) { Map placeholders = new HashMap<>(); placeholders.put("requester", request.requesterName()); @@ -562,32 +706,13 @@ public final class TeleportRequestManager implements Listener { return placeholders; } - @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) - private void onPlayerMove(PlayerMoveEvent event) { - if (!cancelWarmupOnMove || !warmups.containsKey(event.getPlayer().getUniqueId())) { - return; - } - - PendingTeleport pendingTeleport = warmups.get(event.getPlayer().getUniqueId()); - Location start = pendingTeleport.startLocation(); - Location to = event.getTo(); - if (to == null || !sameWorld(start, to)) { - cancelWarmup(event.getPlayer().getUniqueId(), "tpa.messages.warmup-cancelled-move", true); - return; - } - - double distance = Math.abs(start.getX() - to.getX()) - + Math.abs(start.getY() - to.getY()) - + Math.abs(start.getZ() - to.getZ()); - if (distance > warmupMoveThreshold) { - cancelWarmup(event.getPlayer().getUniqueId(), "tpa.messages.warmup-cancelled-move", true); - } - } - @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) private void onEntityDamage(EntityDamageEvent event) { - if (cancelWarmupOnDamage && event.getEntity() instanceof Player player && warmups.containsKey(player.getUniqueId())) { - cancelWarmup(player.getUniqueId(), "tpa.messages.warmup-cancelled-damage", true); + if (event.getDamage() <= 0) { + return; + } + if (event.getEntity() instanceof Player player && warmups.containsKey(player.getUniqueId())) { + warmupDamagedPlayers.add(player.getUniqueId()); } } @@ -597,33 +722,29 @@ public final class TeleportRequestManager implements Listener { return; } - event.getPlayer().sendMessage(plugin.getLangManager().getPrefixedString("tpa.messages.ignore-notification")); + event.getPlayer().sendMessage(plugin.getLangManager().getPrefixedComponent("tpa.messages.ignore-notification")); } @EventHandler private void onPlayerQuit(PlayerQuitEvent event) { - cancelWarmup(event.getPlayer().getUniqueId(), null, false); + UUID uuid = event.getPlayer().getUniqueId(); + cancelWarmup(uuid, null, false); + clearInvulnerability(uuid); } - private void startCleanupTask() { - if (cleanupTask != null) { - return; + private boolean hasMoved(Location start, Location current) { + if (start.getWorld() == null || current.getWorld() == null + || !start.getWorld().getUID().equals(current.getWorld().getUID())) { + return true; } - cleanupTask = Bukkit.getScheduler().runTaskTimer(plugin, this::purgeExpired, 20L * 60L, 20L * 60L); + double distance = Math.abs(start.getX() - current.getX()) + + Math.abs(start.getY() - current.getY()) + + Math.abs(start.getZ() - current.getZ()); + return distance > MOVEMENT_THRESHOLD; } - private void cancelCleanupTask() { - if (cleanupTask == null) { - return; - } - cleanupTask.cancel(); - cleanupTask = null; - } - - private boolean sameWorld(Location first, Location second) { - return first.getWorld() != null - && second.getWorld() != null - && first.getWorld().getUID().equals(second.getWorld().getUID()); + private boolean isMoving(Player player) { + return player.getVelocity().length() >= MOVEMENT_THRESHOLD; } private void loadIgnoringRequests() { @@ -673,7 +794,9 @@ public final class TeleportRequestManager implements Listener { public static final TeleportResult WARMING_UP = new TeleportResult(Status.WARMING_UP, 0); public static final TeleportResult EXPIRED = new TeleportResult(Status.EXPIRED, 0); public static final TeleportResult PLAYER_OFFLINE = new TeleportResult(Status.PLAYER_OFFLINE, 0); + public static final TeleportResult TARGET_OFFLINE = new TeleportResult(Status.TARGET_OFFLINE, 0); public static final TeleportResult ALREADY_WARMING_UP = new TeleportResult(Status.ALREADY_WARMING_UP, 0); + public static final TeleportResult ACCEPTED_WITHOUT_TELEPORT = new TeleportResult(Status.ACCEPTED_WITHOUT_TELEPORT, 0); public static TeleportResult onCooldown(int seconds) { return new TeleportResult(Status.ON_COOLDOWN, seconds); @@ -684,7 +807,9 @@ public final class TeleportRequestManager implements Listener { WARMING_UP, EXPIRED, PLAYER_OFFLINE, + TARGET_OFFLINE, ALREADY_WARMING_UP, + ACCEPTED_WITHOUT_TELEPORT, ON_COOLDOWN } } diff --git a/src/main/resources/blocks-menu.yml b/src/main/resources/blocks-menu.yml new file mode 100644 index 0000000..aab2a96 --- /dev/null +++ b/src/main/resources/blocks-menu.yml @@ -0,0 +1,73 @@ +# ============================================================================ +# EssentialsC - 便捷菜单布局 +# ============================================================================ +# 模块总开关位于 modules.yml:modules.blocks.enabled +# 菜单名称与物品文本位于 lang/<语言>.yml 的 blocks-menu 节点。 + +config-version: 1 +layout-version: 2 + +# 每个菜单项包含: +# slot 槽位编号,范围为 0 - 35 +# material Bukkit Material 名称 +# permission 显示并使用该项目所需的权限 +# command 点击后执行的 EssentialsC 命令键 + +sections: + # 功能方块命令 + blocks: + items: + workbench: + slot: 10 + material: CRAFTING_TABLE + permission: essentialsc.command.workbench + command: workbench + enderchest: + slot: 11 + material: ENDER_CHEST + permission: essentialsc.command.enderchest + command: enderchest + anvil: + slot: 12 + material: ANVIL + permission: essentialsc.command.anvil + command: anvil + grindstone: + slot: 19 + material: GRINDSTONE + permission: essentialsc.command.grindstone + command: grindstone + smithingtable: + slot: 20 + material: SMITHING_TABLE + permission: essentialsc.command.smithingtable + command: smithingtable + stonecutter: + slot: 21 + material: STONECUTTER + permission: essentialsc.command.stonecutter + command: stonecutter + loom: + slot: 28 + material: LOOM + permission: essentialsc.command.loom + command: loom + cartographytable: + slot: 29 + material: CARTOGRAPHY_TABLE + permission: essentialsc.command.cartographytable + command: cartographytable + + # 玩家快捷功能 + shortcuts: + items: + nightvision: + slot: 14 + material: TINTED_GLASS + permission: essentialsc.command.nightvision + command: nightvision + glow: + slot: 15 + material: GLOWSTONE + permission: essentialsc.command.glow + command: glow diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml index 6c32e97..e745059 100644 --- a/src/main/resources/config.yml +++ b/src/main/resources/config.yml @@ -1,176 +1,72 @@ -# EssentialsC 主配置文件 +# EssentialsC 主配置 +# 其他配置:modules.yml、maintenance.yml、skin-bridge.yml、blocks-menu.yml +# 消息与颜色:lang/<语言>.yml +# 修改后使用 /essc reload 重载;命令注册状态发生变化时建议重启服务器。 -# 配置文件版本号 config-version: 2 - -# 语言文件名称,对应插件数据目录下 lang/<语言名>.yml language: "zh_CN" -# 是否输出更详细的调试日志。 +# 输出 EssentialsC 及所有功能模块的详细调试日志。 debug: false +# 管理模式 admin-mode: - # 原版默认飞行速度为 0.1,这里 0.2 表示两倍飞行速度 + # 原版飞行速度为 0.1;0.2 表示两倍速度。 fly-speed: 0.2 + # 状态提示刷新间隔,单位为 tick。 actionbar: - # 管理模式状态提示的刷新间隔,单位为 tick interval-ticks: 40 -jei-sync: - # 是否启用 JEI 配方同步修复 - enabled: true - # 是否输出调试日志 - debug: false - # 玩家加入后延迟多少 tick 再检测客户端品牌,避免品牌信息尚未同步完成。 - brand-check-delay-ticks: 20 - # 是否在玩家加入时发送同步提示 - send-player-message: true - -mob-drops: - enderman: - # 是否允许末影人掉落方块 - enabled: true - +# TPS 状态栏:off(关闭)/ auto(自动检测)/ on(请求启用) tpsbar: - # 可选值:off / auto / on - # auto: 若服务端没有原生 /tpsbar,则启用插件实现 - # on: 始终启用插件实现;若服务端已有原生命令,则自动跳过以避免冲突 mode: auto +# JEI 配方同步修复;同时受 modules.yml 中的模块开关控制。 +jei-sync: + enabled: true + # 玩家加入后延迟多少 tick 检测客户端品牌。 + brand-check-delay-ticks: 20 + send-player-message: true + +# 生物掉落 +mob-drops: + enderman: + # 允许末影人掉落搬运的方块。 + enabled: true + +# TPA 传送请求,行为参考 HuskHomes。 tpa: - # TPA 请求有效时间,单位为秒 + # 请求有效时间,单位为秒。 timeout-seconds: 60 - # 是否让 /tpa 接受后传送到接受时目标所在的位置快照,而不是传送完成时目标当前位置。 + + # 位置规则 + # /tpa:使用目标接受请求时的位置快照。 strict-tpa-requests: false - # 是否让 /tpahere 接受后传送到请求发起时的位置,而不是请求者当前所在位置。 - # 该行为与 HuskHomes 的 strict_tpa_here_requests 默认值一致。 + # /tpahere:使用请求者发起请求时的位置快照。 strict-tpahere-requests: true - # 接受请求后的传送预热时间,单位为秒。设置为 0 可关闭预热。 + + # 传送预热 warmup-seconds: 5 - # 预热期间移动是否取消传送。 cancel-warmup-on-move: true - # 预热期间受到伤害是否取消传送。 cancel-warmup-on-damage: true + # chat / actionbar / title / subtitle / none + warmup-display: actionbar + # 异步传送会先加载目标区块,推荐 Paper / Leaves 服务器保持开启。 + teleport-async: true + # 传送完成后的无敌时间,单位为秒;0 表示关闭。 + teleport-invulnerability-seconds: 0 + + # 冷却时间;单位为秒,0 表示关闭对应冷却。 cooldowns: - # 是否启用 TPA 冷却系统。 enabled: true cooldown-times: - # 发送传送请求后的冷却时间,单位为秒。0 表示关闭。 SEND_TELEPORT_REQUEST: 0 - # 接受传送请求后的冷却时间,单位为秒。0 表示关闭。 ACCEPT_TELEPORT_REQUEST: 0 - # 判断移动取消的曼哈顿距离阈值。0.1 与 HuskHomes 行为接近,可避免只转头就取消。 - warmup-move-threshold: 0.1 - # 预热倒计时显示位置:actionbar / chat / none。 - warmup-display: actionbar + + # 音效 sounds: - # 是否播放 TPA 相关音效。 enabled: true - # 收到请求时播放的音效。 request-received: "entity.experience_orb.pickup" - # 预热倒计时时播放的音效。 warmup: "block.note_block.banjo" - # 预热被取消时播放的音效。 cancelled: "entity.item.break" - # 传送完成时播放的音效。 complete: "entity.enderman.teleport" - -skin-bridge: - # 是否启用外置皮肤站桥接。还需要在 modules.yml 启用 skin-bridge 模块。 - enabled: false - # 是否输出 Provider 查询和皮肤应用的调试日志。 - debug: false - # 是否像 JEI 修复一样向玩家发送检测与同步提示。 - send-player-message: true - # 查询 Yggdrasil profile 的超时时间,单位为秒。 - profile-request-timeout-seconds: 5 - mineskin: - # MineSkin v2 API 地址,一般不需要修改。 - endpoint: "https://api.mineskin.org" - # MineSkin API Key。请仅在服务器运行目录中填写,不要提交到公开仓库。 - api-key: "" - # 生成结果的可见性:public、unlisted 或 private。默认使用 unlisted。 - visibility: "unlisted" - # MineSkin 生成队列的总等待时间,单位为秒。 - request-timeout-seconds: 30 - # 玩家登录来源与生成皮肤的内存缓存时间,单位为分钟。 - cache-minutes: 120 - # 玩家加入后延迟多少 tick 再查询,避免登录资料尚未完全稳定。 - join-delay-ticks: 20 - providers: - # 每个子节点都是一个 Provider,键名可自由命名,并会显示在日志和 /essc skin status 中。 - # 建议使用小写英文、数字和连字符;不要使用点号,因为点号会被 Bukkit 视为配置路径分隔符。 - littleskin: - # LittleSkin 示例 Provider。键名 littleskin 可按需改名。 - enabled: false - priority: 10 - # {uuid} 为无连字符 UUID;{uuid-dashed} 为标准 UUID。 - profile-url: "https://littleskin.cn/api/yggdrasil/sessionserver/session/minecraft/profile/{uuid}?unsigned=false" - my-blessing-skin: - # 自建 Blessing Skin 示例 Provider。my-blessing-skin 可替换为皮肤站名称。 - enabled: false - priority: 20 - profile-url: "https://skin.example.com/api/yggdrasil/sessionserver/session/minecraft/profile/{uuid}?unsigned=false" - -blocks-menu: - # 菜单布局版本,用于后续自动迁移槽位布局 - layout-version: 2 - sections: - blocks: - items: - workbench: - # 物品所在槽位 - slot: 10 - # 菜单图标材质 - material: CRAFTING_TABLE - # 所需权限 - permission: essentialsc.command.workbench - # 点击后执行的命令键 - command: workbench - enderchest: - slot: 11 - material: ENDER_CHEST - permission: essentialsc.command.enderchest - command: enderchest - anvil: - slot: 12 - material: ANVIL - permission: essentialsc.command.anvil - command: anvil - grindstone: - slot: 19 - material: GRINDSTONE - permission: essentialsc.command.grindstone - command: grindstone - smithingtable: - slot: 20 - material: SMITHING_TABLE - permission: essentialsc.command.smithingtable - command: smithingtable - stonecutter: - slot: 21 - material: STONECUTTER - permission: essentialsc.command.stonecutter - command: stonecutter - loom: - slot: 28 - material: LOOM - permission: essentialsc.command.loom - command: loom - cartographytable: - slot: 29 - material: CARTOGRAPHY_TABLE - permission: essentialsc.command.cartographytable - command: cartographytable - shortcuts: - items: - nightvision: - slot: 14 - material: TINTED_GLASS - permission: essentialsc.command.nightvision - command: nightvision - glow: - slot: 15 - material: GLOWSTONE - permission: essentialsc.command.glow - command: glow diff --git a/src/main/resources/lang/en_US.yml b/src/main/resources/lang/en_US.yml index 3327e7d..d3de282 100644 --- a/src/main/resources/lang/en_US.yml +++ b/src/main/resources/lang/en_US.yml @@ -1,259 +1,261 @@ # English language file +# HuskHomes-inspired style: MiniMessage, green success, red errors, gray details. -prefix: "&6[EssentialsC] &r" +prefix: '' messages: - no-permission: "&cYou don't have permission to use this command!\n&7Required permission: {permission}" - player-only: "&cThis command can only be executed by players!" - config-reloaded: "&aConfiguration reloaded." - version: "&fEssentialsC v{version}" - paper-version: "&7Running on Paper {version}" - unknown-subcommand: "&cUnknown subcommand: {command}" - help-usage: "&7Use &f/essc help &7to view available commands." - module-disabled: "&cThis feature module is currently disabled. Please contact an administrator." - blocks-menu-empty: "&cYou do not currently have any available shortcut menu entries." + no-permission: '<#FF3300>Error: <#FF7E5E>You do not have permission to use this command. Required: {permission}' + player-only: '<#FF3300>Error: <#FF7E5E>This command can only be run by players.' + config-reloaded: '<#00FB9A>Configuration reloaded.' + version: '<#00FB9A>EssentialsC v{version}' + paper-version: 'Running on Paper {version}' + unknown-subcommand: '<#FF3300>Error: <#FF7E5E>Unknown subcommand: {command}' + help-usage: 'Use /essc help to view available commands.' + module-disabled: '<#FF3300>Error: <#FF7E5E>This feature module is currently disabled.' + blocks-menu-empty: '<#FF3300>Error: <#FF7E5E>You do not have any available shortcut menu entries.' - hat-success: "&aYou are now wearing {item} on your head!" - hat-failed: "&cFailed to wear the item on your head!" - hat-no-item: "&cYou need to hold an item in your hand!" - suicide-message: "&e{player} has committed suicide!" - fly-enabled: "&aFlight mode enabled!" - fly-disabled: "&cFlight mode disabled!" - nightvision-enabled: "&aNight vision enabled!" - nightvision-disabled: "&cNight vision disabled!" - nightvision-usage: "&cUsage: /nightvision [on|off|toggle]" - glow-enabled: "&aGlowing enabled!" - glow-disabled: "&cGlowing disabled!" - glow-usage: "&cUsage: /glow [on|off|toggle]" - vanish-enabled: "&aYou are now vanished!" - vanish-disabled: "&cYou are no longer vanished!" - seen-usage: "&cUsage: /seen " - seen-usage-console: "&cUsage: /seen " - player-not-found: "&cPlayer not found: {player}" - no-permission-others: "&cYou don't have permission to affect other players!" + hat-success: '<#00FB9A>You are now wearing {item} on your head.' + hat-failed: '<#FF3300>Error: <#FF7E5E>Could not wear that item on your head.' + hat-no-item: '<#FF3300>Error: <#FF7E5E>You need to hold an item.' + suicide-message: '<#FF7E5E>{player} died by suicide.' + fly-enabled: '<#00FB9A>Flight mode enabled.' + fly-disabled: '<#FF7E5E>Flight mode disabled.' + nightvision-enabled: '<#00FB9A>Night vision enabled.' + nightvision-disabled: '<#FF7E5E>Night vision disabled.' + nightvision-usage: '<#FF3300>Error: <#FF7E5E>Usage: /nightvision [on|off|toggle]' + glow-enabled: '<#00FB9A>Glowing enabled.' + glow-disabled: '<#FF7E5E>Glowing disabled.' + glow-usage: '<#FF3300>Error: <#FF7E5E>Usage: /glow [on|off|toggle]' + vanish-enabled: '<#00FB9A>You are now vanished.' + vanish-disabled: '<#FF7E5E>You are no longer vanished.' + seen-usage: '<#FF3300>Error: <#FF7E5E>Usage: /seen [player]' + seen-usage-console: '<#FF3300>Error: <#FF7E5E>Usage: /seen [player]' + player-not-found: '<#FF3300>Error: <#FF7E5E>Could not find the player {player}.' + no-permission-others: '<#FF3300>Error: <#FF7E5E>You do not have permission to affect other players.' - anvil-opened: "&aAnvil opened!" - enchantingtable-opened: "&aEnchanting table opened!" - heal-self: "&aYour health and hunger have been restored!" - heal-other: "&aYou have healed player {player}!" - heal-by-other: "&aYou have been healed by admin {admin}!" - feed-self: "&aYour hunger has been restored!" - feed-other: "&aYou have fed player {player}!" - feed-by-other: "&aYou have been fed by admin {admin}!" - repair-hand-success: "&aItem in hand repaired!" - repair-all-success: "&aRepaired {count} items!" - repair-not-damaged: "&cThis item is not damaged!" - repair-no-item-in-hand: "&cYou don't have an item in your hand!" - repair-no-items: "&cNo repairable items in inventory!" - no-permission-repair-all: "&cYou don't have permission to repair all items!" + anvil-opened: '<#00FB9A>Opened an anvil.' + enchantingtable-opened: '<#00FB9A>Opened an enchanting table.' + heal-self: '<#00FB9A>Your health and hunger have been restored.' + heal-other: '<#00FB9A>You healed {player}.' + heal-by-other: '<#00FB9A>You were healed by {admin}.' + feed-self: '<#00FB9A>Your hunger has been restored.' + feed-other: '<#00FB9A>You fed {player}.' + feed-by-other: '<#00FB9A>You were fed by {admin}.' + repair-hand-success: '<#00FB9A>Repaired the item in your hand.' + repair-all-success: '<#00FB9A>Repaired {count} item(s).' + repair-not-damaged: '<#FF3300>Error: <#FF7E5E>This item is not damaged.' + repair-no-item-in-hand: '<#FF3300>Error: <#FF7E5E>You do not have an item in your hand.' + repair-no-items: '<#FF3300>Error: <#FF7E5E>There are no repairable items in your inventory.' + no-permission-repair-all: '<#FF3300>Error: <#FF7E5E>You do not have permission to repair all items.' - mobdrop-save-failed: "&cFailed to save config: {error}" - mobdrop-toggled: "&aEnderman drops are now {status}&a." - shulkerbox-nested: "&cYou cannot put a shulker box inside another shulker box." - shulkerbox-unstack-first: "&cPlease unstack the shulker box before using quick open." - jei-sync-fabric: "&6JEI-FIX&8(&bFabric&8): &eSynchronizing recipes..." - jei-sync-neoforge: "&6JEI-FIX&8(&bNeoForge&8): &eSynchronizing recipes..." + mobdrop-save-failed: '<#FF3300>Error: <#FF7E5E>Failed to save config: {error}' + mobdrop-toggled: '<#00FB9A>Enderman drops are now {status}.' + shulkerbox-nested: '<#FF3300>Error: <#FF7E5E>You cannot put a shulker box inside another shulker box.' + shulkerbox-unstack-first: '<#FF3300>Error: <#FF7E5E>Please unstack the shulker box before quick opening it.' + jei-sync-fabric: '<#00FB9A>Synchronizing recipes for your Fabric client…' + jei-sync-neoforge: '<#00FB9A>Synchronizing recipes for your NeoForge client…' help: - title: "&6========== &eEssentialsC Help &6==========" - version: "&7Plugin Version: &f{version}" - section-blocks: "&6Functional Block Commands:" - section-other: "&6Other Commands:" - footer: "&7Each command requires the corresponding permission." + title: '<#00FB9A>EssentialsC Command Help' + version: 'Plugin version: {version}' + section-blocks: '<#00FB9A>Functional Block Commands' + section-other: '<#00FB9A>Other Commands' + footer: 'Each command requires the corresponding permission.' commands: - workbench: " &f/workbench &7- Open a crafting table" - anvil: " &f/anvil &7- Open an anvil" - enchantingtable: " &f/enchantingtable &7- Open an enchanting table" - cartographytable: " &f/cartographytable &7- Open a cartography table" - grindstone: " &f/grindstone &7- Open a grindstone" - loom: " &f/loom &7- Open a loom" - smithingtable: " &f/smithingtable &7- Open a smithing table" - stonecutter: " &f/stonecutter &7- Open a stonecutter" - enderchest: " &f/enderchest &7- Open your ender chest" - blocks: " &f/blocks &7- Open the shortcut menu" - hat: " &f/hat &7- Wear the held item as a hat" - suicide: " &f/suicide &7- Commit suicide" - fly: " &f/fly &7- Toggle flight mode" - nightvision: " &f/nightvision &7- Toggle night vision" - glow: " &f/glow &7- Toggle glowing" - heal: " &f/heal &7- Restore health and hunger" - vanish: " &f/vanish &7- Toggle vanish mode" - seen: " &f/seen &7- View player information" - feed: " &f/feed &7- Restore hunger" - repair: " &f/repair &7- Repair held or all items" - tpa: " &f/tpa &7- Request to teleport to a player" - tpahere: " &f/tpahere &7- Request a player teleport to you" - tpaall: " &f/tpaall &7- Request all players teleport to you" - tpaccept: " &f/tpaccept [player] &7- Accept a teleport request" - tpdeny: " &f/tpdeny [player] &7- Deny a teleport request" - tpignore: " &f/tpignore &7- Toggle ignoring teleport requests" - skin: " &f/essc skin [player] &7- View or refresh SkinBridge status" - admin: " &f/essc admin &7- Toggle admin mode" - tpsbar: " &f/tpsbar [player] &7- Toggle TPS boss bar" - maintenance: " &f/maintenance &7- Manage maintenance mode" + workbench: '/workbench - Open a crafting table' + anvil: '/anvil - Open an anvil' + enchantingtable: '/enchantingtable - Open an enchanting table' + cartographytable: '/cartographytable - Open a cartography table' + grindstone: '/grindstone - Open a grindstone' + loom: '/loom - Open a loom' + smithingtable: '/smithingtable - Open a smithing table' + stonecutter: '/stonecutter - Open a stonecutter' + enderchest: '/enderchest - Open your ender chest' + blocks: '/blocks - Open the shortcut menu' + hat: '/hat - Wear the held item as a hat' + suicide: '/suicide - Die by suicide' + fly: '/fly - Toggle flight mode' + nightvision: '/nightvision - Toggle night vision' + glow: '/glow - Toggle glowing' + heal: '/heal - Restore health and hunger' + vanish: '/vanish - Toggle vanish mode' + seen: '/seen - View player information' + feed: '/feed - Restore hunger' + repair: '/repair - Repair held or all items' + tpa: '/tpa [player] - Request to teleport to a player' + tpahere: '/tpahere [player] - Request a player teleport to you' + tpaall: '/tpaall - Request all players teleport to you' + tpaccept: '/tpaccept [player] - Accept a teleport request' + tpdeny: '/tpdeny [player] - Deny a teleport request' + tpignore: '/tpignore - Toggle ignoring teleport requests' + skin: '/essc skin [status|refresh] [player] - View or refresh SkinBridge status' + admin: '/essc admin - Toggle admin mode' + tpsbar: '/tpsbar [player] - Toggle TPS boss bar' + maintenance: '/maintenance [on|off|status|reload|add|remove|list] - Manage maintenance mode' tpa: messages: - usage-tpa: "&cUsage: /tpa " - usage-tpahere: "&cUsage: /tpahere " - usage-tpaall: "&cUsage: /tpaall" - usage-tpaccept: "&cUsage: /tpaccept [player]" - usage-tpdeny: "&cUsage: /tpdeny [player]" - self: "&cYou cannot send a teleport request to yourself." - sent-tpa: "&aSent a teleport request to {target}. It expires in {seconds} seconds." - sent-tpahere: "&aInvited {target} to teleport to you. The request expires in {seconds} seconds." - duplicate-request: "&eYou already have a pending request of this type for {target}." - ignoring-requests: "&cYou are currently ignoring teleport requests." - send-cooldown: "&cPlease wait {seconds} seconds before sending another teleport request." - accept-cooldown: "&cPlease wait {seconds} seconds before accepting another teleport request." - received-tpa: "&e{requester} wants to teleport to you." - received-tpahere: "&e{requester} invited you to teleport to them." - response-hint: "&7Type &f/tpaccept {requester} &7to accept or &f/tpdeny {requester} &7to deny." - accept-button: "&a[Accept]" - deny-button: "&c[Deny]" - no-request: "&cYou do not have any pending teleport requests." - accepted-target: "&aAccepted {requester}'s teleport request." - accepted-sender: "&a{target} accepted your teleport request." - denied-target: "&cDenied {requester}'s teleport request." - denied-sender: "&c{target} denied your teleport request." - expired: "&cYour pending teleport request has expired." - expired-sender: "&cYour teleport request to {target} expired." - expired-target: "&cThe teleport request from {requester} expired." - player-offline: "&cTeleport failed because a player in the request is now offline." - already-warming-up: "&cA related player is already warming up for teleportation." - warmup-start: "&eTeleporting in {seconds} seconds. Do not move or take damage." - warmup-status: "&eTeleporting in {seconds} seconds" - warmup-cancelled-move: "&cTeleport cancelled because you moved during warmup." - warmup-cancelled-damage: "&cTeleport cancelled because you took damage during warmup." - teleport-complete: "&aTeleport complete." - ignore-enabled: "&eYou are now ignoring teleport requests." - ignore-disabled: "&aYou are now accepting teleport requests." - ignore-notification: "&7You are currently ignoring teleport requests." - tpaall-sent: "&aSent teleport requests to all players." - tpaall-no-targets: "&cThere are no online players who can receive the request." + usage-tpa: '<#FF3300>Error: <#FF7E5E>Usage: /tpa [player]' + usage-tpahere: '<#FF3300>Error: <#FF7E5E>Usage: /tpahere [player]' + usage-tpaall: '<#FF3300>Error: <#FF7E5E>Usage: /tpaall' + usage-tpaccept: '<#FF3300>Error: <#FF7E5E>Usage: /tpaccept [player]' + usage-tpdeny: '<#FF3300>Error: <#FF7E5E>Usage: /tpdeny [player]' + self: '<#FF3300>Error: <#FF7E5E>You cannot send a teleport request to yourself.' + sent-tpa: '<#00FB9A>You sent a teleport request asking to teleport to <#00FB9A>{target}<#00FB9A>.' + sent-tpahere: '<#00FB9A>You sent a teleport request asking <#00FB9A>{target} <#00FB9A>to teleport to you.' + ignoring-requests: '<#FF3300>Error: <#FF7E5E>You are currently ignoring teleport requests. <#FF7E5E>Click to listen for incoming teleport requests">[Stop Ignoring...]' + send-cooldown: '<#FF3300>Error: <#FF7E5E>You must wait {seconds}s before doing that again.' + accept-cooldown: '<#FF3300>Error: <#FF7E5E>You must wait {seconds}s before doing that again.' + received-tpa: '<#00FB9A>{requester} <#00FB9A>has requested to teleport to you.' + received-tpahere: '<#00FB9A>{requester} <#00FB9A>has requested that you teleport to them.' + response-buttons: 'Options: <#00FB9A>Accept teleport request\nClick to accept {requester}''s request">[✔ Accept…] <#FF3300>Decline teleport request\nClick to decline {requester}''s request">[❌ Decline…]' + no-request: '<#FF3300>Error: <#FF7E5E>You do not have a pending teleport request.' + invalid-request: '<#FF3300>Error: <#FF7E5E>You do not have a pending teleport request from {requester}.' + accepted-target: '<#00FB9A>You accepted {requester}''s teleport request!' + accepted-sender: '<#00FB9A>{target} has accepted your teleport request!' + denied-target: '<#FF7E5E>You declined {requester}''s teleport request.' + denied-sender: '<#FF7E5E>{target} has declined your teleport request.' + expired: '<#FF3300>Error: <#FF7E5E>Your pending teleport request has expired.' + player-offline: '<#FF3300>Error: <#FF7E5E>The sender of your pending teleport request is no longer online.' + target-offline: '<#FF3300>Error: <#FF7E5E>The teleport target could not be found.' + already-warming-up: '<#FF3300>Error: <#FF7E5E>A related player is already warming up for teleportation.' + warmup-start: '<#00FB9A>You will be teleported in <#00FB9A>{seconds} <#00FB9A>seconds, please stand still…' + warmup-status: '<#00FB9A>Teleporting in <#00FB9A>{seconds}<#00FB9A>…' + warmup-processing: '<#00FB9A>Teleporting…' + warmup-cancelled-move: '<#FF7E5E>Teleportation cancelled—you moved!' + warmup-cancelled-damage: '<#FF7E5E>Teleportation cancelled—you took damage!' + warmup-cancelled-actionbar: '<#FF7E5E>Teleportation cancelled!' + warmup-stand-still: '<#FF3300>Error: <#FF7E5E>You must be standing still before starting a teleport!' + teleport-complete: '<#00FB9A>Teleportation complete!' + teleport-failed: '<#FF3300>Error: <#FF7E5E>Teleportation could not be completed. Please try again.' + ignore-enabled: '<#00FB9A>Now <#00FB9A>ignoring <#00FB9A>incoming teleport requests.' + ignore-disabled: '<#00FB9A>Now <#00FB9A>listening <#00FB9A>to incoming teleport requests.' + ignore-notification: 'You are currently ignoring teleport requests.' + tpaall-sent: '<#00FB9A>You sent a teleport request to every player asking them to teleport to you.' + tpaall-no-targets: '<#FF3300>Error: <#FF7E5E>There are no other players online.' skin-bridge: notifications: - detecting: "&6SKIN-FIX&8: &eDetecting your skin source..." - synced: "&6SKIN-FIX&8(&b{provider}&8): &aSkin synchronization completed." - not-external: "&6SKIN-FIX&8: &7No external skin provider matched; your current skin was kept." - failed: "&6SKIN-FIX&8: &cSkin detection or synchronization failed. Please try again later." + detecting: '<#00FB9A>Detecting your skin source…' + synced: '<#00FB9A>Skin synchronized through {provider}.' + not-external: 'No external skin provider matched; your current skin was kept.' + failed: '<#FF3300>Error: <#FF7E5E>Skin detection or synchronization failed. Please try again later.' messages: - usage: "&cUsage: /essc skin [player]" - feature-disabled: "&cSkinBridge is disabled in config.yml." - dependency-missing: "&cNo valid MineSkin API key is configured in config.yml." - no-providers: "&cNo valid SkinBridge provider is enabled." - status-external: "&a{player} is identified as an external skin provider player. Provider: &f{provider}" - status-not-external: "&7{player} does not match any configured external skin provider." - status-pending: "&eSkinBridge is still detecting {player}'s login source." - status-unknown: "&7{player} has not been checked by SkinBridge yet." - refresh-queued: "&aSkinBridge is detecting and refreshing {player}'s skin." - refresh-cached: "&7{player} is using a valid skin cache entry." - refresh-running: "&eSkinBridge is already processing {player}." + usage: '<#FF3300>Error: <#FF7E5E>Usage: /essc skin [status|refresh] [player]' + feature-disabled: '<#FF3300>Error: <#FF7E5E>SkinBridge is disabled in skin-bridge.yml.' + dependency-missing: '<#FF3300>Error: <#FF7E5E>No valid MineSkin API key is configured in skin-bridge.yml.' + no-providers: '<#FF3300>Error: <#FF7E5E>No valid SkinBridge provider is enabled.' + status-external: '<#00FB9A>{player} is identified as an external skin provider player. Provider: {provider}' + status-not-external: '{player} does not match any configured external skin provider.' + status-pending: '<#FFC43B>SkinBridge is still detecting {player}''s login source.' + status-unknown: '{player} has not been checked by SkinBridge yet.' + refresh-queued: '<#00FB9A>SkinBridge is detecting and refreshing {player}''s skin.' + refresh-cached: '{player} is using a valid skin cache entry.' + refresh-running: '<#FFC43B>SkinBridge is already processing {player}.' blocks-menu: - title: "&6&lEssentialsC &8- &e&lShortcut Menu" + title: '<#00FB9A>Shortcut Menu' items: workbench: - name: "&eWorkbench" + name: '<#00FB9A>Workbench' lore: - - "&7/workbench" - - "&7Open a crafting table" + - '/workbench' + - 'Open a crafting table' enderchest: - name: "&eEnder Chest" + name: '<#00FB9A>Ender Chest' lore: - - "&7/enderchest" - - "&7Open your ender chest" + - '/enderchest' + - 'Open your ender chest' anvil: - name: "&eAnvil" + name: '<#00FB9A>Anvil' lore: - - "&7/anvil" - - "&7Open an anvil" + - '/anvil' + - 'Open an anvil' grindstone: - name: "&eGrindstone" + name: '<#00FB9A>Grindstone' lore: - - "&7/grindstone" - - "&7Open a grindstone" + - '/grindstone' + - 'Open a grindstone' smithingtable: - name: "&eSmithing Table" + name: '<#00FB9A>Smithing Table' lore: - - "&7/smithingtable" - - "&7Open a smithing table" + - '/smithingtable' + - 'Open a smithing table' stonecutter: - name: "&eStonecutter" + name: '<#00FB9A>Stonecutter' lore: - - "&7/stonecutter" - - "&7Open a stonecutter" + - '/stonecutter' + - 'Open a stonecutter' loom: - name: "&eLoom" + name: '<#00FB9A>Loom' lore: - - "&7/loom" - - "&7Open a loom" + - '/loom' + - 'Open a loom' cartographytable: - name: "&eCartography Table" + name: '<#00FB9A>Cartography Table' lore: - - "&7/cartographytable" - - "&7Open a cartography table" + - '/cartographytable' + - 'Open a cartography table' nightvision: - name: "&bNight Vision" + name: '<#00FB9A>Night Vision' lore: - - "&7/nightvision" - - "&7Toggle night vision" + - '/nightvision' + - 'Toggle night vision' glow: - name: "&eGlow" + name: '<#00FB9A>Glow' lore: - - "&7/glow" - - "&7Toggle your glowing effect" + - '/glow' + - 'Toggle your glowing effect' admin-mode: - actionbar: "&c&lAdmin Mode" + actionbar: '<#FF7E5E>Admin Mode' messages: - enabled: "&aAdmin mode enabled, normal inventory has been saved." - disabled: "&cAdmin mode disabled, normal inventory has been restored." - crash-restored: "&eThe previous admin mode session has been restored safely." + enabled: '<#00FB9A>Admin mode enabled; normal inventory has been saved.' + disabled: '<#FF7E5E>Admin mode disabled; normal inventory has been restored.' + crash-restored: '<#FFC43B>The previous admin mode session has been restored safely.' tpsbar: - title-format: "&eTPS&7: {tps_1m} &8| &eMSPT&7: {mspt} &8| &ePing&7: {ping}" + title-format: '<#00FB9A>TPS: {tps_1m} | <#00FB9A>MSPT: {mspt} | <#00FB9A>Ping: {ping}' messages: - enabled-self: "&aTPSBar enabled." - disabled-self: "&cTPSBar disabled." - enabled-other: "&aEnabled TPSBar for {player}." - disabled-other: "&cDisabled TPSBar for {player}." - usage: "&cUsage: /tpsbar [player]" - player-not-found: "&cPlayer not found: {player}" - no-targets: "&cNo matching players were found to toggle." - native-detected: "&7Detected a native /tpsbar command on this server, skipped plugin implementation." - plugin-enabled: "&7No native /tpsbar command was detected, plugin implementation enabled." - plugin-forced-but-native-exists: "&eThe configuration requests the plugin TPSBar, but a native /tpsbar already exists, so the plugin implementation was skipped to avoid conflicts." - mode-changed-reload: "&eTPSBar mode has been updated, but command registration changes require a server restart to fully take effect." + enabled-self: '<#00FB9A>TPSBar enabled.' + disabled-self: '<#FF7E5E>TPSBar disabled.' + enabled-other: '<#00FB9A>Enabled TPSBar for {player}.' + disabled-other: '<#FF7E5E>Disabled TPSBar for {player}.' + usage: '<#FF3300>Error: <#FF7E5E>Usage: /tpsbar [player]' + player-not-found: '<#FF3300>Error: <#FF7E5E>Could not find the player {player}.' + no-targets: '<#FF3300>Error: <#FF7E5E>No matching players were found to toggle.' + native-detected: 'Detected a native /tpsbar command on this server; skipped plugin implementation.' + plugin-enabled: 'No native /tpsbar command was detected; plugin implementation enabled.' + plugin-forced-but-native-exists: '<#FFC43B>The configuration requests the plugin TPSBar, but a native /tpsbar already exists, so the plugin implementation was skipped to avoid conflicts.' + mode-changed-reload: '<#FFC43B>TPSBar mode has been updated, but command registration changes require a server restart to fully take effect.' mobdrops-menu: - title: "&6&lMob Drop Control" + title: '<#00FB9A>Mob Drop Control' status: - enabled: "&aEnabled" - disabled: "&cDisabled" + enabled: '<#00FB9A>Enabled' + disabled: '<#FF7E5E>Disabled' enderman: - name: "&dEnderman Drops" - status: "&7Current status: {status}" - toggle: "&eClick to toggle" + name: '<#00FB9A>Enderman Drops' + status: 'Current status: {status}' + toggle: 'Click to toggle' maintenance: status: - enabled: "&cEnabled" - disabled: "&aDisabled" + enabled: '<#FF7E5E>Enabled' + disabled: '<#00FB9A>Disabled' messages: - enabled: "&aMaintenance mode enabled." - disabled: "&cMaintenance mode disabled." - reloaded: "&aMaintenance configuration reloaded." - status: "&7Maintenance mode status: {status} &8| &7Whitelist: &f{whitelist_count}" - usage: "&cUsage: /maintenance " - add-usage: "&cUsage: /maintenance add " - remove-usage: "&cUsage: /maintenance remove " - whitelist-added: "&aAdded {player} to the maintenance whitelist." - whitelist-removed: "&aRemoved {player} from the maintenance whitelist." - whitelist-exists: "&e{player} is already on the maintenance whitelist." - whitelist-missing: "&c{player} is not on the maintenance whitelist." - whitelist-empty: "&7The maintenance whitelist is empty." - whitelist-list: "&7Maintenance whitelist ({count}): &f{entries}" - login-blocked: "&e{player} was blocked by maintenance mode. &7UUID: {uuid} &8| &7IP: {address}" + enabled: '<#00FB9A>Maintenance mode enabled.' + disabled: '<#FF7E5E>Maintenance mode disabled.' + reloaded: '<#00FB9A>Maintenance configuration reloaded.' + status: 'Maintenance mode status: {status} | Whitelist: {whitelist_count}' + usage: '<#FF3300>Error: <#FF7E5E>Usage: /maintenance [on|off|status|reload|add|remove|list]' + add-usage: '<#FF3300>Error: <#FF7E5E>Usage: /maintenance add [player|uuid]' + remove-usage: '<#FF3300>Error: <#FF7E5E>Usage: /maintenance remove [player|uuid]' + whitelist-added: '<#00FB9A>Added {player} to the maintenance whitelist.' + whitelist-removed: '<#00FB9A>Removed {player} from the maintenance whitelist.' + whitelist-exists: '<#FFC43B>{player} is already on the maintenance whitelist.' + whitelist-missing: '<#FF3300>Error: <#FF7E5E>{player} is not on the maintenance whitelist.' + whitelist-empty: 'The maintenance whitelist is empty.' + whitelist-list: 'Maintenance whitelist ({count}): {entries}' + login-blocked: '<#FFC43B>{player} was blocked by maintenance mode. UUID: {uuid} | IP: {address}' diff --git a/src/main/resources/lang/zh_CN.yml b/src/main/resources/lang/zh_CN.yml index d334596..2e6fcb3 100644 --- a/src/main/resources/lang/zh_CN.yml +++ b/src/main/resources/lang/zh_CN.yml @@ -1,259 +1,261 @@ # 简体中文语言文件 +# 文本风格参考 HuskHomes:MiniMessage、绿色成功、红色错误、灰色说明。 -prefix: "&7[&6EssentialsC&7]&f:&r" +prefix: '' messages: - no-permission: "&c你没有权限执行此命令!\n&7需要权限:{permission}" - player-only: "&c此命令只能由玩家执行!" - config-reloaded: "&a配置已重载。" - version: "&fEssentialsC v{version}" - paper-version: "&7当前运行于 Paper {version}" - unknown-subcommand: "&c未知子命令:{command}" - help-usage: "&7使用 &f/essc help &7查看可用命令。" - module-disabled: "&c该功能模块当前已关闭,请联系管理员。" - blocks-menu-empty: "&c你当前没有可用的便捷菜单项目。" + no-permission: '<#FF3300>错误: <#FF7E5E>你没有权限执行此命令. 需要权限: {permission}' + player-only: '<#FF3300>错误: <#FF7E5E>此命令只能由玩家执行.' + config-reloaded: '<#00FB9A>配置已重载.' + version: '<#00FB9A>EssentialsC v{version}' + paper-version: '当前运行于 Paper {version}' + unknown-subcommand: '<#FF3300>错误: <#FF7E5E>未知子命令: {command}' + help-usage: '使用 /essc help 查看可用命令.' + module-disabled: '<#FF3300>错误: <#FF7E5E>该功能模块当前已关闭.' + blocks-menu-empty: '<#FF3300>错误: <#FF7E5E>你当前没有可用的便捷菜单项目.' - hat-success: "&a你已将 {item} 戴在头上!" - hat-failed: "&c无法将该物品戴在头上!" - hat-no-item: "&c你需要手持一个物品!" - suicide-message: "&e{player} 自杀了!" - fly-enabled: "&a飞行模式已开启!" - fly-disabled: "&c飞行模式已关闭!" - nightvision-enabled: "&a夜视已开启!" - nightvision-disabled: "&c夜视已关闭!" - nightvision-usage: "&c用法:/nightvision [on|off|toggle]" - glow-enabled: "&a发光已开启!" - glow-disabled: "&c发光已关闭!" - glow-usage: "&c用法:/glow [on|off|toggle]" - vanish-enabled: "&a你已进入隐身模式!" - vanish-disabled: "&c你已退出隐身模式!" - seen-usage: "&c用法:/seen <玩家>" - seen-usage-console: "&c用法:/seen <玩家>" - player-not-found: "&c未找到玩家:{player}" - no-permission-others: "&c你没有权限影响其他玩家!" + hat-success: '<#00FB9A>你已将 {item} 戴在头上.' + hat-failed: '<#FF3300>错误: <#FF7E5E>无法将该物品戴在头上.' + hat-no-item: '<#FF3300>错误: <#FF7E5E>你需要手持一个物品.' + suicide-message: '<#FF7E5E>{player} 自杀了.' + fly-enabled: '<#00FB9A>飞行模式已开启.' + fly-disabled: '<#FF7E5E>飞行模式已关闭.' + nightvision-enabled: '<#00FB9A>夜视已开启.' + nightvision-disabled: '<#FF7E5E>夜视已关闭.' + nightvision-usage: '<#FF3300>错误: <#FF7E5E>用法: /nightvision [on|off|toggle]' + glow-enabled: '<#00FB9A>发光已开启.' + glow-disabled: '<#FF7E5E>发光已关闭.' + glow-usage: '<#FF3300>错误: <#FF7E5E>用法: /glow [on|off|toggle]' + vanish-enabled: '<#00FB9A>你已进入隐身模式.' + vanish-disabled: '<#FF7E5E>你已退出隐身模式.' + seen-usage: '<#FF3300>错误: <#FF7E5E>用法: /seen [玩家]' + seen-usage-console: '<#FF3300>错误: <#FF7E5E>用法: /seen [玩家]' + player-not-found: '<#FF3300>错误: <#FF7E5E>没有找到玩家 {player}.' + no-permission-others: '<#FF3300>错误: <#FF7E5E>你没有权限影响其他玩家.' - anvil-opened: "&a已打开铁砧!" - enchantingtable-opened: "&a已打开附魔台!" - heal-self: "&a你的生命值和饥饿值已恢复!" - heal-other: "&a你已治疗玩家 {player}!" - heal-by-other: "&a管理员 {admin} 治疗了你!" - feed-self: "&a你的饥饿值已恢复!" - feed-other: "&a你已喂饱玩家 {player}!" - feed-by-other: "&a管理员 {admin} 喂饱了你!" - repair-hand-success: "&a手中物品已修复!" - repair-all-success: "&a已修复 {count} 个物品!" - repair-not-damaged: "&c该物品没有损坏!" - repair-no-item-in-hand: "&c你手中没有物品!" - repair-no-items: "&c背包中没有可修复的物品!" - no-permission-repair-all: "&c你没有权限修复全部物品!" + anvil-opened: '<#00FB9A>已打开铁砧.' + enchantingtable-opened: '<#00FB9A>已打开附魔台.' + heal-self: '<#00FB9A>你的生命值和饥饿值已恢复.' + heal-other: '<#00FB9A>你已治疗玩家 {player}.' + heal-by-other: '<#00FB9A>管理员 {admin} 治疗了你.' + feed-self: '<#00FB9A>你的饥饿值已恢复.' + feed-other: '<#00FB9A>你已喂饱玩家 {player}.' + feed-by-other: '<#00FB9A>管理员 {admin} 喂饱了你.' + repair-hand-success: '<#00FB9A>手中物品已修复.' + repair-all-success: '<#00FB9A>已修复 {count} 个物品.' + repair-not-damaged: '<#FF3300>错误: <#FF7E5E>该物品没有损坏.' + repair-no-item-in-hand: '<#FF3300>错误: <#FF7E5E>你手中没有物品.' + repair-no-items: '<#FF3300>错误: <#FF7E5E>背包中没有可修复的物品.' + no-permission-repair-all: '<#FF3300>错误: <#FF7E5E>你没有权限修复全部物品.' - mobdrop-save-failed: "&c保存配置失败:{error}" - mobdrop-toggled: "&a末影人掉落已切换为 {status}&a。" - shulkerbox-nested: "&c不能将潜影盒放入另一个潜影盒。" - shulkerbox-unstack-first: "&c请先将潜影盒拆分为单个后再快捷打开。" - jei-sync-fabric: "&6JEI-FIX&8(&bFabric&8): &e正在同步配方..." - jei-sync-neoforge: "&6JEI-FIX&8(&bNeoForge&8): &e正在同步配方..." + mobdrop-save-failed: '<#FF3300>错误: <#FF7E5E>保存配置失败: {error}' + mobdrop-toggled: '<#00FB9A>末影人掉落已切换为 {status}.' + shulkerbox-nested: '<#FF3300>错误: <#FF7E5E>不能将潜影盒放入另一个潜影盒.' + shulkerbox-unstack-first: '<#FF3300>错误: <#FF7E5E>请先将潜影盒拆分为单个后再快捷打开.' + jei-sync-fabric: '<#00FB9A>正在为 Fabric 客户端同步配方…' + jei-sync-neoforge: '<#00FB9A>正在为 NeoForge 客户端同步配方…' help: - title: "&6========== &eEssentialsC 帮助 &6==========" - version: "&7插件版本:&f{version}" - section-blocks: "&6功能方块命令:" - section-other: "&6其他命令:" - footer: "&7每个命令都需要对应权限。" + title: '<#00FB9A>EssentialsC 命令帮助' + version: '插件版本: {version}' + section-blocks: '<#00FB9A>功能方块命令' + section-other: '<#00FB9A>其他命令' + footer: '每个命令都需要对应权限.' commands: - workbench: " &f/workbench &7- 打开工作台" - anvil: " &f/anvil &7- 打开铁砧" - enchantingtable: " &f/enchantingtable &7- 打开附魔台" - cartographytable: " &f/cartographytable &7- 打开制图台" - grindstone: " &f/grindstone &7- 打开砂轮" - loom: " &f/loom &7- 打开织布机" - smithingtable: " &f/smithingtable &7- 打开锻造台" - stonecutter: " &f/stonecutter &7- 打开切石机" - enderchest: " &f/enderchest &7- 打开末影箱" - blocks: " &f/blocks &7- 打开便捷菜单" - hat: " &f/hat &7- 将手持物品戴在头上" - suicide: " &f/suicide &7- 自杀" - fly: " &f/fly &7- 切换飞行模式" - nightvision: " &f/nightvision &7- 切换夜视" - glow: " &f/glow &7- 切换发光" - heal: " &f/heal &7- 恢复生命值和饥饿值" - vanish: " &f/vanish &7- 切换隐身模式" - seen: " &f/seen &7- 查看玩家信息" - feed: " &f/feed &7- 恢复饥饿值" - repair: " &f/repair &7- 修复手中或全部物品" - tpa: " &f/tpa <玩家> &7- 请求传送到玩家身边" - tpahere: " &f/tpahere <玩家> &7- 请求玩家传送到你身边" - tpaall: " &f/tpaall &7- 向所有玩家发送传送到你身边的请求" - tpaccept: " &f/tpaccept [玩家] &7- 接受传送请求" - tpdeny: " &f/tpdeny [玩家] &7- 拒绝传送请求" - tpignore: " &f/tpignore &7- 切换是否忽略传送请求" - skin: " &f/essc skin [玩家] &7- 查看或刷新皮肤桥接状态" - admin: " &f/essc admin &7- 切换管理模式" - tpsbar: " &f/tpsbar [玩家] &7- 切换 TPS 状态栏" - maintenance: " &f/maintenance &7- 管理维护模式" + workbench: '/workbench - 打开工作台' + anvil: '/anvil - 打开铁砧' + enchantingtable: '/enchantingtable - 打开附魔台' + cartographytable: '/cartographytable - 打开制图台' + grindstone: '/grindstone - 打开砂轮' + loom: '/loom - 打开织布机' + smithingtable: '/smithingtable - 打开锻造台' + stonecutter: '/stonecutter - 打开切石机' + enderchest: '/enderchest - 打开末影箱' + blocks: '/blocks - 打开便捷菜单' + hat: '/hat - 将手持物品戴在头上' + suicide: '/suicide - 自杀' + fly: '/fly - 切换飞行模式' + nightvision: '/nightvision - 切换夜视' + glow: '/glow - 切换发光' + heal: '/heal - 恢复生命值和饥饿值' + vanish: '/vanish - 切换隐身模式' + seen: '/seen - 查看玩家信息' + feed: '/feed - 恢复饥饿值' + repair: '/repair - 修复手中或全部物品' + tpa: '/tpa [玩家] - 请求传送到玩家身边' + tpahere: '/tpahere [玩家] - 请求玩家传送到你身边' + tpaall: '/tpaall - 向所有玩家发送传送到你身边的请求' + tpaccept: '/tpaccept [玩家] - 接受传送请求' + tpdeny: '/tpdeny [玩家] - 拒绝传送请求' + tpignore: '/tpignore - 切换是否忽略传送请求' + skin: '/essc skin [status|refresh] [玩家] - 查看或刷新皮肤桥接状态' + admin: '/essc admin - 切换管理模式' + tpsbar: '/tpsbar [玩家] - 切换 TPS 状态栏' + maintenance: '/maintenance [on|off|status|reload|add|remove|list] - 管理维护模式' tpa: messages: - usage-tpa: "&c用法:/tpa <玩家>" - usage-tpahere: "&c用法:/tpahere <玩家>" - usage-tpaall: "&c用法:/tpaall" - usage-tpaccept: "&c用法:/tpaccept [玩家]" - usage-tpdeny: "&c用法:/tpdeny [玩家]" - self: "&c你不能向自己发送传送请求。" - sent-tpa: "&a已向 {target} 发送传送请求,{seconds} 秒后过期。" - sent-tpahere: "&a已邀请 {target} 传送到你身边,{seconds} 秒后过期。" - duplicate-request: "&e你已经向 {target} 发送过同类型传送请求,请等待对方处理。" - ignoring-requests: "&c你当前正在忽略传送请求。" - send-cooldown: "&c请等待 {seconds} 秒后再发送传送请求。" - accept-cooldown: "&c请等待 {seconds} 秒后再接受传送请求。" - received-tpa: "&e{requester} 请求传送到你身边。" - received-tpahere: "&e{requester} 邀请你传送到对方身边。" - response-hint: "&7输入 &f/tpaccept {requester} &7接受,或 &f/tpdeny {requester} &7拒绝。" - accept-button: "&a[接受]" - deny-button: "&c[拒绝]" - no-request: "&c你没有待处理的传送请求。" - accepted-target: "&a你已接受 {requester} 的传送请求。" - accepted-sender: "&a{target} 已接受你的传送请求。" - denied-target: "&c你已拒绝 {requester} 的传送请求。" - denied-sender: "&c{target} 拒绝了你的传送请求。" - expired: "&c你的待处理传送请求已过期。" - expired-sender: "&c你发给 {target} 的传送请求已过期。" - expired-target: "&c来自 {requester} 的传送请求已过期。" - player-offline: "&c无法完成传送,请求中的玩家已离线。" - already-warming-up: "&c相关玩家已有一个正在预热的传送。" - warmup-start: "&e传送将在 {seconds} 秒后开始,请不要移动或受到伤害。" - warmup-status: "&e传送倒计时:{seconds} 秒" - warmup-cancelled-move: "&c传送已取消:你在预热期间移动了。" - warmup-cancelled-damage: "&c传送已取消:你在预热期间受到了伤害。" - teleport-complete: "&a传送完成。" - ignore-enabled: "&e你已开始忽略传送请求。" - ignore-disabled: "&a你已恢复接收传送请求。" - ignore-notification: "&7你当前正在忽略传送请求。" - tpaall-sent: "&a已向所有玩家发送传送请求。" - tpaall-no-targets: "&c没有可接收请求的在线玩家。" + usage-tpa: '<#FF3300>错误: <#FF7E5E>用法: /tpa [玩家]' + usage-tpahere: '<#FF3300>错误: <#FF7E5E>用法: /tpahere [玩家]' + usage-tpaall: '<#FF3300>错误: <#FF7E5E>用法: /tpaall' + usage-tpaccept: '<#FF3300>错误: <#FF7E5E>用法: /tpaccept [玩家]' + usage-tpdeny: '<#FF3300>错误: <#FF7E5E>用法: /tpdeny [玩家]' + self: '<#FF3300>错误: <#FF7E5E>不能向自己发送传送请求' + sent-tpa: '<#00FB9A>已发送传送请求,请求传送到 <#00FB9A>{target}' + sent-tpahere: '<#00FB9A>已发送传送请求,请求 <#00FB9A>{target} <#00FB9A>传送到你的位置' + ignoring-requests: '<#FF3300>错误: <#FF7E5E>你已忽略传送请求 <#FF7E5E>点击恢复接收传送请求">[恢复接收]' + send-cooldown: '<#FF3300>错误: <#FF7E5E>你需要等待 {seconds}s 才能再次进行此操作' + accept-cooldown: '<#FF3300>错误: <#FF7E5E>你需要等待 {seconds}s 才能再次进行此操作' + received-tpa: '<#00FB9A>{requester} <#00FB9A>请求传送到你的位置' + received-tpahere: '<#00FB9A>{requester} <#00FB9A>请求你传送到他的位置' + response-buttons: '选项: <#00FB9A>接受传送请求\n点击接受 {requester} 的请求''>[✔ 接受] <#FF3300>拒绝传送请求\n点击拒绝 {requester} 的请求''>[❌ 拒绝]' + no-request: '<#FF3300>错误: <#FF7E5E>你没有待处理的传送请求' + invalid-request: '<#FF3300>错误: <#FF7E5E>目前没有来自 {requester} 的传送请求' + accepted-target: '<#00FB9A>已接受 {requester} 的传送请求' + accepted-sender: '<#00FB9A>{target} 接受了你的传送请求' + denied-target: '<#FF7E5E>已拒绝 {requester} 的传送请求' + denied-sender: '<#FF7E5E>{target} 拒绝了你的传送请求' + expired: '<#FF3300>错误: <#FF7E5E>传送请求已过期' + player-offline: '<#FF3300>错误: <#FF7E5E>你待处理的传送请求目标玩家不在线' + target-offline: '<#FF3300>错误: <#FF7E5E>没有找到目标玩家' + already-warming-up: '<#FF3300>错误: <#FF7E5E>相关玩家已有一个正在预热的传送' + warmup-start: '<#00FB9A>你将在 <#00FB9A>{seconds} <#00FB9A>秒后被传送,请不要移动…' + warmup-status: '<#00FB9A>将在 <#00FB9A>{seconds}<#00FB9A>秒后传送…' + warmup-processing: '<#00FB9A>传送中…' + warmup-cancelled-move: '<#FF7E5E>传送取消: 你移动了!' + warmup-cancelled-damage: '<#FF7E5E>传送取消: 你受到了伤害!' + warmup-cancelled-actionbar: '<#FF7E5E>传送取消!' + warmup-stand-still: '<#FF3300>错误: <#FF7E5E>在传送时你不能移动!' + teleport-complete: '<#00FB9A>传送完成!' + teleport-failed: '<#FF3300>错误: <#FF7E5E>无法完成传送,请稍后重试' + ignore-enabled: '<#00FB9A>你已 <#00FB9A>忽略 <#00FB9A>传送请求' + ignore-disabled: '<#00FB9A>你已 <#00FB9A>恢复接收 <#00FB9A>传送请求' + ignore-notification: '你当前正在忽略传送请求.' + tpaall-sent: '<#00FB9A>你已向所有玩家发送传送请求,请求他们传送到你的位置' + tpaall-no-targets: '<#FF3300>错误: <#FF7E5E>当前没有其他在线玩家.' skin-bridge: notifications: - detecting: "&6SKIN-FIX&8: &e正在检测皮肤来源..." - synced: "&6SKIN-FIX&8(&b{provider}&8): &a皮肤同步完成。" - not-external: "&6SKIN-FIX&8: &7未匹配外置皮肤站,已保留当前皮肤。" - failed: "&6SKIN-FIX&8: &c皮肤检测或同步失败,请稍后重试。" + detecting: '<#00FB9A>正在检测你的皮肤来源…' + synced: '<#00FB9A>已通过 {provider} 同步皮肤.' + not-external: '未匹配外置皮肤站,已保留当前皮肤.' + failed: '<#FF3300>错误: <#FF7E5E>皮肤检测或同步失败,请稍后重试.' messages: - usage: "&c用法:/essc skin [玩家]" - feature-disabled: "&cSkinBridge 在 config.yml 中未启用。" - dependency-missing: "&c未在 config.yml 中配置有效的 MineSkin API Key。" - no-providers: "&c没有启用有效的 SkinBridge Provider。" - status-external: "&a{player} 已识别为外置皮肤站玩家,Provider:&f{provider}" - status-not-external: "&7{player} 未匹配任何已配置的外置皮肤站。" - status-pending: "&e{player} 的皮肤站来源正在检测中。" - status-unknown: "&7{player} 尚未进行 SkinBridge 检测。" - refresh-queued: "&a已开始重新检测并刷新 {player} 的皮肤。" - refresh-cached: "&7{player} 正在使用有效的皮肤缓存。" - refresh-running: "&e{player} 的皮肤检测任务仍在运行。" + usage: '<#FF3300>错误: <#FF7E5E>用法: /essc skin [status|refresh] [玩家]' + feature-disabled: '<#FF3300>错误: <#FF7E5E>SkinBridge 在 skin-bridge.yml 中未启用.' + dependency-missing: '<#FF3300>错误: <#FF7E5E>未在 skin-bridge.yml 中配置有效的 MineSkin API Key.' + no-providers: '<#FF3300>错误: <#FF7E5E>没有启用有效的 SkinBridge Provider.' + status-external: '<#00FB9A>{player} 已识别为外置皮肤站玩家. Provider: {provider}' + status-not-external: '{player} 未匹配任何已配置的外置皮肤站.' + status-pending: '<#FFC43B>{player} 的皮肤站来源正在检测中.' + status-unknown: '{player} 尚未进行 SkinBridge 检测.' + refresh-queued: '<#00FB9A>已开始重新检测并刷新 {player} 的皮肤.' + refresh-cached: '{player} 正在使用有效的皮肤缓存.' + refresh-running: '<#FFC43B>{player} 的皮肤检测任务仍在运行.' blocks-menu: - title: "&6&lEssentialsC &8- &e&l便捷菜单" + title: '<#00FB9A>便捷菜单' items: workbench: - name: "&e工作台" + name: '<#00FB9A>工作台' lore: - - "&7/workbench" - - "&7打开工作台" + - '/workbench' + - '打开工作台' enderchest: - name: "&e末影箱" + name: '<#00FB9A>末影箱' lore: - - "&7/enderchest" - - "&7打开末影箱" + - '/enderchest' + - '打开末影箱' anvil: - name: "&e铁砧" + name: '<#00FB9A>铁砧' lore: - - "&7/anvil" - - "&7打开铁砧" + - '/anvil' + - '打开铁砧' grindstone: - name: "&e砂轮" + name: '<#00FB9A>砂轮' lore: - - "&7/grindstone" - - "&7打开砂轮" + - '/grindstone' + - '打开砂轮' smithingtable: - name: "&e锻造台" + name: '<#00FB9A>锻造台' lore: - - "&7/smithingtable" - - "&7打开锻造台" + - '/smithingtable' + - '打开锻造台' stonecutter: - name: "&e切石机" + name: '<#00FB9A>切石机' lore: - - "&7/stonecutter" - - "&7打开切石机" + - '/stonecutter' + - '打开切石机' loom: - name: "&e织布机" + name: '<#00FB9A>织布机' lore: - - "&7/loom" - - "&7打开织布机" + - '/loom' + - '打开织布机' cartographytable: - name: "&e制图台" + name: '<#00FB9A>制图台' lore: - - "&7/cartographytable" - - "&7打开制图台" + - '/cartographytable' + - '打开制图台' nightvision: - name: "&b夜视开关" + name: '<#00FB9A>夜视开关' lore: - - "&7/nightvision" - - "&7切换夜视效果" + - '/nightvision' + - '切换夜视效果' glow: - name: "&e发光开关" + name: '<#00FB9A>发光开关' lore: - - "&7/glow" - - "&7切换自身发光效果" + - '/glow' + - '切换自身发光效果' admin-mode: - actionbar: "&c&l管理模式" + actionbar: '<#FF7E5E>管理模式' messages: - enabled: "&a管理模式已开启,普通背包已保存。" - disabled: "&c管理模式已关闭,普通背包已恢复。" - crash-restored: "&e上一次管理模式会话已安全恢复。" + enabled: '<#00FB9A>管理模式已开启,普通背包已保存.' + disabled: '<#FF7E5E>管理模式已关闭,普通背包已恢复.' + crash-restored: '<#FFC43B>上一次管理模式会话已安全恢复.' tpsbar: - title-format: "&eTPS&7: {tps_1m} &8| &eMSPT&7: {mspt} &8| &ePing&7: {ping}" + title-format: '<#00FB9A>TPS: {tps_1m} | <#00FB9A>MSPT: {mspt} | <#00FB9A>Ping: {ping}' messages: - enabled-self: "&a已开启 TPSBar。" - disabled-self: "&c已关闭 TPSBar。" - enabled-other: "&a已为 {player} 开启 TPSBar。" - disabled-other: "&c已为 {player} 关闭 TPSBar。" - usage: "&c用法:/tpsbar [玩家]" - player-not-found: "&c未找到玩家:{player}" - no-targets: "&c没有匹配到可切换的玩家。" - native-detected: "&7检测到服务端已内置 /tpsbar,已跳过插件实现。" - plugin-enabled: "&7未检测到服务端内置 /tpsbar,已启用插件实现。" - plugin-forced-but-native-exists: "&e配置要求启用插件版 TPSBar,但服务端已存在原生 /tpsbar,已跳过插件实现以避免冲突。" - mode-changed-reload: "&eTPSBar 模式已更新,但命令注册状态需要重启服务器后才会完全生效。" + enabled-self: '<#00FB9A>已开启 TPSBar.' + disabled-self: '<#FF7E5E>已关闭 TPSBar.' + enabled-other: '<#00FB9A>已为 {player} 开启 TPSBar.' + disabled-other: '<#FF7E5E>已为 {player} 关闭 TPSBar.' + usage: '<#FF3300>错误: <#FF7E5E>用法: /tpsbar [玩家]' + player-not-found: '<#FF3300>错误: <#FF7E5E>没有找到玩家 {player}.' + no-targets: '<#FF3300>错误: <#FF7E5E>没有匹配到可切换的玩家.' + native-detected: '检测到服务端已内置 /tpsbar,已跳过插件实现.' + plugin-enabled: '未检测到服务端内置 /tpsbar,已启用插件实现.' + plugin-forced-but-native-exists: '<#FFC43B>配置要求启用插件版 TPSBar,但服务端已存在原生 /tpsbar,已跳过插件实现以避免冲突.' + mode-changed-reload: '<#FFC43B>TPSBar 模式已更新,但命令注册状态需要重启服务器后才会完全生效.' mobdrops-menu: - title: "&6&l生物掉落控制" + title: '<#00FB9A>生物掉落控制' status: - enabled: "&a开启" - disabled: "&c关闭" + enabled: '<#00FB9A>开启' + disabled: '<#FF7E5E>关闭' enderman: - name: "&d末影人掉落" - status: "&7当前状态:{status}" - toggle: "&e点击切换" + name: '<#00FB9A>末影人掉落' + status: '当前状态: {status}' + toggle: '点击切换' maintenance: status: - enabled: "&c开启" - disabled: "&a关闭" + enabled: '<#FF7E5E>开启' + disabled: '<#00FB9A>关闭' messages: - enabled: "&a维护模式已开启。" - disabled: "&c维护模式已关闭。" - reloaded: "&a维护模式配置已重载。" - status: "&7维护模式当前状态:{status} &8| &7白名单:&f{whitelist_count}" - usage: "&c用法:/maintenance " - add-usage: "&c用法:/maintenance add <玩家|UUID>" - remove-usage: "&c用法:/maintenance remove <玩家|UUID>" - whitelist-added: "&a已将 {player} 加入维护白名单。" - whitelist-removed: "&a已将 {player} 移出维护白名单。" - whitelist-exists: "&e{player} 已在维护白名单中。" - whitelist-missing: "&c{player} 不在维护白名单中。" - whitelist-empty: "&7维护白名单为空。" - whitelist-list: "&7维护白名单({count}):&f{entries}" - login-blocked: "&e{player} 被维护模式拦截。&7UUID:{uuid} &8| &7IP:{address}" + enabled: '<#00FB9A>维护模式已开启.' + disabled: '<#FF7E5E>维护模式已关闭.' + reloaded: '<#00FB9A>维护模式配置已重载.' + status: '维护模式当前状态: {status} | 白名单: {whitelist_count}' + usage: '<#FF3300>错误: <#FF7E5E>用法: /maintenance [on|off|status|reload|add|remove|list]' + add-usage: '<#FF3300>错误: <#FF7E5E>用法: /maintenance add [玩家|UUID]' + remove-usage: '<#FF3300>错误: <#FF7E5E>用法: /maintenance remove [玩家|UUID]' + whitelist-added: '<#00FB9A>已将 {player} 加入维护白名单.' + whitelist-removed: '<#00FB9A>已将 {player} 移出维护白名单.' + whitelist-exists: '<#FFC43B>{player} 已在维护白名单中.' + whitelist-missing: '<#FF3300>错误: <#FF7E5E>{player} 不在维护白名单中.' + whitelist-empty: '维护白名单为空.' + whitelist-list: '维护白名单 ({count}): {entries}' + login-blocked: '<#FFC43B>{player} 被维护模式拦截. UUID: {uuid} | IP: {address}' diff --git a/src/main/resources/modules.yml b/src/main/resources/modules.yml index b7f7b66..b8deeb3 100644 --- a/src/main/resources/modules.yml +++ b/src/main/resources/modules.yml @@ -1,7 +1,7 @@ # EssentialsC 模块配置 # # modules.yml 用于控制功能模块是否在运行时加载。 -# config.yml 仍然用于控制已启用模块内部的具体行为。 +# 各功能的详细设置位于 config.yml 及对应的独立功能配置文件。 # # 修改模块开关后可使用 /essc reload 刷新运行期服务和监听器。 # 直连命令的完整热增删仍建议通过重启服务器完成。 diff --git a/src/main/resources/skin-bridge.yml b/src/main/resources/skin-bridge.yml new file mode 100644 index 0000000..b0bd080 --- /dev/null +++ b/src/main/resources/skin-bridge.yml @@ -0,0 +1,64 @@ +# ============================================================================ +# EssentialsC - SkinBridge 配置 +# ============================================================================ +# 模块总开关位于 modules.yml:modules.skin-bridge.enabled +# 本文件控制 SkinBridge 内部行为。修改后使用 /essc reload 重载。 + +config-version: 1 + +# ---------------------------------------------------------------------------- +# 基础设置 +# ---------------------------------------------------------------------------- + +# 是否启用外置皮肤站检测与皮肤同步。 +enabled: false + +# 是否在玩家加入时发送检测与同步结果提示。 +send-player-message: true + +# 玩家加入后延迟多少 tick 开始检测,避免登录资料尚未稳定。 +join-delay-ticks: 20 + +# 玩家登录来源与生成皮肤的内存缓存时间,单位为分钟。 +cache-minutes: 120 + +# 查询皮肤站 Yggdrasil Profile 的超时时间,单位为秒。 +profile-request-timeout-seconds: 5 + +# ---------------------------------------------------------------------------- +# MineSkin v2 +# ---------------------------------------------------------------------------- + +mineskin: + # API 地址,一般不需要修改。 + endpoint: "https://api.mineskin.org" + + # MineSkin API Key。只应填写在服务器运行目录,禁止提交到公开仓库。 + api-key: "" + + # 生成结果可见性:public / unlisted / private + visibility: "unlisted" + + # 等待 MineSkin 队列完成的最长时间,单位为秒。 + request-timeout-seconds: 30 + +# ---------------------------------------------------------------------------- +# 外置皮肤站 Provider +# ---------------------------------------------------------------------------- +# 每个一级子节点代表一个皮肤站,节点名称可自由修改,并显示在日志与 +# /essc skin status 中。建议只使用小写英文、数字和连字符,不要使用点号。 +# +# 可用占位符: +# {uuid} 无连字符 UUID +# {uuid-dashed} 标准带连字符 UUID + +providers: + littleskin: + enabled: false + priority: 10 + profile-url: "https://littleskin.cn/api/yggdrasil/sessionserver/session/minecraft/profile/{uuid}?unsigned=false" + + my-blessing-skin: + enabled: false + priority: 20 + profile-url: "https://skin.example.com/api/yggdrasil/sessionserver/session/minecraft/profile/{uuid}?unsigned=false"