9
0
mirror of https://github.com/Xiao-MoMi/craft-engine.git synced 2025-12-19 15:09:15 +00:00

Merge pull request #394 from jhqwqmc/dev

改进s3实现
This commit is contained in:
XiaoMoMi
2025-10-02 22:54:00 +08:00
committed by GitHub
9 changed files with 28 additions and 6 deletions

View File

@@ -49,7 +49,7 @@ public abstract class BukkitItemFactory<W extends ItemWrapper<ItemStack>> extend
case "1.21.4" -> {
return new ComponentItemFactory1_21_4(plugin);
}
case "1.21.5", "1.21.6", "1.21.7", "1.21.8", "1.21.9" -> {
case "1.21.5", "1.21.6", "1.21.7", "1.21.8", "1.21.9", "1.21.10" -> {
return new ComponentItemFactory1_21_5(plugin);
}
default -> throw new IllegalStateException("Unsupported server version: " + plugin.serverVersion());

View File

@@ -6,6 +6,8 @@ import net.momirealms.craftengine.bukkit.plugin.command.feature.*;
import net.momirealms.craftengine.core.plugin.command.AbstractCommandManager;
import net.momirealms.craftengine.core.plugin.command.CommandFeature;
import net.momirealms.craftengine.core.plugin.command.sender.Sender;
import net.momirealms.craftengine.core.util.ReflectionUtils;
import net.momirealms.craftengine.core.util.VersionHelper;
import org.bukkit.command.CommandSender;
import org.incendo.cloud.SenderMapper;
import org.incendo.cloud.bukkit.CloudBukkitCapabilities;
@@ -24,7 +26,11 @@ public class BukkitCommandManager extends AbstractCommandManager<CommandSender>
plugin.javaPlugin(),
ExecutionCoordinator.simpleCoordinator(),
SenderMapper.identity()
));
) {{ // TODO等 cloud 修复后移除,绕过 obc.command.BukkitCommandWrapper 类检查,因为这个类在 1.21.9 版本被移除了,并且项目貌似没用到这个
if (VersionHelper.isOrAbove1_21_9() && ReflectionUtils.classExists("com.mojang.brigadier.tree.CommandNode")) {
registerCapability(CloudBukkitCapabilities.BRIGADIER);
}
}});
this.plugin = plugin;
this.index = Index.create(CommandFeature::getFeatureID, List.of(
new ReloadCommand(this, plugin),
@@ -61,7 +67,7 @@ public class BukkitCommandManager extends AbstractCommandManager<CommandSender>
));
final LegacyPaperCommandManager<CommandSender> manager = (LegacyPaperCommandManager<CommandSender>) getCommandManager();
manager.settings().set(ManagerSetting.ALLOW_UNSAFE_REGISTRATION, true);
if (manager.hasCapability(CloudBukkitCapabilities.NATIVE_BRIGADIER) && manager.hasCapability(CloudBukkitCapabilities.BRIGADIER)) {
if (manager.hasCapability(CloudBukkitCapabilities.NATIVE_BRIGADIER)) {
manager.registerBrigadier();
manager.brigadierManager().setNativeNumberSuggestions(true);
} else if (manager.hasCapability(CloudBukkitCapabilities.ASYNCHRONOUS_COMPLETION)) {

View File

@@ -386,10 +386,14 @@ warning.config.host.onedrive.missing_client_secret: "<yellow>Issue found in conf
warning.config.host.onedrive.missing_refresh_token: "<yellow>Issue found in config.yml at 'resource-pack.delivery.hosting' - Missing required 'refresh-token' argument or environment variable 'CE_ONEDRIVE_REFRESH_TOKEN' for onedrive host.</yellow>"
warning.config.host.onedrive.missing_upload_path: "<yellow>Issue found in config.yml at 'resource-pack.delivery.hosting' - Missing required 'upload-path' argument for onedrive host.</yellow>"
warning.config.host.s3.missing_endpoint: "<yellow>Issue found in config.yml at 'resource-pack.delivery.hosting' - Missing required 'endpoint' argument for s3 host.</yellow>"
warning.config.host.s3.missing_protocol: "<yellow>Issue found in config.yml at 'resource-pack.delivery.hosting' - Missing required 'protocol' argument for s3 host.</yellow>"
warning.config.host.s3.missing_bucket: "<yellow>Issue found in config.yml at 'resource-pack.delivery.hosting' - Missing required 'bucket' argument for s3 host.</yellow>"
warning.config.host.s3.missing_region: "<yellow>Issue found in config.yml at 'resource-pack.delivery.hosting' - Missing required 'region' argument for s3 host.</yellow>"
warning.config.host.s3.missing_access_key: "<yellow>Issue found in config.yml at 'resource-pack.delivery.hosting' - Missing required 'access-key-id' argument or environment variable 'CE_S3_ACCESS_KEY_ID' for s3 host.</yellow>"
warning.config.host.s3.missing_secret: "<yellow>Issue found in config.yml at 'resource-pack.delivery.hosting' - Missing required 'access-key-secret' argument or environment variable 'CE_S3_ACCESS_KEY_SECRET' for s3 host.</yellow>"
warning.config.host.s3.missing_upload_path: "<yellow>Issue found in config.yml at 'resource-pack.delivery.hosting' - Missing required 'upload-path' argument for s3 host.</yellow>"
warning.config.host.s3.missing_cdn_domain: "<yellow>Issue found in config.yml at 'resource-pack.delivery.hosting' - Missing required 'cdn.domain' argument for s3 host.</yellow>"
warning.config.host.s3.missing_cdn_protocol: "<yellow>Issue found in config.yml at 'resource-pack.delivery.hosting' - Missing required 'cdn.protocol' argument for s3 host.</yellow>"
warning.config.host.self.missing_ip: "<yellow>Issue found in config.yml at 'resource-pack.delivery.hosting' - Missing required 'ip' argument for self host.</yellow>"
warning.config.host.self.invalid_port: "<yellow>Issue found in config.yml at 'resource-pack.delivery.hosting' - Invalid port '<arg:0>' for self host.</yellow>"
warning.config.host.self.invalid_url: "<yellow>Issue found in config.yml at 'resource-pack.delivery.hosting' - Invalid url '<arg:0>' for self host.</yellow>"

View File

@@ -372,10 +372,14 @@ warning.config.host.onedrive.missing_client_secret: "<yellow>在 config.yml 的
warning.config.host.onedrive.missing_refresh_token: "<yellow>在 config.yml 的 'resource-pack.delivery.hosting' 处发现问题 - OneDrive 托管缺少必需的 'refresh-token' 参数或环境变量 'CE_ONEDRIVE_REFRESH_TOKEN'</yellow>"
warning.config.host.onedrive.missing_upload_path: "<yellow>在 config.yml 的 'resource-pack.delivery.hosting' 处发现问题 - OneDrive 托管缺少必需的 'upload-path' 参数</yellow>"
warning.config.host.s3.missing_endpoint: "<yellow>在 config.yml 的 'resource-pack.delivery.hosting' 处发现问题 - S3 托管缺少必需的 'endpoint' 参数</yellow>"
warning.config.host.s3.missing_protocol: "<yellow>在 config.yml 的 'resource-pack.delivery.hosting' 处发现问题 - S3 托管缺少必需的 'protocol' 参数</yellow>"
warning.config.host.s3.missing_bucket: "<yellow>在 config.yml 的 'resource-pack.delivery.hosting' 处发现问题 - S3 托管缺少必需的 'bucket' 参数</yellow>"
warning.config.host.s3.missing_region: "<yellow>在 config.yml 的 'resource-pack.delivery.hosting' 处发现问题 - S3 托管缺少必需的 'region' 参数</yellow>"
warning.config.host.s3.missing_access_key: "<yellow>在 config.yml 的 'resource-pack.delivery.hosting' 处发现问题 - S3 托管缺少必需的 'access-key-id' 参数或环境变量 'CE_S3_ACCESS_KEY_ID'</yellow>"
warning.config.host.s3.missing_secret: "<yellow>在 config.yml 的 'resource-pack.delivery.hosting' 处发现问题 - S3 托管缺少必需的 'access-key-secret' 参数或环境变量 'CE_S3_ACCESS_KEY_SECRET'</yellow>"
warning.config.host.s3.missing_upload_path: "<yellow>在 config.yml 的 'resource-pack.delivery.hosting' 处发现问题 - S3 托管缺少必需的 'upload-path' 参数</yellow>"
warning.config.host.s3.missing_cdn_domain: "<yellow>在 config.yml 的 'resource-pack.delivery.hosting' 处发现问题 - S3 托管缺少必需的 'cdn.domain' 参数</yellow>"
warning.config.host.s3.missing_cdn_protocol: "<yellow>在 config.yml 的 'resource-pack.delivery.hosting' 处发现问题 - S3 托管缺少必需的 'cdn.protocol' 参数</yellow>"
warning.config.host.self.missing_ip: "<yellow>在 config.yml 的 'resource-pack.delivery.hosting' 处发现问题 - 自托管托管缺少必需的 'ip' 参数</yellow>"
warning.config.host.self.invalid_port: "<yellow>在 config.yml 的 'resource-pack.delivery.hosting' 处发现问题 - 自托管托管的端口 '<arg:0>' 无效</yellow>"
warning.config.host.self.invalid_url: "<yellow>在 config.yml 的 'resource-pack.delivery.hosting' 处发现问题 - 自托管托管的 URL '<arg:0>' 无效</yellow>"

View File

@@ -21,7 +21,7 @@ dependencies {
implementation("net.momirealms:sparrow-nbt-codec:${rootProject.properties["sparrow_nbt_version"]}")
implementation("net.momirealms:sparrow-nbt-legacy-codec:${rootProject.properties["sparrow_nbt_version"]}")
// S3
implementation("net.momirealms:craft-engine-s3:0.5")
implementation("net.momirealms:craft-engine-s3:0.6")
// Util
compileOnly("net.momirealms:sparrow-util:${rootProject.properties["sparrow_util_version"]}")
// Adventure

View File

@@ -23,6 +23,7 @@ public final class MinecraftVersion implements Comparable<MinecraftVersion> {
PACK_FORMATS.put(1_21_07, 64);
PACK_FORMATS.put(1_21_08, 64);
PACK_FORMATS.put(1_21_09, 69);
PACK_FORMATS.put(1_21_10, 69);
PACK_FORMATS.put(1_99_99, 1000);
}

View File

@@ -20,5 +20,6 @@ public final class MinecraftVersions {
public static final MinecraftVersion V1_21_7 = new MinecraftVersion("1.21.7");
public static final MinecraftVersion V1_21_8 = new MinecraftVersion("1.21.8");
public static final MinecraftVersion V1_21_9 = new MinecraftVersion("1.21.9");
public static final MinecraftVersion V1_21_10 = new MinecraftVersion("1.21.10");
public static final MinecraftVersion FUTURE = new MinecraftVersion("1.99.99");
}

View File

@@ -34,6 +34,7 @@ public class VersionHelper {
private static final boolean v1_21_7;
private static final boolean v1_21_8;
private static final boolean v1_21_9;
private static final boolean v1_21_10;
static {
try (InputStream inputStream = Class.forName("net.minecraft.obfuscate.DontObfuscate").getResourceAsStream("/version.json")) {
@@ -70,6 +71,7 @@ public class VersionHelper {
v1_21_7 = version >= 12107;
v1_21_8 = version >= 12108;
v1_21_9 = version >= 12109;
v1_21_10 = version >= 12110;
majorVersion = major;
minorVersion = minor;
@@ -245,4 +247,8 @@ public class VersionHelper {
public static boolean isOrAbove1_21_9() {
return v1_21_9;
}
public static boolean isOrAbove1_21_10() {
return v1_21_10;
}
}

View File

@@ -6,13 +6,13 @@ project_version=0.0.63.9
config_version=47
lang_version=32
project_group=net.momirealms
latest_supported_version=1.21.8
latest_supported_version=1.21.10
# Supported languages
supported_languages=en,zh_cn,zh_tw,es,tr,de,ru_ru
# Dependency settings
paper_version=1.21.8
paper_version=1.21.9
jetbrains_annotations_version=26.0.2
slf4j_version=2.0.17
log4j_version=2.25.2