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

Merge branch 'Xiao-MoMi:dev' into dev

This commit is contained in:
jhqwqmc
2025-04-08 16:41:35 +08:00
committed by GitHub
3 changed files with 12 additions and 7 deletions

View File

@@ -114,6 +114,7 @@ public class BukkitBlockManager extends AbstractBlockManager {
this.stateId2ImmutableBlockStates = new ImmutableBlockState[customBlockCount];
Arrays.fill(this.stateId2ImmutableBlockStates, EmptyBlock.INSTANCE.defaultState());
instance = this;
this.resetPacketConsumers();
}
public static BukkitBlockManager instance() {

View File

@@ -395,14 +395,14 @@ public abstract class AbstractPackManager implements PackManager {
for (Pack pack : loadedPacks()) {
Pair<List<Path>, List<Path>> files = FileUtils.getConfigsDeeply(pack.configurationFolder());
for (Path path : files.left()) {
Yaml yaml = new Yaml(new StringKeyConstructor(new LoaderOptions()));
try (InputStreamReader inputStream = new InputStreamReader(new FileInputStream(path.toFile()), StandardCharsets.UTF_8)) {
Yaml yaml = new Yaml(new StringKeyConstructor(new LoaderOptions()));
Map<String, Object> data = yaml.load(inputStream);
if (data == null) continue;
for (Map.Entry<String, Object> entry : data.entrySet()) {
processConfigEntry(entry, path, pack);
}
} catch (IOException e) {
} catch (Exception e) {
this.plugin.logger().warn(path, "Error loading config file", e);
}
}
@@ -413,7 +413,7 @@ public abstract class AbstractPackManager implements PackManager {
for (Map.Entry<String, Object> entry : data.entrySet()) {
processConfigEntry(entry, path, pack);
}
} catch (IOException e) {
} catch (Exception e) {
this.plugin.logger().warn(path, "Error loading config file", e);
}
}

View File

@@ -142,12 +142,16 @@ public abstract class CraftEngine implements Plugin {
if (reloadRecipe) {
this.recipeManager.reload();
}
// now we load resources
this.packManager.loadResources(reloadRecipe);
// handle some special client lang for instance block_name
this.translationManager.delayedLoad();
try {
// now we load resources
this.packManager.loadResources(reloadRecipe);
} catch (Exception e) {
this.logger().warn("Failed to load resources folder", e);
}
// init suggestions and packet mapper
this.blockManager.delayedLoad();
// handle some special client lang for instance block_name
this.translationManager.delayedLoad();
// init suggestions
this.furnitureManager.delayedLoad();
// sort the categories