Fix concurrency issue, remove sqlite from Bungee version and fix join message
This commit is contained in:
@@ -40,11 +40,6 @@ public class BukkitConfig implements LPConfiguration {
|
||||
return configuration.getString("server", "global");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPrefix() {
|
||||
return configuration.getString("prefix", "&7&l[&b&lL&a&lP&7&l] &c");
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSyncTime() {
|
||||
return configuration.getInt("sql.sync-minutes", 3);
|
||||
|
||||
@@ -2,6 +2,7 @@ package me.lucko.luckperms.listeners;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import me.lucko.luckperms.LPBukkitPlugin;
|
||||
import me.lucko.luckperms.commands.Util;
|
||||
import me.lucko.luckperms.users.BukkitUser;
|
||||
import me.lucko.luckperms.users.User;
|
||||
import org.bukkit.ChatColor;
|
||||
@@ -20,8 +21,8 @@ public class PlayerListener implements Listener {
|
||||
@EventHandler
|
||||
public void onPlayerPreLogin(AsyncPlayerPreLoginEvent e) {
|
||||
if (!plugin.getDatastore().isAcceptingLogins()) {
|
||||
e.disallow(AsyncPlayerPreLoginEvent.Result.KICK_OTHER, color(plugin.getConfiguration().getPrefix() +
|
||||
"&cError whilst validating login with the network. \nPlease contact an administrator."));
|
||||
e.disallow(AsyncPlayerPreLoginEvent.Result.KICK_OTHER,
|
||||
color(Util.PREFIX + "Error whilst validating login with the network. \nPlease contact an administrator."));
|
||||
return;
|
||||
}
|
||||
plugin.getDatastore().loadOrCreateUser(e.getUniqueId(), e.getName());
|
||||
@@ -33,8 +34,8 @@ public class PlayerListener implements Listener {
|
||||
User user = plugin.getUserManager().getUser(player.getUniqueId());
|
||||
|
||||
if (user == null) {
|
||||
e.disallow(PlayerLoginEvent.Result.KICK_OTHER, color(plugin.getConfiguration().getPrefix() +
|
||||
"&cUser data could not be loaded. Please contact an administrator."));
|
||||
e.disallow(PlayerLoginEvent.Result.KICK_OTHER,
|
||||
color(Util.PREFIX + "User data could not be loaded. Please contact an administrator."));
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -30,23 +30,25 @@ public class BukkitUser extends User {
|
||||
|
||||
@Override
|
||||
public void refreshPermissions() {
|
||||
Player player = Bukkit.getPlayer(getUuid());
|
||||
if (player == null) return;
|
||||
plugin.doSync(() -> {
|
||||
Player player = Bukkit.getPlayer(getUuid());
|
||||
if (player == null) return;
|
||||
|
||||
if (attachment == null) {
|
||||
getPlugin().getLogger().warning("User " + getName() + " does not have a permissions attachment defined.");
|
||||
setAttachment(player.addAttachment(plugin));
|
||||
}
|
||||
if (attachment == null) {
|
||||
getPlugin().getLogger().warning("User " + getName() + " does not have a permissions attachment defined.");
|
||||
setAttachment(player.addAttachment(plugin));
|
||||
}
|
||||
|
||||
// Clear existing permissions
|
||||
for (String p : attachment.getPermissions().keySet()) {
|
||||
attachment.setPermission(p, false);
|
||||
}
|
||||
// Clear existing permissions
|
||||
for (String p : attachment.getPermissions().keySet()) {
|
||||
attachment.setPermission(p, false);
|
||||
}
|
||||
|
||||
// Re-add all defined permissions for the user
|
||||
Map<String, Boolean> local = getLocalPermissions(getPlugin().getConfiguration().getServer(), null);
|
||||
for (String node : local.keySet()) {
|
||||
attachment.setPermission(node, local.get(node));
|
||||
}
|
||||
// Re-add all defined permissions for the user
|
||||
Map<String, Boolean> local = getLocalPermissions(getPlugin().getConfiguration().getServer(), null);
|
||||
for (String node : local.keySet()) {
|
||||
attachment.setPermission(node, local.get(node));
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,8 +9,6 @@ default-group: default
|
||||
# If users on this server should have their global permissions/groups applied.
|
||||
include-global: true
|
||||
|
||||
prefix: '&7&l[&b&lL&a&lP&7&l] &c'
|
||||
|
||||
# Which storage method the plugin should use.
|
||||
# Currently supported: mysql, sqlite, flatfile
|
||||
# Fill out connection info below if you're using MySQL
|
||||
|
||||
Reference in New Issue
Block a user