Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void run() {
- try {
- URL downloadURL = new URL("https://raw.githubusercontent.com/Khhs167/khhs167.github.io/main/oldmc/sounddl/");
- URL dataURL = new URL("https://raw.githubusercontent.com/Khhs167/khhs167.github.io/main/oldmc/sounddl/index.xml");
- DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();
- DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder();
- Document xmlFile = documentBuilder.parse(dataURL.openStream());
- NodeList resources = xmlFile.getElementsByTagName("Contents");
- for(int i = 0; i < 2; ++i) {
- for(int j = 0; j < resources.getLength(); ++j) {
- Node resource = resources.item(j);
- if(resource.getNodeType() == Node.ELEMENT_NODE) {
- Element resourceElement = (Element)resource;
- String name = ((Element)resourceElement.getElementsByTagName("Key").item(0)).getChildNodes().item(0).getNodeValue();
- long size = Long.parseLong(((Element)resourceElement.getElementsByTagName("Size").item(0)).getChildNodes().item(0).getNodeValue());
- if(size > 0L) {
- this.downloadAndInstallResource(downloadURL, name, size, i);
- if(this.closing) {
- return;
- }
- }
- }
- }
- }
- } catch (Exception exception13) {
- this.loadResource(this.resourcesFolder, "");
- exception13.printStackTrace();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment