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