Skip to content

Commit

Permalink
1. Fixed compatibility with java 16 and minecraft 1.16.5
Browse files Browse the repository at this point in the history
  • Loading branch information
DVDishka committed Sep 21, 2024
1 parent 1a22cd8 commit a9cf3dd
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 24 deletions.
5 changes: 5 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,11 @@
<artifactId>commons-net</artifactId>
<version>3.11.0</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.17.0</version>
</dependency>
<dependency>
<groupId>org.bstats</groupId>
<artifactId>bstats-bukkit</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/ru/dvdishka/backuper/Backuper.java
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;

Expand Down Expand Up @@ -52,8 +51,8 @@ public void run() {
return;
}

session = sessionChannelSftpPair.first();
channelSftp = sessionChannelSftpPair.second();
session = sessionChannelSftpPair.getLeft();
channelSftp = sessionChannelSftpPair.getRight();

channelSftp.connect(10000);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -66,8 +66,8 @@ public void run() {
return;
}

session = sessionChannelSftpPair.first();
sftpChannel = sessionChannelSftpPair.second();
session = sessionChannelSftpPair.getLeft();
sftpChannel = sessionChannelSftpPair.getRight();

sftpChannel.connect(10000);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -69,8 +67,8 @@ public void run() {
return;
}

sshSession = sessionChannelSftpPair.first();
sftpChannel = sessionChannelSftpPair.second();
sshSession = sessionChannelSftpPair.getLeft();
sftpChannel = sessionChannelSftpPair.getRight();

if (sftpChannel == null) {
return;
Expand Down
22 changes: 11 additions & 11 deletions src/main/java/ru/dvdishka/backuper/backend/utils/SftpUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -144,8 +144,8 @@ public static void createFolder(String remoteFolderPath, CommandSender sender) {

Pair<Session, ChannelSftp> sessionChannelSftpPair = createChannel(sender);

Session session = sessionChannelSftpPair.first();
ChannelSftp sftpChannel = sessionChannelSftpPair.second();
Session session = sessionChannelSftpPair.getLeft();
ChannelSftp sftpChannel = sessionChannelSftpPair.getRight();

if (sftpChannel == null) {
return;
Expand Down Expand Up @@ -185,8 +185,8 @@ public static void renameFile(String remoteFilePath, String newFilePath, Command

Pair<Session, ChannelSftp> sessionChannelSftpPair = createChannel(sender);

Session session = sessionChannelSftpPair.first();
ChannelSftp sftpChannel = sessionChannelSftpPair.second();
Session session = sessionChannelSftpPair.getLeft();
ChannelSftp sftpChannel = sessionChannelSftpPair.getRight();

if (sftpChannel == null) {
return;
Expand Down Expand Up @@ -218,8 +218,8 @@ public static ArrayList<String> ls(String remoteFolderPath, CommandSender sender

Pair<Session, ChannelSftp> sessionChannelSftpPair = createChannel(sender);

Session session = sessionChannelSftpPair.first();
ChannelSftp sftpChannel = sessionChannelSftpPair.second();
Session session = sessionChannelSftpPair.getLeft();
ChannelSftp sftpChannel = sessionChannelSftpPair.getRight();

if (sftpChannel == null) {
return null;
Expand Down Expand Up @@ -260,8 +260,8 @@ public static long getDirByteSize(String remoteFilePath, CommandSender sender) {

Pair<Session, ChannelSftp> sessionChannelSftpPair = createChannel(sender);

Session session = sessionChannelSftpPair.first();
ChannelSftp sftpChannel = sessionChannelSftpPair.second();
Session session = sessionChannelSftpPair.getLeft();
ChannelSftp sftpChannel = sessionChannelSftpPair.getRight();

if (sftpChannel == null) {
return 0;
Expand Down

0 comments on commit a9cf3dd

Please sign in to comment.