9
0
mirror of https://github.com/Xiao-MoMi/craft-engine.git synced 2026-01-03 22:26:16 +00:00

提取上传方法

This commit is contained in:
XiaoMoMi
2025-04-18 20:09:22 +08:00
parent efcb9e6418
commit fd9a24a718
3 changed files with 8 additions and 2 deletions

View File

@@ -121,6 +121,11 @@ public class BukkitPackManager extends AbstractPackManager implements Listener {
@EventHandler(priority = EventPriority.MONITOR)
public void onAsyncResourcePackGenerate(AsyncResourcePackGenerateEvent event) {
if (!Config.autoUpload()) return;
}
@Override
public void uploadResourcePack() {
resourcePackHost().upload(Config.fileToUpload()).whenComplete((d, e) -> {
if (e != null) {
CraftEngine.instance().logger().warn("Failed to upload resource pack", e);

View File

@@ -5,7 +5,6 @@ import net.momirealms.craftengine.bukkit.plugin.command.BukkitCommandFeature;
import net.momirealms.craftengine.core.pack.host.ResourcePackHost;
import net.momirealms.craftengine.core.plugin.CraftEngine;
import net.momirealms.craftengine.core.plugin.command.CraftEngineCommandManager;
import net.momirealms.craftengine.core.plugin.config.Config;
import net.momirealms.craftengine.core.plugin.locale.MessageConstants;
import org.bukkit.command.CommandSender;
import org.incendo.cloud.Command;
@@ -23,7 +22,7 @@ public class UploadPackCommand extends BukkitCommandFeature<CommandSender> {
ResourcePackHost host = plugin().packManager().resourcePackHost();
if (host.canUpload()) {
handleFeedback(context, MessageConstants.COMMAND_UPLOAD_ON_PROGRESS);
host.upload(Config.fileToUpload());
plugin().packManager().uploadResourcePack();
} else {
handleFeedback(context, MessageConstants.COMMAND_UPLOAD_FAILURE_NOT_SUPPORTED, Component.text(host.type().value()));
}