forked from Limework/RediSkript
added mongodb, bumped versoin
This commit is contained in:
parent
aca7ec2a13
commit
3c461c6307
7
pom.xml
7
pom.xml
@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
<groupId>net.limework.core</groupId>
|
<groupId>net.limework.core</groupId>
|
||||||
<artifactId>LimeworkSpigotCore</artifactId>
|
<artifactId>LimeworkSpigotCore</artifactId>
|
||||||
<version>1.0.0-SNAPSHOT</version>
|
<version>1.0.1-SNAPSHOT</version>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
@ -112,5 +112,10 @@
|
|||||||
<version>19.0.0</version>
|
<version>19.0.0</version>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.mongodb</groupId>
|
||||||
|
<artifactId>mongodb-driver-sync</artifactId>
|
||||||
|
<version>4.0.4</version>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</project>
|
</project>
|
@ -2,6 +2,7 @@ package net.limework.core;
|
|||||||
|
|
||||||
import net.limework.core.guis.ControlGui;
|
import net.limework.core.guis.ControlGui;
|
||||||
import net.limework.core.hooks.SkriptHook;
|
import net.limework.core.hooks.SkriptHook;
|
||||||
|
import net.limework.core.managers.DataSourcesManager;
|
||||||
import net.limework.core.managers.RedisManager;
|
import net.limework.core.managers.RedisManager;
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
|
||||||
@ -10,6 +11,9 @@ public class LimeworkSpigotCore extends JavaPlugin {
|
|||||||
//Redis manager
|
//Redis manager
|
||||||
private RedisManager rm;
|
private RedisManager rm;
|
||||||
|
|
||||||
|
//data
|
||||||
|
private DataSourcesManager dsm;
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onEnable() {
|
public void onEnable() {
|
||||||
@ -29,6 +33,9 @@ public class LimeworkSpigotCore extends JavaPlugin {
|
|||||||
getLogger().info("SOMETHING WENT WRONG WHEN LOADING control gui.");
|
getLogger().info("SOMETHING WENT WRONG WHEN LOADING control gui.");
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
dsm = new DataSourcesManager(this);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -36,10 +43,15 @@ public class LimeworkSpigotCore extends JavaPlugin {
|
|||||||
@Override
|
@Override
|
||||||
public void onDisable() {
|
public void onDisable() {
|
||||||
rm.shutdown();
|
rm.shutdown();
|
||||||
|
dsm.shutdown();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public RedisManager getRm() {
|
public RedisManager getRm() {
|
||||||
return rm;
|
return rm;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public DataSourcesManager getDsm() {
|
||||||
|
return dsm;
|
||||||
|
}
|
||||||
}
|
}
|
@ -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;
|
||||||
|
}
|
||||||
|
}
|
@ -15,3 +15,7 @@ Channels:
|
|||||||
- "Channel1"
|
- "Channel1"
|
||||||
- "Channel2"
|
- "Channel2"
|
||||||
- "Channel3"
|
- "Channel3"
|
||||||
|
|
||||||
|
Mongodb:
|
||||||
|
enabled: false
|
||||||
|
url: ""
|
Loading…
Reference in New Issue
Block a user