mirror of
https://github.com/Xiao-MoMi/craft-engine.git
synced 2025-12-23 08:59:27 +00:00
@@ -248,7 +248,7 @@ public class BukkitBlockManager extends AbstractBlockManager {
|
||||
int vanillaStateCount;
|
||||
if (plugin.hasMod()) {
|
||||
try {
|
||||
Class<?> modClass = ReflectionUtils.getClazz("net.momirealms.craftengine.mod.CraftEnginePlugin");
|
||||
Class<?> modClass = ReflectionUtils.getClazz(CraftEngine.MOD_CLASS);
|
||||
Field amountField = ReflectionUtils.getDeclaredField(modClass, "vanillaRegistrySize");
|
||||
vanillaStateCount = (int) amountField.get(null);
|
||||
} catch (Exception e) {
|
||||
|
||||
@@ -57,7 +57,7 @@ public class BukkitCraftEngine extends CraftEngine {
|
||||
super.classPathAppender = new ReflectionClassPathAppender(this);
|
||||
super.scheduler = new BukkitSchedulerAdapter(this);
|
||||
super.logger = new JavaPluginLogger(bootstrap.getLogger());
|
||||
Class<?> modClass = ReflectionUtils.getClazz("net.momirealms.craftengine.mod.CraftEnginePlugin");
|
||||
Class<?> modClass = ReflectionUtils.getClazz(MOD_CLASS);
|
||||
if (modClass != null) {
|
||||
Field isSuccessfullyRegistered = ReflectionUtils.getDeclaredField(modClass, "isSuccessfullyRegistered");
|
||||
try {
|
||||
|
||||
@@ -32,6 +32,7 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public abstract class CraftEngine implements Plugin {
|
||||
public static final String MOD_CLASS = "net.momirealms.craftengine.mod.CraftEnginePlugin";
|
||||
public static final String NAMESPACE = "craftengine";
|
||||
private static CraftEngine instance;
|
||||
protected Platform platform;
|
||||
@@ -52,6 +53,7 @@ public abstract class CraftEngine implements Plugin {
|
||||
protected SenderFactory<? extends Plugin, ?> senderFactory;
|
||||
protected TemplateManager templateManager;
|
||||
protected PluginLogger logger;
|
||||
private boolean isReloading;
|
||||
|
||||
protected CraftEngine() {
|
||||
instance = this;
|
||||
@@ -71,20 +73,29 @@ public abstract class CraftEngine implements Plugin {
|
||||
|
||||
@Override
|
||||
public void reload() {
|
||||
this.translationManager.reload();
|
||||
this.configManager.reload();
|
||||
this.templateManager.reload();
|
||||
this.furnitureManager.reload();
|
||||
this.fontManager.reload();
|
||||
this.itemManager.reload();
|
||||
this.recipeManager.reload();
|
||||
this.blockManager.reload();
|
||||
this.worldManager.reload();
|
||||
this.packManager.reload();
|
||||
this.blockManager.delayedLoad();
|
||||
this.recipeManager.delayedLoad().thenRunAsync(() -> {
|
||||
this.packManager.generateResourcePack();
|
||||
}, this.scheduler.async());
|
||||
if (this.isReloading) return;
|
||||
this.isReloading = true;
|
||||
try {
|
||||
this.translationManager.reload();
|
||||
this.configManager.reload();
|
||||
this.templateManager.reload();
|
||||
this.furnitureManager.reload();
|
||||
this.fontManager.reload();
|
||||
this.itemManager.reload();
|
||||
this.recipeManager.reload();
|
||||
this.blockManager.reload();
|
||||
this.worldManager.reload();
|
||||
this.packManager.reload();
|
||||
this.blockManager.delayedLoad();
|
||||
} finally {
|
||||
this.recipeManager.delayedLoad().thenRunAsync(() -> {
|
||||
try {
|
||||
this.packManager.generateResourcePack();
|
||||
} finally {
|
||||
this.isReloading = false;
|
||||
}
|
||||
}, this.scheduler.async());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -125,7 +125,7 @@ public class ConfigManager implements Reloadable {
|
||||
// recipe
|
||||
enableRecipeSystem = config.getBoolean("recipe.enable", true);
|
||||
|
||||
Class<?> modClazz = ReflectionUtils.getClazz("net.momirealms.craftengine.mod.CraftEnginePlugin");
|
||||
Class<?> modClazz = ReflectionUtils.getClazz(CraftEngine.MOD_CLASS);
|
||||
if (modClazz != null) {
|
||||
Method setMaxChainMethod = ReflectionUtils.getStaticMethod(modClazz, new String[] {"setMaxChainUpdate"}, void.class, int.class);
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user