added mongodb, bumped versoin

This commit is contained in:
ham1255 2020-07-07 18:49:19 +04:00
parent 9b24e49f43
commit 4141bcdfb1
4 changed files with 52 additions and 2 deletions

View File

@ -6,7 +6,7 @@
<groupId>net.limework.core</groupId>
<artifactId>LimeworkSpigotCore</artifactId>
<version>1.0.0-SNAPSHOT</version>
<version>1.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<build>
@ -112,5 +112,10 @@
<version>19.0.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.mongodb</groupId>
<artifactId>mongodb-driver-sync</artifactId>
<version>4.0.4</version>
</dependency>
</dependencies>
</project>

View File

@ -2,6 +2,7 @@ package net.limework.core;
import net.limework.core.guis.ControlGui;
import net.limework.core.hooks.SkriptHook;
import net.limework.core.managers.DataSourcesManager;
import net.limework.core.managers.RedisManager;
import org.bukkit.plugin.java.JavaPlugin;
@ -10,6 +11,9 @@ public class LimeworkSpigotCore extends JavaPlugin {
//Redis manager
private RedisManager rm;
//data
private DataSourcesManager dsm;
@Override
public void onEnable() {
@ -29,6 +33,9 @@ public class LimeworkSpigotCore extends JavaPlugin {
getLogger().info("SOMETHING WENT WRONG WHEN LOADING control gui.");
e.printStackTrace();
}
dsm = new DataSourcesManager(this);
}
@ -36,10 +43,15 @@ public class LimeworkSpigotCore extends JavaPlugin {
@Override
public void onDisable() {
rm.shutdown();
dsm.shutdown();
}
public RedisManager getRm() {
return rm;
}
public DataSourcesManager getDsm() {
return dsm;
}
}

View File

@ -0,0 +1,29 @@
package net.limework.core.managers;
import com.mongodb.client.MongoClient;
import com.mongodb.client.MongoClients;
import net.limework.core.LimeworkSpigotCore;
import org.bukkit.configuration.Configuration;
public class DataSourcesManager {
private MongoClient mongoClient;
public DataSourcesManager(LimeworkSpigotCore plugin) {
Configuration config = plugin .getConfig();
if (config.getBoolean("Mongodb.enabled")){
mongoClient = MongoClients.create();
}
}
public void shutdown(){
mongoClient.close();
}
public MongoClient getMongoClient() {
return mongoClient;
}
}

View File

@ -15,3 +15,7 @@ Channels:
- "Channel1"
- "Channel2"
- "Channel3"
Mongodb:
enabled: false
url: ""