fix: switch to 2.0 invui and translation
This commit is contained in:
parent
b157836887
commit
a3fbcbf32a
89 changed files with 573 additions and 281 deletions
52
src/main/java/me/unurled/sacredrealms/sr/Manager.java
Normal file
52
src/main/java/me/unurled/sacredrealms/sr/Manager.java
Normal file
|
@ -0,0 +1,52 @@
|
|||
package me.unurled.sacredrealms.sr;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/** The Manager class is a class that is used to manage data and events. */
|
||||
public class Manager implements Listener {
|
||||
|
||||
/** Create a new manager */
|
||||
public Manager() {
|
||||
SR.plugin().managers().addManager(this);
|
||||
Bukkit.getScheduler()
|
||||
.runTaskAsynchronously(
|
||||
SR.plugin(),
|
||||
() -> {
|
||||
load();
|
||||
Bukkit.getPluginManager().registerEvents(this, SR.plugin());
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 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> T getInstance(@NotNull Class<T> clazz) {
|
||||
return clazz.cast(SR.plugin().managers().getManager(clazz));
|
||||
}
|
||||
|
||||
/** Load the manager */
|
||||
public void load() {
|
||||
loadData();
|
||||
}
|
||||
|
||||
/** Unload the manager */
|
||||
public void unload() {
|
||||
saveData();
|
||||
}
|
||||
|
||||
/** Save the data */
|
||||
public void saveData() {
|
||||
/* method empty, so it isn't required by the extended child to implement it */
|
||||
}
|
||||
|
||||
/** Load the data */
|
||||
public void loadData() {
|
||||
/* method empty, so it isn't required by the extended child to implement it */
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue