mirror of
https://github.com/LuckPerms/LuckPerms.git
synced 2025-01-28 03:02:20 +01:00
Slight cleanup and better support for server reloads
This commit is contained in:
parent
50f4a84d04
commit
20f34d9b45
@ -36,32 +36,32 @@ public class BukkitConfig implements LPConfiguration {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getServer() {
|
public String getServer() {
|
||||||
return configuration.getString("server");
|
return configuration.getString("server", "global");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getPrefix() {
|
public String getPrefix() {
|
||||||
return configuration.getString("prefix");
|
return configuration.getString("prefix", "&7&l[&b&lL&a&lP&7&l] &c");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getSyncTime() {
|
public int getSyncTime() {
|
||||||
return configuration.getInt("sql.sync-minutes");
|
return configuration.getInt("sql.sync-minutes", 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getDefaultGroupNode() {
|
public String getDefaultGroupNode() {
|
||||||
return "luckperms.group." + configuration.getString("default-group");
|
return "luckperms.group." + configuration.getString("default-group", "default");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getDefaultGroupName() {
|
public String getDefaultGroupName() {
|
||||||
return configuration.getString("default-group");
|
return configuration.getString("default-group", "default");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean getIncludeGlobalPerms() {
|
public boolean getIncludeGlobalPerms() {
|
||||||
return configuration.getBoolean("include-global");
|
return configuration.getBoolean("include-global", true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -14,7 +14,6 @@ import net.milkbowl.vault.permission.Permission;
|
|||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.command.PluginCommand;
|
import org.bukkit.command.PluginCommand;
|
||||||
import org.bukkit.plugin.PluginManager;
|
import org.bukkit.plugin.PluginManager;
|
||||||
import org.bukkit.plugin.RegisteredServiceProvider;
|
|
||||||
import org.bukkit.plugin.ServicePriority;
|
import org.bukkit.plugin.ServicePriority;
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
|
||||||
@ -55,6 +54,9 @@ public class LPBukkitPlugin extends JavaPlugin implements LuckPermsPlugin {
|
|||||||
userManager = new BukkitUserManager(this);
|
userManager = new BukkitUserManager(this);
|
||||||
groupManager = new GroupManager(this);
|
groupManager = new GroupManager(this);
|
||||||
|
|
||||||
|
// Run update task to refresh any online users
|
||||||
|
new UpdateTask(this).run();
|
||||||
|
|
||||||
int mins = getConfiguration().getSyncTime();
|
int mins = getConfiguration().getSyncTime();
|
||||||
if (mins > 0) {
|
if (mins > 0) {
|
||||||
long ticks = mins * 60 * 20;
|
long ticks = mins * 60 * 20;
|
||||||
@ -76,6 +78,11 @@ public class LPBukkitPlugin extends JavaPlugin implements LuckPermsPlugin {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDisable() {
|
||||||
|
datastore.shutdown();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void doAsync(Runnable r) {
|
public void doAsync(Runnable r) {
|
||||||
Bukkit.getScheduler().runTaskAsynchronously(this, r);
|
Bukkit.getScheduler().runTaskAsynchronously(this, r);
|
||||||
|
@ -43,32 +43,32 @@ public class BungeeConfig implements LPConfiguration {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getServer() {
|
public String getServer() {
|
||||||
return configuration.getString("server");
|
return configuration.getString("server", "bungee");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getPrefix() {
|
public String getPrefix() {
|
||||||
return configuration.getString("prefix");
|
return configuration.getString("prefix", "&7&l[&b&lL&a&lP&7&l] &c");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getSyncTime() {
|
public int getSyncTime() {
|
||||||
return configuration.getInt("sql.sync-minutes");
|
return configuration.getInt("sql.sync-minutes", 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getDefaultGroupNode() {
|
public String getDefaultGroupNode() {
|
||||||
return "luckperms.group." + configuration.getString("default-group");
|
return "luckperms.group." + configuration.getString("default-group", "default");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getDefaultGroupName() {
|
public String getDefaultGroupName() {
|
||||||
return configuration.getString("default-group");
|
return configuration.getString("default-group", "default");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean getIncludeGlobalPerms() {
|
public boolean getIncludeGlobalPerms() {
|
||||||
return configuration.getBoolean("include-global");
|
return configuration.getBoolean("include-global", false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -52,6 +52,11 @@ public class LPBungeePlugin extends Plugin implements LuckPermsPlugin {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDisable() {
|
||||||
|
datastore.shutdown();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getVersion() {
|
public String getVersion() {
|
||||||
return VERSION;
|
return VERSION;
|
||||||
|
@ -48,6 +48,7 @@ public abstract class Datastore {
|
|||||||
These methods will block the thread that they're ran on.
|
These methods will block the thread that they're ran on.
|
||||||
*/
|
*/
|
||||||
public abstract void init(DatastoreConfiguration configuration);
|
public abstract void init(DatastoreConfiguration configuration);
|
||||||
|
public abstract void shutdown();
|
||||||
public abstract boolean loadOrCreateUser(UUID uuid, String username);
|
public abstract boolean loadOrCreateUser(UUID uuid, String username);
|
||||||
public abstract boolean loadUser(UUID uuid);
|
public abstract boolean loadUser(UUID uuid);
|
||||||
public abstract boolean saveUser(User user);
|
public abstract boolean saveUser(User user);
|
||||||
|
@ -104,6 +104,13 @@ public class HikariDatastore extends Datastore {
|
|||||||
setupTables();
|
setupTables();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void shutdown() {
|
||||||
|
if (hikari != null) {
|
||||||
|
hikari.shutdown();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean loadUser(UUID uuid) {
|
public boolean loadUser(UUID uuid) {
|
||||||
User user = plugin.getUserManager().makeUser(uuid);
|
User user = plugin.getUserManager().makeUser(uuid);
|
||||||
|
Loading…
Reference in New Issue
Block a user