mirror of
https://github.com/xoo0524tw/OpenMBedwars.git
synced 2026-12-05 22:06:02 +02:00
Initial commit: MBedwars 5.5.9.1 reconstructed Maven & IDEA-ready codebase
This commit is contained in:
commit
a8fad81ea0
1609 files changed
+239964
No files matched your search
@@ -0,0 +1,58 @@
|
||||
package de.marcely.bedwars.api;
|
||||
|
||||
import de.marcely.bedwars.api.command.CommandsCollection;
|
||||
import de.marcely.bedwars.api.unsafe.BedwarsAPILayer;
|
||||
import de.marcely.bedwars.libraries.org.jetbrains.annotations.Nullable;
|
||||
import de.marcely.bedwars.tools.Helper;
|
||||
import java.io.File;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
|
||||
public abstract class BedwarsAddon {
|
||||
private final Plugin plugin;
|
||||
private CommandsCollection commandsCollection;
|
||||
|
||||
public BedwarsAddon(Plugin var1) {
|
||||
this.plugin = var1;
|
||||
}
|
||||
|
||||
public final Plugin getPlugin() {
|
||||
return this.plugin;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return Helper.get().replaceFirst(this.plugin.getName(), "MBedwars_", "");
|
||||
}
|
||||
|
||||
public String getVersion() {
|
||||
return this.plugin.getDescription().getVersion();
|
||||
}
|
||||
|
||||
public String[] getAuthors() {
|
||||
return this.plugin.getDescription().getAuthors().stream().toArray(String[]::new);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public CommandsCollection getCommandsRoot() {
|
||||
if (this.commandsCollection == null) {
|
||||
return this.commandsCollection = BedwarsAPILayer.INSTANCE.getAddonCommandsCollection(this);
|
||||
} else {
|
||||
return this.isRegistered() ? this.commandsCollection : null;
|
||||
}
|
||||
}
|
||||
|
||||
public File getDataFolder() {
|
||||
return BedwarsAPILayer.INSTANCE.getAddonDataFolder(this);
|
||||
}
|
||||
|
||||
public final boolean register() {
|
||||
return BedwarsAPILayer.INSTANCE.registerAddon(this);
|
||||
}
|
||||
|
||||
public final boolean unregister() {
|
||||
return BedwarsAPILayer.INSTANCE.unregisterAddon(this);
|
||||
}
|
||||
|
||||
public final boolean isRegistered() {
|
||||
return BedwarsAPILayer.INSTANCE.isRegisteredAddon(this);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user