Sacred realms
This commit is contained in:
commit
aa1c13c74c
28 changed files with 1651 additions and 0 deletions
|
@ -0,0 +1,47 @@
|
|||
package me.unurled.sacredrealms.sr.managers;
|
||||
|
||||
import me.unurled.sacredrealms.sr.SR;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.event.Listener;
|
||||
|
||||
public class Manager implements Listener {
|
||||
|
||||
/** Constructor for the Manager class */
|
||||
public Manager() {
|
||||
SR.getInstance().getManagers().addManager(this);
|
||||
Bukkit.getScheduler()
|
||||
.runTaskAsynchronously(
|
||||
SR.getInstance(),
|
||||
() -> {
|
||||
load();
|
||||
Bukkit.getPluginManager().registerEvents(this, SR.getInstance());
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Get an instance of a manager
|
||||
*
|
||||
* @param clazz The class of the manager
|
||||
* @return The instance of the manager
|
||||
* @param <T> The type of the manager
|
||||
*/
|
||||
public static <T extends Manager> Manager getInstance(Class<? extends Manager> clazz) {
|
||||
return clazz.cast(SR.getInstance().getManagers().getManager(clazz));
|
||||
}
|
||||
|
||||
/** Load the manager */
|
||||
public void load() {
|
||||
loadData();
|
||||
}
|
||||
|
||||
/** Unload the manager */
|
||||
public void unload() {
|
||||
saveData();
|
||||
}
|
||||
|
||||
/** Save the data */
|
||||
public void saveData() {}
|
||||
|
||||
/** Load the data */
|
||||
public void loadData() {}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue