Merge pull request #7 from RedstonerServer/Datamanager
Fixed DataManager breaking on remote module reloading
This commit is contained in:
@@ -27,7 +27,7 @@ import com.redstoner.modules.CoreModule;
|
|||||||
import com.redstoner.modules.Module;
|
import com.redstoner.modules.Module;
|
||||||
|
|
||||||
@AutoRegisterListener
|
@AutoRegisterListener
|
||||||
@Version(major = 3, minor = 2, revision = 1, compatible = 3)
|
@Version(major = 3, minor = 2, revision = 2, compatible = 3)
|
||||||
public final class DataManager implements CoreModule, Listener
|
public final class DataManager implements CoreModule, Listener
|
||||||
{
|
{
|
||||||
protected final File dataFolder = new File(Main.plugin.getDataFolder(), "data");
|
protected final File dataFolder = new File(Main.plugin.getDataFolder(), "data");
|
||||||
@@ -92,6 +92,7 @@ public final class DataManager implements CoreModule, Listener
|
|||||||
{
|
{
|
||||||
Module mod = ModuleLoader.getModule("DataManager");
|
Module mod = ModuleLoader.getModule("DataManager");
|
||||||
Method m = mod.getClass().getDeclaredMethod("loadData_", String.class);
|
Method m = mod.getClass().getDeclaredMethod("loadData_", String.class);
|
||||||
|
m.setAccessible(true);
|
||||||
m.invoke(mod, id);
|
m.invoke(mod, id);
|
||||||
}
|
}
|
||||||
catch (NoSuchMethodException | SecurityException | IllegalAccessException | IllegalArgumentException
|
catch (NoSuchMethodException | SecurityException | IllegalAccessException | IllegalArgumentException
|
||||||
@@ -125,6 +126,7 @@ public final class DataManager implements CoreModule, Listener
|
|||||||
Module mod = ModuleLoader.getModule("DataManager");
|
Module mod = ModuleLoader.getModule("DataManager");
|
||||||
Method m = mod.getClass().getDeclaredMethod("getOrDefault_", String.class, String.class, String.class,
|
Method m = mod.getClass().getDeclaredMethod("getOrDefault_", String.class, String.class, String.class,
|
||||||
Object.class);
|
Object.class);
|
||||||
|
m.setAccessible(true);
|
||||||
return m.invoke(mod, id, module, key, fallback);
|
return m.invoke(mod, id, module, key, fallback);
|
||||||
}
|
}
|
||||||
catch (NoSuchMethodException | SecurityException | IllegalAccessException | IllegalArgumentException
|
catch (NoSuchMethodException | SecurityException | IllegalAccessException | IllegalArgumentException
|
||||||
@@ -155,6 +157,7 @@ public final class DataManager implements CoreModule, Listener
|
|||||||
{
|
{
|
||||||
Module mod = ModuleLoader.getModule("DataManager");
|
Module mod = ModuleLoader.getModule("DataManager");
|
||||||
Method m = mod.getClass().getDeclaredMethod("getData_", String.class, String.class, String.class);
|
Method m = mod.getClass().getDeclaredMethod("getData_", String.class, String.class, String.class);
|
||||||
|
m.setAccessible(true);
|
||||||
return m.invoke(mod, id, module, key);
|
return m.invoke(mod, id, module, key);
|
||||||
}
|
}
|
||||||
catch (NoSuchMethodException | SecurityException | IllegalAccessException | IllegalArgumentException
|
catch (NoSuchMethodException | SecurityException | IllegalAccessException | IllegalArgumentException
|
||||||
@@ -207,6 +210,7 @@ public final class DataManager implements CoreModule, Listener
|
|||||||
Module mod = ModuleLoader.getModule("DataManager");
|
Module mod = ModuleLoader.getModule("DataManager");
|
||||||
Method m = mod.getClass().getDeclaredMethod("setData_", String.class, String.class, String.class,
|
Method m = mod.getClass().getDeclaredMethod("setData_", String.class, String.class, String.class,
|
||||||
Object.class);
|
Object.class);
|
||||||
|
m.setAccessible(true);
|
||||||
m.invoke(mod, id, module, key, value);
|
m.invoke(mod, id, module, key, value);
|
||||||
}
|
}
|
||||||
catch (NoSuchMethodException | SecurityException | IllegalAccessException | IllegalArgumentException
|
catch (NoSuchMethodException | SecurityException | IllegalAccessException | IllegalArgumentException
|
||||||
@@ -251,6 +255,7 @@ public final class DataManager implements CoreModule, Listener
|
|||||||
{
|
{
|
||||||
Module mod = ModuleLoader.getModule("DataManager");
|
Module mod = ModuleLoader.getModule("DataManager");
|
||||||
Method m = mod.getClass().getDeclaredMethod("setDirectly_", String.class, String.class, Object.class);
|
Method m = mod.getClass().getDeclaredMethod("setDirectly_", String.class, String.class, Object.class);
|
||||||
|
m.setAccessible(true);
|
||||||
m.invoke(mod, id, module, value);
|
m.invoke(mod, id, module, value);
|
||||||
}
|
}
|
||||||
catch (NoSuchMethodException | SecurityException | IllegalAccessException | IllegalArgumentException
|
catch (NoSuchMethodException | SecurityException | IllegalAccessException | IllegalArgumentException
|
||||||
@@ -315,6 +320,7 @@ public final class DataManager implements CoreModule, Listener
|
|||||||
{
|
{
|
||||||
Module mod = ModuleLoader.getModule("DataManager");
|
Module mod = ModuleLoader.getModule("DataManager");
|
||||||
Method m = mod.getClass().getDeclaredMethod("removeData_", String.class, String.class, String.class);
|
Method m = mod.getClass().getDeclaredMethod("removeData_", String.class, String.class, String.class);
|
||||||
|
m.setAccessible(true);
|
||||||
m.invoke(mod, id, module, key);
|
m.invoke(mod, id, module, key);
|
||||||
}
|
}
|
||||||
catch (NoSuchMethodException | SecurityException | IllegalAccessException | IllegalArgumentException
|
catch (NoSuchMethodException | SecurityException | IllegalAccessException | IllegalArgumentException
|
||||||
@@ -362,6 +368,7 @@ public final class DataManager implements CoreModule, Listener
|
|||||||
{
|
{
|
||||||
Module mod = ModuleLoader.getModule("DataManager");
|
Module mod = ModuleLoader.getModule("DataManager");
|
||||||
Method m = mod.getClass().getDeclaredMethod("importObject_", String.class, String.class, String.class);
|
Method m = mod.getClass().getDeclaredMethod("importObject_", String.class, String.class, String.class);
|
||||||
|
m.setAccessible(true);
|
||||||
m.invoke(mod, module, object);
|
m.invoke(mod, module, object);
|
||||||
}
|
}
|
||||||
catch (NoSuchMethodException | SecurityException | IllegalAccessException | IllegalArgumentException
|
catch (NoSuchMethodException | SecurityException | IllegalAccessException | IllegalArgumentException
|
||||||
@@ -395,6 +402,7 @@ public final class DataManager implements CoreModule, Listener
|
|||||||
{
|
{
|
||||||
Module mod = ModuleLoader.getModule("DataManager");
|
Module mod = ModuleLoader.getModule("DataManager");
|
||||||
Method m = mod.getClass().getDeclaredMethod("migrateAll_", String.class, String.class);
|
Method m = mod.getClass().getDeclaredMethod("migrateAll_", String.class, String.class);
|
||||||
|
m.setAccessible(true);
|
||||||
m.invoke(mod, oldName, newName);
|
m.invoke(mod, oldName, newName);
|
||||||
}
|
}
|
||||||
catch (NoSuchMethodException | SecurityException | IllegalAccessException | IllegalArgumentException
|
catch (NoSuchMethodException | SecurityException | IllegalAccessException | IllegalArgumentException
|
||||||
@@ -428,6 +436,7 @@ public final class DataManager implements CoreModule, Listener
|
|||||||
{
|
{
|
||||||
Module mod = ModuleLoader.getModule("DataManager");
|
Module mod = ModuleLoader.getModule("DataManager");
|
||||||
Method m = mod.getClass().getDeclaredMethod("migrate_", String.class, String.class, String.class);
|
Method m = mod.getClass().getDeclaredMethod("migrate_", String.class, String.class, String.class);
|
||||||
|
m.setAccessible(true);
|
||||||
m.invoke(mod, id, oldName, newName);
|
m.invoke(mod, id, oldName, newName);
|
||||||
}
|
}
|
||||||
catch (NoSuchMethodException | SecurityException | IllegalAccessException | IllegalArgumentException
|
catch (NoSuchMethodException | SecurityException | IllegalAccessException | IllegalArgumentException
|
||||||
@@ -464,6 +473,7 @@ public final class DataManager implements CoreModule, Listener
|
|||||||
{
|
{
|
||||||
Module mod = ModuleLoader.getModule("DataManager");
|
Module mod = ModuleLoader.getModule("DataManager");
|
||||||
Method m = mod.getClass().getDeclaredMethod("save_", CommandSender.class);
|
Method m = mod.getClass().getDeclaredMethod("save_", CommandSender.class);
|
||||||
|
m.setAccessible(true);
|
||||||
m.invoke(mod, sender);
|
m.invoke(mod, sender);
|
||||||
}
|
}
|
||||||
catch (NoSuchMethodException | SecurityException | IllegalAccessException | IllegalArgumentException
|
catch (NoSuchMethodException | SecurityException | IllegalAccessException | IllegalArgumentException
|
||||||
@@ -482,6 +492,7 @@ public final class DataManager implements CoreModule, Listener
|
|||||||
{
|
{
|
||||||
Module mod = ModuleLoader.getModule("DataManager");
|
Module mod = ModuleLoader.getModule("DataManager");
|
||||||
Method m = mod.getClass().getDeclaredMethod("save_", String.class);
|
Method m = mod.getClass().getDeclaredMethod("save_", String.class);
|
||||||
|
m.setAccessible(true);
|
||||||
m.invoke(mod, id);
|
m.invoke(mod, id);
|
||||||
}
|
}
|
||||||
catch (NoSuchMethodException | SecurityException | IllegalAccessException | IllegalArgumentException
|
catch (NoSuchMethodException | SecurityException | IllegalAccessException | IllegalArgumentException
|
||||||
|
|||||||
Reference in New Issue
Block a user