diff --git a/bukkit/pom.xml b/bukkit/pom.xml index 643847b64..ca19cd05d 100644 --- a/bukkit/pom.xml +++ b/bukkit/pom.xml @@ -129,5 +129,46 @@ 1.16.10 provided + + + org.tyrannyofheaven.bukkit + zPermissions + 1.3 + provided + + + ru.tehkode + PermissionsEx + 1.23 + provided + + + org.bukkit + bukkit + + + net.gravitydevelopment.updater + updater + + + + + com.github.cheesesoftware + PowerfulPermsAPI + 1.0.1 + provided + + + org.anjocaido + GroupManager + 1.4 + provided + + + de.bananaco + bpermissions-api + 2.12 + provided + diff --git a/common/src/main/java/me/lucko/luckperms/common/commands/migration/subcommands/MigrationBPermissions.java b/bukkit/src/main/java/me/lucko/luckperms/bukkit/migration/MigrationBPermissions.java similarity index 99% rename from common/src/main/java/me/lucko/luckperms/common/commands/migration/subcommands/MigrationBPermissions.java rename to bukkit/src/main/java/me/lucko/luckperms/bukkit/migration/MigrationBPermissions.java index dfda5c068..10d08bdc1 100644 --- a/common/src/main/java/me/lucko/luckperms/common/commands/migration/subcommands/MigrationBPermissions.java +++ b/bukkit/src/main/java/me/lucko/luckperms/bukkit/migration/MigrationBPermissions.java @@ -20,7 +20,7 @@ * SOFTWARE. */ -package me.lucko.luckperms.common.commands.migration.subcommands; +package me.lucko.luckperms.bukkit.migration; import de.bananaco.bpermissions.api.*; import me.lucko.luckperms.api.Logger; diff --git a/common/src/main/java/me/lucko/luckperms/common/commands/migration/subcommands/MigrationGroupManager.java b/bukkit/src/main/java/me/lucko/luckperms/bukkit/migration/MigrationGroupManager.java similarity index 91% rename from common/src/main/java/me/lucko/luckperms/common/commands/migration/subcommands/MigrationGroupManager.java rename to bukkit/src/main/java/me/lucko/luckperms/bukkit/migration/MigrationGroupManager.java index 61eebacd0..152ea2738 100644 --- a/common/src/main/java/me/lucko/luckperms/common/commands/migration/subcommands/MigrationGroupManager.java +++ b/bukkit/src/main/java/me/lucko/luckperms/bukkit/migration/MigrationGroupManager.java @@ -20,7 +20,7 @@ * SOFTWARE. */ -package me.lucko.luckperms.common.commands.migration.subcommands; +package me.lucko.luckperms.bukkit.migration; import me.lucko.luckperms.api.Logger; import me.lucko.luckperms.common.LuckPermsPlugin; @@ -36,7 +36,6 @@ import org.anjocaido.groupmanager.data.User; import org.anjocaido.groupmanager.dataholder.WorldDataHolder; import org.anjocaido.groupmanager.dataholder.worlds.WorldsHolder; -import java.lang.reflect.InvocationTargetException; import java.util.*; import java.util.stream.Collectors; @@ -63,14 +62,7 @@ public class MigrationGroupManager extends SubCommand { // Migrate Global Groups log.info("GroupManager Migration: Starting Global Group migration."); - - GlobalGroups gg; - try { - gg = (GlobalGroups) GroupManager.class.getMethod("getGlobalGroups").invoke(gm); - } catch (IllegalAccessException | InvocationTargetException | NoSuchMethodException e) { - e.printStackTrace(); - return CommandResult.FAILURE; - } + GlobalGroups gg = GroupManager.getGlobalGroups(); for (Group g : gg.getGroupList()) { plugin.getDatastore().createAndLoadGroup(g.getName().toLowerCase()).getUnchecked(); @@ -127,27 +119,14 @@ public class MigrationGroupManager extends SubCommand { Map, Boolean>> users = new HashMap<>(); Map, Boolean>> groups = new HashMap<>(); - WorldsHolder wh; - try { - wh = (WorldsHolder) GroupManager.class.getMethod("getWorldsHolder").invoke(gm); - } catch (IllegalAccessException | InvocationTargetException | NoSuchMethodException e) { - e.printStackTrace(); - return CommandResult.FAILURE; - } + WorldsHolder wh = gm.getWorldsHolder(); // Collect data for all users and groups. log.info("GroupManager Migration: Starting user and group migration."); for (String world : worlds) { world = world.toLowerCase(); - WorldDataHolder wdh; - - try { - wdh = (WorldDataHolder) WorldsHolder.class.getMethod("getWorldData", String.class).invoke(wh, world); - } catch (IllegalAccessException | InvocationTargetException | NoSuchMethodException e) { - e.printStackTrace(); - return CommandResult.FAILURE; - } + WorldDataHolder wdh = wh.getWorldData(world); for (Group g : wdh.getGroupList()) { groups.putIfAbsent(g.getName().toLowerCase(), new HashMap<>()); diff --git a/common/src/main/java/me/lucko/luckperms/common/commands/migration/subcommands/MigrationPermissionsEx.java b/bukkit/src/main/java/me/lucko/luckperms/bukkit/migration/MigrationPermissionsEx.java similarity index 96% rename from common/src/main/java/me/lucko/luckperms/common/commands/migration/subcommands/MigrationPermissionsEx.java rename to bukkit/src/main/java/me/lucko/luckperms/bukkit/migration/MigrationPermissionsEx.java index 75f25f398..0d10c3119 100644 --- a/common/src/main/java/me/lucko/luckperms/common/commands/migration/subcommands/MigrationPermissionsEx.java +++ b/bukkit/src/main/java/me/lucko/luckperms/bukkit/migration/MigrationPermissionsEx.java @@ -20,7 +20,7 @@ * SOFTWARE. */ -package me.lucko.luckperms.common.commands.migration.subcommands; +package me.lucko.luckperms.bukkit.migration; import me.lucko.luckperms.api.Logger; import me.lucko.luckperms.api.MetaUtils; @@ -40,7 +40,6 @@ import ru.tehkode.permissions.PermissionUser; import ru.tehkode.permissions.bukkit.PermissionsEx; import java.lang.reflect.Field; -import java.lang.reflect.InvocationTargetException; import java.util.List; import java.util.UUID; import java.util.stream.Collectors; @@ -72,13 +71,7 @@ public class MigrationPermissionsEx extends SubCommand { .collect(Collectors.toList()); PermissionsEx pex = (PermissionsEx) plugin.getPlugin("PermissionsEx"); - PermissionManager manager; // The compiler complains if you call the method directly, as Bukkit is not in this module. - try { - manager = (PermissionManager) PermissionsEx.class.getMethod("getPermissionsManager").invoke(pex); - } catch (IllegalAccessException | InvocationTargetException | NoSuchMethodException e) { - e.printStackTrace(); - return CommandResult.FAILURE; - } + PermissionManager manager = pex.getPermissionsManager(); NativeInterface ni; try { diff --git a/common/src/main/java/me/lucko/luckperms/common/commands/migration/subcommands/MigrationPowerfulPerms.java b/bukkit/src/main/java/me/lucko/luckperms/bukkit/migration/MigrationPowerfulPerms.java similarity index 99% rename from common/src/main/java/me/lucko/luckperms/common/commands/migration/subcommands/MigrationPowerfulPerms.java rename to bukkit/src/main/java/me/lucko/luckperms/bukkit/migration/MigrationPowerfulPerms.java index 4b2a70030..254ec5a26 100644 --- a/common/src/main/java/me/lucko/luckperms/common/commands/migration/subcommands/MigrationPowerfulPerms.java +++ b/bukkit/src/main/java/me/lucko/luckperms/bukkit/migration/MigrationPowerfulPerms.java @@ -20,7 +20,7 @@ * SOFTWARE. */ -package me.lucko.luckperms.common.commands.migration.subcommands; +package me.lucko.luckperms.bukkit.migration; import com.github.cheesesoftware.PowerfulPermsAPI.*; import com.google.common.util.concurrent.ListenableFuture; @@ -28,9 +28,9 @@ import com.zaxxer.hikari.HikariDataSource; import lombok.Cleanup; import me.lucko.luckperms.api.Logger; import me.lucko.luckperms.api.data.Callback; +import me.lucko.luckperms.bukkit.migration.utils.LPResultRunnable; import me.lucko.luckperms.common.LuckPermsPlugin; import me.lucko.luckperms.common.commands.*; -import me.lucko.luckperms.common.commands.migration.subcommands.utils.LPResultRunnable; import me.lucko.luckperms.common.constants.Constants; import me.lucko.luckperms.common.core.PermissionHolder; import me.lucko.luckperms.common.data.LogEntry; diff --git a/common/src/main/java/me/lucko/luckperms/common/commands/migration/subcommands/MigrationZPermissions.java b/bukkit/src/main/java/me/lucko/luckperms/bukkit/migration/MigrationZPermissions.java similarity index 98% rename from common/src/main/java/me/lucko/luckperms/common/commands/migration/subcommands/MigrationZPermissions.java rename to bukkit/src/main/java/me/lucko/luckperms/bukkit/migration/MigrationZPermissions.java index 293912c53..0f3b7453d 100644 --- a/common/src/main/java/me/lucko/luckperms/common/commands/migration/subcommands/MigrationZPermissions.java +++ b/bukkit/src/main/java/me/lucko/luckperms/bukkit/migration/MigrationZPermissions.java @@ -20,7 +20,7 @@ * SOFTWARE. */ -package me.lucko.luckperms.common.commands.migration.subcommands; +package me.lucko.luckperms.bukkit.migration; import me.lucko.luckperms.api.Logger; import me.lucko.luckperms.api.MetaUtils; @@ -40,10 +40,6 @@ import java.util.Map; import java.util.UUID; import java.util.stream.Collectors; -/** - * <3 <3 zPermissions <3 <3 - * Finally a permissions plugin with a decent API. *sigh* - */ public class MigrationZPermissions extends SubCommand { public MigrationZPermissions() { super("zpermissions", "Migration from zPermissions", Permission.MIGRATION, Predicate.alwaysFalse(), diff --git a/common/src/main/java/me/lucko/luckperms/common/commands/migration/subcommands/utils/LPResultRunnable.java b/bukkit/src/main/java/me/lucko/luckperms/bukkit/migration/utils/LPResultRunnable.java similarity index 95% rename from common/src/main/java/me/lucko/luckperms/common/commands/migration/subcommands/utils/LPResultRunnable.java rename to bukkit/src/main/java/me/lucko/luckperms/bukkit/migration/utils/LPResultRunnable.java index 8687ced71..769367599 100644 --- a/common/src/main/java/me/lucko/luckperms/common/commands/migration/subcommands/utils/LPResultRunnable.java +++ b/bukkit/src/main/java/me/lucko/luckperms/bukkit/migration/utils/LPResultRunnable.java @@ -20,7 +20,7 @@ * SOFTWARE. */ -package me.lucko.luckperms.common.commands.migration.subcommands.utils; +package me.lucko.luckperms.bukkit.migration.utils; import com.github.cheesesoftware.PowerfulPermsAPI.ResultRunnable; diff --git a/bungee/pom.xml b/bungee/pom.xml index 46ce26486..fdd8d1f2e 100644 --- a/bungee/pom.xml +++ b/bungee/pom.xml @@ -121,6 +121,13 @@ 1.16.10 provided + + + net.alpenblock + BungeePerms + 3.0-dev-52 + provided + diff --git a/common/src/main/java/me/lucko/luckperms/common/commands/migration/subcommands/MigrationBungeePerms.java b/bungee/src/main/java/me/lucko/luckperms/bungee/migration/MigrationBungeePerms.java similarity index 99% rename from common/src/main/java/me/lucko/luckperms/common/commands/migration/subcommands/MigrationBungeePerms.java rename to bungee/src/main/java/me/lucko/luckperms/bungee/migration/MigrationBungeePerms.java index af104866e..0cf18331f 100644 --- a/common/src/main/java/me/lucko/luckperms/common/commands/migration/subcommands/MigrationBungeePerms.java +++ b/bungee/src/main/java/me/lucko/luckperms/bungee/migration/MigrationBungeePerms.java @@ -20,7 +20,7 @@ * SOFTWARE. */ -package me.lucko.luckperms.common.commands.migration.subcommands; +package me.lucko.luckperms.bungee.migration; import me.lucko.luckperms.api.Logger; import me.lucko.luckperms.api.MetaUtils; @@ -60,7 +60,7 @@ public class MigrationBungeePerms extends SubCommand { log.info("BungeePerms Migration: Starting group migration."); int groupCount = 0; for (Group g : bp.getPermissionsManager().getBackEnd().loadGroups()) { - groupCount ++; + groupCount++; // Make a LuckPerms group for the one being migrated plugin.getDatastore().createAndLoadGroup(g.getName().toLowerCase()).getUnchecked(); diff --git a/common/pom.xml b/common/pom.xml index 474ba3ee7..8b52afd59 100644 --- a/common/pom.xml +++ b/common/pom.xml @@ -95,53 +95,6 @@ 1.16.10 provided - - - org.tyrannyofheaven.bukkit - zPermissions - 1.3 - provided - - - ru.tehkode - PermissionsEx - 1.23 - provided - - - org.bukkit - bukkit - - - net.gravitydevelopment.updater - updater - - - - - com.github.cheesesoftware - PowerfulPermsAPI - 1.0.1 - provided - - - org.anjocaido - GroupManager - 1.4 - provided - - - net.alpenblock - BungeePerms - 3.0-dev-52 - provided - - - de.bananaco - bpermissions-api - 2.12 - provided - diff --git a/common/src/main/java/me/lucko/luckperms/common/commands/migration/MigrationMainCommand.java b/common/src/main/java/me/lucko/luckperms/common/commands/migration/MigrationMainCommand.java index 60c519478..0b8bc0e13 100644 --- a/common/src/main/java/me/lucko/luckperms/common/commands/migration/MigrationMainCommand.java +++ b/common/src/main/java/me/lucko/luckperms/common/commands/migration/MigrationMainCommand.java @@ -27,7 +27,6 @@ import me.lucko.luckperms.common.commands.CommandResult; import me.lucko.luckperms.common.commands.MainCommand; import me.lucko.luckperms.common.commands.Sender; import me.lucko.luckperms.common.commands.SubCommand; -import me.lucko.luckperms.common.commands.migration.subcommands.*; import me.lucko.luckperms.common.constants.Constants; import me.lucko.luckperms.common.constants.Message; @@ -43,34 +42,33 @@ public class MigrationMainCommand extends MainCommand { try { Class.forName("org.anjocaido.groupmanager.GroupManager"); - subCommands.add(new MigrationGroupManager()); + subCommands.add((SubCommand) Class.forName("me.lucko.luckperms.bukkit.migration.MigrationGroupManager").newInstance()); } catch (Throwable ignored) {} try { Class.forName("ru.tehkode.permissions.bukkit.PermissionsEx"); - subCommands.add(new MigrationPermissionsEx()); + subCommands.add((SubCommand) Class.forName("me.lucko.luckperms.bukkit.migration.MigrationPermissionsEx").newInstance()); } catch (Throwable ignored) {} try { Class.forName("com.github.cheesesoftware.PowerfulPermsAPI.PowerfulPermsPlugin"); - subCommands.add(new MigrationPowerfulPerms()); + subCommands.add((SubCommand) Class.forName("me.lucko.luckperms.bukkit.migration.MigrationPowerfulPerms").newInstance()); } catch (Throwable ignored) {} try { Class.forName("org.tyrannyofheaven.bukkit.zPermissions.ZPermissionsService"); - subCommands.add(new MigrationZPermissions()); + subCommands.add((SubCommand) Class.forName("me.lucko.luckperms.bukkit.migration.MigrationZPermissions").newInstance()); } catch (Throwable ignored) {} try { Class.forName("net.alpenblock.bungeeperms.BungeePerms"); - subCommands.add(new MigrationBungeePerms()); + subCommands.add((SubCommand) Class.forName("me.lucko.luckperms.bungee.migration.MigrationBungeePerms").newInstance()); } catch (Throwable ignored) {} try { Class.forName("de.bananaco.bpermissions.api.WorldManager"); - subCommands.add(new MigrationBPermissions()); + subCommands.add((SubCommand) Class.forName("me.lucko.luckperms.bukkit.migration.MigrationBPermissions").newInstance()); } catch (Throwable ignored) {} - } @Override