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