mirror of
https://github.com/Xiao-MoMi/craft-engine.git
synced 2026-01-06 15:52:03 +00:00
Make mod class constant
This commit is contained in:
@@ -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) {
|
||||||
|
|||||||
@@ -56,7 +56,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 {
|
||||||
|
|||||||
@@ -31,6 +31,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 DependencyManager dependencyManager;
|
protected DependencyManager dependencyManager;
|
||||||
|
|||||||
@@ -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