misc cleanup
This commit is contained in:
parent
1707f333bf
commit
e8c0c43e9d
@ -66,6 +66,7 @@ class BukkitListener extends AbstractListener implements Listener {
|
|||||||
deniedAsyncLogin.add(e.getUniqueId());
|
deniedAsyncLogin.add(e.getUniqueId());
|
||||||
|
|
||||||
// The datastore is disabled, prevent players from joining the server
|
// The datastore is disabled, prevent players from joining the server
|
||||||
|
plugin.getLog().warn("The plugin storage is not loaded. Denying connection from: " + e.getUniqueId() + " - " + e.getName());
|
||||||
e.disallow(AsyncPlayerPreLoginEvent.Result.KICK_OTHER, Message.LOADING_ERROR.toString());
|
e.disallow(AsyncPlayerPreLoginEvent.Result.KICK_OTHER, Message.LOADING_ERROR.toString());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -81,9 +82,8 @@ class BukkitListener extends AbstractListener implements Listener {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (plugin.isStarted() && plugin.getStorage().isAcceptingLogins() && e.getLoginResult() != AsyncPlayerPreLoginEvent.Result.ALLOWED) {
|
|
||||||
|
|
||||||
// Login event was cancelled by another plugin
|
// Login event was cancelled by another plugin
|
||||||
|
if (plugin.isStarted() && plugin.getStorage().isAcceptingLogins() && e.getLoginResult() != AsyncPlayerPreLoginEvent.Result.ALLOWED) {
|
||||||
onLeave(e.getUniqueId());
|
onLeave(e.getUniqueId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -102,6 +102,7 @@ class BukkitListener extends AbstractListener implements Listener {
|
|||||||
deniedLogin.add(e.getPlayer().getUniqueId());
|
deniedLogin.add(e.getPlayer().getUniqueId());
|
||||||
|
|
||||||
// User wasn't loaded for whatever reason.
|
// User wasn't loaded for whatever reason.
|
||||||
|
plugin.getLog().warn("User " + player.getUniqueId() + " - " + player.getName() + " could not be loaded. - denying login.");
|
||||||
e.disallow(PlayerLoginEvent.Result.KICK_OTHER, Message.LOADING_ERROR.toString());
|
e.disallow(PlayerLoginEvent.Result.KICK_OTHER, Message.LOADING_ERROR.toString());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -66,7 +66,6 @@ import java.util.function.Consumer;
|
|||||||
|
|
||||||
import static me.lucko.luckperms.common.constants.Permission.MIGRATION;
|
import static me.lucko.luckperms.common.constants.Permission.MIGRATION;
|
||||||
|
|
||||||
|
|
||||||
public class MigrationPowerfulPerms extends SubCommand<Object> {
|
public class MigrationPowerfulPerms extends SubCommand<Object> {
|
||||||
private static Method getPlayerPermissionsMethod = null;
|
private static Method getPlayerPermissionsMethod = null;
|
||||||
private static Method getPlayerGroupsMethod = null;
|
private static Method getPlayerGroupsMethod = null;
|
||||||
|
@ -3,4 +3,3 @@ version: ${release.version}.${patch.version}
|
|||||||
description: A permissions plugin
|
description: A permissions plugin
|
||||||
author: Luck
|
author: Luck
|
||||||
main: me.lucko.luckperms.bungee.LPBungeePlugin
|
main: me.lucko.luckperms.bungee.LPBungeePlugin
|
||||||
softdepends: [PowerfulPerms] # For migration
|
|
||||||
|
@ -44,6 +44,7 @@ import java.io.FileWriter;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.util.Collection;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
@ -129,12 +130,17 @@ public class ExportCommand extends SingleCommand {
|
|||||||
// Export tracks
|
// Export tracks
|
||||||
log.log("Starting track export.");
|
log.log("Starting track export.");
|
||||||
|
|
||||||
|
Collection<? extends Track> tracks = plugin.getTrackManager().getAll().values();
|
||||||
|
if (!tracks.isEmpty()) {
|
||||||
|
|
||||||
// Create the actual tracks first
|
// Create the actual tracks first
|
||||||
write(writer, "# Create tracks");
|
write(writer, "# Create tracks");
|
||||||
for (Track track : plugin.getTrackManager().getAll().values()) {
|
for (Track track : tracks) {
|
||||||
write(writer, "/luckperms createtrack " + track.getName());
|
write(writer, "/luckperms createtrack " + track.getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
write(writer, "");
|
||||||
|
|
||||||
AtomicInteger trackCount = new AtomicInteger(0);
|
AtomicInteger trackCount = new AtomicInteger(0);
|
||||||
for (Track track : plugin.getTrackManager().getAll().values()) {
|
for (Track track : plugin.getTrackManager().getAll().values()) {
|
||||||
write(writer, "# Export track: " + track.getName());
|
write(writer, "# Export track: " + track.getName());
|
||||||
@ -144,10 +150,12 @@ public class ExportCommand extends SingleCommand {
|
|||||||
write(writer, "");
|
write(writer, "");
|
||||||
log.logAllProgress("Exported {} tracks so far.", trackCount.incrementAndGet());
|
log.logAllProgress("Exported {} tracks so far.", trackCount.incrementAndGet());
|
||||||
}
|
}
|
||||||
log.log("Exported " + trackCount.get() + " tracks.");
|
|
||||||
|
|
||||||
write(writer, "");
|
write(writer, "");
|
||||||
write(writer, "");
|
write(writer, "");
|
||||||
|
}
|
||||||
|
|
||||||
|
log.log("Exported " + tracks.size() + " tracks.");
|
||||||
|
|
||||||
// Export users
|
// Export users
|
||||||
log.log("Starting user export. Finding a list of unique users to export.");
|
log.log("Starting user export. Finding a list of unique users to export.");
|
||||||
|
@ -81,6 +81,7 @@ public class Importer {
|
|||||||
this.notify = ImmutableSet.of(executor, commandManager.getPlugin().getConsoleSender());
|
this.notify = ImmutableSet.of(executor, commandManager.getPlugin().getConsoleSender());
|
||||||
}
|
}
|
||||||
this.commands = commands.stream()
|
this.commands = commands.stream()
|
||||||
|
.map(String::trim)
|
||||||
.filter(s -> !s.isEmpty())
|
.filter(s -> !s.isEmpty())
|
||||||
.filter(s -> !s.startsWith("#"))
|
.filter(s -> !s.startsWith("#"))
|
||||||
.filter(s -> !s.startsWith("//"))
|
.filter(s -> !s.startsWith("//"))
|
||||||
|
@ -240,7 +240,7 @@ public class LPSpongePlugin implements LuckPermsPlugin {
|
|||||||
getLog().info("Registering commands...");
|
getLog().info("Registering commands...");
|
||||||
CommandManager cmdService = game.getCommandManager();
|
CommandManager cmdService = game.getCommandManager();
|
||||||
SpongeCommand commandManager = new SpongeCommand(this);
|
SpongeCommand commandManager = new SpongeCommand(this);
|
||||||
cmdService.register(this, commandManager, "luckperms", "perms", "lp", "permissions", "p", "perm");
|
cmdService.register(this, commandManager, "luckperms", "perms", "lp", "permissions", "perm");
|
||||||
|
|
||||||
// load internal managers
|
// load internal managers
|
||||||
getLog().info("Loading internal permission managers...");
|
getLog().info("Loading internal permission managers...");
|
||||||
|
@ -46,6 +46,7 @@ import java.util.Set;
|
|||||||
public class MigrationUtils {
|
public class MigrationUtils {
|
||||||
|
|
||||||
public static void migrateSubject(Subject subject, PermissionHolder holder, int priority) {
|
public static void migrateSubject(Subject subject, PermissionHolder holder, int priority) {
|
||||||
|
|
||||||
// Migrate permissions
|
// Migrate permissions
|
||||||
Map<Set<Context>, Map<String, Boolean>> perms = subject.getSubjectData().getAllPermissions();
|
Map<Set<Context>, Map<String, Boolean>> perms = subject.getSubjectData().getAllPermissions();
|
||||||
for (Map.Entry<Set<Context>, Map<String, Boolean>> e : perms.entrySet()) {
|
for (Map.Entry<Set<Context>, Map<String, Boolean>> e : perms.entrySet()) {
|
||||||
@ -94,7 +95,6 @@ public class MigrationUtils {
|
|||||||
// Ignore. This is just so older versions of Sponge API can be used.
|
// Ignore. This is just so older versions of Sponge API can be used.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Migrate parents
|
// Migrate parents
|
||||||
Map<Set<Context>, List<Subject>> parents = subject.getSubjectData().getAllParents();
|
Map<Set<Context>, List<Subject>> parents = subject.getSubjectData().getAllParents();
|
||||||
for (Map.Entry<Set<Context>, List<Subject>> e : parents.entrySet()) {
|
for (Map.Entry<Set<Context>, List<Subject>> e : parents.entrySet()) {
|
||||||
|
Loading…
Reference in New Issue
Block a user