Compare commits
3
Commits
2479192ad3
...
5c760b26c6
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5c760b26c6 | ||
|
|
2cad93de9a | ||
|
|
2aeb8d0340 |
@@ -12,7 +12,7 @@
|
||||
- 最低支持版本为 `Paper 1.21.11`
|
||||
- 已适配 `Paper 26.2`
|
||||
- 构建环境固定为 `Java 21`
|
||||
- 配置、模块开关与文本分离:行为配置放在 `config.yml`,模块开关放在 `modules.yml`,提示文本放在 `lang/`
|
||||
- 配置按职责拆分:主行为配置、模块开关、SkinBridge、菜单布局、维护模式和语言文本分别管理
|
||||
- 支持运行期模块开关,避免为不同功能组合构建多个插件版本
|
||||
|
||||
## 主要功能
|
||||
@@ -67,6 +67,7 @@
|
||||
| `jei-sync` | 开启 | Fabric / NeoForge JEI 配方同步修复 |
|
||||
| `mob-drops` | 关闭 | 末影人掉落控制,默认关闭以保留过去标准版行为 |
|
||||
| `maintenance` | 开启 | 维护模式命令、MOTD 替换、登录拦截、白名单和拦截通知 |
|
||||
| `skin-bridge` | 关闭 | 查询外置 Yggdrasil profile,并通过 MineSkin 与 Paper Profile API 同步皮肤 |
|
||||
|
||||
修改模块开关后可先使用 `/essc reload` 刷新运行期服务与监听器状态。由于 Bukkit 命令表不适合在运行期完整热增删,若模块是在启动时关闭的,对应直连命令可能仍需重启后才会注册;通过 `/essc <子命令>` 入口通常可立即按新的模块状态执行。
|
||||
|
||||
@@ -75,12 +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` 和 `skin-bridge.yml` 中的 `enabled`,填写 `mineskin.api-key`,并至少启用一个 Provider。真实密钥只应填写在服务器运行目录的 `skin-bridge.yml` 中,不要写入源码或提交到公开仓库。该模块不要求安装 SkinsRestorer。`send-player-message` 控制是否向玩家发送检测、匹配和同步结果提示;`providers` 下的键名可自由命名,并会显示在日志和 `/essc skin status <玩家>` 中。
|
||||
|
||||
- `config.yml`
|
||||
- 语言选择
|
||||
@@ -88,9 +91,14 @@
|
||||
- JEI 同步开关
|
||||
- 掉落控制
|
||||
- TPSBar 模式
|
||||
- 便捷菜单布局
|
||||
- TPA 请求、预热、冷却和音效
|
||||
- `modules.yml`
|
||||
- 功能模块开关
|
||||
- `skin-bridge.yml`
|
||||
- MineSkin API 与队列设置
|
||||
- Provider、缓存和检测设置
|
||||
- `blocks-menu.yml`
|
||||
- 便捷菜单分区、槽位、材质和权限
|
||||
- `maintenance.yml`
|
||||
- 维护模式状态
|
||||
- 维护 MOTD
|
||||
@@ -106,7 +114,7 @@
|
||||
- 管理模式文本
|
||||
- TPSBar 文本
|
||||
|
||||
配置文件包含 `config-version`,后续如有结构升级,可基于版本号进行迁移与重建。
|
||||
配置文件包含 `config-version`。从旧结构升级时,插件会备份主配置,并自动把 SkinBridge 与便捷菜单节点迁移到独立文件。
|
||||
|
||||
## 权限示例
|
||||
|
||||
@@ -124,9 +132,20 @@ 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
|
||||
essentialsc.command.skin
|
||||
essentialsc.maintenance.bypass
|
||||
essentialsc.maintenance.notify
|
||||
essentialsc.shulkerbox.open
|
||||
|
||||
+2
-1
@@ -8,7 +8,7 @@ plugins {
|
||||
}
|
||||
|
||||
group = 'cn.infstar'
|
||||
version = '1.6.0'
|
||||
version = '1.4.0'
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
@@ -21,6 +21,7 @@ repositories {
|
||||
dependencies {
|
||||
paperweight.paperDevBundle('1.21.11-R0.1-SNAPSHOT')
|
||||
implementation project(':compat-api')
|
||||
implementation 'com.google.code.gson:gson:2.11.0'
|
||||
}
|
||||
|
||||
java {
|
||||
|
||||
@@ -13,6 +13,7 @@ import cn.infstar.essentialsC.listeners.ShulkerBoxListener;
|
||||
import cn.infstar.essentialsC.listeners.VanishListener;
|
||||
import cn.infstar.essentialsC.maintenance.MaintenanceListener;
|
||||
import cn.infstar.essentialsC.maintenance.MaintenanceManager;
|
||||
import cn.infstar.essentialsC.skinbridge.SkinBridgeManager;
|
||||
import cn.infstar.essentialsC.teleport.TeleportRequestManager;
|
||||
import cn.infstar.essentialsC.tpsbar.TpsBarManager;
|
||||
import cn.infstar.essentialsC.tpsbar.TpsBarService;
|
||||
@@ -35,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;
|
||||
@@ -45,6 +47,7 @@ public final class EssentialsC extends JavaPlugin {
|
||||
private MobDropListener mobDropListener;
|
||||
private MobDropMenuListener mobDropMenuListener;
|
||||
private VanishListener vanishListener;
|
||||
private SkinBridgeManager skinBridgeManager;
|
||||
private boolean commandsRegistered;
|
||||
private final Map<String, String> moduleStatus = new LinkedHashMap<>();
|
||||
|
||||
@@ -52,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();
|
||||
@@ -73,6 +77,9 @@ public final class EssentialsC extends JavaPlugin {
|
||||
if (teleportRequestManager != null) {
|
||||
teleportRequestManager.shutdown();
|
||||
}
|
||||
if (skinBridgeManager != null) {
|
||||
skinBridgeManager.shutdown();
|
||||
}
|
||||
VanishCommand.clearAll(this);
|
||||
unregisterRuntimeListeners();
|
||||
unregisterPluginChannels();
|
||||
@@ -91,6 +98,10 @@ public final class EssentialsC extends JavaPlugin {
|
||||
return moduleManager;
|
||||
}
|
||||
|
||||
public FeatureConfigManager getFeatureConfigManager() {
|
||||
return featureConfigManager;
|
||||
}
|
||||
|
||||
public MaintenanceManager getMaintenanceManager() {
|
||||
return maintenanceManager;
|
||||
}
|
||||
@@ -103,6 +114,10 @@ public final class EssentialsC extends JavaPlugin {
|
||||
return tpsBarManager;
|
||||
}
|
||||
|
||||
public SkinBridgeManager getSkinBridgeManager() {
|
||||
return skinBridgeManager;
|
||||
}
|
||||
|
||||
public void reloadRuntimeModules() {
|
||||
moduleStatus.clear();
|
||||
refreshPlayer();
|
||||
@@ -112,6 +127,7 @@ public final class EssentialsC extends JavaPlugin {
|
||||
refreshBlocks();
|
||||
refreshJeiSync();
|
||||
refreshMobDrops();
|
||||
refreshSkinBridge();
|
||||
}
|
||||
|
||||
private void refreshPlayer() {
|
||||
@@ -278,6 +294,26 @@ public final class EssentialsC extends JavaPlugin {
|
||||
setModuleStatus("生物掉落", true, "末影人掉落控制已启用");
|
||||
}
|
||||
|
||||
private void refreshSkinBridge() {
|
||||
if (!moduleManager.isEnabled(ModuleManager.SKIN_BRIDGE)) {
|
||||
if (skinBridgeManager != null) {
|
||||
skinBridgeManager.shutdown();
|
||||
HandlerList.unregisterAll(skinBridgeManager);
|
||||
skinBridgeManager = null;
|
||||
}
|
||||
setModuleStatus("皮肤桥接", false, "已禁用");
|
||||
return;
|
||||
}
|
||||
|
||||
if (skinBridgeManager == null) {
|
||||
skinBridgeManager = new SkinBridgeManager(this);
|
||||
getServer().getPluginManager().registerEvents(skinBridgeManager, this);
|
||||
} else {
|
||||
skinBridgeManager.reload();
|
||||
}
|
||||
setModuleStatus("皮肤桥接", true, skinBridgeManager.getModuleDetail());
|
||||
}
|
||||
|
||||
private void registerPluginChannels() {
|
||||
Messenger messenger = getServer().getMessenger();
|
||||
messenger.registerOutgoingPluginChannel(this, "fabric:recipe_sync");
|
||||
@@ -299,6 +335,7 @@ public final class EssentialsC extends JavaPlugin {
|
||||
unregisterListener(mobDropMenuListener);
|
||||
unregisterListener(vanishListener);
|
||||
unregisterListener(teleportRequestManager);
|
||||
unregisterListener(skinBridgeManager);
|
||||
if (tpsBarManager instanceof Listener listener) {
|
||||
unregisterListener(listener);
|
||||
}
|
||||
|
||||
@@ -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());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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<String, String> 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<String, String> 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<String, String> 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<String, String> 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<String> 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());
|
||||
@@ -152,26 +211,88 @@ public class LangManager {
|
||||
}
|
||||
|
||||
private void loadDefaultLanguageFallback() {
|
||||
InputStream defaultLangStream = plugin.getResource("lang/en_US.yml");
|
||||
if (defaultLangStream == null) {
|
||||
InputStream selectedLangStream = plugin.getResource("lang/" + currentLanguage + ".yml");
|
||||
if (selectedLangStream == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
YamlConfiguration defaultLang = YamlConfiguration.loadConfiguration(
|
||||
new InputStreamReader(defaultLangStream, StandardCharsets.UTF_8)
|
||||
YamlConfiguration selectedDefaults = YamlConfiguration.loadConfiguration(
|
||||
new InputStreamReader(selectedLangStream, StandardCharsets.UTF_8)
|
||||
);
|
||||
langFile.setDefaults(defaultLang);
|
||||
if (!"en_US".equalsIgnoreCase(currentLanguage)) {
|
||||
InputStream englishLangStream = plugin.getResource("lang/en_US.yml");
|
||||
if (englishLangStream != null) {
|
||||
YamlConfiguration englishDefaults = YamlConfiguration.loadConfiguration(
|
||||
new InputStreamReader(englishLangStream, StandardCharsets.UTF_8)
|
||||
);
|
||||
selectedDefaults.setDefaults(englishDefaults);
|
||||
}
|
||||
}
|
||||
langFile.setDefaults(selectedDefaults);
|
||||
}
|
||||
|
||||
private String applyPlaceholders(String value, Map<String, String> placeholders) {
|
||||
String result = value;
|
||||
for (Map.Entry<String, String> 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<String, String> 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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,6 +20,7 @@ public final class ModuleManager {
|
||||
public static final String JEI_SYNC = "jei-sync";
|
||||
public static final String MOB_DROPS = "mob-drops";
|
||||
public static final String MAINTENANCE = "maintenance";
|
||||
public static final String SKIN_BRIDGE = "skin-bridge";
|
||||
|
||||
private static final Map<String, Boolean> DEFAULT_MODULES = new LinkedHashMap<>();
|
||||
|
||||
@@ -31,6 +32,7 @@ public final class ModuleManager {
|
||||
DEFAULT_MODULES.put(JEI_SYNC, true);
|
||||
DEFAULT_MODULES.put(MOB_DROPS, false);
|
||||
DEFAULT_MODULES.put(MAINTENANCE, true);
|
||||
DEFAULT_MODULES.put(SKIN_BRIDGE, false);
|
||||
}
|
||||
|
||||
private final JavaPlugin plugin;
|
||||
|
||||
@@ -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() {
|
||||
|
||||
@@ -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<String> lore, String commandKey) {
|
||||
|
||||
@@ -50,6 +50,7 @@ public final class CommandRegistry {
|
||||
register("mobdrops", "essentialsc.mobdrops.enderman", ModuleManager.MOB_DROPS, "cn.infstar.essentialsC.commands.MobDropCommand");
|
||||
register("maintenance", "essentialsc.command.maintenance", ModuleManager.MAINTENANCE, "cn.infstar.essentialsC.commands.MaintenanceCommand", "maint");
|
||||
registerSubCommand("admin", "essentialsc.command.admin", ModuleManager.ADMIN_MODE, "cn.infstar.essentialsC.commands.AdminCommand");
|
||||
registerSubCommand("skin", "essentialsc.command.skin", ModuleManager.SKIN_BRIDGE, "cn.infstar.essentialsC.commands.SkinBridgeCommand");
|
||||
}
|
||||
|
||||
private CommandRegistry() {
|
||||
|
||||
@@ -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();
|
||||
@@ -202,6 +204,10 @@ public class HelpCommand extends BaseCommand implements TabCompleter {
|
||||
otherCommands.append(lang.getString("help.commands.tpignore")).append("\n");
|
||||
hasOtherCommands = true;
|
||||
}
|
||||
if (CommandRegistry.isAvailable("skin") && player.hasPermission("essentialsc.command.skin")) {
|
||||
otherCommands.append(lang.getString("help.commands.skin")).append("\n");
|
||||
hasOtherCommands = true;
|
||||
}
|
||||
if (CommandRegistry.isAvailable("admin") && player.hasPermission("essentialsc.command.admin")) {
|
||||
otherCommands.append(lang.getString("help.commands.admin")).append("\n");
|
||||
hasOtherCommands = true;
|
||||
@@ -293,6 +299,7 @@ public class HelpCommand extends BaseCommand implements TabCompleter {
|
||||
{"tpdecline", "essentialsc.command.tpdeny"},
|
||||
{"tpno", "essentialsc.command.tpdeny"},
|
||||
{"tpignore", "essentialsc.command.tpignore"},
|
||||
{"skin", "essentialsc.command.skin"},
|
||||
{"tpsbar", "essentialsc.command.tpsbar"},
|
||||
{"maintenance", "essentialsc.command.maintenance"},
|
||||
{"maint", "essentialsc.command.maintenance"},
|
||||
@@ -345,6 +352,13 @@ public class HelpCommand extends BaseCommand implements TabCompleter {
|
||||
return manager == null ? List.of() : manager.getIncomingRequesterNames(completionPlayer, args[1]);
|
||||
}
|
||||
|
||||
if (subCmd.equals("skin") && sender.hasPermission("essentialsc.command.skin")) {
|
||||
String partial = args[1].toLowerCase();
|
||||
return List.of("status", "refresh").stream()
|
||||
.filter(option -> option.startsWith(partial))
|
||||
.toList();
|
||||
}
|
||||
|
||||
if ((subCmd.equals("nightvision") || subCmd.equals("nv")) && sender.hasPermission("essentialsc.command.nightvision")) {
|
||||
return completeToggleArgs(args[1]);
|
||||
}
|
||||
@@ -370,6 +384,19 @@ public class HelpCommand extends BaseCommand implements TabCompleter {
|
||||
}
|
||||
}
|
||||
|
||||
if (args.length == 3 && args[0].equalsIgnoreCase("skin")
|
||||
&& (args[1].equalsIgnoreCase("status") || args[1].equalsIgnoreCase("refresh"))
|
||||
&& sender.hasPermission("essentialsc.command.skin")) {
|
||||
List<String> players = new ArrayList<>();
|
||||
String partial = args[2].toLowerCase();
|
||||
for (Player player : Bukkit.getOnlinePlayers()) {
|
||||
if (player.getName().toLowerCase().startsWith(partial)) {
|
||||
players.add(player.getName());
|
||||
}
|
||||
}
|
||||
return players;
|
||||
}
|
||||
|
||||
return new ArrayList<>();
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,127 @@
|
||||
package cn.infstar.essentialsC.commands;
|
||||
|
||||
import cn.infstar.essentialsC.skinbridge.SkinBridgeManager;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.command.TabCompleter;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
|
||||
public final class SkinBridgeCommand extends BaseCommand implements TabCompleter {
|
||||
|
||||
public SkinBridgeCommand() {
|
||||
super("essentialsc.command.skin");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean execute(Player player, String[] args) {
|
||||
return executeCommand(player, args, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean executeConsole(CommandSender sender, String[] args) {
|
||||
return executeCommand(sender, args, true);
|
||||
}
|
||||
|
||||
private boolean executeCommand(CommandSender sender, String[] args, boolean console) {
|
||||
if (args.length < 1 || args.length > 2) {
|
||||
sender.sendMessage(getLang().getPrefixedString("skin-bridge.messages.usage"));
|
||||
return true;
|
||||
}
|
||||
|
||||
SkinBridgeManager manager = plugin.getSkinBridgeManager();
|
||||
if (manager == null) {
|
||||
sender.sendMessage(getLang().getPrefixedString("messages.module-disabled"));
|
||||
return true;
|
||||
}
|
||||
|
||||
Player target = console ? null : (Player) sender;
|
||||
if (args.length == 2) {
|
||||
target = Bukkit.getPlayerExact(args[1]);
|
||||
if (target == null || !target.isOnline()) {
|
||||
sender.sendMessage(getLang().getPrefixedString("messages.player-not-found", Map.of("player", args[1])));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if (target == null) {
|
||||
sender.sendMessage(getLang().getPrefixedString("skin-bridge.messages.usage"));
|
||||
return true;
|
||||
}
|
||||
|
||||
String action = args[0].toLowerCase(Locale.ROOT);
|
||||
if (action.equals("status")) {
|
||||
sendStatus(sender, target, manager);
|
||||
return true;
|
||||
}
|
||||
if (action.equals("refresh")) {
|
||||
sendRefreshResult(sender, target, manager.queueSync(target, true));
|
||||
return true;
|
||||
}
|
||||
|
||||
sender.sendMessage(getLang().getPrefixedString("skin-bridge.messages.usage"));
|
||||
return true;
|
||||
}
|
||||
|
||||
private void sendStatus(CommandSender sender, Player target, SkinBridgeManager manager) {
|
||||
if (!manager.isEnabled()) {
|
||||
sender.sendMessage(getLang().getPrefixedString("skin-bridge.messages.feature-disabled"));
|
||||
return;
|
||||
}
|
||||
if (!manager.isSkinGatewayAvailable()) {
|
||||
sender.sendMessage(getLang().getPrefixedString("skin-bridge.messages.dependency-missing"));
|
||||
return;
|
||||
}
|
||||
if (manager.getProviderCount() == 0) {
|
||||
sender.sendMessage(getLang().getPrefixedString("skin-bridge.messages.no-providers"));
|
||||
return;
|
||||
}
|
||||
|
||||
SkinBridgeManager.Status status = manager.getStatus(target);
|
||||
Map<String, String> placeholders = Map.of("player", target.getName(), "provider", String.valueOf(status.providerId()));
|
||||
switch (status.state()) {
|
||||
case EXTERNAL -> sender.sendMessage(getLang().getPrefixedString("skin-bridge.messages.status-external", placeholders));
|
||||
case NOT_EXTERNAL -> sender.sendMessage(getLang().getPrefixedString("skin-bridge.messages.status-not-external", placeholders));
|
||||
case PENDING -> sender.sendMessage(getLang().getPrefixedString("skin-bridge.messages.status-pending", placeholders));
|
||||
case UNKNOWN -> sender.sendMessage(getLang().getPrefixedString("skin-bridge.messages.status-unknown", placeholders));
|
||||
}
|
||||
}
|
||||
|
||||
private void sendRefreshResult(CommandSender sender, Player target, SkinBridgeManager.SyncResult result) {
|
||||
Map<String, String> placeholders = Map.of("player", target.getName());
|
||||
String messagePath = switch (result) {
|
||||
case QUEUED -> "skin-bridge.messages.refresh-queued";
|
||||
case CACHED -> "skin-bridge.messages.refresh-cached";
|
||||
case ALREADY_RUNNING -> "skin-bridge.messages.refresh-running";
|
||||
case FEATURE_DISABLED -> "skin-bridge.messages.feature-disabled";
|
||||
case DEPENDENCY_MISSING -> "skin-bridge.messages.dependency-missing";
|
||||
case NO_PROVIDERS -> "skin-bridge.messages.no-providers";
|
||||
};
|
||||
sender.sendMessage(getLang().getPrefixedString(messagePath, placeholders));
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> onTabComplete(CommandSender sender, Command command, String label, String[] args) {
|
||||
if (args.length == 1) {
|
||||
String partial = args[0].toLowerCase(Locale.ROOT);
|
||||
return List.of("status", "refresh").stream()
|
||||
.filter(option -> option.startsWith(partial))
|
||||
.toList();
|
||||
}
|
||||
if (args.length == 2 && (args[0].equalsIgnoreCase("status") || args[0].equalsIgnoreCase("refresh"))) {
|
||||
String partial = args[1].toLowerCase(Locale.ROOT);
|
||||
List<String> players = new ArrayList<>();
|
||||
for (Player onlinePlayer : Bukkit.getOnlinePlayers()) {
|
||||
if (onlinePlayer.getName().toLowerCase(Locale.ROOT).startsWith(partial)) {
|
||||
players.add(onlinePlayer.getName());
|
||||
}
|
||||
}
|
||||
return players;
|
||||
}
|
||||
return List.of();
|
||||
}
|
||||
}
|
||||
@@ -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<String, String> 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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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<String, String> 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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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<String, String> 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<String, String> 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<String> 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<String> 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());
|
||||
}
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -0,0 +1,179 @@
|
||||
package cn.infstar.essentialsC.skinbridge;
|
||||
|
||||
import com.destroystokyo.paper.profile.PlayerProfile;
|
||||
import com.destroystokyo.paper.profile.ProfileProperty;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.JsonParser;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.net.URI;
|
||||
import java.net.http.HttpClient;
|
||||
import java.net.http.HttpRequest;
|
||||
import java.net.http.HttpResponse;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.time.Duration;
|
||||
|
||||
public final class MineSkinGateway implements SkinBridgeGateway {
|
||||
|
||||
private static final String TEXTURES_PROPERTY = "textures";
|
||||
private static final String QUEUE_PATH = "/v2/queue";
|
||||
private static final long POLL_INTERVAL_MILLIS = 1000L;
|
||||
|
||||
private final HttpClient httpClient;
|
||||
private final URI queueUri;
|
||||
private final String apiKey;
|
||||
private final String visibility;
|
||||
private final int timeoutSeconds;
|
||||
private final String userAgent;
|
||||
|
||||
public MineSkinGateway(HttpClient httpClient, String endpoint, String apiKey, String visibility, int timeoutSeconds, String userAgent) {
|
||||
this.httpClient = httpClient;
|
||||
this.queueUri = URI.create(normalizeEndpoint(endpoint) + QUEUE_PATH);
|
||||
this.apiKey = apiKey;
|
||||
this.visibility = normalizeVisibility(visibility);
|
||||
this.timeoutSeconds = timeoutSeconds;
|
||||
this.userAgent = userAgent;
|
||||
}
|
||||
|
||||
@Override
|
||||
public GeneratedSkin generateSkin(String skinUrl, SkinModel model) throws Exception {
|
||||
JsonObject requestBody = new JsonObject();
|
||||
requestBody.addProperty("url", skinUrl);
|
||||
requestBody.addProperty("variant", model == SkinModel.SLIM ? "slim" : "classic");
|
||||
requestBody.addProperty("visibility", visibility);
|
||||
|
||||
HttpResponse<String> response = send(HttpRequest.newBuilder(queueUri)
|
||||
.POST(HttpRequest.BodyPublishers.ofString(requestBody.toString(), StandardCharsets.UTF_8))
|
||||
.header("Content-Type", "application/json"));
|
||||
JsonObject body = parseResponse(response);
|
||||
if (response.statusCode() == 200) {
|
||||
return parseGeneratedSkin(body);
|
||||
}
|
||||
if (response.statusCode() != 202) {
|
||||
throw apiError("提交 MineSkin 生成请求", response, body);
|
||||
}
|
||||
|
||||
JsonObject job = object(body, "job");
|
||||
String jobId = string(job, "id");
|
||||
return pollJob(jobId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void applySkin(Player player, GeneratedSkin skin) {
|
||||
PlayerProfile profile = player.getPlayerProfile();
|
||||
profile.removeProperty(TEXTURES_PROPERTY);
|
||||
profile.setProperty(new ProfileProperty(TEXTURES_PROPERTY, skin.value(), skin.signature()));
|
||||
player.setPlayerProfile(profile);
|
||||
}
|
||||
|
||||
private GeneratedSkin pollJob(String jobId) throws Exception {
|
||||
long deadline = System.nanoTime() + Duration.ofSeconds(timeoutSeconds).toNanos();
|
||||
URI jobUri = URI.create(queueUri + "/" + jobId);
|
||||
while (System.nanoTime() < deadline) {
|
||||
HttpResponse<String> response = send(HttpRequest.newBuilder(jobUri).GET());
|
||||
JsonObject body = parseResponse(response);
|
||||
if (response.statusCode() != 200) {
|
||||
throw apiError("查询 MineSkin 生成任务", response, body);
|
||||
}
|
||||
|
||||
JsonObject job = object(body, "job");
|
||||
String status = string(job, "status");
|
||||
if ("completed".equalsIgnoreCase(status)) {
|
||||
return parseGeneratedSkin(body);
|
||||
}
|
||||
if ("failed".equalsIgnoreCase(status)) {
|
||||
throw new IllegalStateException("MineSkin 生成任务失败: " + errorMessage(body));
|
||||
}
|
||||
if (!"waiting".equalsIgnoreCase(status) && !"active".equalsIgnoreCase(status)) {
|
||||
throw new IllegalStateException("MineSkin 返回未知任务状态: " + status);
|
||||
}
|
||||
Thread.sleep(POLL_INTERVAL_MILLIS);
|
||||
}
|
||||
throw new IllegalStateException("MineSkin 生成任务超时,请增大 skin-bridge.yml 中的 mineskin.request-timeout-seconds。");
|
||||
}
|
||||
|
||||
private HttpResponse<String> send(HttpRequest.Builder builder) throws Exception {
|
||||
HttpRequest request = builder
|
||||
.timeout(Duration.ofSeconds(timeoutSeconds))
|
||||
.header("Accept", "application/json")
|
||||
.header("Authorization", "Bearer " + apiKey)
|
||||
.header("User-Agent", userAgent)
|
||||
.build();
|
||||
return httpClient.send(request, HttpResponse.BodyHandlers.ofString(StandardCharsets.UTF_8));
|
||||
}
|
||||
|
||||
private JsonObject parseResponse(HttpResponse<String> response) {
|
||||
if (response.body() == null || response.body().isBlank()) {
|
||||
throw new IllegalStateException("MineSkin 返回空响应,HTTP " + response.statusCode());
|
||||
}
|
||||
if (response.body().length() > 1_048_576) {
|
||||
throw new IllegalStateException("MineSkin 响应超过 1 MiB 限制。");
|
||||
}
|
||||
try {
|
||||
return JsonParser.parseString(response.body()).getAsJsonObject();
|
||||
} catch (RuntimeException exception) {
|
||||
throw new IllegalStateException("MineSkin 返回了无效 JSON,HTTP " + response.statusCode(), exception);
|
||||
}
|
||||
}
|
||||
|
||||
private GeneratedSkin parseGeneratedSkin(JsonObject body) {
|
||||
JsonObject skin = object(body, "skin");
|
||||
JsonObject texture = object(skin, "texture");
|
||||
JsonObject data = object(texture, "data");
|
||||
return new GeneratedSkin(string(data, "value"), string(data, "signature"));
|
||||
}
|
||||
|
||||
private IllegalStateException apiError(String action, HttpResponse<String> response, JsonObject body) {
|
||||
return new IllegalStateException(action + "失败,HTTP " + response.statusCode() + ": " + errorMessage(body));
|
||||
}
|
||||
|
||||
private String errorMessage(JsonObject body) {
|
||||
for (String key : new String[]{"message", "error", "code"}) {
|
||||
if (body.has(key) && body.get(key).isJsonPrimitive()) {
|
||||
return body.get(key).getAsString();
|
||||
}
|
||||
}
|
||||
return "未提供错误信息";
|
||||
}
|
||||
|
||||
private static JsonObject object(JsonObject parent, String key) {
|
||||
if (!parent.has(key) || !parent.get(key).isJsonObject()) {
|
||||
throw new IllegalStateException("MineSkin 响应缺少对象字段: " + key);
|
||||
}
|
||||
return parent.getAsJsonObject(key);
|
||||
}
|
||||
|
||||
private static String string(JsonObject parent, String key) {
|
||||
if (!parent.has(key) || !parent.get(key).isJsonPrimitive()) {
|
||||
throw new IllegalStateException("MineSkin 响应缺少字符串字段: " + key);
|
||||
}
|
||||
String value = parent.get(key).getAsString();
|
||||
if (value.isBlank()) {
|
||||
throw new IllegalStateException("MineSkin 响应字符串字段为空: " + key);
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
private static String normalizeEndpoint(String endpoint) {
|
||||
String normalized = endpoint == null ? "" : endpoint.trim();
|
||||
while (normalized.endsWith("/")) {
|
||||
normalized = normalized.substring(0, normalized.length() - 1);
|
||||
}
|
||||
if (normalized.isBlank()) {
|
||||
throw new IllegalArgumentException("MineSkin API 地址不能为空。");
|
||||
}
|
||||
URI uri = URI.create(normalized);
|
||||
if (!"https".equalsIgnoreCase(uri.getScheme())) {
|
||||
throw new IllegalArgumentException("MineSkin API 必须使用 HTTPS。");
|
||||
}
|
||||
return normalized;
|
||||
}
|
||||
|
||||
private static String normalizeVisibility(String visibility) {
|
||||
String normalized = visibility == null ? "" : visibility.trim().toLowerCase(java.util.Locale.ROOT);
|
||||
if (!normalized.equals("public") && !normalized.equals("unlisted") && !normalized.equals("private")) {
|
||||
throw new IllegalArgumentException("MineSkin visibility 必须是 public、unlisted 或 private。");
|
||||
}
|
||||
return normalized;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package cn.infstar.essentialsC.skinbridge;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
interface SkinBridgeGateway {
|
||||
|
||||
GeneratedSkin generateSkin(String skinUrl, SkinModel model) throws Exception;
|
||||
|
||||
void applySkin(Player player, GeneratedSkin skin) throws Exception;
|
||||
}
|
||||
|
||||
enum SkinModel {
|
||||
CLASSIC,
|
||||
SLIM
|
||||
}
|
||||
|
||||
record GeneratedSkin(String value, String signature) {
|
||||
}
|
||||
@@ -0,0 +1,491 @@
|
||||
package cn.infstar.essentialsC.skinbridge;
|
||||
|
||||
import cn.infstar.essentialsC.EssentialsC;
|
||||
import com.google.gson.JsonArray;
|
||||
import com.google.gson.JsonElement;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.JsonParser;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.player.PlayerJoinEvent;
|
||||
|
||||
import java.net.URI;
|
||||
import java.net.http.HttpClient;
|
||||
import java.net.http.HttpRequest;
|
||||
import java.net.http.HttpResponse;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.time.Duration;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Base64;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ConcurrentMap;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.ThreadFactory;
|
||||
import java.util.concurrent.atomic.AtomicLong;
|
||||
|
||||
public final class SkinBridgeManager implements Listener {
|
||||
|
||||
private final EssentialsC plugin;
|
||||
private final HttpClient httpClient;
|
||||
private final ExecutorService executor;
|
||||
private final ConcurrentMap<UUID, CachedLookup> cache = new ConcurrentHashMap<>();
|
||||
private final ConcurrentMap<UUID, Long> pendingLookups = new ConcurrentHashMap<>();
|
||||
private final AtomicLong configurationGeneration = new AtomicLong();
|
||||
|
||||
private volatile List<SkinProvider> providers = List.of();
|
||||
private volatile SkinBridgeGateway gateway;
|
||||
private volatile boolean enabled;
|
||||
private volatile boolean debug;
|
||||
private volatile boolean sendPlayerMessage;
|
||||
private volatile int requestTimeoutSeconds;
|
||||
private volatile int cacheMinutes;
|
||||
private volatile long joinDelayTicks;
|
||||
|
||||
public SkinBridgeManager(EssentialsC plugin) {
|
||||
this.plugin = plugin;
|
||||
this.httpClient = HttpClient.newBuilder()
|
||||
.connectTimeout(Duration.ofSeconds(5))
|
||||
.followRedirects(HttpClient.Redirect.NEVER)
|
||||
.build();
|
||||
this.executor = Executors.newFixedThreadPool(2, new SkinBridgeThreadFactory());
|
||||
reload();
|
||||
}
|
||||
|
||||
public void reload() {
|
||||
configurationGeneration.incrementAndGet();
|
||||
FileConfiguration config = plugin.getFeatureConfigManager().getSkinBridgeConfig();
|
||||
addDefaults(config);
|
||||
config.options().copyDefaults(true);
|
||||
plugin.getFeatureConfigManager().saveSkinBridgeConfig();
|
||||
|
||||
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);
|
||||
|
||||
if (enabled && gateway == null) {
|
||||
plugin.getLogger().warning("SkinBridge 已启用,但未配置有效的 MineSkin API Key,皮肤同步不会执行。");
|
||||
}
|
||||
}
|
||||
|
||||
public void shutdown() {
|
||||
configurationGeneration.incrementAndGet();
|
||||
cache.clear();
|
||||
pendingLookups.clear();
|
||||
executor.shutdownNow();
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerJoin(PlayerJoinEvent event) {
|
||||
queueSync(event.getPlayer(), false);
|
||||
}
|
||||
|
||||
public SyncResult queueSync(Player player, boolean force) {
|
||||
if (!enabled) {
|
||||
return SyncResult.FEATURE_DISABLED;
|
||||
}
|
||||
if (gateway == null) {
|
||||
return SyncResult.DEPENDENCY_MISSING;
|
||||
}
|
||||
if (providers.isEmpty()) {
|
||||
return SyncResult.NO_PROVIDERS;
|
||||
}
|
||||
|
||||
UUID playerId = player.getUniqueId();
|
||||
if (force) {
|
||||
cache.remove(playerId);
|
||||
}
|
||||
|
||||
CachedLookup cached = cache.get(playerId);
|
||||
if (!force && cached != null && !cached.hasExpired()) {
|
||||
if (cached.skin() != null) {
|
||||
applySkin(playerId, cached, configurationGeneration.get());
|
||||
}
|
||||
return SyncResult.CACHED;
|
||||
}
|
||||
|
||||
long lookupGeneration = configurationGeneration.get();
|
||||
if (!registerPendingLookup(playerId, lookupGeneration)) {
|
||||
return SyncResult.ALREADY_RUNNING;
|
||||
}
|
||||
|
||||
String playerName = player.getName();
|
||||
Bukkit.getScheduler().runTaskLater(plugin, () -> startLookup(playerId, playerName, lookupGeneration), joinDelayTicks);
|
||||
sendPlayerNotification(playerId, "skin-bridge.notifications.detecting", Map.of());
|
||||
return SyncResult.QUEUED;
|
||||
}
|
||||
|
||||
public Status getStatus(Player player) {
|
||||
CachedLookup cached = cache.get(player.getUniqueId());
|
||||
if (cached != null && !cached.hasExpired()) {
|
||||
return new Status(cached.state(), cached.providerId());
|
||||
}
|
||||
if (pendingLookups.containsKey(player.getUniqueId())) {
|
||||
return new Status(State.PENDING, null);
|
||||
}
|
||||
return new Status(State.UNKNOWN, null);
|
||||
}
|
||||
|
||||
public boolean isEnabled() {
|
||||
return enabled;
|
||||
}
|
||||
|
||||
public boolean isSkinGatewayAvailable() {
|
||||
return gateway != null;
|
||||
}
|
||||
|
||||
public int getProviderCount() {
|
||||
return providers.size();
|
||||
}
|
||||
|
||||
public String getModuleDetail() {
|
||||
if (!enabled) {
|
||||
return "配置未启用";
|
||||
}
|
||||
if (gateway == null) {
|
||||
return "缺少 MineSkin API Key 或配置无效";
|
||||
}
|
||||
if (providers.isEmpty()) {
|
||||
return "未配置有效 Provider";
|
||||
}
|
||||
return providers.size() + " 个 Provider 已就绪";
|
||||
}
|
||||
|
||||
private void startLookup(UUID playerId, String playerName, long lookupGeneration) {
|
||||
if (executor.isShutdown() || lookupGeneration != configurationGeneration.get()) {
|
||||
pendingLookups.remove(playerId, lookupGeneration);
|
||||
return;
|
||||
}
|
||||
executor.execute(() -> {
|
||||
try {
|
||||
CachedLookup resolved = resolve(playerId, playerName);
|
||||
if (lookupGeneration != configurationGeneration.get()) {
|
||||
return;
|
||||
}
|
||||
cache.put(playerId, resolved);
|
||||
if (resolved.skin() != null) {
|
||||
applySkin(playerId, resolved, lookupGeneration);
|
||||
} else {
|
||||
sendPlayerNotification(playerId, "skin-bridge.notifications.not-external", Map.of());
|
||||
if (debug) {
|
||||
plugin.getLogger().info("SkinBridge 未识别到外置登录玩家: " + playerName);
|
||||
}
|
||||
}
|
||||
} catch (Exception exception) {
|
||||
plugin.getLogger().warning("SkinBridge 查询 " + playerName + " 的皮肤资料失败: " + exception.getMessage());
|
||||
sendPlayerNotification(playerId, "skin-bridge.notifications.failed", Map.of());
|
||||
if (debug) {
|
||||
plugin.getLogger().warning("SkinBridge 异常类型: " + exception.getClass().getName());
|
||||
}
|
||||
} finally {
|
||||
pendingLookups.remove(playerId, lookupGeneration);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private boolean registerPendingLookup(UUID playerId, long lookupGeneration) {
|
||||
while (true) {
|
||||
Long runningGeneration = pendingLookups.putIfAbsent(playerId, lookupGeneration);
|
||||
if (runningGeneration == null) {
|
||||
return true;
|
||||
}
|
||||
if (runningGeneration == lookupGeneration) {
|
||||
return false;
|
||||
}
|
||||
if (pendingLookups.replace(playerId, runningGeneration, lookupGeneration)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private CachedLookup resolve(UUID playerId, String playerName) throws Exception {
|
||||
Exception lastFailure = null;
|
||||
for (SkinProvider provider : providers) {
|
||||
Optional<ProviderProfile> profile;
|
||||
try {
|
||||
profile = queryProfile(provider, playerId, playerName);
|
||||
} catch (Exception exception) {
|
||||
lastFailure = exception;
|
||||
plugin.getLogger().warning("SkinBridge Provider " + provider.id() + " 查询失败: " + exception.getMessage());
|
||||
continue;
|
||||
}
|
||||
if (profile.isEmpty()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
SkinBridgeGateway currentGateway = gateway;
|
||||
if (currentGateway == null) {
|
||||
throw new IllegalStateException("MineSkin 网关在查询期间不可用。");
|
||||
}
|
||||
|
||||
ProviderProfile matchedProfile = profile.get();
|
||||
GeneratedSkin generatedSkin = currentGateway.generateSkin(matchedProfile.skinUrl(), matchedProfile.model());
|
||||
return cached(provider.id(), generatedSkin, State.EXTERNAL);
|
||||
}
|
||||
|
||||
if (lastFailure != null) {
|
||||
throw new IllegalStateException("所有可用 Provider 均未能完成确认。", lastFailure);
|
||||
}
|
||||
return cached(null, null, State.NOT_EXTERNAL);
|
||||
}
|
||||
|
||||
private Optional<ProviderProfile> queryProfile(SkinProvider provider, UUID playerId, String playerName) throws Exception {
|
||||
URI requestUri = URI.create(provider.resolveProfileUrl(playerId));
|
||||
HttpRequest request = HttpRequest.newBuilder(requestUri)
|
||||
.timeout(Duration.ofSeconds(requestTimeoutSeconds))
|
||||
.header("Accept", "application/json")
|
||||
.header("User-Agent", "EssentialsC/" + plugin.getDescription().getVersion() + " SkinBridge")
|
||||
.GET()
|
||||
.build();
|
||||
HttpResponse<String> response = httpClient.send(request, HttpResponse.BodyHandlers.ofString(StandardCharsets.UTF_8));
|
||||
|
||||
if (response.statusCode() == 204 || response.statusCode() == 404) {
|
||||
return Optional.empty();
|
||||
}
|
||||
if (response.statusCode() != 200) {
|
||||
throw new IllegalStateException(provider.id() + " 返回 HTTP " + response.statusCode());
|
||||
}
|
||||
if (response.body().length() > 1_048_576) {
|
||||
throw new IllegalStateException(provider.id() + " 返回的 profile 超过 1 MiB 限制。");
|
||||
}
|
||||
|
||||
JsonObject profile = JsonParser.parseString(response.body()).getAsJsonObject();
|
||||
String profileId = requireString(profile, "id");
|
||||
String profileName = requireString(profile, "name");
|
||||
if (!normalizeUuid(profileId).equals(normalizeUuid(playerId.toString())) || !profileName.equalsIgnoreCase(playerName)) {
|
||||
if (debug) {
|
||||
plugin.getLogger().warning("SkinBridge 忽略 " + provider.id() + " 的不匹配 profile: " + profileName + " / " + profileId);
|
||||
}
|
||||
return Optional.empty();
|
||||
}
|
||||
|
||||
JsonObject textureData = findTextureData(profile);
|
||||
JsonObject skin = textureData.getAsJsonObject("textures").getAsJsonObject("SKIN");
|
||||
String skinUrl = requireString(skin, "url");
|
||||
URI skinUri = URI.create(skinUrl);
|
||||
if (!"https".equalsIgnoreCase(skinUri.getScheme()) && !"http".equalsIgnoreCase(skinUri.getScheme())) {
|
||||
throw new IllegalStateException(provider.id() + " 返回了不支持的皮肤 URL 协议。");
|
||||
}
|
||||
|
||||
SkinModel model = SkinModel.CLASSIC;
|
||||
JsonObject metadata = skin.has("metadata") && skin.get("metadata").isJsonObject()
|
||||
? skin.getAsJsonObject("metadata")
|
||||
: null;
|
||||
if (metadata != null && "slim".equalsIgnoreCase(metadata.has("model") ? metadata.get("model").getAsString() : "")) {
|
||||
model = SkinModel.SLIM;
|
||||
}
|
||||
return Optional.of(new ProviderProfile(skinUrl, model));
|
||||
}
|
||||
|
||||
private JsonObject findTextureData(JsonObject profile) {
|
||||
JsonArray properties = profile.has("properties") && profile.get("properties").isJsonArray()
|
||||
? profile.getAsJsonArray("properties")
|
||||
: new JsonArray();
|
||||
for (JsonElement element : properties) {
|
||||
if (!element.isJsonObject()) {
|
||||
continue;
|
||||
}
|
||||
JsonObject property = element.getAsJsonObject();
|
||||
if (!"textures".equals(property.has("name") ? property.get("name").getAsString() : "")) {
|
||||
continue;
|
||||
}
|
||||
String encodedValue = requireString(property, "value");
|
||||
String decodedValue = new String(Base64.getDecoder().decode(encodedValue), StandardCharsets.UTF_8);
|
||||
JsonObject textureData = JsonParser.parseString(decodedValue).getAsJsonObject();
|
||||
if (textureData.has("textures")
|
||||
&& textureData.get("textures").isJsonObject()
|
||||
&& textureData.getAsJsonObject("textures").has("SKIN")
|
||||
&& textureData.getAsJsonObject("textures").get("SKIN").isJsonObject()) {
|
||||
return textureData;
|
||||
}
|
||||
}
|
||||
throw new IllegalStateException("profile 不包含有效的皮肤 textures 属性。");
|
||||
}
|
||||
|
||||
private List<SkinProvider> loadProviders(FileConfiguration config) {
|
||||
ConfigurationSection providersSection = config.getConfigurationSection("providers");
|
||||
if (providersSection == null) {
|
||||
return List.of();
|
||||
}
|
||||
|
||||
List<SkinProvider> loadedProviders = new ArrayList<>();
|
||||
for (String key : providersSection.getKeys(false)) {
|
||||
ConfigurationSection providerSection = providersSection.getConfigurationSection(key);
|
||||
if (providerSection == null || !providerSection.getBoolean("enabled", false)) {
|
||||
continue;
|
||||
}
|
||||
String profileUrl = providerSection.getString("profile-url", "").trim();
|
||||
if (!profileUrl.contains("{uuid}") && !profileUrl.contains("{uuid-dashed}")) {
|
||||
plugin.getLogger().warning("SkinBridge Provider " + key + " 缺少 {uuid} 或 {uuid-dashed} 占位符,已跳过。");
|
||||
continue;
|
||||
}
|
||||
try {
|
||||
URI.create(profileUrl.replace("{uuid}", "00000000000000000000000000000000")
|
||||
.replace("{uuid-dashed}", "00000000-0000-0000-0000-000000000000"));
|
||||
loadedProviders.add(new SkinProvider(key, profileUrl, providerSection.getInt("priority", 100)));
|
||||
} catch (IllegalArgumentException exception) {
|
||||
plugin.getLogger().warning("SkinBridge Provider " + key + " 的 profile-url 无效,已跳过。");
|
||||
}
|
||||
}
|
||||
loadedProviders.sort(Comparator.comparingInt(SkinProvider::priority).thenComparing(SkinProvider::id));
|
||||
return List.copyOf(loadedProviders);
|
||||
}
|
||||
|
||||
private SkinBridgeGateway loadGateway(String endpoint, String apiKey, String visibility, int timeoutSeconds) {
|
||||
if (apiKey.isBlank()) {
|
||||
return null;
|
||||
}
|
||||
try {
|
||||
return new MineSkinGateway(httpClient, endpoint, apiKey, visibility, timeoutSeconds,
|
||||
"EssentialsC/" + plugin.getDescription().getVersion() + " SkinBridge");
|
||||
} catch (Exception | LinkageError exception) {
|
||||
plugin.getLogger().warning("加载 MineSkin SkinBridge 适配器失败: " + exception.getMessage());
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private void addDefaults(FileConfiguration config) {
|
||||
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) {
|
||||
Bukkit.getScheduler().runTask(plugin, () -> {
|
||||
if (lookupGeneration != configurationGeneration.get()) {
|
||||
return;
|
||||
}
|
||||
Player player = Bukkit.getPlayer(playerId);
|
||||
SkinBridgeGateway currentGateway = gateway;
|
||||
if (player == null || !player.isOnline() || currentGateway == null || resolved.skin() == null) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
currentGateway.applySkin(player, resolved.skin());
|
||||
sendPlayerNotification(playerId, "skin-bridge.notifications.synced",
|
||||
Map.of("provider", resolved.providerId()));
|
||||
if (debug) {
|
||||
plugin.getLogger().info("SkinBridge 已应用 " + player.getName() + " 的 " + resolved.providerId() + " 皮肤。");
|
||||
}
|
||||
} catch (Exception exception) {
|
||||
plugin.getLogger().warning("SkinBridge 应用 " + player.getName() + " 的皮肤失败: " + exception.getMessage());
|
||||
sendPlayerNotification(playerId, "skin-bridge.notifications.failed", Map.of());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void sendPlayerNotification(UUID playerId, String messagePath, Map<String, String> placeholders) {
|
||||
if (!sendPlayerMessage) {
|
||||
return;
|
||||
}
|
||||
|
||||
Runnable notification = () -> {
|
||||
Player player = Bukkit.getPlayer(playerId);
|
||||
if (player != null && player.isOnline()) {
|
||||
player.sendMessage(EssentialsC.getLangManager().getPrefixedString(messagePath, placeholders));
|
||||
}
|
||||
};
|
||||
if (Bukkit.isPrimaryThread()) {
|
||||
notification.run();
|
||||
} else {
|
||||
Bukkit.getScheduler().runTask(plugin, notification);
|
||||
}
|
||||
}
|
||||
|
||||
private CachedLookup cached(String providerId, GeneratedSkin skin, State state) {
|
||||
return new CachedLookup(providerId, skin, state, System.currentTimeMillis() + Duration.ofMinutes(cacheMinutes).toMillis());
|
||||
}
|
||||
|
||||
private static String requireString(JsonObject object, String key) {
|
||||
if (!object.has(key) || !object.get(key).isJsonPrimitive()) {
|
||||
throw new IllegalStateException("缺少字符串字段: " + key);
|
||||
}
|
||||
String value = object.get(key).getAsString();
|
||||
if (value.isBlank()) {
|
||||
throw new IllegalStateException("字符串字段为空: " + key);
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
private static String normalizeUuid(String value) {
|
||||
return value.replace("-", "").toLowerCase(java.util.Locale.ROOT);
|
||||
}
|
||||
|
||||
private static int clamp(int value, int min, int max) {
|
||||
return Math.max(min, Math.min(max, value));
|
||||
}
|
||||
|
||||
private static long clamp(long value, long min, long max) {
|
||||
return Math.max(min, Math.min(max, value));
|
||||
}
|
||||
|
||||
private record SkinProvider(String id, String profileUrl, int priority) {
|
||||
private String resolveProfileUrl(UUID playerId) {
|
||||
return profileUrl.replace("{uuid}", playerId.toString().replace("-", ""))
|
||||
.replace("{uuid-dashed}", playerId.toString());
|
||||
}
|
||||
}
|
||||
|
||||
private record ProviderProfile(String skinUrl, SkinModel model) {
|
||||
}
|
||||
|
||||
private record CachedLookup(String providerId, GeneratedSkin skin, State state, long expiresAtMillis) {
|
||||
private boolean hasExpired() {
|
||||
return System.currentTimeMillis() >= expiresAtMillis;
|
||||
}
|
||||
}
|
||||
|
||||
private static final class SkinBridgeThreadFactory implements ThreadFactory {
|
||||
@Override
|
||||
public Thread newThread(Runnable runnable) {
|
||||
Thread thread = new Thread(runnable, "EssentialsC-SkinBridge");
|
||||
thread.setDaemon(true);
|
||||
return thread;
|
||||
}
|
||||
}
|
||||
|
||||
public enum SyncResult {
|
||||
QUEUED,
|
||||
CACHED,
|
||||
ALREADY_RUNNING,
|
||||
FEATURE_DISABLED,
|
||||
DEPENDENCY_MISSING,
|
||||
NO_PROVIDERS
|
||||
}
|
||||
|
||||
public record Status(State state, String providerId) {
|
||||
}
|
||||
|
||||
public enum State {
|
||||
EXTERNAL,
|
||||
NOT_EXTERNAL,
|
||||
PENDING,
|
||||
UNKNOWN
|
||||
}
|
||||
}
|
||||
@@ -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<UUID, Deque<TeleportRequest>> requests = new HashMap<>();
|
||||
private final Map<UUID, PendingTeleport> warmups = new HashMap<>();
|
||||
private final Map<UUID, Long> sendCooldowns = new HashMap<>();
|
||||
private final Map<UUID, Long> acceptCooldowns = new HashMap<>();
|
||||
private final Map<UUID, BukkitTask> invulnerabilityTasks = new HashMap<>();
|
||||
private final Set<UUID> warmupDamagedPlayers = new HashSet<>();
|
||||
private final Set<UUID> invulnerablePlayers = new HashSet<>();
|
||||
private final Set<UUID> 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<String, String> 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<String, String> 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<Player> 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<String, String> 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<String, String> placeholders) {
|
||||
String requesterName = request.requesterName();
|
||||
String acceptCommand = "/tpaccept " + requesterName;
|
||||
String denyCommand = "/tpdeny " + requesterName;
|
||||
public Optional<Player> findOnlinePlayer(String playerName, Predicate<Player> filter) {
|
||||
Optional<Player> 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<String, String> 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<String, String> 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<UUID> emptyQueues = new ArrayList<>();
|
||||
for (Map.Entry<UUID, Deque<TeleportRequest>> entry : requests.entrySet()) {
|
||||
entry.getValue().removeIf(TeleportRequest::hasExpired);
|
||||
if (entry.getValue().isEmpty()) {
|
||||
emptyQueues.add(entry.getKey());
|
||||
}
|
||||
}
|
||||
emptyQueues.forEach(requests::remove);
|
||||
}
|
||||
|
||||
public Map<String, String> placeholders(TeleportRequest request) {
|
||||
Map<String, String> 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
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
+45
-112
@@ -1,139 +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"
|
||||
|
||||
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
|
||||
# 音效
|
||||
sounds:
|
||||
enabled: true
|
||||
request-received: "entity.experience_orb.pickup"
|
||||
warmup: "block.note_block.banjo"
|
||||
cancelled: "entity.item.break"
|
||||
complete: "entity.enderman.teleport"
|
||||
|
||||
+210
-188
@@ -1,239 +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:</#FF3300> <#FF7E5E>You do not have permission to use this command.</#FF7E5E> <gray>Required: {permission}</gray>'
|
||||
player-only: '<#FF3300>Error:</#FF3300> <#FF7E5E>This command can only be run by players.</#FF7E5E>'
|
||||
config-reloaded: '<#00FB9A>Configuration reloaded.</#00FB9A>'
|
||||
version: '<#00FB9A>EssentialsC v{version}</#00FB9A>'
|
||||
paper-version: '<gray>Running on Paper {version}</gray>'
|
||||
unknown-subcommand: '<#FF3300>Error:</#FF3300> <#FF7E5E>Unknown subcommand: {command}</#FF7E5E>'
|
||||
help-usage: '<gray>Use <white>/essc help</white> to view available commands.</gray>'
|
||||
module-disabled: '<#FF3300>Error:</#FF3300> <#FF7E5E>This feature module is currently disabled.</#FF7E5E>'
|
||||
blocks-menu-empty: '<#FF3300>Error:</#FF3300> <#FF7E5E>You do not have any available shortcut menu entries.</#FF7E5E>'
|
||||
|
||||
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 <player>"
|
||||
seen-usage-console: "&cUsage: /seen <player>"
|
||||
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 <bold>{item}</bold> on your head.</#00FB9A>'
|
||||
hat-failed: '<#FF3300>Error:</#FF3300> <#FF7E5E>Could not wear that item on your head.</#FF7E5E>'
|
||||
hat-no-item: '<#FF3300>Error:</#FF3300> <#FF7E5E>You need to hold an item.</#FF7E5E>'
|
||||
suicide-message: '<#FF7E5E>{player} died by suicide.</#FF7E5E>'
|
||||
fly-enabled: '<#00FB9A>Flight mode enabled.</#00FB9A>'
|
||||
fly-disabled: '<#FF7E5E>Flight mode disabled.</#FF7E5E>'
|
||||
nightvision-enabled: '<#00FB9A>Night vision enabled.</#00FB9A>'
|
||||
nightvision-disabled: '<#FF7E5E>Night vision disabled.</#FF7E5E>'
|
||||
nightvision-usage: '<#FF3300>Error:</#FF3300> <#FF7E5E>Usage: /nightvision [on|off|toggle]</#FF7E5E>'
|
||||
glow-enabled: '<#00FB9A>Glowing enabled.</#00FB9A>'
|
||||
glow-disabled: '<#FF7E5E>Glowing disabled.</#FF7E5E>'
|
||||
glow-usage: '<#FF3300>Error:</#FF3300> <#FF7E5E>Usage: /glow [on|off|toggle]</#FF7E5E>'
|
||||
vanish-enabled: '<#00FB9A>You are now vanished.</#00FB9A>'
|
||||
vanish-disabled: '<#FF7E5E>You are no longer vanished.</#FF7E5E>'
|
||||
seen-usage: '<#FF3300>Error:</#FF3300> <#FF7E5E>Usage: /seen [player]</#FF7E5E>'
|
||||
seen-usage-console: '<#FF3300>Error:</#FF3300> <#FF7E5E>Usage: /seen [player]</#FF7E5E>'
|
||||
player-not-found: '<#FF3300>Error:</#FF3300> <#FF7E5E>Could not find the player {player}.</#FF7E5E>'
|
||||
no-permission-others: '<#FF3300>Error:</#FF3300> <#FF7E5E>You do not have permission to affect other players.</#FF7E5E>'
|
||||
|
||||
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.</#00FB9A>'
|
||||
enchantingtable-opened: '<#00FB9A>Opened an enchanting table.</#00FB9A>'
|
||||
heal-self: '<#00FB9A>Your health and hunger have been restored.</#00FB9A>'
|
||||
heal-other: '<#00FB9A>You healed <bold>{player}</bold>.</#00FB9A>'
|
||||
heal-by-other: '<#00FB9A>You were healed by <bold>{admin}</bold>.</#00FB9A>'
|
||||
feed-self: '<#00FB9A>Your hunger has been restored.</#00FB9A>'
|
||||
feed-other: '<#00FB9A>You fed <bold>{player}</bold>.</#00FB9A>'
|
||||
feed-by-other: '<#00FB9A>You were fed by <bold>{admin}</bold>.</#00FB9A>'
|
||||
repair-hand-success: '<#00FB9A>Repaired the item in your hand.</#00FB9A>'
|
||||
repair-all-success: '<#00FB9A>Repaired <bold>{count}</bold> item(s).</#00FB9A>'
|
||||
repair-not-damaged: '<#FF3300>Error:</#FF3300> <#FF7E5E>This item is not damaged.</#FF7E5E>'
|
||||
repair-no-item-in-hand: '<#FF3300>Error:</#FF3300> <#FF7E5E>You do not have an item in your hand.</#FF7E5E>'
|
||||
repair-no-items: '<#FF3300>Error:</#FF3300> <#FF7E5E>There are no repairable items in your inventory.</#FF7E5E>'
|
||||
no-permission-repair-all: '<#FF3300>Error:</#FF3300> <#FF7E5E>You do not have permission to repair all items.</#FF7E5E>'
|
||||
|
||||
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:</#FF3300> <#FF7E5E>Failed to save config: {error}</#FF7E5E>'
|
||||
mobdrop-toggled: '<#00FB9A>Enderman drops are now {status}.</#00FB9A>'
|
||||
shulkerbox-nested: '<#FF3300>Error:</#FF3300> <#FF7E5E>You cannot put a shulker box inside another shulker box.</#FF7E5E>'
|
||||
shulkerbox-unstack-first: '<#FF3300>Error:</#FF3300> <#FF7E5E>Please unstack the shulker box before quick opening it.</#FF7E5E>'
|
||||
jei-sync-fabric: '<#00FB9A>Synchronizing recipes for your <bold>Fabric</bold> client…</#00FB9A>'
|
||||
jei-sync-neoforge: '<#00FB9A>Synchronizing recipes for your <bold>NeoForge</bold> client…</#00FB9A>'
|
||||
|
||||
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><bold>EssentialsC</bold></#00FB9A> <gray>Command Help</gray>'
|
||||
version: '<gray>Plugin version: <white>{version}</white></gray>'
|
||||
section-blocks: '<#00FB9A>Functional Block Commands</#00FB9A>'
|
||||
section-other: '<#00FB9A>Other Commands</#00FB9A>'
|
||||
footer: '<gray>Each command requires the corresponding permission.</gray>'
|
||||
|
||||
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 <player> &7- Request to teleport to a player"
|
||||
tpahere: " &f/tpahere <player> &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"
|
||||
admin: " &f/essc admin &7- Toggle admin mode"
|
||||
tpsbar: " &f/tpsbar [player] &7- Toggle TPS boss bar"
|
||||
maintenance: " &f/maintenance <on|off|status|reload|add|remove|list> &7- Manage maintenance mode"
|
||||
workbench: '<white>/workbench</white> <gray>- Open a crafting table</gray>'
|
||||
anvil: '<white>/anvil</white> <gray>- Open an anvil</gray>'
|
||||
enchantingtable: '<white>/enchantingtable</white> <gray>- Open an enchanting table</gray>'
|
||||
cartographytable: '<white>/cartographytable</white> <gray>- Open a cartography table</gray>'
|
||||
grindstone: '<white>/grindstone</white> <gray>- Open a grindstone</gray>'
|
||||
loom: '<white>/loom</white> <gray>- Open a loom</gray>'
|
||||
smithingtable: '<white>/smithingtable</white> <gray>- Open a smithing table</gray>'
|
||||
stonecutter: '<white>/stonecutter</white> <gray>- Open a stonecutter</gray>'
|
||||
enderchest: '<white>/enderchest</white> <gray>- Open your ender chest</gray>'
|
||||
blocks: '<white>/blocks</white> <gray>- Open the shortcut menu</gray>'
|
||||
hat: '<white>/hat</white> <gray>- Wear the held item as a hat</gray>'
|
||||
suicide: '<white>/suicide</white> <gray>- Die by suicide</gray>'
|
||||
fly: '<white>/fly</white> <gray>- Toggle flight mode</gray>'
|
||||
nightvision: '<white>/nightvision</white> <gray>- Toggle night vision</gray>'
|
||||
glow: '<white>/glow</white> <gray>- Toggle glowing</gray>'
|
||||
heal: '<white>/heal</white> <gray>- Restore health and hunger</gray>'
|
||||
vanish: '<white>/vanish</white> <gray>- Toggle vanish mode</gray>'
|
||||
seen: '<white>/seen</white> <gray>- View player information</gray>'
|
||||
feed: '<white>/feed</white> <gray>- Restore hunger</gray>'
|
||||
repair: '<white>/repair</white> <gray>- Repair held or all items</gray>'
|
||||
tpa: '<white>/tpa [player]</white> <gray>- Request to teleport to a player</gray>'
|
||||
tpahere: '<white>/tpahere [player]</white> <gray>- Request a player teleport to you</gray>'
|
||||
tpaall: '<white>/tpaall</white> <gray>- Request all players teleport to you</gray>'
|
||||
tpaccept: '<white>/tpaccept [player]</white> <gray>- Accept a teleport request</gray>'
|
||||
tpdeny: '<white>/tpdeny [player]</white> <gray>- Deny a teleport request</gray>'
|
||||
tpignore: '<white>/tpignore</white> <gray>- Toggle ignoring teleport requests</gray>'
|
||||
skin: '<white>/essc skin [status|refresh] [player]</white> <gray>- View or refresh SkinBridge status</gray>'
|
||||
admin: '<white>/essc admin</white> <gray>- Toggle admin mode</gray>'
|
||||
tpsbar: '<white>/tpsbar [player]</white> <gray>- Toggle TPS boss bar</gray>'
|
||||
maintenance: '<white>/maintenance [on|off|status|reload|add|remove|list]</white> <gray>- Manage maintenance mode</gray>'
|
||||
|
||||
tpa:
|
||||
messages:
|
||||
usage-tpa: "&cUsage: /tpa <player>"
|
||||
usage-tpahere: "&cUsage: /tpahere <player>"
|
||||
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:</#FF3300> <#FF7E5E>Usage: /tpa [player]</#FF7E5E>'
|
||||
usage-tpahere: '<#FF3300>Error:</#FF3300> <#FF7E5E>Usage: /tpahere [player]</#FF7E5E>'
|
||||
usage-tpaall: '<#FF3300>Error:</#FF3300> <#FF7E5E>Usage: /tpaall</#FF7E5E>'
|
||||
usage-tpaccept: '<#FF3300>Error:</#FF3300> <#FF7E5E>Usage: /tpaccept [player]</#FF7E5E>'
|
||||
usage-tpdeny: '<#FF3300>Error:</#FF3300> <#FF7E5E>Usage: /tpdeny [player]</#FF7E5E>'
|
||||
self: '<#FF3300>Error:</#FF3300> <#FF7E5E>You cannot send a teleport request to yourself.</#FF7E5E>'
|
||||
sent-tpa: '<#00FB9A>You sent a teleport request asking to teleport to</#00FB9A> <bold><#00FB9A>{target}</#00FB9A></bold><#00FB9A>.</#00FB9A>'
|
||||
sent-tpahere: '<#00FB9A>You sent a teleport request asking</#00FB9A> <bold><#00FB9A>{target}</#00FB9A></bold> <#00FB9A>to teleport to you.</#00FB9A>'
|
||||
ignoring-requests: '<#FF3300>Error:</#FF3300> <#FF7E5E>You are currently ignoring teleport requests.</#FF7E5E> <#FF7E5E><click:run_command:/tpignore><hover:show_text:"<#FF7E5E>Click to listen for incoming teleport requests</#FF7E5E>">[Stop Ignoring...]</hover></click></#FF7E5E>'
|
||||
send-cooldown: '<#FF3300>Error:</#FF3300> <#FF7E5E>You must wait {seconds}s before doing that again.</#FF7E5E>'
|
||||
accept-cooldown: '<#FF3300>Error:</#FF3300> <#FF7E5E>You must wait {seconds}s before doing that again.</#FF7E5E>'
|
||||
received-tpa: '<bold><#00FB9A>{requester}</#00FB9A></bold> <#00FB9A>has requested to teleport to you.</#00FB9A>'
|
||||
received-tpahere: '<bold><#00FB9A>{requester}</#00FB9A></bold> <#00FB9A>has requested that you teleport to them.</#00FB9A>'
|
||||
response-buttons: '<gray>Options:</gray> <#00FB9A><click:run_command:''/tpaccept {requester}''><hover:show_text:"<#00FB9A>Accept teleport request\n<dark_gray>Click to accept {requester}''s request</dark_gray></#00FB9A>">[✔ Accept…]</hover></click></#00FB9A> <#FF3300><click:run_command:''/tpdeny {requester}''><hover:show_text:"<#FF3300>Decline teleport request\n<dark_gray>Click to decline {requester}''s request</dark_gray></#FF3300>">[❌ Decline…]</hover></click></#FF3300>'
|
||||
no-request: '<#FF3300>Error:</#FF3300> <#FF7E5E>You do not have a pending teleport request.</#FF7E5E>'
|
||||
invalid-request: '<#FF3300>Error:</#FF3300> <#FF7E5E>You do not have a pending teleport request from {requester}.</#FF7E5E>'
|
||||
accepted-target: '<#00FB9A>You accepted {requester}''s teleport request!</#00FB9A>'
|
||||
accepted-sender: '<#00FB9A>{target} has accepted your teleport request!</#00FB9A>'
|
||||
denied-target: '<#FF7E5E>You declined {requester}''s teleport request.</#FF7E5E>'
|
||||
denied-sender: '<#FF7E5E>{target} has declined your teleport request.</#FF7E5E>'
|
||||
expired: '<#FF3300>Error:</#FF3300> <#FF7E5E>Your pending teleport request has expired.</#FF7E5E>'
|
||||
player-offline: '<#FF3300>Error:</#FF3300> <#FF7E5E>The sender of your pending teleport request is no longer online.</#FF7E5E>'
|
||||
target-offline: '<#FF3300>Error:</#FF3300> <#FF7E5E>The teleport target could not be found.</#FF7E5E>'
|
||||
already-warming-up: '<#FF3300>Error:</#FF3300> <#FF7E5E>A related player is already warming up for teleportation.</#FF7E5E>'
|
||||
warmup-start: '<#00FB9A>You will be teleported in</#00FB9A> <bold><#00FB9A>{seconds}</#00FB9A></bold> <#00FB9A>seconds, please stand still…</#00FB9A>'
|
||||
warmup-status: '<#00FB9A>Teleporting in</#00FB9A> <bold><#00FB9A>{seconds}</#00FB9A></bold><#00FB9A>…</#00FB9A>'
|
||||
warmup-processing: '<#00FB9A>Teleporting…</#00FB9A>'
|
||||
warmup-cancelled-move: '<#FF7E5E>Teleportation cancelled—you moved!</#FF7E5E>'
|
||||
warmup-cancelled-damage: '<#FF7E5E>Teleportation cancelled—you took damage!</#FF7E5E>'
|
||||
warmup-cancelled-actionbar: '<#FF7E5E>Teleportation cancelled!</#FF7E5E>'
|
||||
warmup-stand-still: '<#FF3300>Error:</#FF3300> <#FF7E5E>You must be standing still before starting a teleport!</#FF7E5E>'
|
||||
teleport-complete: '<#00FB9A>Teleportation complete!</#00FB9A>'
|
||||
teleport-failed: '<#FF3300>Error:</#FF3300> <#FF7E5E>Teleportation could not be completed. Please try again.</#FF7E5E>'
|
||||
ignore-enabled: '<#00FB9A>Now</#00FB9A> <bold><#00FB9A>ignoring</#00FB9A></bold> <#00FB9A>incoming teleport requests.</#00FB9A>'
|
||||
ignore-disabled: '<#00FB9A>Now</#00FB9A> <bold><#00FB9A>listening</#00FB9A></bold> <#00FB9A>to incoming teleport requests.</#00FB9A>'
|
||||
ignore-notification: '<gray>You are currently ignoring teleport requests.</gray>'
|
||||
tpaall-sent: '<#00FB9A>You sent a teleport request to every player asking them to teleport to you.</#00FB9A>'
|
||||
tpaall-no-targets: '<#FF3300>Error:</#FF3300> <#FF7E5E>There are no other players online.</#FF7E5E>'
|
||||
|
||||
skin-bridge:
|
||||
notifications:
|
||||
detecting: '<#00FB9A>Detecting your skin source…</#00FB9A>'
|
||||
synced: '<#00FB9A>Skin synchronized through <bold>{provider}</bold>.</#00FB9A>'
|
||||
not-external: '<gray>No external skin provider matched; your current skin was kept.</gray>'
|
||||
failed: '<#FF3300>Error:</#FF3300> <#FF7E5E>Skin detection or synchronization failed. Please try again later.</#FF7E5E>'
|
||||
messages:
|
||||
usage: '<#FF3300>Error:</#FF3300> <#FF7E5E>Usage: /essc skin [status|refresh] [player]</#FF7E5E>'
|
||||
feature-disabled: '<#FF3300>Error:</#FF3300> <#FF7E5E>SkinBridge is disabled in skin-bridge.yml.</#FF7E5E>'
|
||||
dependency-missing: '<#FF3300>Error:</#FF3300> <#FF7E5E>No valid MineSkin API key is configured in skin-bridge.yml.</#FF7E5E>'
|
||||
no-providers: '<#FF3300>Error:</#FF3300> <#FF7E5E>No valid SkinBridge provider is enabled.</#FF7E5E>'
|
||||
status-external: '<#00FB9A>{player} is identified as an external skin provider player.</#00FB9A> <gray>Provider: <white>{provider}</white></gray>'
|
||||
status-not-external: '<gray>{player} does not match any configured external skin provider.</gray>'
|
||||
status-pending: '<#FFC43B>SkinBridge is still detecting {player}''s login source.</#FFC43B>'
|
||||
status-unknown: '<gray>{player} has not been checked by SkinBridge yet.</gray>'
|
||||
refresh-queued: '<#00FB9A>SkinBridge is detecting and refreshing {player}''s skin.</#00FB9A>'
|
||||
refresh-cached: '<gray>{player} is using a valid skin cache entry.</gray>'
|
||||
refresh-running: '<#FFC43B>SkinBridge is already processing {player}.</#FFC43B>'
|
||||
|
||||
blocks-menu:
|
||||
title: "&6&lEssentialsC &8- &e&lShortcut Menu"
|
||||
title: '<#00FB9A><bold>Shortcut Menu</bold></#00FB9A>'
|
||||
items:
|
||||
workbench:
|
||||
name: "&eWorkbench"
|
||||
name: '<#00FB9A>Workbench</#00FB9A>'
|
||||
lore:
|
||||
- "&7/workbench"
|
||||
- "&7Open a crafting table"
|
||||
- '<gray>/workbench</gray>'
|
||||
- '<gray>Open a crafting table</gray>'
|
||||
enderchest:
|
||||
name: "&eEnder Chest"
|
||||
name: '<#00FB9A>Ender Chest</#00FB9A>'
|
||||
lore:
|
||||
- "&7/enderchest"
|
||||
- "&7Open your ender chest"
|
||||
- '<gray>/enderchest</gray>'
|
||||
- '<gray>Open your ender chest</gray>'
|
||||
anvil:
|
||||
name: "&eAnvil"
|
||||
name: '<#00FB9A>Anvil</#00FB9A>'
|
||||
lore:
|
||||
- "&7/anvil"
|
||||
- "&7Open an anvil"
|
||||
- '<gray>/anvil</gray>'
|
||||
- '<gray>Open an anvil</gray>'
|
||||
grindstone:
|
||||
name: "&eGrindstone"
|
||||
name: '<#00FB9A>Grindstone</#00FB9A>'
|
||||
lore:
|
||||
- "&7/grindstone"
|
||||
- "&7Open a grindstone"
|
||||
- '<gray>/grindstone</gray>'
|
||||
- '<gray>Open a grindstone</gray>'
|
||||
smithingtable:
|
||||
name: "&eSmithing Table"
|
||||
name: '<#00FB9A>Smithing Table</#00FB9A>'
|
||||
lore:
|
||||
- "&7/smithingtable"
|
||||
- "&7Open a smithing table"
|
||||
- '<gray>/smithingtable</gray>'
|
||||
- '<gray>Open a smithing table</gray>'
|
||||
stonecutter:
|
||||
name: "&eStonecutter"
|
||||
name: '<#00FB9A>Stonecutter</#00FB9A>'
|
||||
lore:
|
||||
- "&7/stonecutter"
|
||||
- "&7Open a stonecutter"
|
||||
- '<gray>/stonecutter</gray>'
|
||||
- '<gray>Open a stonecutter</gray>'
|
||||
loom:
|
||||
name: "&eLoom"
|
||||
name: '<#00FB9A>Loom</#00FB9A>'
|
||||
lore:
|
||||
- "&7/loom"
|
||||
- "&7Open a loom"
|
||||
- '<gray>/loom</gray>'
|
||||
- '<gray>Open a loom</gray>'
|
||||
cartographytable:
|
||||
name: "&eCartography Table"
|
||||
name: '<#00FB9A>Cartography Table</#00FB9A>'
|
||||
lore:
|
||||
- "&7/cartographytable"
|
||||
- "&7Open a cartography table"
|
||||
- '<gray>/cartographytable</gray>'
|
||||
- '<gray>Open a cartography table</gray>'
|
||||
nightvision:
|
||||
name: "&bNight Vision"
|
||||
name: '<#00FB9A>Night Vision</#00FB9A>'
|
||||
lore:
|
||||
- "&7/nightvision"
|
||||
- "&7Toggle night vision"
|
||||
- '<gray>/nightvision</gray>'
|
||||
- '<gray>Toggle night vision</gray>'
|
||||
glow:
|
||||
name: "&eGlow"
|
||||
name: '<#00FB9A>Glow</#00FB9A>'
|
||||
lore:
|
||||
- "&7/glow"
|
||||
- "&7Toggle your glowing effect"
|
||||
- '<gray>/glow</gray>'
|
||||
- '<gray>Toggle your glowing effect</gray>'
|
||||
|
||||
admin-mode:
|
||||
actionbar: "&c&lAdmin Mode"
|
||||
actionbar: '<#FF7E5E><bold>Admin Mode</bold></#FF7E5E>'
|
||||
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.</#00FB9A>'
|
||||
disabled: '<#FF7E5E>Admin mode disabled; normal inventory has been restored.</#FF7E5E>'
|
||||
crash-restored: '<#FFC43B>The previous admin mode session has been restored safely.</#FFC43B>'
|
||||
|
||||
tpsbar:
|
||||
title-format: "&eTPS&7: {tps_1m} &8| &eMSPT&7: {mspt} &8| &ePing&7: {ping}"
|
||||
title-format: '<#00FB9A>TPS</#00FB9A><gray>: {tps_1m} | </gray><#00FB9A>MSPT</#00FB9A><gray>: {mspt} | </gray><#00FB9A>Ping</#00FB9A><gray>: {ping}</gray>'
|
||||
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.</#00FB9A>'
|
||||
disabled-self: '<#FF7E5E>TPSBar disabled.</#FF7E5E>'
|
||||
enabled-other: '<#00FB9A>Enabled TPSBar for {player}.</#00FB9A>'
|
||||
disabled-other: '<#FF7E5E>Disabled TPSBar for {player}.</#FF7E5E>'
|
||||
usage: '<#FF3300>Error:</#FF3300> <#FF7E5E>Usage: /tpsbar [player]</#FF7E5E>'
|
||||
player-not-found: '<#FF3300>Error:</#FF3300> <#FF7E5E>Could not find the player {player}.</#FF7E5E>'
|
||||
no-targets: '<#FF3300>Error:</#FF3300> <#FF7E5E>No matching players were found to toggle.</#FF7E5E>'
|
||||
native-detected: '<gray>Detected a native /tpsbar command on this server; skipped plugin implementation.</gray>'
|
||||
plugin-enabled: '<gray>No native /tpsbar command was detected; plugin implementation enabled.</gray>'
|
||||
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.</#FFC43B>'
|
||||
mode-changed-reload: '<#FFC43B>TPSBar mode has been updated, but command registration changes require a server restart to fully take effect.</#FFC43B>'
|
||||
|
||||
mobdrops-menu:
|
||||
title: "&6&lMob Drop Control"
|
||||
title: '<#00FB9A><bold>Mob Drop Control</bold></#00FB9A>'
|
||||
status:
|
||||
enabled: "&aEnabled"
|
||||
disabled: "&cDisabled"
|
||||
enabled: '<#00FB9A>Enabled</#00FB9A>'
|
||||
disabled: '<#FF7E5E>Disabled</#FF7E5E>'
|
||||
enderman:
|
||||
name: "&dEnderman Drops"
|
||||
status: "&7Current status: {status}"
|
||||
toggle: "&eClick to toggle"
|
||||
name: '<#00FB9A>Enderman Drops</#00FB9A>'
|
||||
status: '<gray>Current status: {status}</gray>'
|
||||
toggle: '<gray>Click to toggle</gray>'
|
||||
|
||||
maintenance:
|
||||
status:
|
||||
enabled: "&cEnabled"
|
||||
disabled: "&aDisabled"
|
||||
enabled: '<#FF7E5E>Enabled</#FF7E5E>'
|
||||
disabled: '<#00FB9A>Disabled</#00FB9A>'
|
||||
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 <on|off|status|reload|add|remove|list>"
|
||||
add-usage: "&cUsage: /maintenance add <player|uuid>"
|
||||
remove-usage: "&cUsage: /maintenance remove <player|uuid>"
|
||||
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.</#00FB9A>'
|
||||
disabled: '<#FF7E5E>Maintenance mode disabled.</#FF7E5E>'
|
||||
reloaded: '<#00FB9A>Maintenance configuration reloaded.</#00FB9A>'
|
||||
status: '<gray>Maintenance mode status: {status} | Whitelist: <white>{whitelist_count}</white></gray>'
|
||||
usage: '<#FF3300>Error:</#FF3300> <#FF7E5E>Usage: /maintenance [on|off|status|reload|add|remove|list]</#FF7E5E>'
|
||||
add-usage: '<#FF3300>Error:</#FF3300> <#FF7E5E>Usage: /maintenance add [player|uuid]</#FF7E5E>'
|
||||
remove-usage: '<#FF3300>Error:</#FF3300> <#FF7E5E>Usage: /maintenance remove [player|uuid]</#FF7E5E>'
|
||||
whitelist-added: '<#00FB9A>Added {player} to the maintenance whitelist.</#00FB9A>'
|
||||
whitelist-removed: '<#00FB9A>Removed {player} from the maintenance whitelist.</#00FB9A>'
|
||||
whitelist-exists: '<#FFC43B>{player} is already on the maintenance whitelist.</#FFC43B>'
|
||||
whitelist-missing: '<#FF3300>Error:</#FF3300> <#FF7E5E>{player} is not on the maintenance whitelist.</#FF7E5E>'
|
||||
whitelist-empty: '<gray>The maintenance whitelist is empty.</gray>'
|
||||
whitelist-list: '<gray>Maintenance whitelist ({count}): <white>{entries}</white></gray>'
|
||||
login-blocked: '<#FFC43B>{player} was blocked by maintenance mode.</#FFC43B> <gray>UUID: {uuid} | IP: {address}</gray>'
|
||||
|
||||
+210
-188
@@ -1,239 +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>错误:</#FF3300> <#FF7E5E>你没有权限执行此命令.</#FF7E5E> <gray>需要权限: {permission}</gray>'
|
||||
player-only: '<#FF3300>错误:</#FF3300> <#FF7E5E>此命令只能由玩家执行.</#FF7E5E>'
|
||||
config-reloaded: '<#00FB9A>配置已重载.</#00FB9A>'
|
||||
version: '<#00FB9A>EssentialsC v{version}</#00FB9A>'
|
||||
paper-version: '<gray>当前运行于 Paper {version}</gray>'
|
||||
unknown-subcommand: '<#FF3300>错误:</#FF3300> <#FF7E5E>未知子命令: {command}</#FF7E5E>'
|
||||
help-usage: '<gray>使用 <white>/essc help</white> 查看可用命令.</gray>'
|
||||
module-disabled: '<#FF3300>错误:</#FF3300> <#FF7E5E>该功能模块当前已关闭.</#FF7E5E>'
|
||||
blocks-menu-empty: '<#FF3300>错误:</#FF3300> <#FF7E5E>你当前没有可用的便捷菜单项目.</#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>你已将 <bold>{item}</bold> 戴在头上.</#00FB9A>'
|
||||
hat-failed: '<#FF3300>错误:</#FF3300> <#FF7E5E>无法将该物品戴在头上.</#FF7E5E>'
|
||||
hat-no-item: '<#FF3300>错误:</#FF3300> <#FF7E5E>你需要手持一个物品.</#FF7E5E>'
|
||||
suicide-message: '<#FF7E5E>{player} 自杀了.</#FF7E5E>'
|
||||
fly-enabled: '<#00FB9A>飞行模式已开启.</#00FB9A>'
|
||||
fly-disabled: '<#FF7E5E>飞行模式已关闭.</#FF7E5E>'
|
||||
nightvision-enabled: '<#00FB9A>夜视已开启.</#00FB9A>'
|
||||
nightvision-disabled: '<#FF7E5E>夜视已关闭.</#FF7E5E>'
|
||||
nightvision-usage: '<#FF3300>错误:</#FF3300> <#FF7E5E>用法: /nightvision [on|off|toggle]</#FF7E5E>'
|
||||
glow-enabled: '<#00FB9A>发光已开启.</#00FB9A>'
|
||||
glow-disabled: '<#FF7E5E>发光已关闭.</#FF7E5E>'
|
||||
glow-usage: '<#FF3300>错误:</#FF3300> <#FF7E5E>用法: /glow [on|off|toggle]</#FF7E5E>'
|
||||
vanish-enabled: '<#00FB9A>你已进入隐身模式.</#00FB9A>'
|
||||
vanish-disabled: '<#FF7E5E>你已退出隐身模式.</#FF7E5E>'
|
||||
seen-usage: '<#FF3300>错误:</#FF3300> <#FF7E5E>用法: /seen [玩家]</#FF7E5E>'
|
||||
seen-usage-console: '<#FF3300>错误:</#FF3300> <#FF7E5E>用法: /seen [玩家]</#FF7E5E>'
|
||||
player-not-found: '<#FF3300>错误:</#FF3300> <#FF7E5E>没有找到玩家 {player}.</#FF7E5E>'
|
||||
no-permission-others: '<#FF3300>错误:</#FF3300> <#FF7E5E>你没有权限影响其他玩家.</#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>已打开铁砧.</#00FB9A>'
|
||||
enchantingtable-opened: '<#00FB9A>已打开附魔台.</#00FB9A>'
|
||||
heal-self: '<#00FB9A>你的生命值和饥饿值已恢复.</#00FB9A>'
|
||||
heal-other: '<#00FB9A>你已治疗玩家 <bold>{player}</bold>.</#00FB9A>'
|
||||
heal-by-other: '<#00FB9A>管理员 <bold>{admin}</bold> 治疗了你.</#00FB9A>'
|
||||
feed-self: '<#00FB9A>你的饥饿值已恢复.</#00FB9A>'
|
||||
feed-other: '<#00FB9A>你已喂饱玩家 <bold>{player}</bold>.</#00FB9A>'
|
||||
feed-by-other: '<#00FB9A>管理员 <bold>{admin}</bold> 喂饱了你.</#00FB9A>'
|
||||
repair-hand-success: '<#00FB9A>手中物品已修复.</#00FB9A>'
|
||||
repair-all-success: '<#00FB9A>已修复 <bold>{count}</bold> 个物品.</#00FB9A>'
|
||||
repair-not-damaged: '<#FF3300>错误:</#FF3300> <#FF7E5E>该物品没有损坏.</#FF7E5E>'
|
||||
repair-no-item-in-hand: '<#FF3300>错误:</#FF3300> <#FF7E5E>你手中没有物品.</#FF7E5E>'
|
||||
repair-no-items: '<#FF3300>错误:</#FF3300> <#FF7E5E>背包中没有可修复的物品.</#FF7E5E>'
|
||||
no-permission-repair-all: '<#FF3300>错误:</#FF3300> <#FF7E5E>你没有权限修复全部物品.</#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>错误:</#FF3300> <#FF7E5E>保存配置失败: {error}</#FF7E5E>'
|
||||
mobdrop-toggled: '<#00FB9A>末影人掉落已切换为 {status}.</#00FB9A>'
|
||||
shulkerbox-nested: '<#FF3300>错误:</#FF3300> <#FF7E5E>不能将潜影盒放入另一个潜影盒.</#FF7E5E>'
|
||||
shulkerbox-unstack-first: '<#FF3300>错误:</#FF3300> <#FF7E5E>请先将潜影盒拆分为单个后再快捷打开.</#FF7E5E>'
|
||||
jei-sync-fabric: '<#00FB9A>正在为 <bold>Fabric</bold> 客户端同步配方…</#00FB9A>'
|
||||
jei-sync-neoforge: '<#00FB9A>正在为 <bold>NeoForge</bold> 客户端同步配方…</#00FB9A>'
|
||||
|
||||
help:
|
||||
title: "&6========== &eEssentialsC 帮助 &6=========="
|
||||
version: "&7插件版本:&f{version}"
|
||||
section-blocks: "&6功能方块命令:"
|
||||
section-other: "&6其他命令:"
|
||||
footer: "&7每个命令都需要对应权限。"
|
||||
title: '<#00FB9A><bold>EssentialsC</bold></#00FB9A> <gray>命令帮助</gray>'
|
||||
version: '<gray>插件版本: <white>{version}</white></gray>'
|
||||
section-blocks: '<#00FB9A>功能方块命令</#00FB9A>'
|
||||
section-other: '<#00FB9A>其他命令</#00FB9A>'
|
||||
footer: '<gray>每个命令都需要对应权限.</gray>'
|
||||
|
||||
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- 切换是否忽略传送请求"
|
||||
admin: " &f/essc admin &7- 切换管理模式"
|
||||
tpsbar: " &f/tpsbar [玩家] &7- 切换 TPS 状态栏"
|
||||
maintenance: " &f/maintenance <on|off|status|reload|add|remove|list> &7- 管理维护模式"
|
||||
workbench: '<white>/workbench</white> <gray>- 打开工作台</gray>'
|
||||
anvil: '<white>/anvil</white> <gray>- 打开铁砧</gray>'
|
||||
enchantingtable: '<white>/enchantingtable</white> <gray>- 打开附魔台</gray>'
|
||||
cartographytable: '<white>/cartographytable</white> <gray>- 打开制图台</gray>'
|
||||
grindstone: '<white>/grindstone</white> <gray>- 打开砂轮</gray>'
|
||||
loom: '<white>/loom</white> <gray>- 打开织布机</gray>'
|
||||
smithingtable: '<white>/smithingtable</white> <gray>- 打开锻造台</gray>'
|
||||
stonecutter: '<white>/stonecutter</white> <gray>- 打开切石机</gray>'
|
||||
enderchest: '<white>/enderchest</white> <gray>- 打开末影箱</gray>'
|
||||
blocks: '<white>/blocks</white> <gray>- 打开便捷菜单</gray>'
|
||||
hat: '<white>/hat</white> <gray>- 将手持物品戴在头上</gray>'
|
||||
suicide: '<white>/suicide</white> <gray>- 自杀</gray>'
|
||||
fly: '<white>/fly</white> <gray>- 切换飞行模式</gray>'
|
||||
nightvision: '<white>/nightvision</white> <gray>- 切换夜视</gray>'
|
||||
glow: '<white>/glow</white> <gray>- 切换发光</gray>'
|
||||
heal: '<white>/heal</white> <gray>- 恢复生命值和饥饿值</gray>'
|
||||
vanish: '<white>/vanish</white> <gray>- 切换隐身模式</gray>'
|
||||
seen: '<white>/seen</white> <gray>- 查看玩家信息</gray>'
|
||||
feed: '<white>/feed</white> <gray>- 恢复饥饿值</gray>'
|
||||
repair: '<white>/repair</white> <gray>- 修复手中或全部物品</gray>'
|
||||
tpa: '<white>/tpa [玩家]</white> <gray>- 请求传送到玩家身边</gray>'
|
||||
tpahere: '<white>/tpahere [玩家]</white> <gray>- 请求玩家传送到你身边</gray>'
|
||||
tpaall: '<white>/tpaall</white> <gray>- 向所有玩家发送传送到你身边的请求</gray>'
|
||||
tpaccept: '<white>/tpaccept [玩家]</white> <gray>- 接受传送请求</gray>'
|
||||
tpdeny: '<white>/tpdeny [玩家]</white> <gray>- 拒绝传送请求</gray>'
|
||||
tpignore: '<white>/tpignore</white> <gray>- 切换是否忽略传送请求</gray>'
|
||||
skin: '<white>/essc skin [status|refresh] [玩家]</white> <gray>- 查看或刷新皮肤桥接状态</gray>'
|
||||
admin: '<white>/essc admin</white> <gray>- 切换管理模式</gray>'
|
||||
tpsbar: '<white>/tpsbar [玩家]</white> <gray>- 切换 TPS 状态栏</gray>'
|
||||
maintenance: '<white>/maintenance [on|off|status|reload|add|remove|list]</white> <gray>- 管理维护模式</gray>'
|
||||
|
||||
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>错误:</#FF3300> <#FF7E5E>用法: /tpa [玩家]</#FF7E5E>'
|
||||
usage-tpahere: '<#FF3300>错误:</#FF3300> <#FF7E5E>用法: /tpahere [玩家]</#FF7E5E>'
|
||||
usage-tpaall: '<#FF3300>错误:</#FF3300> <#FF7E5E>用法: /tpaall</#FF7E5E>'
|
||||
usage-tpaccept: '<#FF3300>错误:</#FF3300> <#FF7E5E>用法: /tpaccept [玩家]</#FF7E5E>'
|
||||
usage-tpdeny: '<#FF3300>错误:</#FF3300> <#FF7E5E>用法: /tpdeny [玩家]</#FF7E5E>'
|
||||
self: '<#FF3300>错误:</#FF3300> <#FF7E5E>不能向自己发送传送请求</#FF7E5E>'
|
||||
sent-tpa: '<#00FB9A>已发送传送请求,请求传送到</#00FB9A> <bold><#00FB9A>{target}</#00FB9A></bold>'
|
||||
sent-tpahere: '<#00FB9A>已发送传送请求,请求</#00FB9A> <bold><#00FB9A>{target}</#00FB9A></bold> <#00FB9A>传送到你的位置</#00FB9A>'
|
||||
ignoring-requests: '<#FF3300>错误:</#FF3300> <#FF7E5E>你已忽略传送请求</#FF7E5E> <#FF7E5E><click:run_command:/tpignore><hover:show_text:"<#FF7E5E>点击恢复接收传送请求</#FF7E5E>">[恢复接收]</hover></click></#FF7E5E>'
|
||||
send-cooldown: '<#FF3300>错误:</#FF3300> <#FF7E5E>你需要等待 {seconds}s 才能再次进行此操作</#FF7E5E>'
|
||||
accept-cooldown: '<#FF3300>错误:</#FF3300> <#FF7E5E>你需要等待 {seconds}s 才能再次进行此操作</#FF7E5E>'
|
||||
received-tpa: '<bold><#00FB9A>{requester}</#00FB9A></bold> <#00FB9A>请求传送到你的位置</#00FB9A>'
|
||||
received-tpahere: '<bold><#00FB9A>{requester}</#00FB9A></bold> <#00FB9A>请求你传送到他的位置</#00FB9A>'
|
||||
response-buttons: '<gray>选项:</gray> <#00FB9A><click:run_command:''/tpaccept {requester}''><hover:show_text:''<#00FB9A>接受传送请求\n<dark_gray>点击接受 {requester} 的请求</dark_gray></#00FB9A>''>[✔ 接受]</hover></click></#00FB9A> <#FF3300><click:run_command:''/tpdeny {requester}''><hover:show_text:''<#FF3300>拒绝传送请求\n<dark_gray>点击拒绝 {requester} 的请求</dark_gray></#FF3300>''>[❌ 拒绝]</hover></click></#FF3300>'
|
||||
no-request: '<#FF3300>错误:</#FF3300> <#FF7E5E>你没有待处理的传送请求</#FF7E5E>'
|
||||
invalid-request: '<#FF3300>错误:</#FF3300> <#FF7E5E>目前没有来自 {requester} 的传送请求</#FF7E5E>'
|
||||
accepted-target: '<#00FB9A>已接受 {requester} 的传送请求</#00FB9A>'
|
||||
accepted-sender: '<#00FB9A>{target} 接受了你的传送请求</#00FB9A>'
|
||||
denied-target: '<#FF7E5E>已拒绝 {requester} 的传送请求</#FF7E5E>'
|
||||
denied-sender: '<#FF7E5E>{target} 拒绝了你的传送请求</#FF7E5E>'
|
||||
expired: '<#FF3300>错误:</#FF3300> <#FF7E5E>传送请求已过期</#FF7E5E>'
|
||||
player-offline: '<#FF3300>错误:</#FF3300> <#FF7E5E>你待处理的传送请求目标玩家不在线</#FF7E5E>'
|
||||
target-offline: '<#FF3300>错误:</#FF3300> <#FF7E5E>没有找到目标玩家</#FF7E5E>'
|
||||
already-warming-up: '<#FF3300>错误:</#FF3300> <#FF7E5E>相关玩家已有一个正在预热的传送</#FF7E5E>'
|
||||
warmup-start: '<#00FB9A>你将在</#00FB9A> <bold><#00FB9A>{seconds}</#00FB9A></bold> <#00FB9A>秒后被传送,请不要移动…</#00FB9A>'
|
||||
warmup-status: '<#00FB9A>将在</#00FB9A> <bold><#00FB9A>{seconds}</#00FB9A></bold><#00FB9A>秒后传送…</#00FB9A>'
|
||||
warmup-processing: '<#00FB9A>传送中…</#00FB9A>'
|
||||
warmup-cancelled-move: '<#FF7E5E>传送取消: 你移动了!</#FF7E5E>'
|
||||
warmup-cancelled-damage: '<#FF7E5E>传送取消: 你受到了伤害!</#FF7E5E>'
|
||||
warmup-cancelled-actionbar: '<#FF7E5E>传送取消!</#FF7E5E>'
|
||||
warmup-stand-still: '<#FF3300>错误:</#FF3300> <#FF7E5E>在传送时你不能移动!</#FF7E5E>'
|
||||
teleport-complete: '<#00FB9A>传送完成!</#00FB9A>'
|
||||
teleport-failed: '<#FF3300>错误:</#FF3300> <#FF7E5E>无法完成传送,请稍后重试</#FF7E5E>'
|
||||
ignore-enabled: '<#00FB9A>你已</#00FB9A> <bold><#00FB9A>忽略</#00FB9A></bold> <#00FB9A>传送请求</#00FB9A>'
|
||||
ignore-disabled: '<#00FB9A>你已</#00FB9A> <bold><#00FB9A>恢复接收</#00FB9A></bold> <#00FB9A>传送请求</#00FB9A>'
|
||||
ignore-notification: '<gray>你当前正在忽略传送请求.</gray>'
|
||||
tpaall-sent: '<#00FB9A>你已向所有玩家发送传送请求,请求他们传送到你的位置</#00FB9A>'
|
||||
tpaall-no-targets: '<#FF3300>错误:</#FF3300> <#FF7E5E>当前没有其他在线玩家.</#FF7E5E>'
|
||||
|
||||
skin-bridge:
|
||||
notifications:
|
||||
detecting: '<#00FB9A>正在检测你的皮肤来源…</#00FB9A>'
|
||||
synced: '<#00FB9A>已通过 <bold>{provider}</bold> 同步皮肤.</#00FB9A>'
|
||||
not-external: '<gray>未匹配外置皮肤站,已保留当前皮肤.</gray>'
|
||||
failed: '<#FF3300>错误:</#FF3300> <#FF7E5E>皮肤检测或同步失败,请稍后重试.</#FF7E5E>'
|
||||
messages:
|
||||
usage: '<#FF3300>错误:</#FF3300> <#FF7E5E>用法: /essc skin [status|refresh] [玩家]</#FF7E5E>'
|
||||
feature-disabled: '<#FF3300>错误:</#FF3300> <#FF7E5E>SkinBridge 在 skin-bridge.yml 中未启用.</#FF7E5E>'
|
||||
dependency-missing: '<#FF3300>错误:</#FF3300> <#FF7E5E>未在 skin-bridge.yml 中配置有效的 MineSkin API Key.</#FF7E5E>'
|
||||
no-providers: '<#FF3300>错误:</#FF3300> <#FF7E5E>没有启用有效的 SkinBridge Provider.</#FF7E5E>'
|
||||
status-external: '<#00FB9A>{player} 已识别为外置皮肤站玩家.</#00FB9A> <gray>Provider: <white>{provider}</white></gray>'
|
||||
status-not-external: '<gray>{player} 未匹配任何已配置的外置皮肤站.</gray>'
|
||||
status-pending: '<#FFC43B>{player} 的皮肤站来源正在检测中.</#FFC43B>'
|
||||
status-unknown: '<gray>{player} 尚未进行 SkinBridge 检测.</gray>'
|
||||
refresh-queued: '<#00FB9A>已开始重新检测并刷新 {player} 的皮肤.</#00FB9A>'
|
||||
refresh-cached: '<gray>{player} 正在使用有效的皮肤缓存.</gray>'
|
||||
refresh-running: '<#FFC43B>{player} 的皮肤检测任务仍在运行.</#FFC43B>'
|
||||
|
||||
blocks-menu:
|
||||
title: "&6&lEssentialsC &8- &e&l便捷菜单"
|
||||
title: '<#00FB9A><bold>便捷菜单</bold></#00FB9A>'
|
||||
items:
|
||||
workbench:
|
||||
name: "&e工作台"
|
||||
name: '<#00FB9A>工作台</#00FB9A>'
|
||||
lore:
|
||||
- "&7/workbench"
|
||||
- "&7打开工作台"
|
||||
- '<gray>/workbench</gray>'
|
||||
- '<gray>打开工作台</gray>'
|
||||
enderchest:
|
||||
name: "&e末影箱"
|
||||
name: '<#00FB9A>末影箱</#00FB9A>'
|
||||
lore:
|
||||
- "&7/enderchest"
|
||||
- "&7打开末影箱"
|
||||
- '<gray>/enderchest</gray>'
|
||||
- '<gray>打开末影箱</gray>'
|
||||
anvil:
|
||||
name: "&e铁砧"
|
||||
name: '<#00FB9A>铁砧</#00FB9A>'
|
||||
lore:
|
||||
- "&7/anvil"
|
||||
- "&7打开铁砧"
|
||||
- '<gray>/anvil</gray>'
|
||||
- '<gray>打开铁砧</gray>'
|
||||
grindstone:
|
||||
name: "&e砂轮"
|
||||
name: '<#00FB9A>砂轮</#00FB9A>'
|
||||
lore:
|
||||
- "&7/grindstone"
|
||||
- "&7打开砂轮"
|
||||
- '<gray>/grindstone</gray>'
|
||||
- '<gray>打开砂轮</gray>'
|
||||
smithingtable:
|
||||
name: "&e锻造台"
|
||||
name: '<#00FB9A>锻造台</#00FB9A>'
|
||||
lore:
|
||||
- "&7/smithingtable"
|
||||
- "&7打开锻造台"
|
||||
- '<gray>/smithingtable</gray>'
|
||||
- '<gray>打开锻造台</gray>'
|
||||
stonecutter:
|
||||
name: "&e切石机"
|
||||
name: '<#00FB9A>切石机</#00FB9A>'
|
||||
lore:
|
||||
- "&7/stonecutter"
|
||||
- "&7打开切石机"
|
||||
- '<gray>/stonecutter</gray>'
|
||||
- '<gray>打开切石机</gray>'
|
||||
loom:
|
||||
name: "&e织布机"
|
||||
name: '<#00FB9A>织布机</#00FB9A>'
|
||||
lore:
|
||||
- "&7/loom"
|
||||
- "&7打开织布机"
|
||||
- '<gray>/loom</gray>'
|
||||
- '<gray>打开织布机</gray>'
|
||||
cartographytable:
|
||||
name: "&e制图台"
|
||||
name: '<#00FB9A>制图台</#00FB9A>'
|
||||
lore:
|
||||
- "&7/cartographytable"
|
||||
- "&7打开制图台"
|
||||
- '<gray>/cartographytable</gray>'
|
||||
- '<gray>打开制图台</gray>'
|
||||
nightvision:
|
||||
name: "&b夜视开关"
|
||||
name: '<#00FB9A>夜视开关</#00FB9A>'
|
||||
lore:
|
||||
- "&7/nightvision"
|
||||
- "&7切换夜视效果"
|
||||
- '<gray>/nightvision</gray>'
|
||||
- '<gray>切换夜视效果</gray>'
|
||||
glow:
|
||||
name: "&e发光开关"
|
||||
name: '<#00FB9A>发光开关</#00FB9A>'
|
||||
lore:
|
||||
- "&7/glow"
|
||||
- "&7切换自身发光效果"
|
||||
- '<gray>/glow</gray>'
|
||||
- '<gray>切换自身发光效果</gray>'
|
||||
|
||||
admin-mode:
|
||||
actionbar: "&c&l管理模式"
|
||||
actionbar: '<#FF7E5E><bold>管理模式</bold></#FF7E5E>'
|
||||
messages:
|
||||
enabled: "&a管理模式已开启,普通背包已保存。"
|
||||
disabled: "&c管理模式已关闭,普通背包已恢复。"
|
||||
crash-restored: "&e上一次管理模式会话已安全恢复。"
|
||||
enabled: '<#00FB9A>管理模式已开启,普通背包已保存.</#00FB9A>'
|
||||
disabled: '<#FF7E5E>管理模式已关闭,普通背包已恢复.</#FF7E5E>'
|
||||
crash-restored: '<#FFC43B>上一次管理模式会话已安全恢复.</#FFC43B>'
|
||||
|
||||
tpsbar:
|
||||
title-format: "&eTPS&7: {tps_1m} &8| &eMSPT&7: {mspt} &8| &ePing&7: {ping}"
|
||||
title-format: '<#00FB9A>TPS</#00FB9A><gray>: {tps_1m} | </gray><#00FB9A>MSPT</#00FB9A><gray>: {mspt} | </gray><#00FB9A>Ping</#00FB9A><gray>: {ping}</gray>'
|
||||
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.</#00FB9A>'
|
||||
disabled-self: '<#FF7E5E>已关闭 TPSBar.</#FF7E5E>'
|
||||
enabled-other: '<#00FB9A>已为 {player} 开启 TPSBar.</#00FB9A>'
|
||||
disabled-other: '<#FF7E5E>已为 {player} 关闭 TPSBar.</#FF7E5E>'
|
||||
usage: '<#FF3300>错误:</#FF3300> <#FF7E5E>用法: /tpsbar [玩家]</#FF7E5E>'
|
||||
player-not-found: '<#FF3300>错误:</#FF3300> <#FF7E5E>没有找到玩家 {player}.</#FF7E5E>'
|
||||
no-targets: '<#FF3300>错误:</#FF3300> <#FF7E5E>没有匹配到可切换的玩家.</#FF7E5E>'
|
||||
native-detected: '<gray>检测到服务端已内置 /tpsbar,已跳过插件实现.</gray>'
|
||||
plugin-enabled: '<gray>未检测到服务端内置 /tpsbar,已启用插件实现.</gray>'
|
||||
plugin-forced-but-native-exists: '<#FFC43B>配置要求启用插件版 TPSBar,但服务端已存在原生 /tpsbar,已跳过插件实现以避免冲突.</#FFC43B>'
|
||||
mode-changed-reload: '<#FFC43B>TPSBar 模式已更新,但命令注册状态需要重启服务器后才会完全生效.</#FFC43B>'
|
||||
|
||||
mobdrops-menu:
|
||||
title: "&6&l生物掉落控制"
|
||||
title: '<#00FB9A><bold>生物掉落控制</bold></#00FB9A>'
|
||||
status:
|
||||
enabled: "&a开启"
|
||||
disabled: "&c关闭"
|
||||
enabled: '<#00FB9A>开启</#00FB9A>'
|
||||
disabled: '<#FF7E5E>关闭</#FF7E5E>'
|
||||
enderman:
|
||||
name: "&d末影人掉落"
|
||||
status: "&7当前状态:{status}"
|
||||
toggle: "&e点击切换"
|
||||
name: '<#00FB9A>末影人掉落</#00FB9A>'
|
||||
status: '<gray>当前状态: {status}</gray>'
|
||||
toggle: '<gray>点击切换</gray>'
|
||||
|
||||
maintenance:
|
||||
status:
|
||||
enabled: "&c开启"
|
||||
disabled: "&a关闭"
|
||||
enabled: '<#FF7E5E>开启</#FF7E5E>'
|
||||
disabled: '<#00FB9A>关闭</#00FB9A>'
|
||||
messages:
|
||||
enabled: "&a维护模式已开启。"
|
||||
disabled: "&c维护模式已关闭。"
|
||||
reloaded: "&a维护模式配置已重载。"
|
||||
status: "&7维护模式当前状态:{status} &8| &7白名单:&f{whitelist_count}"
|
||||
usage: "&c用法:/maintenance <on|off|status|reload|add|remove|list>"
|
||||
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>维护模式已开启.</#00FB9A>'
|
||||
disabled: '<#FF7E5E>维护模式已关闭.</#FF7E5E>'
|
||||
reloaded: '<#00FB9A>维护模式配置已重载.</#00FB9A>'
|
||||
status: '<gray>维护模式当前状态: {status} | 白名单: <white>{whitelist_count}</white></gray>'
|
||||
usage: '<#FF3300>错误:</#FF3300> <#FF7E5E>用法: /maintenance [on|off|status|reload|add|remove|list]</#FF7E5E>'
|
||||
add-usage: '<#FF3300>错误:</#FF3300> <#FF7E5E>用法: /maintenance add [玩家|UUID]</#FF7E5E>'
|
||||
remove-usage: '<#FF3300>错误:</#FF3300> <#FF7E5E>用法: /maintenance remove [玩家|UUID]</#FF7E5E>'
|
||||
whitelist-added: '<#00FB9A>已将 {player} 加入维护白名单.</#00FB9A>'
|
||||
whitelist-removed: '<#00FB9A>已将 {player} 移出维护白名单.</#00FB9A>'
|
||||
whitelist-exists: '<#FFC43B>{player} 已在维护白名单中.</#FFC43B>'
|
||||
whitelist-missing: '<#FF3300>错误:</#FF3300> <#FF7E5E>{player} 不在维护白名单中.</#FF7E5E>'
|
||||
whitelist-empty: '<gray>维护白名单为空.</gray>'
|
||||
whitelist-list: '<gray>维护白名单 ({count}): <white>{entries}</white></gray>'
|
||||
login-blocked: '<#FFC43B>{player} 被维护模式拦截.</#FFC43B> <gray>UUID: {uuid} | IP: {address}</gray>'
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# EssentialsC 模块配置
|
||||
#
|
||||
# modules.yml 用于控制功能模块是否在运行时加载。
|
||||
# config.yml 仍然用于控制已启用模块内部的具体行为。
|
||||
# 各功能的详细设置位于 config.yml 及对应的独立功能配置文件。
|
||||
#
|
||||
# 修改模块开关后可使用 /essc reload 刷新运行期服务和监听器。
|
||||
# 直连命令的完整热增删仍建议通过重启服务器完成。
|
||||
@@ -30,3 +30,6 @@ modules:
|
||||
maintenance:
|
||||
# 维护模式。开启维护后可替换 MOTD,并阻止无绕过权限的玩家进入。
|
||||
enabled: true
|
||||
skin-bridge:
|
||||
# 查询外置 Yggdrasil profile,并通过 MineSkin 与 Paper Profile API 同步皮肤。
|
||||
enabled: false
|
||||
|
||||
@@ -119,6 +119,9 @@ permissions:
|
||||
essentialsc.command.maintenance:
|
||||
description: 允许管理维护模式
|
||||
default: op
|
||||
essentialsc.command.skin:
|
||||
description: 允许管理 SkinBridge 状态与刷新
|
||||
default: op
|
||||
essentialsc.maintenance.bypass:
|
||||
description: 允许在维护模式下进入服务器
|
||||
default: op
|
||||
@@ -171,6 +174,7 @@ permissions:
|
||||
essentialsc.command.tpsbar: true
|
||||
essentialsc.command.tpsbar.others: true
|
||||
essentialsc.command.maintenance: true
|
||||
essentialsc.command.skin: true
|
||||
essentialsc.maintenance.bypass: true
|
||||
essentialsc.maintenance.notify: true
|
||||
essentialsc.shulkerbox.open: true
|
||||
|
||||
@@ -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"
|
||||
Reference in New Issue
Block a user