Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import com.mongodb.*;
- import com.mongodb.client.MongoCollection;
- import javax.swing.text.Document;
- import java.io.IOError;
- public class DataBaseManager {
- private DB db;
- private MongoClient client;
- private MongoCollection<Document> profile;
- public boolean connect(String ip, int port){
- try {
- client = new MongoClient(ip, port);
- } catch (IOError e) {
- System.out.println("Could not connect to database!");
- e.printStackTrace();
- return false;
- }
- return true;
- }
- public DBCollection getProfileCollection() {
- return this.db.getCollection("profile");
- }
- public DBCollection getPermBans() {
- return this.db.getCollection("permbans");
- }
- public DBCollection getTempBans() {
- return this.db.getCollection("tempbans");
- }
- public DBCollection getPermIPBans() {
- return this.db.getCollection("ipbans");
- }
- public DBCollection getTempIPBans() {
- return this.db.getCollection("tempipbans");
- }
- public DB getDb() {
- return db;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement