MOre documentation
This commit is contained in:
parent
7d6d238def
commit
5a928d91f4
|
@ -106,21 +106,47 @@ public class AuthConfig {
|
|||
|
||||
/**
|
||||
* Whether to use MongoDB instead of LevelDB.
|
||||
* Note: you need to install MongoDB yourself.
|
||||
* Note: you need to install MongoDB yourself, as well
|
||||
* as create a user (account) that will be used by SimpleAuth
|
||||
* to manage its database.
|
||||
*/
|
||||
public boolean useMongoDB = false;
|
||||
|
||||
/**
|
||||
* Credentials for MongoDB database.
|
||||
* Leave this as-is if you are using LevelDB.
|
||||
*/
|
||||
public static class MongoDBCredentials {
|
||||
/**
|
||||
* Credentials for MongoDB database.
|
||||
* Leave this as-is if you are using LevelDB.
|
||||
* Username for the database access.
|
||||
*/
|
||||
public String username = "";
|
||||
/**
|
||||
* Password for the database access.
|
||||
*/
|
||||
public String password = "";
|
||||
public String host = "localhost";
|
||||
public int port = 27017;
|
||||
public String simpleAuthDatabase = "SimpleAuthPlayerData";
|
||||
/**
|
||||
* Database where user with provided credentials
|
||||
* is located.
|
||||
*/
|
||||
public String userSourceDatabase = "";
|
||||
/**
|
||||
* Database host (address).
|
||||
*/
|
||||
public String host = "localhost";
|
||||
/**
|
||||
* Database port.
|
||||
* Default: 27017
|
||||
*/
|
||||
public int port = 27017;
|
||||
/**
|
||||
* Name of the new database in which SimpleAuth should
|
||||
* store player data.
|
||||
*/
|
||||
public String simpleAuthDatabase = "SimpleAuthPlayerData";
|
||||
/**
|
||||
* Whether to use ssl connection.
|
||||
*/
|
||||
public boolean useSsl = true;
|
||||
}
|
||||
|
||||
|
@ -153,7 +179,6 @@ public class AuthConfig {
|
|||
public String disallowedUsername = "§6Invalid username characters! Allowed character regex: %s";
|
||||
public String playerAlreadyOnline = "§cPlayer %s is already online!";
|
||||
public String worldSpawnSet = "§aSpawn for logging in was set successfully.";
|
||||
public String corruptedPlayerData = "§cYour data is probably corrupted. Please contact admin.";
|
||||
public String userNotRegistered = "§cThis player is not registered!";
|
||||
public String cannotLogout = "§cYou cannot logout!";
|
||||
}
|
||||
|
|
|
@ -22,20 +22,6 @@ public class MongoDB {
|
|||
private static MongoClient mongoClient;
|
||||
|
||||
public static void initialize() {
|
||||
|
||||
/*MongoCredential credential = MongoCredential.createCredential(
|
||||
config.mongoDBCredentials.username,
|
||||
config.mongoDBCredentials.userSourceDatabase,
|
||||
config.mongoDBCredentials.password.toCharArray()
|
||||
);
|
||||
|
||||
mongoClient = MongoClients.create(
|
||||
MongoClientSettings.builder()
|
||||
.applyToClusterSettings(builder ->
|
||||
builder.hosts(Collections.singletonList(new ServerAddress(config.mongoDBCredentials.host, config.mongoDBCredentials.port))))
|
||||
.applyToSslSettings(builder -> builder.enabled(config.mongoDBCredentials.useSsl))
|
||||
.credential(credential)
|
||||
.build());*/
|
||||
mongoClient = MongoClients.create(
|
||||
String.format(
|
||||
"mongodb://%s:%s@%s:%d/?authSource=%s&useSsl=%b",
|
||||
|
@ -47,7 +33,6 @@ public class MongoDB {
|
|||
config.mongoDBCredentials.useSsl
|
||||
)
|
||||
);
|
||||
//mongoClient = MongoClients.create(String.format("mongodb://%s:%d", config.mongoDBCredentials.host, config.mongoDBCredentials.port));
|
||||
MongoDatabase database = mongoClient.getDatabase(config.mongoDBCredentials.simpleAuthDatabase);
|
||||
collection = database.getCollection("players");
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue