diff --git a/pom.xml b/pom.xml index 4daa446..9fcf976 100644 --- a/pom.xml +++ b/pom.xml @@ -93,6 +93,11 @@ commons-net 3.11.0 + + org.apache.commons + commons-lang3 + 3.17.0 + org.bstats bstats-bukkit diff --git a/src/main/java/ru/dvdishka/backuper/Backuper.java b/src/main/java/ru/dvdishka/backuper/Backuper.java index 9815e89..ae1a7a1 100644 --- a/src/main/java/ru/dvdishka/backuper/Backuper.java +++ b/src/main/java/ru/dvdishka/backuper/Backuper.java @@ -72,7 +72,7 @@ public void onEnable() { public void onLoad() { - CommandAPI.onLoad(new CommandAPIBukkitConfig(this).useLatestNMSVersion(true)); + CommandAPI.onLoad(new CommandAPIBukkitConfig(this).useLatestNMSVersion(false)); } public void onDisable() { diff --git a/src/main/java/ru/dvdishka/backuper/backend/tasks/sftp/SftpDeleteDirTask.java b/src/main/java/ru/dvdishka/backuper/backend/tasks/sftp/SftpDeleteDirTask.java index b4c3352..61a1252 100644 --- a/src/main/java/ru/dvdishka/backuper/backend/tasks/sftp/SftpDeleteDirTask.java +++ b/src/main/java/ru/dvdishka/backuper/backend/tasks/sftp/SftpDeleteDirTask.java @@ -3,7 +3,7 @@ import com.jcraft.jsch.ChannelSftp; import com.jcraft.jsch.Session; import com.jcraft.jsch.SftpATTRS; -import it.unimi.dsi.fastutil.Pair; +import org.apache.commons.lang3.tuple.Pair; import org.bukkit.command.CommandSender; import ru.dvdishka.backuper.Backuper; import ru.dvdishka.backuper.backend.common.Logger; @@ -12,7 +12,6 @@ import ru.dvdishka.backuper.backend.utils.UIUtils; import ru.dvdishka.backuper.handlers.commands.Permissions; -import java.util.ArrayList; import java.util.List; import java.util.Vector; @@ -52,8 +51,8 @@ public void run() { return; } - session = sessionChannelSftpPair.first(); - channelSftp = sessionChannelSftpPair.second(); + session = sessionChannelSftpPair.getLeft(); + channelSftp = sessionChannelSftpPair.getRight(); channelSftp.connect(10000); } diff --git a/src/main/java/ru/dvdishka/backuper/backend/tasks/sftp/SftpGetFileFolderTask.java b/src/main/java/ru/dvdishka/backuper/backend/tasks/sftp/SftpGetFileFolderTask.java index 24a5bb7..178a7d4 100644 --- a/src/main/java/ru/dvdishka/backuper/backend/tasks/sftp/SftpGetFileFolderTask.java +++ b/src/main/java/ru/dvdishka/backuper/backend/tasks/sftp/SftpGetFileFolderTask.java @@ -3,7 +3,7 @@ import com.jcraft.jsch.ChannelSftp; import com.jcraft.jsch.Session; import com.jcraft.jsch.SftpATTRS; -import it.unimi.dsi.fastutil.Pair; +import org.apache.commons.lang3.tuple.Pair; import org.bukkit.command.CommandSender; import ru.dvdishka.backuper.Backuper; import ru.dvdishka.backuper.backend.classes.SftpProgressMonitor; @@ -66,8 +66,8 @@ public void run() { return; } - session = sessionChannelSftpPair.first(); - sftpChannel = sessionChannelSftpPair.second(); + session = sessionChannelSftpPair.getLeft(); + sftpChannel = sessionChannelSftpPair.getRight(); sftpChannel.connect(10000); } diff --git a/src/main/java/ru/dvdishka/backuper/backend/tasks/sftp/SftpSendFileFolderTask.java b/src/main/java/ru/dvdishka/backuper/backend/tasks/sftp/SftpSendFileFolderTask.java index a3c7ed0..3ca61cf 100644 --- a/src/main/java/ru/dvdishka/backuper/backend/tasks/sftp/SftpSendFileFolderTask.java +++ b/src/main/java/ru/dvdishka/backuper/backend/tasks/sftp/SftpSendFileFolderTask.java @@ -3,7 +3,7 @@ import com.jcraft.jsch.ChannelSftp; import com.jcraft.jsch.JSchException; import com.jcraft.jsch.Session; -import it.unimi.dsi.fastutil.Pair; +import org.apache.commons.lang3.tuple.Pair; import org.bukkit.command.CommandSender; import ru.dvdishka.backuper.Backuper; import ru.dvdishka.backuper.backend.classes.SftpProgressMonitor; @@ -15,8 +15,6 @@ import ru.dvdishka.backuper.handlers.commands.Permissions; import java.io.File; -import java.io.IOException; -import java.io.InterruptedIOException; import java.util.ArrayList; import java.util.Arrays; import java.util.List; @@ -69,8 +67,8 @@ public void run() { return; } - sshSession = sessionChannelSftpPair.first(); - sftpChannel = sessionChannelSftpPair.second(); + sshSession = sessionChannelSftpPair.getLeft(); + sftpChannel = sessionChannelSftpPair.getRight(); if (sftpChannel == null) { return; diff --git a/src/main/java/ru/dvdishka/backuper/backend/utils/SftpUtils.java b/src/main/java/ru/dvdishka/backuper/backend/utils/SftpUtils.java index 110361d..b341210 100644 --- a/src/main/java/ru/dvdishka/backuper/backend/utils/SftpUtils.java +++ b/src/main/java/ru/dvdishka/backuper/backend/utils/SftpUtils.java @@ -5,7 +5,7 @@ import com.jcraft.jsch.JSchException; import com.jcraft.jsch.OpenSSHConfig; import com.jcraft.jsch.Session; -import it.unimi.dsi.fastutil.Pair; +import org.apache.commons.lang3.tuple.Pair; import org.bukkit.command.CommandSender; import ru.dvdishka.backuper.backend.common.Logger; import ru.dvdishka.backuper.backend.config.Config; @@ -55,10 +55,10 @@ public static boolean checkConnection(CommandSender sender) { boolean connected = channelSftp != null; try { - channelSftp.first().disconnect(); + channelSftp.getLeft().disconnect(); } catch (Exception ignored) {} try { - channelSftp.second().exit(); + channelSftp.getRight().exit(); } catch (Exception ignored) {} return connected; @@ -144,8 +144,8 @@ public static void createFolder(String remoteFolderPath, CommandSender sender) { Pair sessionChannelSftpPair = createChannel(sender); - Session session = sessionChannelSftpPair.first(); - ChannelSftp sftpChannel = sessionChannelSftpPair.second(); + Session session = sessionChannelSftpPair.getLeft(); + ChannelSftp sftpChannel = sessionChannelSftpPair.getRight(); if (sftpChannel == null) { return; @@ -185,8 +185,8 @@ public static void renameFile(String remoteFilePath, String newFilePath, Command Pair sessionChannelSftpPair = createChannel(sender); - Session session = sessionChannelSftpPair.first(); - ChannelSftp sftpChannel = sessionChannelSftpPair.second(); + Session session = sessionChannelSftpPair.getLeft(); + ChannelSftp sftpChannel = sessionChannelSftpPair.getRight(); if (sftpChannel == null) { return; @@ -218,8 +218,8 @@ public static ArrayList ls(String remoteFolderPath, CommandSender sender Pair sessionChannelSftpPair = createChannel(sender); - Session session = sessionChannelSftpPair.first(); - ChannelSftp sftpChannel = sessionChannelSftpPair.second(); + Session session = sessionChannelSftpPair.getLeft(); + ChannelSftp sftpChannel = sessionChannelSftpPair.getRight(); if (sftpChannel == null) { return null; @@ -260,8 +260,8 @@ public static long getDirByteSize(String remoteFilePath, CommandSender sender) { Pair sessionChannelSftpPair = createChannel(sender); - Session session = sessionChannelSftpPair.first(); - ChannelSftp sftpChannel = sessionChannelSftpPair.second(); + Session session = sessionChannelSftpPair.getLeft(); + ChannelSftp sftpChannel = sessionChannelSftpPair.getRight(); if (sftpChannel == null) { return 0;