2020-10-26 03:55:49 +00:00
|
|
|
package me.totalfreedom.plex;
|
|
|
|
|
2020-10-27 18:14:34 +00:00
|
|
|
import lombok.AccessLevel;
|
|
|
|
import lombok.Getter;
|
|
|
|
import lombok.Setter;
|
|
|
|
import me.totalfreedom.plex.config.Config;
|
|
|
|
import me.totalfreedom.plex.config.YamlConfig;
|
|
|
|
import me.totalfreedom.plex.storage.MongoConnection;
|
|
|
|
import me.totalfreedom.plex.storage.SQLConnection;
|
|
|
|
import me.totalfreedom.plex.storage.StorageType;
|
|
|
|
import me.totalfreedom.plex.util.PlexLog;
|
|
|
|
import me.totalfreedom.plex.util.PlexUtils;
|
2020-10-26 03:55:49 +00:00
|
|
|
import org.bukkit.plugin.java.JavaPlugin;
|
|
|
|
|
2020-10-27 18:14:34 +00:00
|
|
|
@Getter
|
|
|
|
@Setter
|
2020-10-26 03:55:49 +00:00
|
|
|
public class Plex extends JavaPlugin
|
|
|
|
{
|
2020-10-27 18:14:34 +00:00
|
|
|
@Setter(AccessLevel.NONE)
|
|
|
|
private static Plex plugin;
|
|
|
|
|
|
|
|
private StorageType storageType;
|
|
|
|
|
|
|
|
private SQLConnection sqlConnection;
|
|
|
|
private MongoConnection mongoConnection;
|
|
|
|
|
2020-10-26 03:55:49 +00:00
|
|
|
@Override
|
|
|
|
public void onLoad()
|
|
|
|
{
|
2020-10-27 18:14:34 +00:00
|
|
|
plugin = this;
|
|
|
|
|
|
|
|
getConfig().options().copyDefaults(true);
|
|
|
|
saveConfig();
|
|
|
|
|
|
|
|
saveResource("database.db", false);
|
|
|
|
|
|
|
|
sqlConnection = new SQLConnection();
|
|
|
|
mongoConnection = new MongoConnection();
|
2020-10-26 03:55:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void onEnable()
|
|
|
|
{
|
2020-10-27 18:14:34 +00:00
|
|
|
PlexUtils.testConnections();
|
2020-10-26 03:55:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void onDisable()
|
|
|
|
{
|
|
|
|
}
|
2020-10-27 18:14:34 +00:00
|
|
|
|
|
|
|
public static Plex get() {
|
|
|
|
return plugin;
|
|
|
|
}
|
2020-10-26 03:55:49 +00:00
|
|
|
}
|