mirror of
https://github.com/Xiao-MoMi/craft-engine.git
synced 2026-01-03 22:26:16 +00:00
提取上传方法
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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()));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user