2021-05-10 08:01:35 +00:00
|
|
|
package com.alttd.chat;
|
|
|
|
|
|
2021-05-10 08:57:26 +00:00
|
|
|
import com.alttd.chat.config.Config;
|
2021-05-10 08:35:47 +00:00
|
|
|
import com.alttd.chat.database.DatabaseConnection;
|
2021-05-10 08:01:35 +00:00
|
|
|
import net.luckperms.api.LuckPerms;
|
|
|
|
|
import net.luckperms.api.LuckPermsProvider;
|
|
|
|
|
|
2021-05-10 08:57:26 +00:00
|
|
|
import java.io.File;
|
|
|
|
|
|
2021-05-10 08:01:35 +00:00
|
|
|
public class ChatImplementation implements ChatAPI{
|
|
|
|
|
|
2021-05-10 08:35:47 +00:00
|
|
|
private ChatAPI instance;
|
2021-05-10 08:01:35 +00:00
|
|
|
|
|
|
|
|
private LuckPerms luckPerms;
|
2021-05-10 08:35:47 +00:00
|
|
|
private DatabaseConnection databaseConnection;
|
2021-05-10 08:01:35 +00:00
|
|
|
|
|
|
|
|
ChatImplementation() {
|
2021-05-10 08:35:47 +00:00
|
|
|
instance = this;
|
2021-05-10 08:57:26 +00:00
|
|
|
Config.init(new File(System.getProperty("user.home")));
|
2021-05-10 08:01:35 +00:00
|
|
|
// init database
|
|
|
|
|
// init depends//or set them the first time they are called?
|
|
|
|
|
}
|
|
|
|
|
|
2021-05-10 08:35:47 +00:00
|
|
|
@Override
|
|
|
|
|
public ChatAPI get() {
|
|
|
|
|
if(instance == null)
|
|
|
|
|
instance = new ChatImplementation();
|
|
|
|
|
return instance;
|
|
|
|
|
}
|
|
|
|
|
|
2021-05-10 08:01:35 +00:00
|
|
|
@Override
|
|
|
|
|
public LuckPerms getLuckPerms() {
|
|
|
|
|
if(luckPerms == null)
|
|
|
|
|
luckPerms = LuckPermsProvider.get();
|
|
|
|
|
return luckPerms;
|
|
|
|
|
}
|
2021-05-10 08:35:47 +00:00
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public DatabaseConnection getDataBase() {
|
|
|
|
|
if(databaseConnection == null)
|
|
|
|
|
databaseConnection = new DatabaseConnection();
|
|
|
|
|
return databaseConnection;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2021-05-10 08:01:35 +00:00
|
|
|
}
|