diff --git a/dependency-reduced-pom.xml b/dependency-reduced-pom.xml new file mode 100644 index 0000000..8a2aada --- /dev/null +++ b/dependency-reduced-pom.xml @@ -0,0 +1,94 @@ + + + 4.0.0 + com.drtshock + PlayerVaultsX + PlayerVaultsX + 4.0.1 + http://dev.bukkit.org/pancakes/playervaults/ + + clean install + + + true + src/main/resources/ + + *.yml + + + + PlayerVaultsX + + + maven-compiler-plugin + 2.3.2 + + 1.7 + 1.7 + + + + maven-shade-plugin + 2.4.3 + + + package + + shade + + + true + + + com.turt2live.uuid + + + + + com.turt2live.uuid + com.drtshock.playervaults.lib + + + + + + + + + + + vault-repo + http://nexus.hc.to/content/repositories/pub_releases/ + + + spigot-repo + https://hub.spigotmc.org/nexus/content/groups/public/ + + + + + org.spigotmc + spigot-api + 1.12.2-R0.1-SNAPSHOT + compile + + + net.milkbowl.vault + VaultAPI + 1.6 + compile + + + com.turt2live + UUID-Library + 0.0.1-SNAPSHOT + system + ${basedir}/lib/UUID-Library.jar + + + + SNAPSHOT + UTF-8 + + + diff --git a/lib/UUID-Library.jar b/lib/UUID-Library.jar deleted file mode 100644 index 24d7445..0000000 Binary files a/lib/UUID-Library.jar and /dev/null differ diff --git a/pom.xml b/pom.xml index 695e866..69583b2 100644 --- a/pom.xml +++ b/pom.xml @@ -34,32 +34,6 @@ 1.7 - - org.apache.maven.plugins - maven-shade-plugin - 1.5 - - - package - - shade - - - - - com.turt2live:UUID-Library - - - - - com.turt2live.uuid - com.drtshock.playervaults.lib.uuid - - - - - - @@ -79,18 +53,13 @@ org.spigotmc spigot-api 1.12.2-R0.1-SNAPSHOT + provided net.milkbowl.vault VaultAPI 1.6 - - - com.turt2live - UUID-Library - 1.0 - system - ${basedir}/lib/UUID-Library.jar + provided diff --git a/src/main/java/com/drtshock/playervaults/commands/ConvertCommand.java b/src/main/java/com/drtshock/playervaults/commands/ConvertCommand.java index 88a2537..9fa71a6 100644 --- a/src/main/java/com/drtshock/playervaults/commands/ConvertCommand.java +++ b/src/main/java/com/drtshock/playervaults/commands/ConvertCommand.java @@ -5,24 +5,16 @@ import com.drtshock.playervaults.converters.BackpackConverter; import com.drtshock.playervaults.converters.Converter; import com.drtshock.playervaults.util.Lang; import com.drtshock.playervaults.vaultmanagement.VaultOperations; -import com.turt2live.uuid.CachingServiceProvider; -import com.turt2live.uuid.ServiceProvider; -import com.turt2live.uuid.turt2live.v2.ApiV2Service; -import org.bukkit.OfflinePlayer; import org.bukkit.command.Command; import org.bukkit.command.CommandExecutor; import org.bukkit.command.CommandSender; import java.util.ArrayList; -import java.util.HashMap; import java.util.List; -import java.util.Map; -import java.util.UUID; public class ConvertCommand implements CommandExecutor { private final List converters = new ArrayList<>(); - private ServiceProvider uuidProvider; public ConvertCommand() { converters.add(new BackpackConverter()); @@ -56,27 +48,15 @@ public class ConvertCommand implements CommandExecutor { PlayerVaults.getInstance().getServer().getScheduler().runTaskLaterAsynchronously(PlayerVaults.getInstance(), new Runnable() { @Override public void run() { - if (uuidProvider == null) { - CachingServiceProvider cachingUuidProvider = new CachingServiceProvider(new ApiV2Service()); - Map seed = new HashMap<>(); - - for (OfflinePlayer player : PlayerVaults.getInstance().getServer().getOfflinePlayers()) { - if (player.hasPlayedBefore()) { - seed.put(player.getUniqueId(), player.getName()); - } - } - - cachingUuidProvider.seedLoad(seed, 6 * 60 * 60); // 6 hour cache time - uuidProvider = cachingUuidProvider; - } - int converted = 0; VaultOperations.setLocked(true); + for (Converter converter : applicableConverters) { if (converter.canConvert()) { - converted += converter.run(sender, uuidProvider); + converted += converter.run(sender); } } + VaultOperations.setLocked(false); sender.sendMessage(Lang.TITLE + Lang.CONVERT_COMPLETE.toString().replace("%converted", converted + "")); } diff --git a/src/main/java/com/drtshock/playervaults/converters/BackpackConverter.java b/src/main/java/com/drtshock/playervaults/converters/BackpackConverter.java index c3c97e6..14d33cb 100644 --- a/src/main/java/com/drtshock/playervaults/converters/BackpackConverter.java +++ b/src/main/java/com/drtshock/playervaults/converters/BackpackConverter.java @@ -2,8 +2,8 @@ package com.drtshock.playervaults.converters; import com.drtshock.playervaults.PlayerVaults; import com.drtshock.playervaults.vaultmanagement.VaultManager; -import com.turt2live.uuid.PlayerRecord; -import com.turt2live.uuid.ServiceProvider; +import org.bukkit.Bukkit; +import org.bukkit.OfflinePlayer; import org.bukkit.command.CommandSender; import org.bukkit.configuration.ConfigurationSection; import org.bukkit.configuration.file.FileConfiguration; @@ -22,10 +22,7 @@ import java.util.UUID; public class BackpackConverter implements Converter { @Override - public int run(CommandSender initiator, ServiceProvider uuidProvider) { - if (uuidProvider == null) { - throw new IllegalArgumentException(); - } + public int run(CommandSender initiator) { PlayerVaults plugin = PlayerVaults.getInstance(); File destination = new File(plugin.getDataFolder().getParentFile(), "Backpack" + File.separator + "backpacks"); @@ -39,7 +36,7 @@ public class BackpackConverter implements Converter { int vaultNum = 1; for (File file : worldDirs != null ? worldDirs : new File[0]) { if (file.isDirectory()) { - converted += convert(file, vaultNum, uuidProvider); + converted += convert(file, vaultNum); vaultNum++; } } @@ -47,7 +44,7 @@ public class BackpackConverter implements Converter { return converted; } - private int convert(File worldFolder, int intoVaultNum, ServiceProvider uuidProvider) { + private int convert(File worldFolder, int intoVaultNum) { PlayerVaults plugin = PlayerVaults.getInstance(); VaultManager vaults = VaultManager.getInstance(); int converted = 0; @@ -56,11 +53,11 @@ public class BackpackConverter implements Converter { for (File file : files != null ? files : new File[0]) { if (file.isFile() && file.getName().toLowerCase().endsWith(".yml")) { try { - PlayerRecord player = uuidProvider.doLookup(file.getName().substring(0, file.getName().lastIndexOf('.'))); - if (player == null || player.getUuid() == null) { + OfflinePlayer player = Bukkit.getOfflinePlayer(file.getName().substring(0, file.getName().lastIndexOf('.'))); + if (player == null || player.getUniqueId() == null) { plugin.getLogger().warning("Unable to convert Backpack for player: " + (player != null ? player.getName() : file.getName())); } else { - UUID uuid = player.getUuid(); + UUID uuid = player.getUniqueId(); FileConfiguration yaml = YamlConfiguration.loadConfiguration(file); ConfigurationSection section = yaml.getConfigurationSection("backpack"); if (section.getKeys(false).size() <= 0) { diff --git a/src/main/java/com/drtshock/playervaults/converters/Converter.java b/src/main/java/com/drtshock/playervaults/converters/Converter.java index 6f03fa6..6e4975c 100644 --- a/src/main/java/com/drtshock/playervaults/converters/Converter.java +++ b/src/main/java/com/drtshock/playervaults/converters/Converter.java @@ -1,6 +1,5 @@ package com.drtshock.playervaults.converters; -import com.turt2live.uuid.ServiceProvider; import org.bukkit.command.CommandSender; /** @@ -14,11 +13,10 @@ public interface Converter { * Converts the other plugin's data. * * @param initiator the initiator of the conversion. May be null - * @param uuidProvider the UUID provider to use, cannot be null * * @return the number of vaults converted. Returns 0 on none converted or -1 if no vaults were converted. */ - int run(CommandSender initiator, ServiceProvider uuidProvider); + int run(CommandSender initiator); /** * Determines if this converter is applicable for converting to PlayerVaults. This may check for the existance of a