9
0
mirror of https://github.com/Xiao-MoMi/craft-engine.git synced 2026-01-06 15:52:03 +00:00
This commit is contained in:
XiaoMoMi
2025-04-04 05:27:29 +08:00
parent 6ea0b1e9a6
commit 81fc801bd9
2 changed files with 12 additions and 10 deletions

View File

@@ -58,15 +58,17 @@ public class ReloadCommand extends BukkitCommandFeature<CommandSender> {
} else if (argument == ReloadArgument.ALL) { } else if (argument == ReloadArgument.ALL) {
plugin().scheduler().executeAsync(() -> { plugin().scheduler().executeAsync(() -> {
plugin().reload((a, b) -> { plugin().reload((a, b) -> {
try { plugin().scheduler().async().execute(() -> {
long time1 = System.currentTimeMillis(); try {
plugin().packManager().generateResourcePack(); long time1 = System.currentTimeMillis();
long time2 = System.currentTimeMillis(); plugin().packManager().generateResourcePack();
handleFeedback(context, MessageConstants.COMMAND_RELOAD_ALL_SUCCESS, Component.text(a + b + time2 - time1), Component.text(a), Component.text(b), Component.text(time2 - time1)); long time2 = System.currentTimeMillis();
} catch (Exception e) { handleFeedback(context, MessageConstants.COMMAND_RELOAD_ALL_SUCCESS, Component.text(a + b + time2 - time1), Component.text(a), Component.text(b), Component.text(time2 - time1));
handleFeedback(context, MessageConstants.COMMAND_RELOAD_ALL_FAILURE); } catch (Exception e) {
plugin().logger().warn("Failed to generate resource pack", e); handleFeedback(context, MessageConstants.COMMAND_RELOAD_ALL_FAILURE);
} plugin().logger().warn("Failed to generate resource pack", e);
}
});
}); });
}); });
} }

View File

@@ -412,7 +412,7 @@ public abstract class AbstractPackManager implements PackManager {
try { try {
Key id = Key.withDefaultNamespace(key, cached.pack().namespace()); Key id = Key.withDefaultNamespace(key, cached.pack().namespace());
if (parser.isTemplate()) { if (parser.isTemplate()) {
((TemplateManager) parser).addTemplate(cached.pack(), cached.filePath(), id, configEntry.getValue()); this.plugin.templateManager().addTemplate(cached.pack(), cached.filePath(), id, configEntry.getValue());
} else { } else {
if (configEntry.getValue() instanceof Map<?, ?> configSection0) { if (configEntry.getValue() instanceof Map<?, ?> configSection0) {
Map<String, Object> configSection1 = castToMap(configSection0, false); Map<String, Object> configSection1 = castToMap(configSection0, false);