Fix dependency download
This commit is contained in:
@@ -17,8 +17,8 @@ import java.util.stream.Collectors;
|
||||
public class SQLHost extends IHost {
|
||||
|
||||
private String host;
|
||||
private String user;
|
||||
private String port;
|
||||
private String user;
|
||||
private String password;
|
||||
private String database;
|
||||
private List<String> flags = Arrays.asList("characterEncoding=utf-8", "useSSL=false");
|
||||
@@ -28,23 +28,18 @@ public class SQLHost extends IHost {
|
||||
}
|
||||
|
||||
public SQLHost(ConfigurationSection section, Plugin plugin, boolean autoClose) {
|
||||
this(section.getString("host", "localhost"), section.getString("user", "root"), section.getString("port", "3306"), section.getString("password", ""), section.getString("database", "test"), plugin);
|
||||
this(section.getString("host", "localhost"), section.getString("port", "3306"), section.getString("user", "root"), section.getString("password", ""), section.getString("database", "test"), plugin);
|
||||
}
|
||||
|
||||
public SQLHost(String host, int port, String user, String password, String database, Plugin plugin) {
|
||||
this(host, user, String.valueOf(port), password, database, plugin, false);
|
||||
public SQLHost(String host, String port, String user, String password, String database, Plugin plugin) {
|
||||
this(host, port, user, password, database, plugin, false);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public SQLHost(String host, String user, String port, String password, String database, Plugin plugin) {
|
||||
this(host, user, port, password, database, plugin, false);
|
||||
}
|
||||
|
||||
public SQLHost(String host, String user, String port, String password, String database, Plugin plugin, boolean autoClose) {
|
||||
public SQLHost(String host, String port, String user, String password, String database, Plugin plugin, boolean autoClose) {
|
||||
super(plugin, autoClose);
|
||||
this.host = host;
|
||||
this.user = user;
|
||||
this.port = port;
|
||||
this.user = user;
|
||||
this.password = password;
|
||||
this.database = database;
|
||||
}
|
||||
|
||||
@@ -58,7 +58,6 @@ public class TDependency {
|
||||
|
||||
private static boolean downloadMaven(String url, String groupId, String artifactId, String version, File target, String dl) {
|
||||
TLocale.Logger.info("DEPENDENCY.DOWNLOAD-START", target.getName());
|
||||
Files.toFile(Files.readFromURL(dl.length() == 0 ? url + "/" + groupId.replace('.', '/') + "/" + artifactId + "/" + version + "/" + artifactId + "-" + version + ".jar" : dl, ""), Files.file(target));
|
||||
return target.length() > 0;
|
||||
return Files.downloadFile(dl.length() == 0 ? url + "/" + groupId.replace('.', '/') + "/" + artifactId + "/" + version + "/" + artifactId + "-" + version + ".jar" : dl, Files.file(target));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package io.izzel.taboolib.module.dependency;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
|
||||
import java.io.File;
|
||||
@@ -15,7 +16,7 @@ public class TDependencyLoader {
|
||||
try {
|
||||
Method method = URLClassLoader.class.getDeclaredMethod("addURL", URL.class);
|
||||
method.setAccessible(true);
|
||||
method.invoke(plugin.getClass().getClassLoader(), url);
|
||||
method.invoke(Bukkit.class.getClassLoader(), url);
|
||||
} catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
@@ -26,15 +26,15 @@ public abstract class ChannelExecutor {
|
||||
|
||||
public void addPlayerChannel(Player player) {
|
||||
addChannelService.submit(() -> {
|
||||
getPlayerChannel(player).pipeline().addBefore("packet_handler", "taboolib_packet_handler", new ChannelHandler(player));
|
||||
getPlayerChannel(player).pipeline().addBefore("packet_handler", "taboolib5_packet_handler", new ChannelHandler(player));
|
||||
});
|
||||
}
|
||||
|
||||
public void removePlayerChannel(Player player) {
|
||||
removeChannelService.submit(() -> {
|
||||
Channel playerChannel = getPlayerChannel(player);
|
||||
if (playerChannel.pipeline().get("taboolib_packet_handler") != null) {
|
||||
playerChannel.pipeline().remove("taboolib_packet_handler");
|
||||
if (playerChannel.pipeline().get("taboolib5_packet_handler") != null) {
|
||||
playerChannel.pipeline().remove("taboolib5_packet_handler");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user