From f8a77cf809ee7ff59245b8a99a20e285e3605b42 Mon Sep 17 00:00:00 2001 From: bakatrouble Date: Sun, 25 Dec 2016 20:43:36 +0300 Subject: [PATCH] Change comments on configs; default ports for all storage backends --- bukkit/src/main/resources/config.yml | 14 ++++++++++---- bungee/src/main/resources/config.yml | 14 ++++++++++---- .../luckperms/common/messaging/RedisMessaging.java | 7 ++++--- .../common/storage/backing/MongoDBBacking.java | 8 ++++---- sponge/src/main/resources/luckperms.conf | 14 ++++++++++---- 5 files changed, 38 insertions(+), 19 deletions(-) diff --git a/bukkit/src/main/resources/config.yml b/bukkit/src/main/resources/config.yml index 85bb4ba2f..944bc1e73 100644 --- a/bukkit/src/main/resources/config.yml +++ b/bukkit/src/main/resources/config.yml @@ -148,8 +148,8 @@ group-name-rewrite: # +------------------------------------------------------------------------+ # # Which storage method the plugin should use. -# Currently supported: mysql, sqlite, h2, json, yaml, mongodb -# Fill out connection info below if you're using MySQL or MongoDB +# Currently supported: mysql, postgresql, sqlite, h2, json, yaml, mongodb +# Fill out connection info below if you're using MySQL, PostgreSQL or MongoDB storage-method: h2 # This block enables support for split datastores. @@ -163,7 +163,11 @@ split-storage: log: h2 data: - address: localhost:3306 + # Uses standard DB engine port by default + # MySQL: 3306, PostgreSQL: 5432, MongoDB: 27017 + # Specify as "host:port" if differs + address: localhost + database: minecraft username: root password: '' @@ -181,9 +185,11 @@ data: # # If you decide to enable this feature, you should set "sync-minutes" to -1, as there is no need for LuckPerms # to poll the database for changes. +# +# Port 6379 is used by default; set address to "host:port" if differs redis: enabled: false - address: localhost:6379 + address: localhost password: '' diff --git a/bungee/src/main/resources/config.yml b/bungee/src/main/resources/config.yml index bc13167df..7eafac6ac 100644 --- a/bungee/src/main/resources/config.yml +++ b/bungee/src/main/resources/config.yml @@ -90,8 +90,8 @@ group-weight: # +------------------------------------------------------------------------+ # # Which storage method the plugin should use. -# Currently supported: mysql, sqlite, h2, json, yaml, mongodb -# Fill out connection info below if you're using MySQL or MongoDB +# Currently supported: mysql, postgresql, sqlite, h2, json, yaml, mongodb +# Fill out connection info below if you're using MySQL, PostgreSQL or MongoDB storage-method: h2 # This block enables support for split datastores. @@ -105,7 +105,11 @@ split-storage: log: h2 data: - address: localhost:3306 + # Uses standard DB engine port by default + # MySQL: 3306, PostgreSQL: 5432, MongoDB: 27017 + # Specify as "host:port" if differs + address: localhost + database: minecraft username: root password: '' @@ -123,9 +127,11 @@ data: # # If you decide to enable this feature, you should set "sync-minutes" to -1, as there is no need for LuckPerms # to poll the database for changes. +# +# Port 6379 is used by default; set address to "host:port" if differs redis: enabled: false - address: localhost:6379 + address: localhost password: '' diff --git a/common/src/main/java/me/lucko/luckperms/common/messaging/RedisMessaging.java b/common/src/main/java/me/lucko/luckperms/common/messaging/RedisMessaging.java index 9998fcdbc..468673383 100644 --- a/common/src/main/java/me/lucko/luckperms/common/messaging/RedisMessaging.java +++ b/common/src/main/java/me/lucko/luckperms/common/messaging/RedisMessaging.java @@ -49,8 +49,9 @@ public class RedisMessaging implements MessagingService { private LPSub sub; public void init(String address, String password) { - String host = address.substring(0, address.indexOf(':')); - int port = Integer.parseInt(address.substring(address.indexOf(":") + 1)); + String[] addressSplit = address.split(":"); + String host = addressSplit[0]; + int port = addressSplit.length > 1 ? Integer.parseInt(addressSplit[1]) : 6379; if (password.equals("")) { jedisPool = new JedisPool(new JedisPoolConfig(), host, port); @@ -91,7 +92,7 @@ public class RedisMessaging implements MessagingService { private final LuckPermsPlugin plugin; private final Set receivedMsgs = Collections.synchronizedSet(new HashSet<>()); - public UUID generateId() { + UUID generateId() { UUID uuid = UUID.randomUUID(); receivedMsgs.add(uuid); return uuid; diff --git a/common/src/main/java/me/lucko/luckperms/common/storage/backing/MongoDBBacking.java b/common/src/main/java/me/lucko/luckperms/common/storage/backing/MongoDBBacking.java index cb7f2b1e1..25f80344b 100644 --- a/common/src/main/java/me/lucko/luckperms/common/storage/backing/MongoDBBacking.java +++ b/common/src/main/java/me/lucko/luckperms/common/storage/backing/MongoDBBacking.java @@ -139,10 +139,10 @@ public class MongoDBBacking extends AbstractBacking { } } - ServerAddress address = new ServerAddress( - configuration.getAddress().split(":")[0], - Integer.parseInt(configuration.getAddress().split(":")[1]) - ); + String[] addressSplit = configuration.getAddress().split(":"); + String host = addressSplit[0]; + int port = addressSplit.length > 1 ? Integer.parseInt(addressSplit[1]) : 27017; + ServerAddress address = new ServerAddress(host, port); if (credential == null) { mongoClient = new MongoClient(address, Collections.emptyList()); diff --git a/sponge/src/main/resources/luckperms.conf b/sponge/src/main/resources/luckperms.conf index c62a4d90e..9526c7a7a 100644 --- a/sponge/src/main/resources/luckperms.conf +++ b/sponge/src/main/resources/luckperms.conf @@ -89,8 +89,8 @@ group-weight { # +------------------------------------------------------------------------+ # # Which storage method the plugin should use. -# Currently supported: mysql, sqlite, h2, json, yaml, mongodb -# Fill out connection info below if you're using MySQL or MongoDB +# Currently supported: mysql, postgresql, sqlite, h2, json, yaml, mongodb +# Fill out connection info below if you're using MySQL, PostgreSQL or MongoDB storage-method="h2" # This block enables support for split datastores. @@ -106,7 +106,11 @@ split-storage { } data { - address="localhost:3306" + # Uses standard DB engine port by default + # MySQL: 3306, PostgreSQL: 5432, MongoDB: 27017 + # Specify as "host:port" if differs + address="localhost" + database="minecraft" username="root" password="" @@ -125,9 +129,11 @@ data { # # If you decide to enable this feature, you should set "sync-minutes" to -1, as there is no need for LuckPerms # to poll the database for changes. +# +# Port 6379 is used by default; set address to "host:port" if differs redis { enabled=false - address="localhost:6379" + address="localhost" password="" }