├── macapp └── Contents │ ├── PkgInfo │ ├── Resources │ └── Icon.icns │ ├── MacOS │ └── JavaApplicationStub │ └── Info.plist ├── src ├── main │ ├── resources │ │ └── assets │ │ │ ├── image │ │ │ ├── Help.png │ │ │ ├── Icon.ico │ │ │ ├── Icon.png │ │ │ ├── Error.png │ │ │ ├── Icon.icns │ │ │ ├── Warning.png │ │ │ ├── Collapsed.png │ │ │ ├── Expanded.png │ │ │ ├── StatusRed.png │ │ │ ├── FacebookIcon.png │ │ │ ├── GitHubIcon.png │ │ │ ├── RedditIcon.png │ │ │ ├── SplashScreen.png │ │ │ ├── StatusGreen.png │ │ │ ├── StatusWhite.png │ │ │ ├── StatusYellow.png │ │ │ ├── TwitterIcon.png │ │ │ ├── CreeperHostIcon.png │ │ │ ├── NewMinecraftIcon.png │ │ │ └── OldMinecraftIcon.png │ │ │ ├── toast │ │ │ └── icons │ │ │ │ ├── error.png │ │ │ │ ├── info.png │ │ │ │ ├── question.png │ │ │ │ └── warning.png │ │ │ ├── font │ │ │ └── Oswald-Regular.ttf │ │ │ └── css │ │ │ └── news.css │ └── java │ │ ├── com │ │ └── atlauncher │ │ │ ├── data │ │ │ ├── .gitignore │ │ │ ├── Download.java │ │ │ ├── DecompType.java │ │ │ ├── ExtractTo.java │ │ │ ├── Status.java │ │ │ ├── json │ │ │ │ ├── DownloadType.java │ │ │ │ ├── ExtractToType.java │ │ │ │ ├── CaseType.java │ │ │ │ ├── TheAction.java │ │ │ │ ├── ActionAfter.java │ │ │ │ ├── ActionType.java │ │ │ │ ├── DecompType.java │ │ │ │ ├── ModType.java │ │ │ │ ├── Delete.java │ │ │ │ ├── Deletes.java │ │ │ │ ├── MainClass.java │ │ │ │ ├── ExtraArguments.java │ │ │ │ ├── Library.java │ │ │ │ └── Messages.java │ │ │ ├── mojang │ │ │ │ ├── auth │ │ │ │ │ ├── ValidateRequest.java │ │ │ │ │ ├── UserType.java │ │ │ │ │ ├── RefreshRequest.java │ │ │ │ │ ├── InvalidateRequest.java │ │ │ │ │ ├── User.java │ │ │ │ │ ├── Agent.java │ │ │ │ │ ├── GameProfile.java │ │ │ │ │ └── AuthenticationRequest.java │ │ │ │ ├── api │ │ │ │ │ ├── ProfileTexture.java │ │ │ │ │ ├── ProfileResponse.java │ │ │ │ │ ├── UserPropertyRaw.java │ │ │ │ │ ├── UserProperty.java │ │ │ │ │ └── MinecraftProfileResponse.java │ │ │ │ ├── Property.java │ │ │ │ ├── OperatingSystemRule.java │ │ │ │ ├── ExtractRule.java │ │ │ │ ├── MojangConstants.java │ │ │ │ ├── AssetIndex.java │ │ │ │ ├── AssetObject.java │ │ │ │ ├── FileTypeAdapter.java │ │ │ │ ├── OperatingSystem.java │ │ │ │ ├── MojangVersion.java │ │ │ │ ├── Rule.java │ │ │ │ ├── EnumTypeAdapterFactory.java │ │ │ │ ├── Library.java │ │ │ │ └── DateTypeAdapter.java │ │ │ ├── PackType.java │ │ │ ├── Type.java │ │ │ ├── PackUsers.java │ │ │ ├── Version.java │ │ │ ├── News.java │ │ │ ├── DownloadableFile.java │ │ │ ├── Server.java │ │ │ ├── LauncherVersion.java │ │ │ ├── PackVersion.java │ │ │ ├── openmods │ │ │ │ └── OpenEyeReportResponse.java │ │ │ ├── MinecraftVersion.java │ │ │ ├── SyncAbstract.java │ │ │ └── APIResponse.java │ │ │ ├── gui │ │ │ ├── tabs │ │ │ │ ├── Tab.java │ │ │ │ ├── ToolsTab.java │ │ │ │ └── settings │ │ │ │ │ └── AbstractSettingsTab.java │ │ │ ├── components │ │ │ │ ├── BlankToolPanel.java │ │ │ │ ├── ToolsPanel.java │ │ │ │ ├── ImagePanel.java │ │ │ │ ├── JLabelWithHover.java │ │ │ │ ├── SMButton.java │ │ │ │ ├── AbstractToolPanel.java │ │ │ │ ├── Console.java │ │ │ │ ├── ServerCheckerToolPanel.java │ │ │ │ └── PackImagePanel.java │ │ │ ├── CustomLineBorder.java │ │ │ ├── layer │ │ │ │ └── BlurLayer.java │ │ │ ├── AccountsDropDownRenderer.java │ │ │ ├── card │ │ │ │ ├── ModCard.java │ │ │ │ └── NilCard.java │ │ │ ├── SplashScreen.java │ │ │ └── dialogs │ │ │ │ └── GithubIssueReporterDialog.java │ │ │ ├── evnt │ │ │ ├── listener │ │ │ │ ├── MinecraftLandListener.java │ │ │ │ ├── MinecraftLaunchListener.java │ │ │ │ ├── ReskinListener.java │ │ │ │ ├── TabChangeListener.java │ │ │ │ ├── ConsoleCloseListener.java │ │ │ │ ├── ConsoleOpenListener.java │ │ │ │ ├── SettingsListener.java │ │ │ │ └── RelocalizationListener.java │ │ │ ├── manager │ │ │ │ ├── ReskinManager.java │ │ │ │ ├── TabChangeManager.java │ │ │ │ ├── SettingsManager.java │ │ │ │ ├── ConsoleOpenManager.java │ │ │ │ ├── RelocalizationManager.java │ │ │ │ └── ConsoleCloseManager.java │ │ │ └── LogEvent.java │ │ │ ├── annot │ │ │ └── Json.java │ │ │ ├── exceptions │ │ │ ├── InvalidPack.java │ │ │ ├── InvalidMinecraftVersion.java │ │ │ └── ChunkyException.java │ │ │ ├── ExceptionStrainer.java │ │ │ ├── reporter │ │ │ ├── GithubIssue.java │ │ │ └── GithubIssueReporter.java │ │ │ ├── utils │ │ │ └── Timestamper.java │ │ │ ├── Gsons.java │ │ │ ├── writer │ │ │ └── LogEventWriter.java │ │ │ ├── Update.java │ │ │ ├── thread │ │ │ ├── LoggingThread.java │ │ │ └── PasteUpload.java │ │ │ ├── LogManager.java │ │ │ └── adapter │ │ │ └── ColorTypeAdapter.java │ │ ├── io │ │ └── github │ │ │ └── asyncronous │ │ │ └── toast │ │ │ ├── Intrinsic.java │ │ │ ├── ToasterConstants.java │ │ │ └── thread │ │ │ └── ToastAnimator.java │ │ └── de │ │ └── zh32 │ │ └── pingtest │ │ ├── QueryVersion.java │ │ ├── Response.java │ │ └── ServerListPingB18.java └── test │ └── java │ ├── TestGithubIssue.java │ └── TestLauncherVersion.java ├── .gitignore └── IntelliJ-Coding-Style.xml /macapp/Contents/PkgInfo: -------------------------------------------------------------------------------- 1 | APPL???? -------------------------------------------------------------------------------- /macapp/Contents/Resources/Icon.icns: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/questlog/ATLauncher/master/macapp/Contents/Resources/Icon.icns -------------------------------------------------------------------------------- /src/main/resources/assets/image/Help.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/questlog/ATLauncher/master/src/main/resources/assets/image/Help.png -------------------------------------------------------------------------------- /src/main/resources/assets/image/Icon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/questlog/ATLauncher/master/src/main/resources/assets/image/Icon.ico -------------------------------------------------------------------------------- /src/main/resources/assets/image/Icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/questlog/ATLauncher/master/src/main/resources/assets/image/Icon.png -------------------------------------------------------------------------------- /macapp/Contents/MacOS/JavaApplicationStub: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/questlog/ATLauncher/master/macapp/Contents/MacOS/JavaApplicationStub -------------------------------------------------------------------------------- /src/main/resources/assets/image/Error.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/questlog/ATLauncher/master/src/main/resources/assets/image/Error.png -------------------------------------------------------------------------------- /src/main/resources/assets/image/Icon.icns: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/questlog/ATLauncher/master/src/main/resources/assets/image/Icon.icns -------------------------------------------------------------------------------- /src/main/resources/assets/image/Warning.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/questlog/ATLauncher/master/src/main/resources/assets/image/Warning.png -------------------------------------------------------------------------------- /src/main/resources/assets/image/Collapsed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/questlog/ATLauncher/master/src/main/resources/assets/image/Collapsed.png -------------------------------------------------------------------------------- /src/main/resources/assets/image/Expanded.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/questlog/ATLauncher/master/src/main/resources/assets/image/Expanded.png -------------------------------------------------------------------------------- /src/main/resources/assets/image/StatusRed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/questlog/ATLauncher/master/src/main/resources/assets/image/StatusRed.png -------------------------------------------------------------------------------- /src/main/resources/assets/image/FacebookIcon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/questlog/ATLauncher/master/src/main/resources/assets/image/FacebookIcon.png -------------------------------------------------------------------------------- /src/main/resources/assets/image/GitHubIcon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/questlog/ATLauncher/master/src/main/resources/assets/image/GitHubIcon.png -------------------------------------------------------------------------------- /src/main/resources/assets/image/RedditIcon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/questlog/ATLauncher/master/src/main/resources/assets/image/RedditIcon.png -------------------------------------------------------------------------------- /src/main/resources/assets/image/SplashScreen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/questlog/ATLauncher/master/src/main/resources/assets/image/SplashScreen.png -------------------------------------------------------------------------------- /src/main/resources/assets/image/StatusGreen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/questlog/ATLauncher/master/src/main/resources/assets/image/StatusGreen.png -------------------------------------------------------------------------------- /src/main/resources/assets/image/StatusWhite.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/questlog/ATLauncher/master/src/main/resources/assets/image/StatusWhite.png -------------------------------------------------------------------------------- /src/main/resources/assets/image/StatusYellow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/questlog/ATLauncher/master/src/main/resources/assets/image/StatusYellow.png -------------------------------------------------------------------------------- /src/main/resources/assets/image/TwitterIcon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/questlog/ATLauncher/master/src/main/resources/assets/image/TwitterIcon.png -------------------------------------------------------------------------------- /src/main/resources/assets/toast/icons/error.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/questlog/ATLauncher/master/src/main/resources/assets/toast/icons/error.png -------------------------------------------------------------------------------- /src/main/resources/assets/toast/icons/info.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/questlog/ATLauncher/master/src/main/resources/assets/toast/icons/info.png -------------------------------------------------------------------------------- /src/main/resources/assets/font/Oswald-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/questlog/ATLauncher/master/src/main/resources/assets/font/Oswald-Regular.ttf -------------------------------------------------------------------------------- /src/main/resources/assets/toast/icons/question.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/questlog/ATLauncher/master/src/main/resources/assets/toast/icons/question.png -------------------------------------------------------------------------------- /src/main/resources/assets/toast/icons/warning.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/questlog/ATLauncher/master/src/main/resources/assets/toast/icons/warning.png -------------------------------------------------------------------------------- /src/main/resources/assets/image/CreeperHostIcon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/questlog/ATLauncher/master/src/main/resources/assets/image/CreeperHostIcon.png -------------------------------------------------------------------------------- /src/main/resources/assets/image/NewMinecraftIcon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/questlog/ATLauncher/master/src/main/resources/assets/image/NewMinecraftIcon.png -------------------------------------------------------------------------------- /src/main/resources/assets/image/OldMinecraftIcon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/questlog/ATLauncher/master/src/main/resources/assets/image/OldMinecraftIcon.png -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Ignore Everything 2 | /* 3 | /*/ 4 | 5 | # Except These 6 | !/src/ 7 | !/macapp/ 8 | !/.gitignore 9 | !/LICENSE 10 | !/README.md 11 | !/pom.xml 12 | !/IntelliJ-Coding-Style.xml 13 | -------------------------------------------------------------------------------- /src/main/java/com/atlauncher/data/.gitignore: -------------------------------------------------------------------------------- 1 | # Don't remove this, this is necessary to generate correct server details for the Launcher 2 | # Please read the README.md at the base of the repo for more information 3 | 4 | Constants.java -------------------------------------------------------------------------------- /src/main/java/io/github/asyncronous/toast/Intrinsic.java: -------------------------------------------------------------------------------- 1 | package io.github.asyncronous.toast; 2 | 3 | import java.lang.annotation.Retention; 4 | import java.lang.annotation.RetentionPolicy; 5 | 6 | @Retention(RetentionPolicy.SOURCE) 7 | public @interface Intrinsic { 8 | } -------------------------------------------------------------------------------- /src/test/java/TestGithubIssue.java: -------------------------------------------------------------------------------- 1 | import com.atlauncher.reporter.GithubIssue; 2 | import org.junit.Test; 3 | 4 | public final class TestGithubIssue{ 5 | @Test 6 | public void test(){ 7 | GithubIssue issue = new GithubIssue("Test", "Test"); 8 | System.out.println(issue); 9 | } 10 | } -------------------------------------------------------------------------------- /src/main/resources/assets/css/news.css: -------------------------------------------------------------------------------- 1 | A { 2 | color: #0088CC; 3 | } 4 | 5 | #newsHeader { 6 | font-weight: bold; 7 | font-size: 14px; 8 | color: #339933; 9 | } 10 | 11 | #newsBody { 12 | font-size: 10px; 13 | padding-left: 10px; 14 | padding-right: 10px; 15 | padding-top: 10px; 16 | } -------------------------------------------------------------------------------- /src/main/java/de/zh32/pingtest/QueryVersion.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2013 and onwards by ATLauncher and Contributors 3 | * 4 | * This work is licensed under the GNU General Public License v3.0. 5 | * Link to license: http://www.gnu.org/licenses/gpl-3.0.txt. 6 | */ 7 | package de.zh32.pingtest; 8 | 9 | public enum QueryVersion { 10 | mc18b, mc14, mc16, mc17; 11 | } 12 | -------------------------------------------------------------------------------- /src/main/java/com/atlauncher/data/Download.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ATLauncher - https://github.com/ATLauncher/ATLauncher 3 | * Copyright (C) 2013 ATLauncher 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package com.atlauncher.data; 19 | 20 | public enum Download { 21 | browser, direct, server 22 | } -------------------------------------------------------------------------------- /src/main/java/com/atlauncher/data/DecompType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ATLauncher - https://github.com/ATLauncher/ATLauncher 3 | * Copyright (C) 2013 ATLauncher 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package com.atlauncher.data; 19 | 20 | public enum DecompType { 21 | jar, mods, coremods, root 22 | } 23 | -------------------------------------------------------------------------------- /src/main/java/com/atlauncher/gui/tabs/Tab.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ATLauncher - https://github.com/ATLauncher/ATLauncher 3 | * Copyright (C) 2013 ATLauncher 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package com.atlauncher.gui.tabs; 20 | 21 | public interface Tab { 22 | public String getTitle(); 23 | } -------------------------------------------------------------------------------- /IntelliJ-Coding-Style.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 9 | 21 | 22 | -------------------------------------------------------------------------------- /src/main/java/com/atlauncher/data/ExtractTo.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ATLauncher - https://github.com/ATLauncher/ATLauncher 3 | * Copyright (C) 2013 ATLauncher 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package com.atlauncher.data; 19 | 20 | public enum ExtractTo { 21 | 22 | root, mods, coremods 23 | 24 | } 25 | -------------------------------------------------------------------------------- /src/main/java/com/atlauncher/data/Status.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ATLauncher - https://github.com/ATLauncher/ATLauncher 3 | * Copyright (C) 2013 ATLauncher 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package com.atlauncher.data; 20 | 21 | public enum Status { 22 | ONLINE, OFFLINE, PARTIAL, UNKNOWN 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/com/atlauncher/data/json/DownloadType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ATLauncher - https://github.com/ATLauncher/ATLauncher 3 | * Copyright (C) 2013 ATLauncher 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package com.atlauncher.data.json; 19 | 20 | public enum DownloadType { 21 | server, browser, direct 22 | } 23 | -------------------------------------------------------------------------------- /src/main/java/com/atlauncher/data/json/ExtractToType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ATLauncher - https://github.com/ATLauncher/ATLauncher 3 | * Copyright (C) 2013 ATLauncher 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package com.atlauncher.data.json; 19 | 20 | public enum ExtractToType { 21 | root, mods, coremods 22 | } 23 | -------------------------------------------------------------------------------- /src/main/java/com/atlauncher/evnt/listener/MinecraftLandListener.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ATLauncher - https://github.com/ATLauncher/ATLauncher 3 | * Copyright (C) 2013 ATLauncher 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package com.atlauncher.evnt.listener; 20 | 21 | public interface MinecraftLandListener { 22 | 23 | } -------------------------------------------------------------------------------- /src/main/java/com/atlauncher/evnt/listener/MinecraftLaunchListener.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ATLauncher - https://github.com/ATLauncher/ATLauncher 3 | * Copyright (C) 2013 ATLauncher 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package com.atlauncher.evnt.listener; 20 | 21 | public interface MinecraftLaunchListener { 22 | 23 | } -------------------------------------------------------------------------------- /src/main/java/com/atlauncher/evnt/listener/ReskinListener.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ATLauncher - https://github.com/ATLauncher/ATLauncher 3 | * Copyright (C) 2013 ATLauncher 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package com.atlauncher.evnt.listener; 20 | 21 | public interface ReskinListener { 22 | public void onReskin(); 23 | } -------------------------------------------------------------------------------- /src/main/java/com/atlauncher/evnt/listener/TabChangeListener.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ATLauncher - https://github.com/ATLauncher/ATLauncher 3 | * Copyright (C) 2013 ATLauncher 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package com.atlauncher.evnt.listener; 20 | 21 | public interface TabChangeListener{ 22 | public void on(); 23 | } -------------------------------------------------------------------------------- /src/main/java/com/atlauncher/evnt/listener/ConsoleCloseListener.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ATLauncher - https://github.com/ATLauncher/ATLauncher 3 | * Copyright (C) 2013 ATLauncher 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package com.atlauncher.evnt.listener; 20 | 21 | public interface ConsoleCloseListener { 22 | public void onConsoleClose(); 23 | } -------------------------------------------------------------------------------- /src/main/java/com/atlauncher/evnt/listener/ConsoleOpenListener.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ATLauncher - https://github.com/ATLauncher/ATLauncher 3 | * Copyright (C) 2013 ATLauncher 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package com.atlauncher.evnt.listener; 20 | 21 | public interface ConsoleOpenListener { 22 | public void onConsoleOpen(); 23 | } -------------------------------------------------------------------------------- /src/main/java/com/atlauncher/evnt/listener/SettingsListener.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ATLauncher - https://github.com/ATLauncher/ATLauncher 3 | * Copyright (C) 2013 ATLauncher 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package com.atlauncher.evnt.listener; 20 | 21 | public interface SettingsListener { 22 | public void onSettingsSaved(); 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/com/atlauncher/data/json/CaseType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ATLauncher - https://github.com/ATLauncher/ATLauncher 3 | * Copyright (C) 2013 ATLauncher 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package com.atlauncher.data.json; 19 | 20 | import com.atlauncher.annot.Json; 21 | 22 | @Json 23 | public enum CaseType { 24 | upper, lower 25 | } 26 | -------------------------------------------------------------------------------- /src/main/java/com/atlauncher/data/json/TheAction.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ATLauncher - https://github.com/ATLauncher/ATLauncher 3 | * Copyright (C) 2013 ATLauncher 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package com.atlauncher.data.json; 19 | 20 | import com.atlauncher.annot.Json; 21 | 22 | @Json 23 | public enum TheAction { 24 | createZip, rename 25 | } 26 | -------------------------------------------------------------------------------- /src/main/java/com/atlauncher/data/json/ActionAfter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ATLauncher - https://github.com/ATLauncher/ATLauncher 3 | * Copyright (C) 2013 ATLauncher 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package com.atlauncher.data.json; 19 | 20 | import com.atlauncher.annot.Json; 21 | 22 | @Json 23 | public enum ActionAfter { 24 | delete, nothing 25 | } 26 | -------------------------------------------------------------------------------- /src/main/java/com/atlauncher/data/json/ActionType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ATLauncher - https://github.com/ATLauncher/ATLauncher 3 | * Copyright (C) 2013 ATLauncher 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package com.atlauncher.data.json; 19 | 20 | import com.atlauncher.annot.Json; 21 | 22 | @Json 23 | public enum ActionType { 24 | jar, mods, coremods 25 | } 26 | -------------------------------------------------------------------------------- /src/main/java/com/atlauncher/evnt/listener/RelocalizationListener.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ATLauncher - https://github.com/ATLauncher/ATLauncher 3 | * Copyright (C) 2013 ATLauncher 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package com.atlauncher.evnt.listener; 20 | 21 | public interface RelocalizationListener { 22 | public void onRelocalization(); 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/com/atlauncher/data/json/DecompType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ATLauncher - https://github.com/ATLauncher/ATLauncher 3 | * Copyright (C) 2013 ATLauncher 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package com.atlauncher.data.json; 19 | 20 | import com.atlauncher.annot.Json; 21 | 22 | @Json 23 | public enum DecompType { 24 | jar, mods, coremods, root 25 | } 26 | -------------------------------------------------------------------------------- /src/main/java/com/atlauncher/gui/components/BlankToolPanel.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ATLauncher - https://github.com/ATLauncher/ATLauncher 3 | * Copyright (C) 2013 ATLauncher 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package com.atlauncher.gui.components; 19 | 20 | public class BlankToolPanel extends AbstractToolPanel { 21 | /** 22 | * Auto generated serial. 23 | */ 24 | private static final long serialVersionUID = -5618131685589325394L; 25 | } -------------------------------------------------------------------------------- /src/main/java/com/atlauncher/data/mojang/auth/ValidateRequest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ATLauncher - https://github.com/ATLauncher/ATLauncher 3 | * Copyright (C) 2013 ATLauncher 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package com.atlauncher.data.mojang.auth; 19 | 20 | public class ValidateRequest { 21 | private String accessToken; 22 | 23 | public ValidateRequest(String accessToken) { 24 | this.accessToken = accessToken; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/main/java/com/atlauncher/data/PackType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ATLauncher - https://github.com/ATLauncher/ATLauncher 3 | * Copyright (C) 2013 ATLauncher 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package com.atlauncher.data; 19 | 20 | import com.google.gson.annotations.SerializedName; 21 | 22 | public enum PackType { 23 | @SerializedName("public")PUBLIC, 24 | @SerializedName("private")PRIVATE, 25 | @SerializedName("semipublic")SEMIPUBLIC 26 | } 27 | -------------------------------------------------------------------------------- /src/main/java/com/atlauncher/data/mojang/api/ProfileTexture.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ATLauncher - https://github.com/ATLauncher/ATLauncher 3 | * Copyright (C) 2013 ATLauncher 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package com.atlauncher.data.mojang.api; 19 | 20 | import com.atlauncher.annot.Json; 21 | 22 | @Json 23 | public class ProfileTexture { 24 | private String url; 25 | 26 | public String getUrl() { 27 | return this.url; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/main/java/com/atlauncher/data/Type.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ATLauncher - https://github.com/ATLauncher/ATLauncher 3 | * Copyright (C) 2013 ATLauncher 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package com.atlauncher.data; 19 | 20 | public enum Type { 21 | jar, dependency, 22 | forge, mcpc, mods, plugins, 23 | ic2lib, denlib, flan, coremods, 24 | extract, decomp, millenaire, texturepack, 25 | resourcepack, texturepackextract, resourcepackextract, 26 | shaderpack 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/com/atlauncher/data/mojang/api/ProfileResponse.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ATLauncher - https://github.com/ATLauncher/ATLauncher 3 | * Copyright (C) 2013 ATLauncher 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package com.atlauncher.data.mojang.api; 19 | 20 | public class ProfileResponse { 21 | private String name; 22 | private String id; 23 | private boolean legacy; 24 | private boolean demo; 25 | 26 | public String getId() { 27 | return this.id; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/main/java/com/atlauncher/data/mojang/Property.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ATLauncher - https://github.com/ATLauncher/ATLauncher 3 | * Copyright (C) 2013 ATLauncher 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package com.atlauncher.data.mojang; 19 | 20 | public class Property { 21 | 22 | private String name; 23 | private String value; 24 | 25 | public String getKey() { 26 | return this.name; 27 | } 28 | 29 | public String getValue() { 30 | return this.value; 31 | } 32 | 33 | } 34 | -------------------------------------------------------------------------------- /src/main/java/com/atlauncher/annot/Json.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ATLauncher - https://github.com/ATLauncher/ATLauncher 3 | * Copyright (C) 2013 ATLauncher 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package com.atlauncher.annot; 20 | 21 | import java.lang.annotation.ElementType; 22 | import java.lang.annotation.Retention; 23 | import java.lang.annotation.RetentionPolicy; 24 | import java.lang.annotation.Target; 25 | 26 | @Retention(RetentionPolicy.SOURCE) 27 | @Target(ElementType.TYPE) 28 | public @interface Json { 29 | 30 | } -------------------------------------------------------------------------------- /src/main/java/com/atlauncher/exceptions/InvalidPack.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ATLauncher - https://github.com/ATLauncher/ATLauncher 3 | * Copyright (C) 2013 ATLauncher 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package com.atlauncher.exceptions; 19 | 20 | 21 | /** 22 | * InvalidPack is thrown when searching for a Pack by ID and that ID isn't found 23 | * 24 | * @author Ryan 25 | */ 26 | public class InvalidPack extends Exception { 27 | public InvalidPack(String message) { 28 | super(message); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /macapp/Contents/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleName 6 | ATLauncher 7 | CFBundleIdentifier 8 | com.atlauncher.App 9 | CFBundleVersion 10 | %VERSION% 11 | CFBundleAllowMixedLocalizations 12 | true 13 | CFBundleExecutable 14 | JavaApplicationStub 15 | CFBundleDevelopmentRegion 16 | English 17 | CFBundlePackageType 18 | APPL 19 | CFBundleSignature 20 | ???? 21 | CFBundleInfoDictionaryVersion 22 | 6.0 23 | CFBundleIconFile 24 | Icon.icns 25 | Java 26 | 27 | WorkingDirectory 28 | $APP_PACKAGE/Contents/Resources/Java 29 | MainClass 30 | com.atlauncher.App 31 | ClassPath 32 | $JAVAROOT/ATLauncher.jar 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /src/main/java/com/atlauncher/data/json/ModType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ATLauncher - https://github.com/ATLauncher/ATLauncher 3 | * Copyright (C) 2013 ATLauncher 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package com.atlauncher.data.json; 19 | 20 | import com.atlauncher.annot.Json; 21 | 22 | @Json 23 | public enum ModType { 24 | jar, dependency, depandency, forge, mcpc, mods, plugins, ic2lib, denlib, flan, coremods, extract, decomp, 25 | millenaire, texturepack, resourcepack, texturepackextract, resourcepackextract, shaderpack 26 | } 27 | -------------------------------------------------------------------------------- /src/main/java/com/atlauncher/data/mojang/auth/UserType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ATLauncher - https://github.com/ATLauncher/ATLauncher 3 | * Copyright (C) 2013 ATLauncher 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package com.atlauncher.data.mojang.auth; 19 | 20 | public enum UserType { 21 | LEGACY("legacy"), MOJANG("mojang"); 22 | 23 | private final String name; 24 | 25 | private UserType(String name) { 26 | this.name = name; 27 | } 28 | 29 | public String getName() { 30 | return this.name; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/main/java/com/atlauncher/data/mojang/auth/RefreshRequest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ATLauncher - https://github.com/ATLauncher/ATLauncher 3 | * Copyright (C) 2013 ATLauncher 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package com.atlauncher.data.mojang.auth; 19 | 20 | public class RefreshRequest { 21 | private String accessToken; 22 | private String clientToken; 23 | 24 | public RefreshRequest(String accessToken, String clientToken) { 25 | this.accessToken = accessToken; 26 | this.clientToken = clientToken; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/main/java/com/atlauncher/data/json/Delete.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ATLauncher - https://github.com/ATLauncher/ATLauncher 3 | * Copyright (C) 2013 ATLauncher 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package com.atlauncher.data.json; 19 | 20 | import com.atlauncher.annot.Json; 21 | 22 | @Json 23 | public class Delete { 24 | private String base; 25 | private String target; 26 | 27 | public String getBase() { 28 | return this.base; 29 | } 30 | 31 | public String getTarget() { 32 | return this.target; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/com/atlauncher/data/mojang/OperatingSystemRule.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ATLauncher - https://github.com/ATLauncher/ATLauncher 3 | * Copyright (C) 2013 ATLauncher 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package com.atlauncher.data.mojang; 19 | 20 | public class OperatingSystemRule { 21 | 22 | private OperatingSystem name; 23 | private String version; 24 | 25 | public OperatingSystem getName() { 26 | return this.name; 27 | } 28 | 29 | public String getVersion() { 30 | return this.version; 31 | } 32 | 33 | } -------------------------------------------------------------------------------- /src/main/java/com/atlauncher/data/mojang/auth/InvalidateRequest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ATLauncher - https://github.com/ATLauncher/ATLauncher 3 | * Copyright (C) 2013 ATLauncher 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package com.atlauncher.data.mojang.auth; 19 | 20 | public class InvalidateRequest { 21 | 22 | private String accessToken; 23 | private String clientToken; 24 | 25 | public InvalidateRequest(String accessToken, String clientToken) { 26 | this.accessToken = accessToken; 27 | this.clientToken = clientToken; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/main/java/com/atlauncher/exceptions/InvalidMinecraftVersion.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ATLauncher - https://github.com/ATLauncher/ATLauncher 3 | * Copyright (C) 2013 ATLauncher 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package com.atlauncher.exceptions; 19 | 20 | /** 21 | * InvalidMinecraftVersion is thrown when a given Minecraft version number isn't supported by the Launcher 22 | * 23 | * @author Ryan 24 | */ 25 | public class InvalidMinecraftVersion extends Exception { 26 | public InvalidMinecraftVersion(String message) { 27 | super(message); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/main/java/com/atlauncher/exceptions/ChunkyException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ATLauncher - https://github.com/ATLauncher/ATLauncher 3 | * Copyright (C) 2013 ATLauncher 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package com.atlauncher.exceptions; 20 | 21 | public final class ChunkyException extends RuntimeException { 22 | public ChunkyException(String ex) { 23 | super(ex); 24 | } 25 | 26 | public ChunkyException(String ex, Throwable t) { 27 | super(ex, t); 28 | } 29 | 30 | public ChunkyException(Throwable t) { 31 | super(t); 32 | } 33 | } -------------------------------------------------------------------------------- /src/main/java/com/atlauncher/data/json/Deletes.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ATLauncher - https://github.com/ATLauncher/ATLauncher 3 | * Copyright (C) 2013 ATLauncher 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package com.atlauncher.data.json; 19 | 20 | import com.atlauncher.annot.Json; 21 | 22 | import java.util.List; 23 | 24 | @Json 25 | public class Deletes { 26 | private List files; 27 | private List folders; 28 | 29 | public List getFiles() { 30 | return this.files; 31 | } 32 | 33 | public List getFolders() { 34 | return this.folders; 35 | } 36 | } -------------------------------------------------------------------------------- /src/main/java/com/atlauncher/data/mojang/auth/User.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ATLauncher - https://github.com/ATLauncher/ATLauncher 3 | * Copyright (C) 2013 ATLauncher 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package com.atlauncher.data.mojang.auth; 19 | 20 | import com.atlauncher.data.mojang.Property; 21 | 22 | import java.util.List; 23 | 24 | public class User { 25 | 26 | private String id; 27 | private List properties; 28 | 29 | public String getId() { 30 | return this.id; 31 | } 32 | 33 | public List getProperties() { 34 | return this.properties; 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/com/atlauncher/data/mojang/auth/Agent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ATLauncher - https://github.com/ATLauncher/ATLauncher 3 | * Copyright (C) 2013 ATLauncher 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package com.atlauncher.data.mojang.auth; 19 | 20 | public class Agent { 21 | 22 | private final String name; 23 | private final int version; 24 | 25 | public Agent(String name, int version) { 26 | this.name = name; 27 | this.version = version; 28 | } 29 | 30 | public String getName() { 31 | return this.name; 32 | } 33 | 34 | public int getVersion() { 35 | return this.version; 36 | } 37 | 38 | } 39 | -------------------------------------------------------------------------------- /src/main/java/com/atlauncher/ExceptionStrainer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ATLauncher - https://github.com/ATLauncher/ATLauncher 3 | * Copyright (C) 2013 ATLauncher 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package com.atlauncher; 20 | 21 | public final class ExceptionStrainer implements Thread.UncaughtExceptionHandler { 22 | @Override 23 | public void uncaughtException(Thread t, Throwable e) { 24 | e.printStackTrace(); 25 | LogManager.error(e.getMessage()); 26 | for (StackTraceElement element : e.getStackTrace()) { 27 | if (element.toString() != null) { 28 | LogManager.error(element.toString()); 29 | } 30 | } 31 | } 32 | } -------------------------------------------------------------------------------- /src/main/java/com/atlauncher/data/mojang/ExtractRule.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ATLauncher - https://github.com/ATLauncher/ATLauncher 3 | * Copyright (C) 2013 ATLauncher 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package com.atlauncher.data.mojang; 19 | 20 | import java.util.List; 21 | 22 | public class ExtractRule { 23 | 24 | private List exclude; 25 | 26 | public boolean shouldExclude(String filename) { 27 | if (exclude == null) { 28 | return false; 29 | } 30 | for (String name : exclude) { 31 | if (filename.startsWith(name)) { 32 | return true; 33 | } 34 | } 35 | return false; 36 | } 37 | 38 | } 39 | -------------------------------------------------------------------------------- /src/main/java/com/atlauncher/data/mojang/MojangConstants.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ATLauncher - https://github.com/ATLauncher/ATLauncher 3 | * Copyright (C) 2013 ATLauncher 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package com.atlauncher.data.mojang; 19 | 20 | public enum MojangConstants { 21 | 22 | LIBRARIES_BASE("https://libraries.minecraft.net/"), 23 | RESOURCES_BASE("http://resources.download.minecraft.net/"), 24 | DOWNLOAD_BASE("http://s3.amazonaws.com/Minecraft.Download/"); 25 | 26 | private final String url; 27 | 28 | private MojangConstants(String url) { 29 | this.url = url; 30 | } 31 | 32 | public String getURL(String path) { 33 | return this.url + path; 34 | } 35 | } -------------------------------------------------------------------------------- /src/main/java/com/atlauncher/data/mojang/AssetIndex.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ATLauncher - https://github.com/ATLauncher/ATLauncher 3 | * Copyright (C) 2013 ATLauncher 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package com.atlauncher.data.mojang; 19 | 20 | import java.util.HashSet; 21 | import java.util.Map; 22 | 23 | public class AssetIndex { 24 | 25 | private Map objects; 26 | private boolean virtual; 27 | 28 | public Map getObjects() { 29 | return this.objects; 30 | } 31 | 32 | public HashSet getUniqueObjects() { 33 | return new HashSet(this.objects.values()); 34 | } 35 | 36 | public boolean isVirtual() { 37 | return this.virtual; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/main/java/com/atlauncher/gui/components/ToolsPanel.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ATLauncher - https://github.com/ATLauncher/ATLauncher 3 | * Copyright (C) 2013 ATLauncher 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package com.atlauncher.gui.components; 20 | 21 | import javax.swing.JButton; 22 | import javax.swing.JPanel; 23 | import java.awt.FlowLayout; 24 | 25 | public final class ToolsPanel extends JPanel { 26 | /** 27 | * Auto generated serial. 28 | */ 29 | private static final long serialVersionUID = 4409533883142880167L; 30 | 31 | public ToolsPanel() { 32 | super(new FlowLayout(FlowLayout.CENTER)); 33 | } 34 | 35 | public ToolsPanel add(JButton button) { 36 | super.add(button); 37 | return this; 38 | } 39 | } -------------------------------------------------------------------------------- /src/main/java/com/atlauncher/data/mojang/auth/GameProfile.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ATLauncher - https://github.com/ATLauncher/ATLauncher 3 | * Copyright (C) 2013 ATLauncher 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package com.atlauncher.data.mojang.auth; 19 | 20 | public class GameProfile { 21 | 22 | private final String id; 23 | private final String name; 24 | private boolean legacy; 25 | 26 | public GameProfile(String id, String name) { 27 | this.id = id; 28 | this.name = name; 29 | } 30 | 31 | public String getId() { 32 | return this.id; 33 | } 34 | 35 | public String getName() { 36 | return this.name; 37 | } 38 | 39 | public boolean isLegacy() { 40 | return this.legacy; 41 | } 42 | 43 | } -------------------------------------------------------------------------------- /src/main/java/com/atlauncher/reporter/GithubIssue.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ATLauncher - https://github.com/ATLauncher/ATLauncher 3 | * Copyright (C) 2013 ATLauncher 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package com.atlauncher.reporter; 20 | 21 | import com.atlauncher.data.Settings; 22 | 23 | @SuppressWarnings("unused") 24 | public final class GithubIssue { 25 | private final String title; 26 | private final String body; 27 | private final String[] labels; 28 | 29 | public GithubIssue(String title, String body) { 30 | this.title = title; 31 | this.body = body; 32 | this.labels = new String[]{"Bug(s)"}; 33 | } 34 | 35 | @Override 36 | public String toString() { 37 | return Settings.gson.toJson(this); 38 | } 39 | } -------------------------------------------------------------------------------- /src/main/java/com/atlauncher/data/mojang/api/UserPropertyRaw.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ATLauncher - https://github.com/ATLauncher/ATLauncher 3 | * Copyright (C) 2013 ATLauncher 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package com.atlauncher.data.mojang.api; 19 | 20 | import com.atlauncher.Gsons; 21 | import com.atlauncher.annot.Json; 22 | import com.atlauncher.utils.Base64; 23 | 24 | import java.io.IOException; 25 | 26 | @Json 27 | public class UserPropertyRaw { 28 | private String name; 29 | private String value; 30 | private String signature; 31 | 32 | public String getName() { 33 | return this.name; 34 | } 35 | 36 | public UserProperty parse() throws IOException { 37 | return Gsons.DEFAULT.fromJson(new String(Base64.decode(this.value)), UserProperty.class); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/main/java/com/atlauncher/utils/Timestamper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ATLauncher - https://github.com/ATLauncher/ATLauncher 3 | * Copyright (C) 2013 ATLauncher 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package com.atlauncher.utils; 19 | 20 | import com.atlauncher.App; 21 | 22 | import java.text.SimpleDateFormat; 23 | import java.util.Date; 24 | 25 | public final class Timestamper { 26 | private static final SimpleDateFormat format = new SimpleDateFormat(App.settings.getDateFormat() + " HH:mm:ss a"); 27 | 28 | public static String now() { 29 | return format.format(new Date()); 30 | } 31 | 32 | public static String was(Date date) { 33 | return format.format(date); 34 | } 35 | 36 | public static void updateDateFormat() { 37 | format.applyLocalizedPattern(App.settings.getDateFormat() + " HH:mm:ss a"); 38 | } 39 | } -------------------------------------------------------------------------------- /src/main/java/com/atlauncher/data/mojang/AssetObject.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ATLauncher - https://github.com/ATLauncher/ATLauncher 3 | * Copyright (C) 2013 ATLauncher 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package com.atlauncher.data.mojang; 19 | 20 | import com.atlauncher.utils.Utils; 21 | 22 | import java.io.File; 23 | 24 | public class AssetObject { 25 | private String hash; 26 | private long size; 27 | 28 | public String getHash() { 29 | return hash; 30 | } 31 | 32 | public long getSize() { 33 | return size; 34 | } 35 | 36 | public boolean needToDownload(File file) { 37 | if (!file.exists() || !file.isFile()) { 38 | return true; 39 | } 40 | if (file.length() != this.size) { 41 | return true; 42 | } 43 | return !this.hash.equalsIgnoreCase(Utils.getSHA1(file)); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /src/main/java/com/atlauncher/data/json/MainClass.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ATLauncher - https://github.com/ATLauncher/ATLauncher 3 | * Copyright (C) 2013 ATLauncher 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package com.atlauncher.data.json; 19 | 20 | import com.atlauncher.annot.Json; 21 | 22 | @Json 23 | public class MainClass { 24 | private String mainClass; 25 | private String depends; 26 | private String dependsGroup; 27 | 28 | public String getMainClass() { 29 | return this.mainClass; 30 | } 31 | 32 | public String getDepends() { 33 | return this.depends; 34 | } 35 | 36 | public String getDependsGroup() { 37 | return this.dependsGroup; 38 | } 39 | 40 | public boolean hasDepends() { 41 | return this.depends != null; 42 | } 43 | 44 | public boolean hasDependsGroup() { 45 | return this.dependsGroup != null; 46 | } 47 | } -------------------------------------------------------------------------------- /src/main/java/com/atlauncher/data/mojang/api/UserProperty.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ATLauncher - https://github.com/ATLauncher/ATLauncher 3 | * Copyright (C) 2013 ATLauncher 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package com.atlauncher.data.mojang.api; 19 | 20 | import com.atlauncher.LogManager; 21 | import com.atlauncher.annot.Json; 22 | 23 | import java.util.Map; 24 | 25 | @Json 26 | public class UserProperty { 27 | private long timestamp; 28 | private String profileId; 29 | private String profileName; 30 | private boolean isPublic; 31 | private Map textures; 32 | 33 | public ProfileTexture getTexture(String name) { 34 | if(!textures.containsKey(name)) { 35 | LogManager.error("No texture " + name + " for account " + this.profileName); 36 | return null; 37 | } 38 | 39 | return textures.get(name); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/main/java/com/atlauncher/data/json/ExtraArguments.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ATLauncher - https://github.com/ATLauncher/ATLauncher 3 | * Copyright (C) 2013 ATLauncher 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package com.atlauncher.data.json; 19 | 20 | import com.atlauncher.annot.Json; 21 | 22 | @Json 23 | public class ExtraArguments { 24 | private String arguments; 25 | private String depends; 26 | private String dependsGroup; 27 | 28 | public String getArguments() { 29 | return this.arguments; 30 | } 31 | 32 | public String getDepends() { 33 | return this.depends; 34 | } 35 | 36 | public String getDependsGroup() { 37 | return this.dependsGroup; 38 | } 39 | 40 | public boolean hasDepends() { 41 | return this.depends != null; 42 | } 43 | 44 | public boolean hasDependsGroup() { 45 | return this.dependsGroup != null; 46 | } 47 | } -------------------------------------------------------------------------------- /src/main/java/com/atlauncher/data/PackUsers.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ATLauncher - https://github.com/ATLauncher/ATLauncher 3 | * Copyright (C) 2013 ATLauncher 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package com.atlauncher.data; 19 | 20 | import com.atlauncher.App; 21 | import com.atlauncher.annot.Json; 22 | import com.atlauncher.exceptions.InvalidPack; 23 | 24 | import java.util.List; 25 | 26 | @Json 27 | public class PackUsers { 28 | private int pack; 29 | private List testers; 30 | private List allowedPlayers; 31 | 32 | public void addUsers() { 33 | Pack pack = null; 34 | try { 35 | pack = App.settings.getPackByID(this.pack); 36 | } catch (InvalidPack e) { 37 | App.settings.logStackTrace(e); 38 | return; 39 | } 40 | if (this.testers != null) { 41 | pack.addTesters(testers); 42 | } 43 | if (this.allowedPlayers != null) { 44 | pack.addAllowedPlayers(allowedPlayers); 45 | } 46 | } 47 | } -------------------------------------------------------------------------------- /src/main/java/com/atlauncher/data/Version.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ATLauncher - https://github.com/ATLauncher/ATLauncher 3 | * Copyright (C) 2013 ATLauncher 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package com.atlauncher.data; 19 | 20 | public class Version { 21 | private boolean isDev; 22 | private String version; 23 | private MinecraftVersion minecraftVersion; 24 | 25 | public Version(boolean isDev, String version, MinecraftVersion minecraftVersion) { 26 | this.isDev = isDev; 27 | this.version = version; 28 | this.minecraftVersion = minecraftVersion; 29 | } 30 | 31 | public boolean isDevVersion() { 32 | return this.isDev; 33 | } 34 | 35 | public String getVersion() { 36 | return this.version; 37 | } 38 | 39 | public MinecraftVersion getMinecraftVersion() { 40 | return this.minecraftVersion; 41 | } 42 | 43 | public String toString() { 44 | return this.version + " (Minecraft " + this.minecraftVersion.getVersion() + ")"; 45 | } 46 | 47 | } 48 | -------------------------------------------------------------------------------- /src/main/java/com/atlauncher/evnt/manager/ReskinManager.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ATLauncher - https://github.com/ATLauncher/ATLauncher 3 | * Copyright (C) 2013 ATLauncher 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package com.atlauncher.evnt.manager; 20 | 21 | import com.atlauncher.evnt.listener.ReskinListener; 22 | 23 | import javax.swing.SwingUtilities; 24 | import java.util.LinkedList; 25 | import java.util.List; 26 | 27 | @Deprecated 28 | public final class ReskinManager { 29 | private static final List listeners = new LinkedList(); 30 | 31 | public static synchronized void addListener(ReskinListener listener) { 32 | listeners.add(listener); 33 | } 34 | 35 | public static synchronized void post() { 36 | SwingUtilities.invokeLater(new Runnable() { 37 | @Override 38 | public void run() { 39 | for (ReskinListener listener : listeners) { 40 | listener.onReskin(); 41 | } 42 | } 43 | }); 44 | } 45 | } -------------------------------------------------------------------------------- /src/main/java/com/atlauncher/data/mojang/FileTypeAdapter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ATLauncher - https://github.com/ATLauncher/ATLauncher 3 | * Copyright (C) 2013 ATLauncher 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package com.atlauncher.data.mojang; 19 | 20 | import com.google.gson.TypeAdapter; 21 | import com.google.gson.stream.JsonReader; 22 | import com.google.gson.stream.JsonWriter; 23 | 24 | import java.io.File; 25 | import java.io.IOException; 26 | 27 | public class FileTypeAdapter extends TypeAdapter { 28 | 29 | @Override 30 | public File read(JsonReader json) throws IOException { 31 | if (json.hasNext()) { 32 | String value = json.nextString(); 33 | return value == null ? null : new File(value); 34 | } 35 | return null; 36 | } 37 | 38 | @Override 39 | public void write(JsonWriter json, File value) throws IOException { 40 | if (value == null) { 41 | json.nullValue(); 42 | } else { 43 | json.value(value.getAbsolutePath()); 44 | } 45 | } 46 | } -------------------------------------------------------------------------------- /src/main/java/com/atlauncher/data/mojang/OperatingSystem.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ATLauncher - https://github.com/ATLauncher/ATLauncher 3 | * Copyright (C) 2013 ATLauncher 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package com.atlauncher.data.mojang; 19 | 20 | public enum OperatingSystem { 21 | LINUX("linux"), WINDOWS("windows"), OSX("osx"); 22 | 23 | private final String name; 24 | 25 | private OperatingSystem(String name) { 26 | this.name = name; 27 | } 28 | 29 | public String getName() { 30 | return this.name; 31 | } 32 | 33 | public static OperatingSystem getOS() { 34 | String osName = System.getProperty("os.name").toLowerCase(); 35 | if (osName.contains("win")) { 36 | return OperatingSystem.WINDOWS; 37 | } else if (osName.contains("mac")) { 38 | return OperatingSystem.OSX; 39 | } else { 40 | return OperatingSystem.LINUX; 41 | } 42 | } 43 | 44 | public static String getVersion() { 45 | return System.getProperty("os.version"); 46 | } 47 | 48 | } 49 | -------------------------------------------------------------------------------- /src/main/java/com/atlauncher/data/mojang/api/MinecraftProfileResponse.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ATLauncher - https://github.com/ATLauncher/ATLauncher 3 | * Copyright (C) 2013 ATLauncher 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package com.atlauncher.data.mojang.api; 19 | 20 | import com.atlauncher.App; 21 | import com.atlauncher.annot.Json; 22 | 23 | import java.io.IOException; 24 | import java.util.List; 25 | 26 | @Json 27 | public class MinecraftProfileResponse { 28 | private String id; 29 | private String name; 30 | private List properties; 31 | 32 | public UserProperty getUserProperty(String name) { 33 | for (UserPropertyRaw property : this.properties) { 34 | if (property.getName().equals(name)) { 35 | try { 36 | return property.parse(); 37 | } catch (IOException e) { 38 | App.settings.logStackTrace("Error parsing user property " + name + " for username " + name, e); 39 | } 40 | } 41 | } 42 | return null; 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /src/main/java/com/atlauncher/gui/CustomLineBorder.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ATLauncher - https://github.com/ATLauncher/ATLauncher 3 | * Copyright (C) 2013 ATLauncher 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package com.atlauncher.gui; 19 | 20 | import javax.swing.border.LineBorder; 21 | import java.awt.Color; 22 | import java.awt.Component; 23 | import java.awt.Insets; 24 | 25 | public class CustomLineBorder extends LineBorder { 26 | private int insets = 0; 27 | 28 | public CustomLineBorder(int insets, Color color) { 29 | super(color); 30 | this.insets = insets; 31 | } 32 | 33 | public CustomLineBorder(int insets, Color color, int thickness) { 34 | super(color, thickness); 35 | this.insets = insets; 36 | } 37 | 38 | public CustomLineBorder(int insets, Color color, int thickness, boolean rounded) { 39 | super(color, thickness, rounded); 40 | this.insets = insets; 41 | } 42 | 43 | @Override 44 | public Insets getBorderInsets(Component c, Insets insets) { 45 | return new Insets(this.insets, this.insets, this.insets, this.insets); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /src/main/java/com/atlauncher/data/mojang/MojangVersion.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ATLauncher - https://github.com/ATLauncher/ATLauncher 3 | * Copyright (C) 2013 ATLauncher 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package com.atlauncher.data.mojang; 19 | 20 | import java.util.List; 21 | 22 | public class MojangVersion { 23 | 24 | private String id; 25 | private String minecraftArguments; 26 | private String assets; 27 | private List libraries; 28 | private List rules; 29 | private String mainClass; 30 | 31 | public String getId() { 32 | return id; 33 | } 34 | 35 | public String getMinecraftArguments() { 36 | return this.minecraftArguments; 37 | } 38 | 39 | public String getAssets() { 40 | if (this.assets == null) { 41 | return "legacy"; 42 | } 43 | return this.assets; 44 | } 45 | 46 | public List getLibraries() { 47 | return this.libraries; 48 | } 49 | 50 | public List getRules() { 51 | return this.rules; 52 | } 53 | 54 | public String getMainClass() { 55 | return this.mainClass; 56 | } 57 | 58 | } 59 | -------------------------------------------------------------------------------- /src/main/java/com/atlauncher/data/mojang/Rule.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ATLauncher - https://github.com/ATLauncher/ATLauncher 3 | * Copyright (C) 2013 ATLauncher 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package com.atlauncher.data.mojang; 19 | 20 | import java.util.regex.Matcher; 21 | import java.util.regex.Pattern; 22 | 23 | enum Action { 24 | ALLOW, DISALLOW 25 | } 26 | 27 | public class Rule { 28 | 29 | private Action action; // If it should be allowed 30 | private OperatingSystemRule os; // The OS this rule applies to 31 | 32 | public boolean ruleApplies() { 33 | if (this.os == null) { 34 | return true; 35 | } 36 | if (this.os.getName() != null && this.os.getName() != OperatingSystem.getOS()) { 37 | return false; 38 | } 39 | if (this.os.getVersion() == null) { 40 | return true; 41 | } 42 | Pattern pattern = Pattern.compile(this.os.getVersion()); 43 | Matcher matcher = pattern.matcher(OperatingSystem.getVersion()); 44 | return matcher.matches(); 45 | } 46 | 47 | public Action getAction() { 48 | return this.action; 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /src/main/java/com/atlauncher/data/News.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ATLauncher - https://github.com/ATLauncher/ATLauncher 3 | * Copyright (C) 2013 ATLauncher 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package com.atlauncher.data; 19 | 20 | import com.atlauncher.annot.Json; 21 | 22 | /** 23 | * News class contains a single news article. 24 | */ 25 | @Json 26 | public class News { 27 | /** 28 | * The title of this news article. 29 | */ 30 | private String title; 31 | 32 | /** 33 | * The number of comments on this news article. 34 | */ 35 | private int comments; 36 | 37 | /** 38 | * The link to this news article. 39 | */ 40 | private String link; 41 | 42 | /** 43 | * The content of this news article. 44 | */ 45 | private String content; 46 | 47 | /** 48 | * Gets the HTML of this object. 49 | */ 50 | public String getHTML() { 51 | return "

- " + this.title + " (" + this.comments + " " 52 | + (this.comments == 1 ? "comment" : "comments") + ")

" + "

" + this.content + 53 | "


"; 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /src/main/java/com/atlauncher/evnt/manager/TabChangeManager.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ATLauncher - https://github.com/ATLauncher/ATLauncher 3 | * Copyright (C) 2013 ATLauncher 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package com.atlauncher.evnt.manager; 20 | 21 | import com.atlauncher.evnt.listener.TabChangeListener; 22 | 23 | import java.util.LinkedList; 24 | import java.util.List; 25 | import javax.swing.SwingUtilities; 26 | 27 | public final class TabChangeManager { 28 | private static final List listeners = new LinkedList(); 29 | 30 | public static synchronized void addListener(TabChangeListener listener) { 31 | listeners.add(listener); 32 | } 33 | 34 | public static synchronized void removeListener(TabChangeListener listener) { 35 | listeners.remove(listener); 36 | } 37 | 38 | public static synchronized void post() { 39 | SwingUtilities.invokeLater(new Runnable(){ 40 | @Override 41 | public void run(){ 42 | for(TabChangeListener listener : listeners){ 43 | listener.on(); 44 | } 45 | } 46 | }); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /src/main/java/com/atlauncher/gui/components/ImagePanel.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ATLauncher - https://github.com/ATLauncher/ATLauncher 3 | * Copyright (C) 2013 ATLauncher 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package com.atlauncher.gui.components; 20 | 21 | import java.awt.Cursor; 22 | import java.awt.Dimension; 23 | import java.awt.Graphics; 24 | import java.awt.Graphics2D; 25 | import java.awt.Image; 26 | import javax.swing.JPanel; 27 | 28 | public final class ImagePanel 29 | extends JPanel { 30 | private static final Cursor HAND = new Cursor(Cursor.HAND_CURSOR); 31 | 32 | private volatile Image image; 33 | 34 | public ImagePanel(Image image) { 35 | this.image = image; 36 | this.setCursor(HAND); 37 | this.setPreferredSize(new Dimension(Math.min(image.getWidth(null), 300), Math.min(image.getWidth(null), 150))); 38 | } 39 | 40 | public void setImage(Image img){ 41 | this.image = img; 42 | this.repaint(); 43 | } 44 | 45 | @Override 46 | public void paintComponent(Graphics g) { 47 | Graphics2D g2 = (Graphics2D) g; 48 | g2.drawImage(this.image, 0, (this.getHeight() - 150) / 2, 300, 150, null); 49 | } 50 | } -------------------------------------------------------------------------------- /src/main/java/com/atlauncher/data/mojang/auth/AuthenticationRequest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ATLauncher - https://github.com/ATLauncher/ATLauncher 3 | * Copyright (C) 2013 ATLauncher 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package com.atlauncher.data.mojang.auth; 19 | 20 | public class AuthenticationRequest { 21 | 22 | private Agent agent; 23 | private String username; 24 | private String password; 25 | private String clientToken; 26 | private boolean requestUser = true; 27 | 28 | public AuthenticationRequest(String username, String password, String clientToken) { 29 | this.agent = new Agent("Minecraft", 10); 30 | this.username = username; 31 | this.password = password; 32 | this.clientToken = clientToken; 33 | } 34 | 35 | public Agent getAgent() { 36 | return agent; 37 | } 38 | 39 | public String getUsername() { 40 | return username; 41 | } 42 | 43 | public String getPassword() { 44 | return password; 45 | } 46 | 47 | public String getClientToken() { 48 | return clientToken; 49 | } 50 | 51 | public boolean isRequestUser() { 52 | return requestUser; 53 | } 54 | 55 | } 56 | -------------------------------------------------------------------------------- /src/main/java/com/atlauncher/evnt/manager/SettingsManager.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ATLauncher - https://github.com/ATLauncher/ATLauncher 3 | * Copyright (C) 2013 ATLauncher 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package com.atlauncher.evnt.manager; 20 | 21 | import com.atlauncher.evnt.listener.SettingsListener; 22 | 23 | import javax.swing.SwingUtilities; 24 | import java.util.LinkedList; 25 | import java.util.List; 26 | 27 | public final class SettingsManager { 28 | private static final List listeners = new LinkedList(); 29 | 30 | public static synchronized void addListener(SettingsListener listener) { 31 | listeners.add(listener); 32 | } 33 | 34 | public static synchronized void removeListener(SettingsListener listener) { 35 | listeners.remove(listener); 36 | } 37 | 38 | public static synchronized void post() { 39 | SwingUtilities.invokeLater(new Runnable() { 40 | @Override 41 | public void run() { 42 | for (SettingsListener listener : listeners) { 43 | listener.onSettingsSaved(); 44 | } 45 | } 46 | }); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /src/main/java/com/atlauncher/data/DownloadableFile.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ATLauncher - https://github.com/ATLauncher/ATLauncher 3 | * Copyright (C) 2013 ATLauncher 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package com.atlauncher.data; 19 | 20 | import com.atlauncher.App; 21 | 22 | import java.io.File; 23 | 24 | public class DownloadableFile { 25 | private String name; 26 | private String folder; 27 | private int size; 28 | private String md5; 29 | private String sha1; 30 | 31 | public boolean isLauncher() { 32 | return this.name.equals("Launcher"); 33 | } 34 | 35 | public String getMD5() { 36 | return this.md5; 37 | } 38 | 39 | public String getSHA1() { 40 | return this.sha1; 41 | } 42 | 43 | public Downloadable getDownloadable() { 44 | File file = new File(new File(App.settings.getConfigsDir(), this.folder), this.name); 45 | if (this.folder.equalsIgnoreCase("Skins")) { 46 | file = new File(App.settings.getSkinsDir(), this.name); 47 | } 48 | return new Downloadable("launcher/" + this.folder.toLowerCase() + "/" + this.name, file, this.sha1, 49 | this.size, null, true); 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /src/main/java/com/atlauncher/evnt/manager/ConsoleOpenManager.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ATLauncher - https://github.com/ATLauncher/ATLauncher 3 | * Copyright (C) 2013 ATLauncher 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package com.atlauncher.evnt.manager; 20 | 21 | import com.atlauncher.evnt.listener.ConsoleOpenListener; 22 | 23 | import javax.swing.SwingUtilities; 24 | import java.util.LinkedList; 25 | import java.util.List; 26 | 27 | public final class ConsoleOpenManager { 28 | private static final List listeners = new LinkedList(); 29 | 30 | public static synchronized void addListener(ConsoleOpenListener listener) { 31 | listeners.add(listener); 32 | } 33 | 34 | public static synchronized void removeListener(ConsoleOpenListener listener) { 35 | listeners.remove(listener); 36 | } 37 | 38 | public static synchronized void post() { 39 | SwingUtilities.invokeLater(new Runnable() { 40 | @Override 41 | public void run() { 42 | for (ConsoleOpenListener listener : listeners) { 43 | listener.onConsoleOpen(); 44 | } 45 | } 46 | }); 47 | } 48 | } -------------------------------------------------------------------------------- /src/main/java/com/atlauncher/Gsons.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ATLauncher - https://github.com/ATLauncher/ATLauncher 3 | * Copyright (C) 2013 ATLauncher 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package com.atlauncher; 20 | 21 | import com.atlauncher.adapter.ColorTypeAdapter; 22 | import com.atlauncher.data.mojang.DateTypeAdapter; 23 | import com.atlauncher.data.mojang.EnumTypeAdapterFactory; 24 | import com.atlauncher.data.mojang.FileTypeAdapter; 25 | import com.google.gson.Gson; 26 | import com.google.gson.GsonBuilder; 27 | 28 | import java.awt.Color; 29 | import java.io.File; 30 | import java.util.Date; 31 | 32 | public final class Gsons { 33 | public static final Gson DEFAULT = new GsonBuilder().setPrettyPrinting().create(); 34 | 35 | public static final Gson THEMES = new GsonBuilder().setPrettyPrinting().registerTypeAdapter(Color.class, 36 | new ColorTypeAdapter()).create(); 37 | 38 | public static final Gson DEFAULT_ALT = new GsonBuilder().registerTypeAdapterFactory(new EnumTypeAdapterFactory()) 39 | .registerTypeAdapter(Date.class, new DateTypeAdapter()).registerTypeAdapter(File.class, 40 | new FileTypeAdapter()).create(); 41 | 42 | private Gsons() { 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /src/main/java/com/atlauncher/evnt/manager/RelocalizationManager.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ATLauncher - https://github.com/ATLauncher/ATLauncher 3 | * Copyright (C) 2013 ATLauncher 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package com.atlauncher.evnt.manager; 20 | 21 | import com.atlauncher.evnt.listener.RelocalizationListener; 22 | 23 | import javax.swing.SwingUtilities; 24 | import java.util.LinkedList; 25 | import java.util.List; 26 | 27 | public final class RelocalizationManager { 28 | private static final List listeners = new LinkedList(); 29 | 30 | public static synchronized void addListener(RelocalizationListener listener) { 31 | listeners.add(listener); 32 | } 33 | 34 | public static synchronized void removeListener(RelocalizationListener listener) { 35 | listeners.remove(listener); 36 | } 37 | 38 | public static synchronized void post() { 39 | SwingUtilities.invokeLater(new Runnable() { 40 | @Override 41 | public void run() { 42 | for (RelocalizationListener listener : listeners) { 43 | listener.onRelocalization(); 44 | } 45 | } 46 | }); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /src/main/java/com/atlauncher/evnt/manager/ConsoleCloseManager.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ATLauncher - https://github.com/ATLauncher/ATLauncher 3 | * Copyright (C) 2013 ATLauncher 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package com.atlauncher.evnt.manager; 20 | 21 | import com.atlauncher.evnt.listener.ConsoleCloseListener; 22 | 23 | import javax.swing.SwingUtilities; 24 | import java.util.LinkedList; 25 | import java.util.List; 26 | 27 | public final class ConsoleCloseManager { 28 | private static final List listeners = new LinkedList(); 29 | 30 | private ConsoleCloseManager() { 31 | } 32 | 33 | public static synchronized void addListener(ConsoleCloseListener listener) { 34 | listeners.add(listener); 35 | } 36 | 37 | public static synchronized void removeListener(ConsoleCloseListener listener) { 38 | listeners.remove(listener); 39 | } 40 | 41 | public static synchronized void post() { 42 | SwingUtilities.invokeLater(new Runnable() { 43 | @Override 44 | public void run() { 45 | for (ConsoleCloseListener listener : listeners) { 46 | listener.onConsoleClose(); 47 | } 48 | } 49 | }); 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /src/main/java/io/github/asyncronous/toast/ToasterConstants.java: -------------------------------------------------------------------------------- 1 | package io.github.asyncronous.toast; 2 | 3 | public interface ToasterConstants { 4 | /** 5 | * The icon for an Information Toast Notification 6 | */ 7 | public static final String INFO_ICON = "Toaster.infoIcon"; 8 | 9 | /** 10 | * The icon for an Error Toast Notification 11 | */ 12 | public static final String ERROR_ICON = "Toaster.errorIcon"; 13 | 14 | /** 15 | * The icon for a Question Toast Notification 16 | */ 17 | public static final String QUESTION_ICON = "Toaster.questionIcon"; 18 | 19 | /** 20 | * The icon for a Warning Toast Notification 21 | */ 22 | public static final String WARNING_ICON = "Toaster.warningIcon"; 23 | 24 | /** 25 | * The font for the message in the notification 26 | */ 27 | public static final String FONT = "Toaster.font"; 28 | 29 | /** 30 | * The color of the message of the notification 31 | */ 32 | public static final String MSG_COLOR = "Toaster.msgColor"; 33 | 34 | /** 35 | * The color of the border of the notification 36 | */ 37 | public static final String BORDER_COLOR = "Toaster.borderColor"; 38 | 39 | /** 40 | * The color of the background of the notification 41 | */ 42 | public static final String BG_COLOR = "Toaster.bgColor"; 43 | 44 | /** 45 | * The delay of time in milliseconds before the notification collapses 46 | */ 47 | public static final String TIME = "Toaster.time"; 48 | 49 | /** 50 | * Set if the notifications are opaque or not 51 | * 52 | * @note Will override the opacity, causing it to be redundant 53 | */ 54 | public static final String OPAQUE = "Toaster.opaque"; 55 | 56 | /** 57 | * Changes the opacity of the notifications 58 | * 59 | * @note Overridden if the notifications are set to be opaque 60 | */ 61 | public static final String OPACITY = "Toaster.opacity"; 62 | } 63 | -------------------------------------------------------------------------------- /src/main/java/com/atlauncher/gui/components/JLabelWithHover.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ATLauncher - https://github.com/ATLauncher/ATLauncher 3 | * Copyright (C) 2013 ATLauncher 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package com.atlauncher.gui.components; 19 | 20 | import com.atlauncher.App; 21 | import com.atlauncher.gui.CustomLineBorder; 22 | 23 | import javax.swing.Icon; 24 | import javax.swing.JLabel; 25 | import javax.swing.JToolTip; 26 | import javax.swing.border.Border; 27 | 28 | public class JLabelWithHover extends JLabel { 29 | private static final long serialVersionUID = -4371080285355832166L; 30 | private static final Border HOVER_BORDER = new CustomLineBorder(5, App.THEME.getHoverBorderColor(), 2); 31 | 32 | public JLabelWithHover(Icon icon, String tooltipText, Border border) { 33 | super(); 34 | super.setIcon(icon); 35 | super.setToolTipText(tooltipText); 36 | super.setBorder(border); 37 | } 38 | 39 | public JLabelWithHover(String label, Icon icon, String tooltipText) { 40 | super(label); 41 | super.setIcon(icon); 42 | super.setToolTipText(tooltipText); 43 | } 44 | 45 | @Override 46 | public JToolTip createToolTip() { 47 | JToolTip tip = super.createToolTip(); 48 | tip.setBorder(HOVER_BORDER); 49 | return tip; 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /src/main/java/com/atlauncher/gui/components/SMButton.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ATLauncher - https://github.com/ATLauncher/ATLauncher 3 | * Copyright (C) 2013 ATLauncher 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package com.atlauncher.gui.components; 20 | 21 | import com.atlauncher.App; 22 | import com.atlauncher.gui.CustomLineBorder; 23 | import com.atlauncher.utils.Utils; 24 | 25 | import javax.swing.BorderFactory; 26 | import javax.swing.ImageIcon; 27 | import javax.swing.JButton; 28 | import javax.swing.JToolTip; 29 | import javax.swing.border.Border; 30 | import java.awt.Cursor; 31 | 32 | public class SMButton extends JButton { 33 | private static final Cursor hand = new Cursor(Cursor.HAND_CURSOR); 34 | 35 | public SMButton(ImageIcon i, String tooltip) { 36 | super(i); 37 | this.setToolTipText(tooltip); 38 | this.setBorder(BorderFactory.createEmptyBorder()); 39 | this.setContentAreaFilled(false); 40 | this.setCursor(hand); 41 | } 42 | 43 | public SMButton(String i, String t) { 44 | this(Utils.getIconImage(i), t); 45 | } 46 | 47 | public JToolTip createToolTip() { 48 | JToolTip tip = super.createToolTip(); 49 | Border border = new CustomLineBorder(5, App.THEME.getHoverBorderColor(), 2); 50 | tip.setBorder(border); 51 | return tip; 52 | } 53 | } -------------------------------------------------------------------------------- /src/main/java/com/atlauncher/gui/tabs/ToolsTab.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ATLauncher - https://github.com/ATLauncher/ATLauncher 3 | * Copyright (C) 2013 ATLauncher 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package com.atlauncher.gui.tabs; 19 | 20 | import com.atlauncher.data.Language; 21 | import com.atlauncher.gui.components.BlankToolPanel; 22 | import com.atlauncher.gui.components.NetworkCheckerToolPanel; 23 | import com.atlauncher.gui.components.ServerCheckerToolPanel; 24 | 25 | import javax.swing.JPanel; 26 | import java.awt.BorderLayout; 27 | import java.awt.GridLayout; 28 | 29 | @SuppressWarnings("serial") 30 | public class ToolsTab extends JPanel implements Tab { 31 | private JPanel mainPanel; 32 | 33 | public ToolsTab() { 34 | setLayout(new BorderLayout()); 35 | 36 | mainPanel = new JPanel(); 37 | 38 | mainPanel.setLayout(new GridLayout(3, 2)); 39 | 40 | mainPanel.add(new NetworkCheckerToolPanel()); 41 | mainPanel.add(new ServerCheckerToolPanel()); 42 | mainPanel.add(new BlankToolPanel()); 43 | mainPanel.add(new BlankToolPanel()); 44 | mainPanel.add(new BlankToolPanel()); 45 | mainPanel.add(new BlankToolPanel()); 46 | 47 | add(mainPanel, BorderLayout.CENTER); 48 | } 49 | 50 | @Override 51 | public String getTitle() { 52 | return Language.INSTANCE.localize("tabs.tools"); 53 | } 54 | } -------------------------------------------------------------------------------- /src/main/java/com/atlauncher/gui/components/AbstractToolPanel.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ATLauncher - https://github.com/ATLauncher/ATLauncher 3 | * Copyright (C) 2013 ATLauncher 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package com.atlauncher.gui.components; 19 | 20 | import com.atlauncher.App; 21 | import com.atlauncher.data.Language; 22 | import com.atlauncher.utils.Utils; 23 | 24 | import javax.swing.JButton; 25 | import javax.swing.JPanel; 26 | import java.awt.BorderLayout; 27 | import java.awt.Font; 28 | 29 | public abstract class AbstractToolPanel extends JPanel { 30 | /** 31 | * Auto generated serial. 32 | */ 33 | private static final long serialVersionUID = -7755529465856056647L; 34 | 35 | protected final Font BOLD_FONT = new Font(App.THEME.getDefaultFont().getFontName(), Font.BOLD, 36 | App.THEME.getDefaultFont().getSize()).deriveFont(Utils.getBaseFontSize()); 37 | protected final JPanel TOP_PANEL = new JPanel(); 38 | protected final JPanel MIDDLE_PANEL = new JPanel(); 39 | protected final JPanel BOTTOM_PANEL = new JPanel(); 40 | 41 | protected final JButton LAUNCH_BUTTON = new JButton(Language.INSTANCE.localize("tools.launch")); 42 | 43 | public AbstractToolPanel() { 44 | setLayout(new BorderLayout()); 45 | add(TOP_PANEL, BorderLayout.NORTH); 46 | add(MIDDLE_PANEL, BorderLayout.CENTER); 47 | add(BOTTOM_PANEL, BorderLayout.SOUTH); 48 | } 49 | } -------------------------------------------------------------------------------- /src/main/java/com/atlauncher/data/json/Library.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ATLauncher - https://github.com/ATLauncher/ATLauncher 3 | * Copyright (C) 2013 ATLauncher 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package com.atlauncher.data.json; 19 | 20 | import com.atlauncher.annot.Json; 21 | 22 | @Json 23 | public class Library { 24 | private String url; 25 | private String file; 26 | private String server; 27 | private String md5; 28 | private DownloadType download; 29 | private String depends; 30 | private String dependsGroup; 31 | 32 | public String getUrl() { 33 | return this.url; 34 | } 35 | 36 | public String getFile() { 37 | return this.file; 38 | } 39 | 40 | public String getServer() { 41 | return this.server; 42 | } 43 | 44 | public String getMD5() { 45 | return this.md5; 46 | } 47 | 48 | public DownloadType getDownloadType() { 49 | return this.download; 50 | } 51 | 52 | public String getDepends() { 53 | return this.depends; 54 | } 55 | 56 | public String getDependsGroup() { 57 | return this.dependsGroup; 58 | } 59 | 60 | public boolean hasDepends() { 61 | return this.depends != null; 62 | } 63 | 64 | public boolean hasDependsGroup() { 65 | return this.dependsGroup != null; 66 | } 67 | 68 | public boolean forServer() { 69 | return this.server != null; 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /src/main/java/com/atlauncher/gui/components/Console.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ATLauncher - https://github.com/ATLauncher/ATLauncher 3 | * Copyright (C) 2013 ATLauncher 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package com.atlauncher.gui.components; 20 | 21 | import javax.swing.JTextPane; 22 | import javax.swing.text.SimpleAttributeSet; 23 | import javax.swing.text.StyleConstants; 24 | import java.awt.Color; 25 | 26 | public final class Console extends JTextPane { 27 | /** 28 | * Auto generate serial. 29 | */ 30 | private static final long serialVersionUID = 5325985090210097809L; 31 | private final SimpleAttributeSet attrs = new SimpleAttributeSet(); 32 | 33 | public Console() { 34 | this.setEditable(false); 35 | } 36 | 37 | public Console setColor(Color c) { 38 | StyleConstants.setForeground(this.attrs, c); 39 | return this; 40 | } 41 | 42 | public Console setBold(boolean b) { 43 | StyleConstants.setBold(this.attrs, b); 44 | return this; 45 | } 46 | 47 | @Override 48 | public boolean getScrollableTracksViewportWidth() { 49 | return true; // Word Wrapping 50 | } 51 | 52 | public void write(String str) { 53 | try { 54 | this.getDocument().insertString(this.getDocument().getLength(), str, this.attrs); 55 | this.setCaretPosition(this.getDocument().getLength()); 56 | } catch (Exception ex) { 57 | ex.printStackTrace(System.err); 58 | } 59 | } 60 | } -------------------------------------------------------------------------------- /src/main/java/com/atlauncher/gui/layer/BlurLayer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ATLauncher - https://github.com/ATLauncher/ATLauncher 3 | * Copyright (C) 2013 ATLauncher 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package com.atlauncher.gui.layer; 20 | 21 | import java.awt.AlphaComposite; 22 | import java.awt.Composite; 23 | import java.awt.Graphics; 24 | import java.awt.Graphics2D; 25 | import java.beans.PropertyChangeEvent; 26 | import javax.swing.JComponent; 27 | import javax.swing.JLayer; 28 | import javax.swing.JPanel; 29 | import javax.swing.plaf.LayerUI; 30 | 31 | public final class BlurLayer 32 | extends LayerUI{ 33 | private boolean blur = false; 34 | 35 | public void setBlur(boolean b){ 36 | this.firePropertyChange("blur", this.blur, b); 37 | } 38 | 39 | @Override 40 | public void applyPropertyChange(PropertyChangeEvent pce, JLayer l) { 41 | if(pce.getPropertyName().equalsIgnoreCase("blur")){ 42 | this.blur = (Boolean) pce.getNewValue(); 43 | l.repaint(); 44 | } 45 | } 46 | 47 | @Override 48 | public void paint(Graphics g, JComponent comp){ 49 | Graphics2D g2 = (Graphics2D) g; 50 | super.paint(g2, comp); 51 | 52 | if(this.blur){ 53 | g2.setComposite(alpha(0.5F)); 54 | g2.fillRect(0, 0, comp.getWidth(), comp.getHeight()); 55 | } 56 | } 57 | 58 | private Composite alpha(float f){ 59 | return AlphaComposite.getInstance(AlphaComposite.SRC_OVER, f); 60 | } 61 | } -------------------------------------------------------------------------------- /src/main/java/com/atlauncher/writer/LogEventWriter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ATLauncher - https://github.com/ATLauncher/ATLauncher 3 | * Copyright (C) 2013 ATLauncher 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package com.atlauncher.writer; 20 | 21 | import com.atlauncher.evnt.LogEvent; 22 | import com.atlauncher.exceptions.ChunkyException; 23 | 24 | import java.io.Closeable; 25 | import java.io.Flushable; 26 | import java.io.IOException; 27 | import java.io.Writer; 28 | 29 | public final class LogEventWriter implements Closeable, Flushable { 30 | private final Writer writer; 31 | 32 | public LogEventWriter(Writer writer) { 33 | if (writer == null) { 34 | throw new ChunkyException("Writer == null"); 35 | } 36 | 37 | this.writer = writer; 38 | } 39 | 40 | public void write(LogEvent event) throws IOException { 41 | if (event == null) { 42 | throw new ChunkyException("Event == null"); 43 | } else { 44 | this.writer.write(event.toString()); 45 | } 46 | } 47 | 48 | public void write(String comment) throws IOException { 49 | if (comment == null) { 50 | throw new ChunkyException("Comment == null"); 51 | } else { 52 | this.writer.write((!comment.startsWith("#") ? "#" + comment : comment)); 53 | } 54 | } 55 | 56 | @Override 57 | public void flush() throws IOException { 58 | this.writer.flush(); 59 | } 60 | 61 | @Override 62 | public void close() throws IOException { 63 | this.writer.close(); 64 | } 65 | } -------------------------------------------------------------------------------- /src/main/java/com/atlauncher/gui/tabs/settings/AbstractSettingsTab.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ATLauncher - https://github.com/ATLauncher/ATLauncher 3 | * Copyright (C) 2013 ATLauncher 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package com.atlauncher.gui.tabs.settings; 19 | 20 | import com.atlauncher.App; 21 | import com.atlauncher.gui.CustomLineBorder; 22 | import com.atlauncher.gui.tabs.Tab; 23 | import com.atlauncher.utils.Utils; 24 | 25 | import javax.swing.BorderFactory; 26 | import javax.swing.ImageIcon; 27 | import javax.swing.JPanel; 28 | import javax.swing.border.Border; 29 | import java.awt.GridBagConstraints; 30 | import java.awt.GridBagLayout; 31 | import java.awt.Insets; 32 | 33 | @SuppressWarnings("serial") 34 | public abstract class AbstractSettingsTab extends JPanel implements Tab { 35 | final Insets LABEL_INSETS = new Insets(5, 0, 5, 10); 36 | final Insets FIELD_INSETS = new Insets(5, 0, 5, 0); 37 | final Insets LABEL_INSETS_SMALL = new Insets(0, 0, 0, 10); 38 | final Insets FIELD_INSETS_SMALL = new Insets(0, 0, 0, 0); 39 | 40 | final ImageIcon HELP_ICON = Utils.getIconImage("/assets/image/Help.png"); 41 | final ImageIcon ERROR_ICON = Utils.getIconImage("/assets/image/Error.png"); 42 | final ImageIcon WARNING_ICON = Utils.getIconImage("/assets/image/Warning.png"); 43 | 44 | final Border RESTART_BORDER = BorderFactory.createEmptyBorder(0, 0, 0, 5); 45 | final Border HOVER_BORDER = new CustomLineBorder(5, App.THEME.getHoverBorderColor(), 2); 46 | 47 | final GridBagConstraints gbc; 48 | 49 | public AbstractSettingsTab() { 50 | setLayout(new GridBagLayout()); 51 | this.gbc = new GridBagConstraints(); 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /src/main/java/com/atlauncher/Update.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ATLauncher - https://github.com/ATLauncher/ATLauncher 3 | * Copyright (C) 2013 ATLauncher 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package com.atlauncher; 19 | 20 | import com.atlauncher.utils.Utils; 21 | 22 | import java.io.File; 23 | import java.io.IOException; 24 | import java.util.ArrayList; 25 | import java.util.List; 26 | 27 | public class Update { 28 | public static void main(String[] args) { 29 | String launcherPath = args[0]; 30 | String temporaryUpdatePath = args[1]; 31 | File launcher = new File(launcherPath); 32 | File temporaryUpdate = new File(temporaryUpdatePath); 33 | Utils.copyFile(temporaryUpdate, launcher.getParentFile()); 34 | 35 | List arguments = new ArrayList(); 36 | 37 | if (Utils.isMac() && new File(new File(System.getProperty("user.dir")).getParentFile().getParentFile(), 38 | "MacOS").exists()) { 39 | arguments.add("open"); 40 | arguments.add(new File(System.getProperty("user.dir")).getParentFile().getParentFile().getParentFile() 41 | .getAbsolutePath()); 42 | 43 | } else { 44 | String path = System.getProperty("java.home") + File.separator + "bin" + File.separator + "java"; 45 | if (Utils.isWindows()) { 46 | path += "w"; 47 | } 48 | arguments.add(path); 49 | arguments.add("-jar"); 50 | arguments.add(launcherPath); 51 | arguments.add("--updated=true"); 52 | } 53 | 54 | ProcessBuilder processBuilder = new ProcessBuilder(); 55 | processBuilder.command(arguments); 56 | 57 | try { 58 | processBuilder.start(); 59 | } catch (IOException e) { 60 | e.printStackTrace(); 61 | } 62 | } 63 | } -------------------------------------------------------------------------------- /src/main/java/com/atlauncher/reporter/GithubIssueReporter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ATLauncher - https://github.com/ATLauncher/ATLauncher 3 | * Copyright (C) 2013 ATLauncher 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package com.atlauncher.reporter; 20 | 21 | import com.atlauncher.App; 22 | import com.atlauncher.LogManager; 23 | import com.atlauncher.data.APIResponse; 24 | import com.atlauncher.data.Settings; 25 | import com.atlauncher.thread.PasteUpload; 26 | import com.atlauncher.utils.Utils; 27 | 28 | import java.io.IOException; 29 | import java.util.HashMap; 30 | import java.util.Map; 31 | 32 | public final class GithubIssueReporter { 33 | private GithubIssueReporter() { 34 | } 35 | 36 | public static void submit(String title, String body) throws Exception { 37 | if (App.settings != null && App.settings.enableLogs()) { 38 | body = body + "\n\n" + times('-', 50) + "\n" + "Here is my log: " + App.TASKPOOL.submit(new PasteUpload() 39 | ).get(); 40 | Map request = new HashMap(); 41 | request.put("issue", new GithubIssue(title, body)); 42 | 43 | try { 44 | APIResponse response = Settings.gson.fromJson(Utils.sendAPICall("githubissue/", request), 45 | APIResponse.class); 46 | if (!response.wasError() && response.getDataAsInt() != 0) { 47 | LogManager.info("Exception reported to GitHub. Track/comment on the issue at " + response 48 | .getDataAsString()); 49 | } 50 | } catch (IOException e) { 51 | e.printStackTrace(); 52 | } 53 | } 54 | } 55 | 56 | private static String times(char c, int times) { 57 | String s = ""; 58 | for (int i = 0; i < times; i++) { 59 | s += c; 60 | } 61 | return s; 62 | } 63 | } -------------------------------------------------------------------------------- /src/main/java/com/atlauncher/gui/AccountsDropDownRenderer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ATLauncher - https://github.com/ATLauncher/ATLauncher 3 | * Copyright (C) 2013 ATLauncher 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package com.atlauncher.gui; 19 | 20 | import com.atlauncher.data.Account; 21 | 22 | import javax.swing.ImageIcon; 23 | import javax.swing.JLabel; 24 | import javax.swing.JList; 25 | import javax.swing.ListCellRenderer; 26 | import java.awt.Component; 27 | import java.awt.Dimension; 28 | 29 | @SuppressWarnings("serial") 30 | public class AccountsDropDownRenderer extends JLabel implements ListCellRenderer { 31 | public AccountsDropDownRenderer() { 32 | setOpaque(true); 33 | setHorizontalAlignment(CENTER); 34 | setVerticalAlignment(CENTER); 35 | setPreferredSize(new Dimension(200, 40)); 36 | setIconTextGap(10); 37 | } 38 | 39 | /* 40 | * This method finds the image and text corresponding to the selected value and returns the 41 | * label, set up to display the text and image. 42 | */ 43 | @SuppressWarnings("rawtypes") 44 | public Component getListCellRendererComponent(JList list, Account account, int index, boolean isSelected, 45 | boolean cellHasFocus) { 46 | if (account == null) { 47 | return this; 48 | } 49 | 50 | if (isSelected) { 51 | setBackground(list.getSelectionBackground()); 52 | setForeground(list.getSelectionForeground()); 53 | } else { 54 | setBackground(list.getBackground()); 55 | setForeground(list.getForeground()); 56 | } 57 | 58 | ImageIcon icon = account.getMinecraftHead(); 59 | String username = account.getMinecraftUsername(); 60 | setIcon(icon); 61 | setText(username); 62 | setFont(list.getFont()); 63 | return this; 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /src/main/java/com/atlauncher/data/Server.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ATLauncher - https://github.com/ATLauncher/ATLauncher 3 | * Copyright (C) 2013 ATLauncher 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package com.atlauncher.data; 19 | 20 | public class Server { 21 | 22 | private String name; 23 | private String baseURL; 24 | private boolean userSelectable; 25 | private boolean disabled; 26 | private boolean isMaster; 27 | 28 | public Server(String name, String baseURL, boolean userSelectable, boolean isMaster) { 29 | this.name = name; 30 | this.baseURL = baseURL; 31 | this.userSelectable = userSelectable; 32 | this.disabled = false; 33 | this.isMaster = isMaster; 34 | } 35 | 36 | public boolean isMaster() { 37 | return this.isMaster; 38 | } 39 | 40 | public void disableServer() { 41 | this.disabled = true; 42 | } 43 | 44 | public void enableServer() { 45 | this.disabled = false; 46 | } 47 | 48 | public boolean isUserSelectable() { 49 | return this.userSelectable; 50 | } 51 | 52 | public boolean isDisabled() { 53 | return this.disabled; 54 | } 55 | 56 | public String getHost() { 57 | return (this.baseURL.contains("/ATL") ? this.baseURL.replace("/ATL", "") : this.baseURL); 58 | } 59 | 60 | public String getName() { 61 | return this.name; 62 | } 63 | 64 | public String getFileURL(String file) { 65 | return "http://" + this.baseURL + "/" + file; 66 | } 67 | 68 | public String getTestURL() { 69 | return "http://" + this.baseURL + "/ping"; 70 | } 71 | 72 | public void setUserSelectable(boolean selectable) { 73 | this.userSelectable = selectable; 74 | } 75 | 76 | public String toString() { 77 | if (this.disabled) { 78 | return "(X) " + this.name; 79 | } else { 80 | return this.name; 81 | } 82 | } 83 | } 84 | -------------------------------------------------------------------------------- /src/main/java/com/atlauncher/gui/card/ModCard.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ATLauncher - https://github.com/ATLauncher/ATLauncher 3 | * Copyright (C) 2013 ATLauncher 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package com.atlauncher.gui.card; 20 | 21 | import com.atlauncher.data.Mod; 22 | import com.atlauncher.utils.Utils; 23 | 24 | import java.awt.Color; 25 | import java.awt.Cursor; 26 | import java.awt.Dimension; 27 | import java.awt.Graphics; 28 | import java.awt.Graphics2D; 29 | import java.awt.event.MouseAdapter; 30 | import java.awt.event.MouseEvent; 31 | import javax.swing.JPanel; 32 | 33 | public final class ModCard extends JPanel { 34 | public final Mod mod; 35 | 36 | public ModCard(final Mod mod){ 37 | this.setPreferredSize(new Dimension(this.getPreferredSize().width, (int) (this.getPreferredSize().height * 1.5))); 38 | this.mod = mod; 39 | if (this.mod.hasWebsite()) { 40 | this.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); 41 | } 42 | this.addMouseListener(new MouseAdapter() { 43 | @Override 44 | public void mouseClicked(MouseEvent e) { 45 | super.mouseClicked(e); 46 | if (ModCard.this.mod.hasWebsite()) { 47 | try{ 48 | Utils.openBrowser(mod.getWebsite()); 49 | } catch(Exception e1){ 50 | e1.printStackTrace(System.err); 51 | } 52 | } 53 | } 54 | 55 | 56 | }); 57 | } 58 | 59 | @Override 60 | public void paint(Graphics g) { 61 | Graphics2D g2 = (Graphics2D) g; 62 | g2.setColor(Color.WHITE); 63 | g2.drawString(this.mod.getName(), 10, 10); 64 | g2.setColor(this.mod.isOptional() ? Color.GREEN : Color.RED); 65 | g2.drawString(this.mod.isOptional() ? "Optional" : "Required", g2.getFontMetrics().stringWidth(this.mod 66 | .getName()) + g2.getFontMetrics().charWidth('M') * 2, 10); 67 | } 68 | } -------------------------------------------------------------------------------- /src/main/java/com/atlauncher/thread/LoggingThread.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ATLauncher - https://github.com/ATLauncher/ATLauncher 3 | * Copyright (C) 2013 ATLauncher 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package com.atlauncher.thread; 20 | 21 | import com.atlauncher.App; 22 | import com.atlauncher.evnt.LogEvent; 23 | import com.atlauncher.utils.Timestamper; 24 | import com.atlauncher.writer.LogEventWriter; 25 | 26 | import java.io.File; 27 | import java.io.FileWriter; 28 | import java.io.IOException; 29 | import java.util.concurrent.BlockingQueue; 30 | 31 | public final class LoggingThread extends Thread { 32 | private final LogEventWriter writer; 33 | private final BlockingQueue queue; 34 | 35 | public LoggingThread(BlockingQueue queue) { 36 | this.queue = queue; 37 | this.setName("ATL-Logging-Thread"); 38 | try { 39 | this.writer = new LogEventWriter(new FileWriter(new File(App.settings.getBaseDir(), 40 | "ATLauncher-Log-1.txt"))); 41 | this.writer.write("Generated on " + Timestamper.now() + "\n"); 42 | Runtime.getRuntime().addShutdownHook(new Thread(new Runnable() { 43 | @Override 44 | public void run() { 45 | try { 46 | writer.close(); 47 | } catch (IOException e) { 48 | e.printStackTrace(); 49 | } 50 | } 51 | })); 52 | } catch (IOException e) { 53 | throw new RuntimeException("Couldn't create LogEventWriter"); 54 | } 55 | } 56 | 57 | @Override 58 | public void run() { 59 | try { 60 | while (true) { 61 | LogEvent next = this.queue.take(); 62 | if (next != null) { 63 | next.post(this.writer); 64 | } 65 | } 66 | } catch (Exception ex) { 67 | ex.printStackTrace(System.err); 68 | } 69 | } 70 | 71 | } -------------------------------------------------------------------------------- /src/main/java/com/atlauncher/data/mojang/EnumTypeAdapterFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ATLauncher - https://github.com/ATLauncher/ATLauncher 3 | * Copyright (C) 2013 ATLauncher 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package com.atlauncher.data.mojang; 19 | 20 | import com.google.gson.Gson; 21 | import com.google.gson.TypeAdapter; 22 | import com.google.gson.TypeAdapterFactory; 23 | import com.google.gson.reflect.TypeToken; 24 | import com.google.gson.stream.JsonReader; 25 | import com.google.gson.stream.JsonToken; 26 | import com.google.gson.stream.JsonWriter; 27 | 28 | import java.io.IOException; 29 | import java.util.HashMap; 30 | import java.util.Locale; 31 | import java.util.Map; 32 | 33 | public class EnumTypeAdapterFactory implements TypeAdapterFactory { 34 | 35 | @SuppressWarnings("unchecked") 36 | @Override 37 | public TypeAdapter create(Gson gson, TypeToken type) { 38 | if (!type.getRawType().isEnum()) { 39 | return null; 40 | } 41 | final Map map = new HashMap(); 42 | for (T c : (T[]) type.getRawType().getEnumConstants()) { 43 | map.put(c.toString().toLowerCase(Locale.US), c); 44 | } 45 | 46 | return new TypeAdapter() { 47 | @Override 48 | public T read(JsonReader reader) throws IOException { 49 | if (reader.peek() == JsonToken.NULL) { 50 | reader.nextNull(); 51 | return null; 52 | } 53 | String name = reader.nextString(); 54 | if (name == null) { 55 | return null; 56 | } 57 | return map.get(name.toLowerCase(Locale.US)); 58 | } 59 | 60 | @Override 61 | public void write(JsonWriter writer, T value) throws IOException { 62 | if (value == null) { 63 | writer.nullValue(); 64 | } else { 65 | writer.value(value.toString().toLowerCase(Locale.US)); 66 | } 67 | } 68 | }; 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /src/main/java/com/atlauncher/thread/PasteUpload.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ATLauncher - https://github.com/ATLauncher/ATLauncher 3 | * Copyright (C) 2013 ATLauncher 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package com.atlauncher.thread; 20 | 21 | import com.atlauncher.App; 22 | import com.atlauncher.data.Constants; 23 | 24 | import java.io.BufferedReader; 25 | import java.io.InputStream; 26 | import java.io.InputStreamReader; 27 | import java.net.HttpURLConnection; 28 | import java.net.URL; 29 | import java.net.URLEncoder; 30 | import java.util.concurrent.Callable; 31 | 32 | public final class PasteUpload implements Callable { 33 | @Override 34 | public String call() throws Exception { 35 | String log = App.settings.getLog().replace(System.getProperty("line.separator"), "\n"); 36 | String urlParameters = ""; 37 | urlParameters += "title=" + URLEncoder.encode("ATLauncher - Log", "ISO-8859-1") + "&"; 38 | urlParameters += "language=" + URLEncoder.encode("text", "ISO-8859-1") + "&"; 39 | urlParameters += "private=" + URLEncoder.encode("1", "ISO-8859-1") + "&"; 40 | urlParameters += "text=" + URLEncoder.encode(log, "ISO-8859-1"); 41 | HttpURLConnection conn = (HttpURLConnection) new URL(Constants.PASTE_API_URL).openConnection(); 42 | conn.setDoOutput(true); 43 | conn.connect(); 44 | conn.getOutputStream().write(urlParameters.getBytes()); 45 | conn.getOutputStream().flush(); 46 | conn.getOutputStream().close(); 47 | 48 | String line; 49 | StringBuilder builder = new StringBuilder(); 50 | InputStream stream; 51 | try { 52 | stream = conn.getInputStream(); 53 | } catch (Exception ex) { 54 | ex.printStackTrace(System.err); 55 | stream = conn.getErrorStream(); 56 | } 57 | BufferedReader reader = new BufferedReader(new InputStreamReader(stream)); 58 | while ((line = reader.readLine()) != null) { 59 | builder.append(line); 60 | } 61 | reader.close(); 62 | return builder.toString(); 63 | } 64 | } -------------------------------------------------------------------------------- /src/main/java/com/atlauncher/gui/components/ServerCheckerToolPanel.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ATLauncher - https://github.com/ATLauncher/ATLauncher 3 | * Copyright (C) 2013 ATLauncher 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package com.atlauncher.gui.components; 19 | 20 | import com.atlauncher.App; 21 | import com.atlauncher.data.Language; 22 | import com.atlauncher.evnt.listener.SettingsListener; 23 | import com.atlauncher.evnt.manager.SettingsManager; 24 | import com.atlauncher.gui.dialogs.ServerListForCheckerDialog; 25 | import com.atlauncher.utils.Utils; 26 | 27 | import javax.swing.BorderFactory; 28 | import javax.swing.JLabel; 29 | import javax.swing.border.BevelBorder; 30 | import java.awt.event.ActionEvent; 31 | import java.awt.event.ActionListener; 32 | 33 | public class ServerCheckerToolPanel extends AbstractToolPanel implements ActionListener, SettingsListener { 34 | /** 35 | * Auto generated serial. 36 | */ 37 | private static final long serialVersionUID = 1964636496849129267L; 38 | 39 | private final JLabel TITLE_LABEL = new JLabel(Language.INSTANCE.localize("tools.serverchecker")); 40 | 41 | private final JLabel INFO_LABEL = new JLabel("

" + Utils.splitMultilinedString(Language 42 | .INSTANCE.localize("tools.serverchecker.info"), 60, "
") + "

"); 43 | 44 | public ServerCheckerToolPanel() { 45 | TITLE_LABEL.setFont(BOLD_FONT); 46 | TOP_PANEL.add(TITLE_LABEL); 47 | MIDDLE_PANEL.add(INFO_LABEL); 48 | BOTTOM_PANEL.add(LAUNCH_BUTTON); 49 | LAUNCH_BUTTON.addActionListener(this); 50 | setBorder(BorderFactory.createBevelBorder(BevelBorder.RAISED)); 51 | SettingsManager.addListener(this); 52 | this.checkLaunchButtonEnabled(); 53 | } 54 | 55 | private void checkLaunchButtonEnabled() { 56 | LAUNCH_BUTTON.setEnabled(App.settings.enableServerChecker()); 57 | } 58 | 59 | @Override 60 | public void actionPerformed(ActionEvent e) { 61 | if (e.getSource() == LAUNCH_BUTTON) { 62 | new ServerListForCheckerDialog(); 63 | } 64 | } 65 | 66 | @Override 67 | public void onSettingsSaved() { 68 | this.checkLaunchButtonEnabled(); 69 | } 70 | } -------------------------------------------------------------------------------- /src/main/java/com/atlauncher/data/mojang/Library.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ATLauncher - https://github.com/ATLauncher/ATLauncher 3 | * Copyright (C) 2013 ATLauncher 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package com.atlauncher.data.mojang; 19 | 20 | import com.atlauncher.App; 21 | import com.atlauncher.utils.Utils; 22 | 23 | import java.io.File; 24 | import java.util.List; 25 | import java.util.Map; 26 | 27 | public class Library { 28 | 29 | private String name; 30 | private Map natives; 31 | private List rules; 32 | private ExtractRule extract; 33 | private String url; 34 | 35 | public boolean shouldInstall() { 36 | if (this.rules == null) { 37 | return true; // No rules setup so we need it 38 | } 39 | Action lastAction = Action.DISALLOW; 40 | for (Rule rule : this.rules) { // Loop through all the rules 41 | if (rule.ruleApplies()) { // See if this rule applies to this system 42 | lastAction = rule.getAction(); 43 | } 44 | } 45 | return (lastAction == Action.ALLOW); // Check if we are allowing it 46 | } 47 | 48 | public boolean shouldExtract() { 49 | return this.extract != null; 50 | } 51 | 52 | public ExtractRule getExtractRule() { 53 | return this.extract; 54 | } 55 | 56 | public String getName() { 57 | return this.name; 58 | } 59 | 60 | public String getURL() { 61 | String path; 62 | String[] parts = this.name.split(":", 3); 63 | path = parts[0].replace(".", "/") + "/" + parts[1] + "/" + parts[2] + "/" + parts[1] + "-" + parts[2] + 64 | getClassifier() + ".jar"; 65 | return MojangConstants.LIBRARIES_BASE.getURL(path); 66 | } 67 | 68 | public File getFile() { 69 | String[] parts = this.name.split(":", 3); 70 | return new File(App.settings.getLibrariesDir(), parts[1] + "-" + parts[2] + getClassifier() + ".jar"); 71 | } 72 | 73 | public String getClassifier() { 74 | if (this.natives == null) { 75 | return ""; 76 | } 77 | return "-" + this.natives.get(OperatingSystem.getOS()).replace("${arch}", Utils.getArch()); 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /src/main/java/com/atlauncher/LogManager.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ATLauncher - https://github.com/ATLauncher/ATLauncher 3 | * Copyright (C) 2013 ATLauncher 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package com.atlauncher; 20 | 21 | import com.atlauncher.evnt.LogEvent; 22 | import com.atlauncher.evnt.LogEvent.LogType; 23 | import com.atlauncher.thread.LoggingThread; 24 | import com.atlauncher.utils.Utils; 25 | 26 | import java.util.concurrent.ArrayBlockingQueue; 27 | import java.util.concurrent.BlockingQueue; 28 | 29 | public final class LogManager { 30 | private static final BlockingQueue queue = new ArrayBlockingQueue(128); 31 | 32 | public static boolean showDebug = false; 33 | 34 | /** 35 | * The level of debug logs to show. 1 being lowest, 2 being meh, 3 being EXTREEEEEEEME 36 | */ 37 | public static int debugLevel = 0; 38 | 39 | private LogManager() { 40 | } 41 | 42 | public static void start() { 43 | new LoggingThread(queue).start(); 44 | } 45 | 46 | public static void log(LogEvent event) { 47 | queue.offer(event); 48 | } 49 | 50 | public static void info(String message) { 51 | queue.offer(new LogEvent(LogEvent.LogType.INFO, message)); 52 | } 53 | 54 | public static void debug(String message) { 55 | debug(message, false); 56 | } 57 | 58 | public static void debug(String message, boolean force) { 59 | if (showDebug || force) { 60 | queue.offer(new LogEvent(LogEvent.LogType.DEBUG, message)); 61 | } 62 | } 63 | 64 | public static void debug(String message, int level) { 65 | if (showDebug || debugLevel >= level) { 66 | queue.offer(new LogEvent(LogEvent.LogType.DEBUG, message)); 67 | } 68 | } 69 | 70 | public static void warn(String message) { 71 | queue.offer(new LogEvent(LogEvent.LogType.WARN, message)); 72 | } 73 | 74 | public static void error(String message) { 75 | queue.offer(new LogEvent(LogEvent.LogType.ERROR, message)); 76 | } 77 | 78 | public static void minecraft(String message) { 79 | Object[] value = Utils.prepareMessageForMinecraftLog(message); 80 | queue.offer(new LogEvent((LogType) value[0], (String) value[1], 10)); 81 | } 82 | } 83 | -------------------------------------------------------------------------------- /src/main/java/com/atlauncher/data/LauncherVersion.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ATLauncher - https://github.com/ATLauncher/ATLauncher 3 | * Copyright (C) 2013 ATLauncher 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package com.atlauncher.data; 19 | 20 | import com.atlauncher.annot.Json; 21 | 22 | @Json 23 | public class LauncherVersion { 24 | private int reserved; 25 | private int major; 26 | private int minor; 27 | private int revision; 28 | 29 | public LauncherVersion(int reserved, int major, int minor, int revision) { 30 | this.reserved = reserved; 31 | this.major = major; 32 | this.minor = minor; 33 | this.revision = revision; 34 | } 35 | 36 | public int getReserved() { 37 | return this.reserved; 38 | } 39 | 40 | public int getMajor() { 41 | return this.major; 42 | } 43 | 44 | public int getMinor() { 45 | return this.minor; 46 | } 47 | 48 | public int getRevision() { 49 | return this.revision; 50 | } 51 | 52 | public boolean needsUpdate(LauncherVersion toThis) { 53 | if (this.reserved > toThis.getReserved()) { 54 | return false; 55 | } else if (this.reserved < toThis.getReserved()) { 56 | return true; 57 | } else { 58 | if (this.major > toThis.getMajor()) { 59 | return false; 60 | } else if (this.major < toThis.getMajor()) { 61 | return true; 62 | } else { 63 | if (this.minor > toThis.getMinor()) { 64 | return false; 65 | } else if (this.minor < toThis.getMinor()) { 66 | return true; 67 | } else { 68 | if (this.revision > toThis.getRevision()) { 69 | return false; 70 | } else if (this.revision < toThis.getRevision()) { 71 | return true; 72 | } else { 73 | return false; // Same version so doesn't need to update 74 | } 75 | } 76 | } 77 | } 78 | } 79 | 80 | @Override 81 | public String toString() { 82 | return String.format("%d.%d.%d.%d", this.reserved, this.major, this.minor, this.revision); 83 | } 84 | } 85 | -------------------------------------------------------------------------------- /src/main/java/com/atlauncher/gui/components/PackImagePanel.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ATLauncher - https://github.com/ATLauncher/ATLauncher 3 | * Copyright (C) 2013 ATLauncher 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package com.atlauncher.gui.components; 20 | 21 | import com.atlauncher.App; 22 | import com.atlauncher.data.Language; 23 | import com.atlauncher.data.Pack; 24 | 25 | import javax.swing.JPanel; 26 | import java.awt.Color; 27 | import java.awt.Dimension; 28 | import java.awt.Graphics; 29 | import java.awt.Graphics2D; 30 | import java.awt.Image; 31 | 32 | public final class PackImagePanel extends JPanel { 33 | private final Image image; 34 | private final Pack pack; 35 | 36 | public PackImagePanel(Pack pack) { 37 | this.pack = pack; 38 | this.image = pack.getImage().getImage(); 39 | this.setPreferredSize(new Dimension(Math.min(image.getWidth(null), 300), Math.min(image.getWidth(null), 150))); 40 | } 41 | 42 | @Override 43 | public void paintComponent(Graphics g) { 44 | Graphics2D g2 = (Graphics2D) g; 45 | int y = (this.getHeight() - 150) / 2; 46 | g2.drawImage(this.image, 0, y, 300, 150, null); 47 | 48 | if (App.settings.enabledPackTags()) { 49 | String text; 50 | Color colour; 51 | 52 | if (this.pack.getVersionCount() == 0) { 53 | text = Language.INSTANCE.localize("pack.dev"); 54 | colour = Color.lightGray; 55 | } else { 56 | if (this.pack.isPrivate()) { 57 | text = Language.INSTANCE.localize("pack.private"); 58 | colour = Color.red; 59 | } else if (this.pack.isPublic()) { 60 | text = Language.INSTANCE.localize("pack.public"); 61 | colour = Color.green; 62 | } else { 63 | text = Language.INSTANCE.localize("pack.semipublic"); 64 | colour = Color.cyan; 65 | } 66 | } 67 | 68 | g2.setColor(colour); 69 | g2.fillRect(0, y, g2.getFontMetrics().stringWidth(text) + 10, g2.getFontMetrics().getHeight() + 5); 70 | g2.setColor(Color.black); 71 | g2.drawString(text, 5, y + g2.getFontMetrics().getHeight()); 72 | } 73 | } 74 | } -------------------------------------------------------------------------------- /src/main/java/com/atlauncher/gui/SplashScreen.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ATLauncher - https://github.com/ATLauncher/ATLauncher 3 | * Copyright (C) 2013 ATLauncher 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package com.atlauncher.gui; 19 | 20 | import com.atlauncher.data.Language; 21 | import com.atlauncher.utils.Utils; 22 | 23 | import java.awt.Graphics; 24 | import java.awt.event.ActionEvent; 25 | import java.awt.event.ActionListener; 26 | import java.awt.event.MouseAdapter; 27 | import java.awt.event.MouseEvent; 28 | import java.awt.image.BufferedImage; 29 | 30 | import javax.swing.JMenuItem; 31 | import javax.swing.JPopupMenu; 32 | import javax.swing.JWindow; 33 | 34 | public class SplashScreen extends JWindow { 35 | private static final BufferedImage img = Utils.getImage("SplashScreen"); 36 | private final ContextMenu CONTEXT_MENU = new ContextMenu(); 37 | 38 | public SplashScreen() { 39 | this.setLayout(null); 40 | this.setSize(img.getWidth(), img.getHeight()); 41 | this.setLocationRelativeTo(null); 42 | this.addMouseListener(new MouseAdapter() { 43 | @Override 44 | public void mouseReleased(MouseEvent e) { 45 | if (e.getButton() == MouseEvent.BUTTON3) { 46 | CONTEXT_MENU.show(SplashScreen.this, e.getX(), e.getY()); 47 | } 48 | } 49 | }); 50 | this.setAlwaysOnTop(false); 51 | } 52 | 53 | @Override 54 | public void paint(Graphics g) { 55 | g.drawImage(img, 0, 0, this.getWidth(), this.getHeight(), null); 56 | } 57 | 58 | /** 59 | * Closes and disposes of the splash screen 60 | */ 61 | public void close() { 62 | this.setVisible(false); 63 | this.dispose(); 64 | } 65 | 66 | private final class ContextMenu extends JPopupMenu { 67 | private final JMenuItem FORCE_QUIT = new JMenuItem(Language.INSTANCE.localize("common.forcequit")); 68 | 69 | public ContextMenu() { 70 | super(); 71 | 72 | this.FORCE_QUIT.addActionListener(new ActionListener() { 73 | @Override 74 | public void actionPerformed(ActionEvent e) { 75 | System.exit(0); 76 | } 77 | }); 78 | this.add(this.FORCE_QUIT); 79 | } 80 | } 81 | } -------------------------------------------------------------------------------- /src/main/java/com/atlauncher/gui/card/NilCard.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ATLauncher - https://github.com/ATLauncher/ATLauncher 3 | * Copyright (C) 2013 ATLauncher 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package com.atlauncher.gui.card; 19 | 20 | import com.atlauncher.App; 21 | import com.atlauncher.data.Language; 22 | import com.atlauncher.gui.components.ImagePanel; 23 | import com.atlauncher.utils.Utils; 24 | 25 | import javax.swing.BorderFactory; 26 | import javax.swing.JPanel; 27 | import javax.swing.JSplitPane; 28 | import javax.swing.JTextArea; 29 | import javax.swing.border.TitledBorder; 30 | import java.awt.BorderLayout; 31 | import java.awt.Font; 32 | import java.awt.Image; 33 | import java.io.File; 34 | 35 | /** 36 | * Class for displaying packs in the Pack Tab 37 | * 38 | * @author Ryan 39 | */ 40 | public class NilCard extends JPanel { 41 | private static final Image defaultImage = Utils.getIconImage(new File(App.settings.getImagesDir(), 42 | "defaultimage.png")).getImage(); 43 | 44 | private final JTextArea error = new JTextArea(); 45 | private final JSplitPane splitter = new JSplitPane(); 46 | 47 | public NilCard(String message) { 48 | super(new BorderLayout()); 49 | 50 | if (Utils.isMac()) { 51 | this.setBorder(new TitledBorder(null, Language.INSTANCE.localize("common.nothingtoshow"), 52 | TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, new Font("SansSerif", 53 | Font.BOLD, 14))); 54 | } else { 55 | this.setBorder(new TitledBorder(null, Language.INSTANCE.localize("common.nothingtoshow"), 56 | TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, new Font("SansSerif", 57 | Font.BOLD, 15))); 58 | } 59 | 60 | this.error.setBorder(BorderFactory.createEmptyBorder()); 61 | this.error.setEditable(false); 62 | this.error.setHighlighter(null); 63 | this.error.setLineWrap(true); 64 | this.error.setWrapStyleWord(true); 65 | this.error.setText(message); 66 | 67 | this.splitter.setEnabled(false); 68 | this.splitter.setLeftComponent(new ImagePanel(defaultImage)); 69 | this.splitter.setRightComponent(this.error); 70 | 71 | this.add(this.splitter, BorderLayout.CENTER); 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /src/main/java/com/atlauncher/data/PackVersion.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ATLauncher - https://github.com/ATLauncher/ATLauncher 3 | * Copyright (C) 2013 ATLauncher 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package com.atlauncher.data; 19 | 20 | import com.atlauncher.App; 21 | import com.atlauncher.exceptions.InvalidMinecraftVersion; 22 | 23 | public class PackVersion { 24 | private String version; 25 | private String minecraft; 26 | private String hash; 27 | private MinecraftVersion minecraftVersion; 28 | private boolean canUpdate = true; 29 | private boolean isRecommended = true; 30 | private boolean hasJson = false; 31 | private boolean isDev; 32 | 33 | public String getVersion() { 34 | return this.version; 35 | } 36 | 37 | public String getSafeVersion() { 38 | return this.version.replaceAll("[^A-Za-z0-9]", ""); 39 | } 40 | 41 | public void setMinecraftVesion() { 42 | try { 43 | this.minecraftVersion = App.settings.getMinecraftVersion(this.minecraft); 44 | } catch (InvalidMinecraftVersion e) { 45 | this.minecraftVersion = null; 46 | App.settings.logStackTrace(e); 47 | } 48 | } 49 | 50 | public MinecraftVersion getMinecraftVersion() { 51 | if (this.minecraftVersion == null) { 52 | this.setMinecraftVesion(); 53 | } 54 | return this.minecraftVersion; 55 | } 56 | 57 | public String getHash() { 58 | if (this.hash == null || !this.isDev) { 59 | return null; 60 | } 61 | return this.hash; 62 | } 63 | 64 | public boolean canUpdate() { 65 | return this.canUpdate; 66 | } 67 | 68 | public boolean isRecommended() { 69 | return this.isRecommended; 70 | } 71 | 72 | public boolean isDev() { 73 | return this.isDev; 74 | } 75 | 76 | public boolean hasJson() { 77 | return this.hasJson; 78 | } 79 | 80 | public String toString() { 81 | return this.version + " (Minecraft " + this.getMinecraftVersion().getVersion() + ")"; 82 | } 83 | 84 | public boolean versionMatches(String version) { 85 | return this.version.equalsIgnoreCase(version); 86 | } 87 | 88 | public boolean hashMatches(String hash) { 89 | if (this.hash == null || !this.isDev) { 90 | return false; 91 | } 92 | return this.hash.equalsIgnoreCase(hash); 93 | } 94 | 95 | } 96 | -------------------------------------------------------------------------------- /src/main/java/de/zh32/pingtest/Response.java: -------------------------------------------------------------------------------- 1 | package de.zh32.pingtest; 2 | 3 | import java.util.List; 4 | 5 | /** 6 | * @author zh32 7 | */ 8 | public class Response { 9 | private String description; 10 | private Players players; 11 | private Version version; 12 | private String favicon; 13 | private int time; 14 | 15 | public String getDescription() { 16 | return description; 17 | } 18 | 19 | public void setDescription(String description) { 20 | this.description = description; 21 | } 22 | 23 | public Players getPlayers() { 24 | return players; 25 | } 26 | 27 | public void setPlayers(Players players) { 28 | this.players = players; 29 | } 30 | 31 | public Version getVersion() { 32 | return version; 33 | } 34 | 35 | public void setVersion(Version version) { 36 | this.version = version; 37 | } 38 | 39 | public String getFavicon() { 40 | return favicon; 41 | } 42 | 43 | public void setFavicon(String favicon) { 44 | this.favicon = favicon; 45 | } 46 | 47 | public int getTime() { 48 | return time; 49 | } 50 | 51 | public void setTime(int time) { 52 | this.time = time; 53 | } 54 | 55 | public class Players { 56 | private int max; 57 | private int online; 58 | private List sample; 59 | 60 | public int getMax() { 61 | return max; 62 | } 63 | 64 | public void setMax(int max) { 65 | this.max = max; 66 | } 67 | 68 | public int getOnline() { 69 | return online; 70 | } 71 | 72 | public void setOnline(int online) { 73 | this.online = online; 74 | } 75 | 76 | public List getSample() { 77 | return sample; 78 | } 79 | 80 | public void setSample(List sample) { 81 | this.sample = sample; 82 | } 83 | } 84 | 85 | public class Player { 86 | private String name; 87 | private String id; 88 | 89 | public String getName() { 90 | return name; 91 | } 92 | 93 | public void setName(String name) { 94 | this.name = name; 95 | } 96 | 97 | public String getId() { 98 | return id; 99 | } 100 | 101 | public void setId(String id) { 102 | this.id = id; 103 | } 104 | } 105 | 106 | public class Version { 107 | private String name; 108 | private String protocol; 109 | 110 | public String getName() { 111 | return name; 112 | } 113 | 114 | public void setName(String name) { 115 | this.name = name; 116 | } 117 | 118 | public String getProtocol() { 119 | return protocol; 120 | } 121 | 122 | public void setProtocol(String protocol) { 123 | this.protocol = protocol; 124 | } 125 | } 126 | } -------------------------------------------------------------------------------- /src/main/java/io/github/asyncronous/toast/thread/ToastAnimator.java: -------------------------------------------------------------------------------- 1 | package io.github.asyncronous.toast.thread; 2 | 3 | import io.github.asyncronous.toast.Toaster; 4 | import io.github.asyncronous.toast.ui.ToastWindow; 5 | 6 | import javax.swing.SwingWorker; 7 | import javax.swing.UIManager; 8 | import java.awt.Rectangle; 9 | 10 | /** 11 | * The main Toaster animation class, controls the entire window - location, whether or not to display, etc... 12 | */ 13 | public final class ToastAnimator extends SwingWorker { 14 | private final ToastWindow window; 15 | 16 | public ToastAnimator(ToastWindow window) { 17 | this.window = window; 18 | } 19 | 20 | @Override 21 | protected Void doInBackground() throws Exception { 22 | boolean fromBottom = true; 23 | Rectangle screenRect = (Rectangle) UIManager.get("Toaster.contBounds"); 24 | 25 | int startY; 26 | int stopY; 27 | 28 | if (screenRect.y > 0) { 29 | fromBottom = false; 30 | } 31 | 32 | Toaster.MAX_TOASTER_IN_SCREEN = (screenRect.height / this.window.getHeight()); 33 | int posX = screenRect.width - this.window.getWidth() - 1; 34 | this.window.setLocation(posX, screenRect.height); 35 | this.window.setVisible(true); 36 | 37 | if (fromBottom) { 38 | startY = screenRect.height; 39 | stopY = startY - this.window.getHeight() - 1; 40 | if (Toaster.CURRENT_TOASTER_NUMBER > 0) { 41 | stopY = stopY - (Toaster.MAX_TOASTERS % Toaster.MAX_TOASTER_IN_SCREEN * this.window.getHeight()); 42 | } else { 43 | Toaster.MAX_TOASTERS = 0; 44 | } 45 | } else { 46 | startY = screenRect.y - this.window.getHeight(); 47 | stopY = screenRect.y; 48 | 49 | if (Toaster.CURRENT_TOASTER_NUMBER > 0) { 50 | stopY = stopY + (Toaster.MAX_TOASTERS % Toaster.MAX_TOASTER_IN_SCREEN * this.window.getHeight()); 51 | } else { 52 | Toaster.MAX_TOASTERS = 0; 53 | } 54 | } 55 | 56 | Toaster.CURRENT_TOASTER_NUMBER++; 57 | Toaster.MAX_TOASTERS++; 58 | this.moveVert(posX, startY, stopY); 59 | Thread.sleep((Integer) UIManager.get("Toaster.time")); 60 | this.moveVert(posX, stopY, startY); 61 | Toaster.CURRENT_TOASTER_NUMBER--; 62 | Thread.sleep(250); 63 | this.window.setVisible(false); 64 | this.window.dispose(); 65 | 66 | return null; 67 | } 68 | 69 | private void moveVert(int posx, int fromY, int toY) throws Exception { 70 | this.window.setLocation(posx, fromY); 71 | if (toY < fromY) { 72 | for (int i = fromY; i > toY; i -= 20) { 73 | this.window.setLocation(posx, i); 74 | Thread.sleep(20); 75 | } 76 | } else { 77 | for (int i = fromY; i < toY; i += 20) { 78 | this.window.setLocation(posx, i); 79 | Thread.sleep(20); 80 | } 81 | } 82 | this.window.setLocation(posx, toY); 83 | } 84 | } -------------------------------------------------------------------------------- /src/main/java/com/atlauncher/data/openmods/OpenEyeReportResponse.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ATLauncher - https://github.com/ATLauncher/ATLauncher 3 | * Copyright (C) 2013 ATLauncher 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package com.atlauncher.data.openmods; 19 | 20 | import com.atlauncher.data.Language; 21 | import com.atlauncher.utils.Utils; 22 | 23 | /** 24 | * The Class OpenEyeReportResponse contains information returned from OpenMods OpenEye system when a pending crash 25 | * report is reported through their API. 26 | */ 27 | public class OpenEyeReportResponse { 28 | /** 29 | * The type of this response. Generally is only ever 'known crash'. 30 | */ 31 | private String type; 32 | 33 | /** 34 | * The url to the OpenEye website containing this crashes information. 35 | */ 36 | private String url; 37 | 38 | /** 39 | * The note added to the crash, added by the mods developer, if any. Will return null if there has been no note 40 | * added. 41 | */ 42 | private String note; 43 | 44 | /** 45 | * Gets the type of the crash that was reported. 46 | * 47 | * @return the type 48 | */ 49 | public String getType() { 50 | return this.type; 51 | } 52 | 53 | /** 54 | * Gets the url to the OpenEye website with the details of this crash. 55 | * 56 | * @return the url to the OpenEye website 57 | */ 58 | public String getURL() { 59 | return this.url; 60 | } 61 | 62 | /** 63 | * Gets the note associated with this reported crash, if any. 64 | * 65 | * @return the note or null if none 66 | */ 67 | public String getNote() { 68 | return this.getNote(); 69 | } 70 | 71 | /** 72 | * Checks if there is any note added for this response. 73 | * 74 | * @return true, if there is an attached note 75 | */ 76 | public boolean hasNote() { 77 | return (this.note != null); 78 | } 79 | 80 | /** 81 | * Gets the display of the note for showing to the user. 82 | * 83 | * @return the string to add to the dialog box for the note 84 | */ 85 | public String getNoteDisplay() { 86 | if (this.hasNote()) { 87 | return Language.INSTANCE.localize("instance.openeyehasnote") + "

" + Utils.splitMultilinedString 88 | (this.getNote(), 100, "
") + "

"; 89 | } else { 90 | return Language.INSTANCE.localize("instance.openeyenonote") + "

"; 91 | } 92 | } 93 | } 94 | -------------------------------------------------------------------------------- /src/main/java/com/atlauncher/data/MinecraftVersion.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ATLauncher - https://github.com/ATLauncher/ATLauncher 3 | * Copyright (C) 2013 ATLauncher 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package com.atlauncher.data; 19 | 20 | import com.atlauncher.App; 21 | import com.atlauncher.annot.Json; 22 | import com.atlauncher.data.mojang.MojangConstants; 23 | import com.atlauncher.data.mojang.MojangVersion; 24 | import com.google.gson.JsonIOException; 25 | import com.google.gson.JsonSyntaxException; 26 | 27 | import java.io.File; 28 | import java.io.FileNotFoundException; 29 | import java.io.FileReader; 30 | 31 | /** 32 | * TODO: Rewrite along with {@link com.atlauncher.data.Version} {@link com.atlauncher.data.LauncherVersion} 33 | */ 34 | @Json 35 | public class MinecraftVersion { 36 | private String version; 37 | private boolean server; 38 | private boolean legacy; 39 | private boolean coremods; 40 | private boolean resources; 41 | private MojangVersion mojangVersion; 42 | 43 | public void loadVersion() { 44 | File versionFile = new File(App.settings.getVersionsDir(), this.version + ".json"); 45 | if (!App.skipMinecraftVersionDownloads) { 46 | Downloadable download = new Downloadable(MojangConstants.DOWNLOAD_BASE.getURL("versions/" + this.version + 47 | "/" + this.version + ".json"), versionFile, null, null, false); 48 | if (download.needToDownload()) { 49 | download.download(false); 50 | } 51 | } 52 | try { 53 | mojangVersion = Settings.altGson.fromJson(new FileReader(versionFile), MojangVersion.class); 54 | } catch (JsonSyntaxException e) { 55 | App.settings.logStackTrace(e); 56 | } catch (JsonIOException e) { 57 | App.settings.logStackTrace(e); 58 | } catch (FileNotFoundException e) { 59 | App.settings.logStackTrace(e); 60 | } 61 | } 62 | 63 | public boolean canCreateServer() { 64 | return this.server; 65 | } 66 | 67 | public String getVersion() { 68 | return this.version; 69 | } 70 | 71 | public MojangVersion getMojangVersion() { 72 | return this.mojangVersion; 73 | } 74 | 75 | public boolean isLegacy() { 76 | return this.legacy; 77 | } 78 | 79 | public boolean usesCoreMods() { 80 | return this.coremods; 81 | } 82 | 83 | public boolean hasResources() { 84 | return this.resources; 85 | } 86 | 87 | public String toString() { 88 | return this.version; 89 | } 90 | 91 | } -------------------------------------------------------------------------------- /src/main/java/com/atlauncher/data/mojang/DateTypeAdapter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ATLauncher - https://github.com/ATLauncher/ATLauncher 3 | * Copyright (C) 2013 ATLauncher 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package com.atlauncher.data.mojang; 19 | 20 | import com.google.gson.JsonDeserializationContext; 21 | import com.google.gson.JsonDeserializer; 22 | import com.google.gson.JsonElement; 23 | import com.google.gson.JsonParseException; 24 | import com.google.gson.JsonPrimitive; 25 | import com.google.gson.JsonSerializationContext; 26 | import com.google.gson.JsonSerializer; 27 | import com.google.gson.JsonSyntaxException; 28 | 29 | import java.lang.reflect.Type; 30 | import java.text.DateFormat; 31 | import java.text.ParseException; 32 | import java.text.SimpleDateFormat; 33 | import java.util.Date; 34 | import java.util.Locale; 35 | 36 | public class DateTypeAdapter implements JsonDeserializer, JsonSerializer { 37 | private final DateFormat enUsFormat = DateFormat.getDateTimeInstance(2, 2, Locale.US); 38 | private final DateFormat iso8601Format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ"); 39 | 40 | @Override 41 | public Date deserialize(JsonElement json, Type type, JsonDeserializationContext context) throws JsonParseException { 42 | if (!(json instanceof JsonPrimitive)) { 43 | throw new JsonParseException("The date " + json + " is not a string!"); 44 | } 45 | if (type != Date.class) { 46 | throw new IllegalArgumentException(getClass() + " cannot deserialize to " + type); 47 | } 48 | String value = json.getAsString(); 49 | synchronized (enUsFormat) { 50 | try { 51 | return enUsFormat.parse(value); 52 | } catch (ParseException e) { 53 | try { 54 | return iso8601Format.parse(value); 55 | } catch (ParseException e2) { 56 | try { 57 | String tmp = value.replace("Z", "+00:00"); 58 | return iso8601Format.parse(tmp.substring(0, 22) + tmp.substring(23)); 59 | } catch (ParseException e3) { 60 | throw new JsonSyntaxException("Invalid date " + value, e3); 61 | } 62 | } 63 | } 64 | } 65 | } 66 | 67 | @Override 68 | public JsonElement serialize(Date value, Type type, JsonSerializationContext context) { 69 | synchronized (enUsFormat) { 70 | String ret = this.iso8601Format.format(value); 71 | return new JsonPrimitive(ret.substring(0, 22) + ":" + ret.substring(22)); 72 | } 73 | } 74 | } -------------------------------------------------------------------------------- /src/test/java/TestLauncherVersion.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2013 and onwards by ATLauncher and Contributors 3 | * 4 | * This work is licensed under the GNU General Public License v3.0. 5 | * Link to license: http://www.gnu.org/licenses/gpl-3.0.txt. 6 | */ 7 | 8 | import static org.junit.Assert.assertFalse; 9 | import static org.junit.Assert.assertTrue; 10 | 11 | import org.junit.Test; 12 | 13 | import com.atlauncher.data.Constants; 14 | import com.atlauncher.data.LauncherVersion; 15 | 16 | public class TestLauncherVersion { 17 | 18 | @Test 19 | public void test() { 20 | // Test same version - no update 21 | assertFalse(Constants.VERSION.needsUpdate(new LauncherVersion(Constants.VERSION 22 | .getReserved(), Constants.VERSION.getMajor(), Constants.VERSION.getMinor(), 23 | Constants.VERSION.getRevision()))); 24 | 25 | // Test older Reserved - launcher had a big update 26 | assertTrue(Constants.VERSION.needsUpdate(new LauncherVersion(Constants.VERSION 27 | .getReserved() + 1, Constants.VERSION.getMajor(), Constants.VERSION.getMinor(), 28 | Constants.VERSION.getRevision()))); 29 | 30 | // Test older Major - launcher had major update 31 | assertTrue(Constants.VERSION.needsUpdate(new LauncherVersion(Constants.VERSION 32 | .getReserved(), Constants.VERSION.getMajor() + 1, Constants.VERSION.getMinor(), 33 | Constants.VERSION.getRevision()))); 34 | 35 | // Test older Minor - launcher had minor update 36 | assertTrue(Constants.VERSION.needsUpdate(new LauncherVersion(Constants.VERSION 37 | .getReserved(), Constants.VERSION.getMajor(), Constants.VERSION.getMinor() + 1, 38 | Constants.VERSION.getRevision()))); 39 | 40 | // Test older Revision - launcher had a bug fix 41 | assertTrue(Constants.VERSION.needsUpdate(new LauncherVersion(Constants.VERSION 42 | .getReserved(), Constants.VERSION.getMajor(), Constants.VERSION.getMinor(), 43 | Constants.VERSION.getRevision() + 1))); 44 | 45 | // Test newer Reserved - launcher dev version 46 | assertFalse(Constants.VERSION.needsUpdate(new LauncherVersion(Constants.VERSION 47 | .getReserved() - 1, Constants.VERSION.getMajor(), Constants.VERSION.getMinor(), 48 | Constants.VERSION.getRevision()))); 49 | 50 | // Test newer Major - launcher dev version 51 | assertFalse(Constants.VERSION.needsUpdate(new LauncherVersion(Constants.VERSION 52 | .getReserved(), Constants.VERSION.getMajor() - 1, Constants.VERSION.getMinor(), 53 | Constants.VERSION.getRevision()))); 54 | 55 | // Test newer Minor - launcher dev version 56 | assertFalse(Constants.VERSION.needsUpdate(new LauncherVersion(Constants.VERSION 57 | .getReserved(), Constants.VERSION.getMajor(), Constants.VERSION.getMinor() - 1, 58 | Constants.VERSION.getRevision()))); 59 | 60 | // Test newer Revision - launcher dev version 61 | assertFalse(Constants.VERSION.needsUpdate(new LauncherVersion(Constants.VERSION 62 | .getReserved(), Constants.VERSION.getMajor(), Constants.VERSION.getMinor(), 63 | Constants.VERSION.getRevision() - 1))); 64 | } 65 | 66 | } 67 | -------------------------------------------------------------------------------- /src/main/java/com/atlauncher/data/SyncAbstract.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ATLauncher - https://github.com/ATLauncher/ATLauncher 3 | * Copyright (C) 2013 ATLauncher 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package com.atlauncher.data; 20 | 21 | import com.atlauncher.gui.components.CollapsiblePanel; 22 | 23 | import java.io.File; 24 | import java.util.HashMap; 25 | import java.util.List; 26 | 27 | /** 28 | * Extend this class if you wish to add a backup/sync method. You will need to track any backups you make yourself. 29 | * 30 | * @author Kihira 31 | */ 32 | public abstract class SyncAbstract { 33 | public static final HashMap syncList = new HashMap(); 34 | private final String syncName; 35 | 36 | public SyncAbstract(String name) { 37 | if (syncList.containsKey(name)) { 38 | throw new IllegalArgumentException("A sync handler with the name " + name + " has already been created!"); 39 | } else { 40 | syncList.put(name, this); 41 | syncName = name; 42 | } 43 | } 44 | 45 | public String getName() { 46 | return syncName; 47 | } 48 | 49 | /** 50 | * This is called when a world needs to be backed up. 51 | * 52 | * @param backupName The name of the backup 53 | * @param worldData The folder of the world 54 | * @param instance The instance for the world 55 | */ 56 | public abstract void backupWorld(String backupName, File worldData, Instance instance); 57 | 58 | /** 59 | * This should return a list of names of the backups that the current application has backed up 60 | * 61 | * @param instance The instance 62 | * @return A list of world names 63 | */ 64 | public abstract List getBackupsForInstance(Instance instance); 65 | 66 | /** 67 | * This is called when the user wants to restore a backup. It should restore the backup to the correct save location 68 | * This method is called from a new thread 69 | * 70 | * @param backupName The name of the backup to restore 71 | * @param instance The instance that the save should be restored to 72 | */ 73 | public abstract void restoreBackup(String backupName, Instance instance); 74 | 75 | public abstract void deleteBackup(String backupName, Instance instance); 76 | 77 | /** 78 | * If the sync addon has settings then you should return an instance of {@link com.atlauncher.gui.components 79 | * .CollapsiblePanel 80 | * CollapsiblePanel}. It is recommended you extend that class. Look at {@link com.atlauncher.data.DropboxSync 81 | * DropboxSync} for example. 82 | * 83 | * @return The settings panel 84 | */ 85 | public abstract CollapsiblePanel getSettingsPanel(); 86 | } 87 | -------------------------------------------------------------------------------- /src/main/java/com/atlauncher/evnt/LogEvent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ATLauncher - https://github.com/ATLauncher/ATLauncher 3 | * Copyright (C) 2013 ATLauncher 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package com.atlauncher.evnt; 20 | 21 | import com.atlauncher.App; 22 | import com.atlauncher.LogManager; 23 | import com.atlauncher.gui.components.Console; 24 | import com.atlauncher.utils.Timestamper; 25 | import com.atlauncher.writer.LogEventWriter; 26 | 27 | import java.awt.Color; 28 | import java.io.IOException; 29 | 30 | public final class LogEvent { 31 | public static final int CONSOLE = 0xA; 32 | public static final int FILE = 0xB; 33 | public final LogType type; 34 | public final String body; 35 | public final int meta; 36 | 37 | public LogEvent(LogType type, String body) { 38 | this(type, body, CONSOLE | FILE); 39 | } 40 | 41 | public LogEvent(LogType type, String body, int meta) { 42 | this.type = type; 43 | if (App.settings != null && !LogManager.showDebug) { 44 | body = body.replace(App.settings.getBaseDir().getAbsolutePath(), "**USERSDIR**"); 45 | } 46 | this.body = (!body.endsWith("\n") ? body + "\n" : body); 47 | this.meta = meta; 48 | } 49 | 50 | public void post(LogEventWriter writer) { 51 | if ((this.meta & CONSOLE) == CONSOLE) { 52 | Console c = App.settings.getConsole().console; 53 | c.setColor(this.type.color()).setBold(true).write("[" + Timestamper.now() + "] "); 54 | c.setColor(App.THEME.getConsoleTextColor()).setBold(false).write(this.body); 55 | } 56 | if ((this.meta & FILE) == FILE) { 57 | try { 58 | writer.write(this); 59 | } catch (IOException e) { 60 | e.printStackTrace(); 61 | } 62 | } 63 | } 64 | 65 | @Override 66 | public String toString() { 67 | return "[" + Timestamper.now() + "] [" + this.type.name() + "]" + this.body; 68 | } 69 | 70 | public static enum LogType { 71 | INFO, WARN, ERROR, DEBUG; 72 | 73 | public Color color() { 74 | switch (this) { 75 | case INFO: { 76 | return App.THEME.getLogInfoColor(); 77 | } 78 | case WARN: { 79 | return App.THEME.getLogWarnColor(); 80 | } 81 | case ERROR: { 82 | return App.THEME.getLogErrorColor(); 83 | } 84 | case DEBUG: { 85 | return App.THEME.getLogDebugColor(); 86 | } 87 | default: { 88 | return App.THEME.getConsoleTextColor(); 89 | } 90 | } 91 | } 92 | 93 | } 94 | } -------------------------------------------------------------------------------- /src/main/java/com/atlauncher/data/APIResponse.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ATLauncher - https://github.com/ATLauncher/ATLauncher 3 | * Copyright (C) 2013 ATLauncher 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package com.atlauncher.data; 19 | 20 | /** 21 | * Response to an API call made to ATLauncher servers. This contains information including if there was an error, the 22 | * response code of the request, the error message (if any) and the data received (if any) from the API. 23 | */ 24 | public class APIResponse { 25 | /** 26 | * If this request is an error or not. 27 | */ 28 | private boolean error; 29 | 30 | /** 31 | * The response code returned. 32 | * 33 | * @see http://wiki.atlauncher.com/api:response_code 34 | */ 35 | private int code; 36 | 37 | /** 38 | * The error message sent back by the API. Returns null if there was no error. 39 | */ 40 | private String message; 41 | 42 | /** 43 | * The data sent back by the API (if applicable). Can be of various types and may not be specified at all. 44 | */ 45 | private Object data; 46 | 47 | /** 48 | * Checks if this response was an error or not. 49 | * 50 | * @return if there was an error or not 51 | */ 52 | public boolean wasError() { 53 | return this.error; 54 | } 55 | 56 | /** 57 | * Gets the response code for this API response. 58 | * 59 | * @return the response code 60 | * @see http://wiki.atlauncher.com/api:response_code 61 | */ 62 | public int getCode() { 63 | return this.code; 64 | } 65 | 66 | /** 67 | * Gets the error message returned by the API. 68 | * 69 | * @return the error message received from the API if there was an error, or null if there was no error 70 | */ 71 | public String getMessage() { 72 | return this.message; 73 | } 74 | 75 | /** 76 | * Gets the data returned by the API. 77 | * 78 | * @return the data returned from the API. Please note that this may not be set or be null. 79 | */ 80 | public Object getData() { 81 | return this.data; 82 | } 83 | 84 | /** 85 | * Gets the data returned by the API as an Integer. 86 | * 87 | * @return the Integer representation of the data 88 | */ 89 | public int getDataAsInt() { 90 | return (Integer) this.data; 91 | } 92 | 93 | /** 94 | * Gets the data returned by the API as a String. 95 | * 96 | * @return the String representation of the data 97 | */ 98 | public String getDataAsString() { 99 | return (String) this.data; 100 | } 101 | } 102 | -------------------------------------------------------------------------------- /src/main/java/com/atlauncher/adapter/ColorTypeAdapter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ATLauncher - https://github.com/ATLauncher/ATLauncher 3 | * Copyright (C) 2013 ATLauncher 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package com.atlauncher.adapter; 20 | 21 | import com.google.gson.JsonParseException; 22 | import com.google.gson.TypeAdapter; 23 | import com.google.gson.stream.JsonReader; 24 | import com.google.gson.stream.JsonWriter; 25 | 26 | import java.awt.Color; 27 | import java.io.IOException; 28 | 29 | /** 30 | * This class will ensure that colors are serialized to a hex value for easy editing 31 | */ 32 | public final class ColorTypeAdapter extends TypeAdapter { 33 | @Override 34 | public void write(JsonWriter writer, Color c) throws IOException { 35 | writer.beginObject().name("value").value("#" + toHex(c)).endObject(); 36 | } 37 | 38 | @Override 39 | public Color read(JsonReader reader) throws IOException { 40 | reader.beginObject(); 41 | String next = reader.nextName(); 42 | if (!next.equalsIgnoreCase("value")) { 43 | throw new JsonParseException("Key " + next + " isnt a valid key"); 44 | } 45 | String hex = reader.nextString(); 46 | reader.endObject(); 47 | int[] rgb = toRGB(clamp(hex.substring(1))); 48 | return new Color(rgb[0], rgb[1], rgb[2]); 49 | } 50 | 51 | /** 52 | * Adds 0's to the end of a given hex code until it's length is 6 for use as a HTML colour code. 53 | * 54 | * @param hex The hex code to clamp to a length of 6 characters 55 | * @return The hex after claming to 6 characters length 56 | */ 57 | private String clamp(String hex) { 58 | while (hex.length() < 6) { 59 | hex += '0'; 60 | } 61 | return hex; 62 | } 63 | 64 | /** 65 | * Turns a hex colour code into a int array of length 3 with each element being the Red, Green and Blue individual 66 | * hex codes. 67 | *

68 | *

69 | * For example an input of "#FF00FF" returns {255, 0, 255} 70 | * 71 | * @param hex The hex code to convert to RGB format 72 | * @return The int array containing the RGB individual hex codes 73 | */ 74 | private int[] toRGB(String hex) { 75 | int[] ret = new int[3]; 76 | 77 | for (int i = 0; i < 3; i++) { 78 | ret[i] = Integer.parseInt(hex.substring(i * 2, i * 2 + 2), 16); 79 | } 80 | 81 | return ret; 82 | } 83 | 84 | /** 85 | * Converts a {@link Color} object into a hex code. 86 | *

87 | *

88 | * For example an input of Color.BLACK returns #FF00FF 89 | * 90 | * @param c The {@link Color} object to convert to hex 91 | * @return The hex string representing the given Color 92 | */ 93 | private String toHex(Color c) { 94 | return Integer.toHexString(c.getRGB() & 0xFFFFFF); 95 | } 96 | } 97 | -------------------------------------------------------------------------------- /src/main/java/com/atlauncher/data/json/Messages.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ATLauncher - https://github.com/ATLauncher/ATLauncher 3 | * Copyright (C) 2013 ATLauncher 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package com.atlauncher.data.json; 19 | 20 | import com.atlauncher.App; 21 | import com.atlauncher.annot.Json; 22 | import com.atlauncher.data.Language; 23 | import com.atlauncher.data.Pack; 24 | import com.atlauncher.utils.Utils; 25 | 26 | import javax.swing.JEditorPane; 27 | import javax.swing.JOptionPane; 28 | import javax.swing.event.HyperlinkEvent; 29 | import javax.swing.event.HyperlinkListener; 30 | 31 | @Json 32 | public class Messages { 33 | private String install; 34 | private String update; 35 | 36 | public boolean hasInstallMessage() { 37 | return this.install != null; 38 | } 39 | 40 | public String getInstallMessage() { 41 | return this.install; 42 | } 43 | 44 | public int showInstallMessage(Pack pack) { 45 | String[] options = {Language.INSTANCE.localize("common.ok"), Language.INSTANCE.localize("common.cancel")}; 46 | JEditorPane ep = new JEditorPane("text/html", "" + this.install + ""); 47 | ep.setEditable(false); 48 | ep.addHyperlinkListener(new HyperlinkListener() { 49 | @Override 50 | public void hyperlinkUpdate(HyperlinkEvent e) { 51 | if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) { 52 | Utils.openBrowser(e.getURL()); 53 | } 54 | } 55 | }); 56 | return JOptionPane.showOptionDialog(App.settings.getParent(), ep, Language.INSTANCE.localize("common" + 57 | ".installing") + " " + pack.getName(), JOptionPane.DEFAULT_OPTION, JOptionPane.WARNING_MESSAGE, null, 58 | options, options[0]); 59 | } 60 | 61 | public String getUpdateMessage() { 62 | return this.update; 63 | } 64 | 65 | public boolean hasUpdateMessage() { 66 | return this.update != null; 67 | } 68 | 69 | public int showUpdateMessage(Pack pack) { 70 | String[] options = {Language.INSTANCE.localize("common.ok"), Language.INSTANCE.localize("common.cancel")}; 71 | JEditorPane ep = new JEditorPane("text/html", "" + this.update + ""); 72 | ep.setEditable(false); 73 | ep.addHyperlinkListener(new HyperlinkListener() { 74 | @Override 75 | public void hyperlinkUpdate(HyperlinkEvent e) { 76 | if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) { 77 | Utils.openBrowser(e.getURL()); 78 | } 79 | } 80 | }); 81 | return JOptionPane.showOptionDialog(App.settings.getParent(), ep, Language.INSTANCE.localize("common" + 82 | ".reinstalling") + " " + pack.getName(), JOptionPane.DEFAULT_OPTION, JOptionPane.WARNING_MESSAGE, 83 | null, options, options[0]); 84 | } 85 | } 86 | -------------------------------------------------------------------------------- /src/main/java/com/atlauncher/gui/dialogs/GithubIssueReporterDialog.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ATLauncher - https://github.com/ATLauncher/ATLauncher 3 | * Copyright (C) 2013 ATLauncher 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package com.atlauncher.gui.dialogs; 20 | 21 | import com.atlauncher.App; 22 | import com.atlauncher.data.Constants; 23 | import com.atlauncher.data.Language; 24 | import com.atlauncher.gui.components.ToolsPanel; 25 | import com.atlauncher.reporter.GithubIssueReporter; 26 | 27 | import javax.swing.JButton; 28 | import javax.swing.JDialog; 29 | import javax.swing.JFrame; 30 | import javax.swing.JScrollPane; 31 | import javax.swing.JTextArea; 32 | import javax.swing.JTextField; 33 | import javax.swing.WindowConstants; 34 | import java.awt.BorderLayout; 35 | import java.awt.event.ActionEvent; 36 | import java.awt.event.ActionListener; 37 | 38 | public final class GithubIssueReporterDialog extends JDialog { 39 | private final JTextField TITLE_FIELD = new JTextField(16); 40 | private final JTextArea INFO_AREA = new JTextArea(16, 16); 41 | private final JButton CANCEL_BUTTON = new JButton(Language.INSTANCE.localize("common.cancel")); 42 | private final JButton SUBMIT_BUTTON = new JButton(Language.INSTANCE.localize("common.submit")); 43 | 44 | public GithubIssueReporterDialog(JFrame parent) { 45 | super(parent, "Submit a bug", ModalityType.APPLICATION_MODAL); 46 | 47 | this.CANCEL_BUTTON.addActionListener(new ActionListener() { 48 | @Override 49 | public void actionPerformed(ActionEvent e) { 50 | dispose(); 51 | } 52 | }); 53 | 54 | this.SUBMIT_BUTTON.addActionListener(new ActionListener() { 55 | @Override 56 | public void actionPerformed(ActionEvent e) { 57 | App.TASKPOOL.submit(new Runnable() { 58 | @Override 59 | public void run() { 60 | try { 61 | GithubIssueReporter.submit(TITLE_FIELD.getText() + " - " + Constants.VERSION, 62 | INFO_AREA.getText()); 63 | } catch (Exception e1) { 64 | e1.printStackTrace(System.err); 65 | } 66 | dispose(); 67 | } 68 | }); 69 | } 70 | }); 71 | 72 | this.INFO_AREA.setLineWrap(true); 73 | 74 | this.setLocationRelativeTo(parent); 75 | this.setResizable(false); 76 | this.setLayout(new BorderLayout()); 77 | this.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); 78 | this.add(this.TITLE_FIELD, BorderLayout.NORTH); 79 | this.add(new JScrollPane(this.INFO_AREA, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, 80 | JScrollPane.HORIZONTAL_SCROLLBAR_NEVER), BorderLayout.CENTER); 81 | this.add(new ToolsPanel().add(this.CANCEL_BUTTON).add(this.SUBMIT_BUTTON), BorderLayout.SOUTH); 82 | this.pack(); 83 | } 84 | } -------------------------------------------------------------------------------- /src/main/java/de/zh32/pingtest/ServerListPingB18.java: -------------------------------------------------------------------------------- 1 | package de.zh32.pingtest; 2 | 3 | import java.io.DataOutputStream; 4 | import java.io.IOException; 5 | import java.io.InputStream; 6 | import java.io.InputStreamReader; 7 | import java.io.OutputStream; 8 | import java.net.InetSocketAddress; 9 | import java.net.Socket; 10 | import java.nio.charset.Charset; 11 | 12 | /** 13 | * @author zh32 14 | */ 15 | public class ServerListPingB18 { 16 | private InetSocketAddress address; 17 | private int timeout = 2500; 18 | private String motd; 19 | private int playersOnline = -1; 20 | private int maxPlayers = -1; 21 | 22 | public InetSocketAddress getAddress() { 23 | return address; 24 | } 25 | 26 | public void setAddress(InetSocketAddress address) { 27 | this.address = address; 28 | } 29 | 30 | public int getTimeout() { 31 | return timeout; 32 | } 33 | 34 | public void setTimeout(int timeout) { 35 | this.timeout = timeout; 36 | } 37 | 38 | public String getMotd() { 39 | return motd; 40 | } 41 | 42 | public void setMotd(String motd) { 43 | this.motd = motd; 44 | } 45 | 46 | public int getPlayersOnline() { 47 | return playersOnline; 48 | } 49 | 50 | public void setPlayersOnline(int playersOnline) { 51 | this.playersOnline = playersOnline; 52 | } 53 | 54 | public int getMaxPlayers() { 55 | return maxPlayers; 56 | } 57 | 58 | public void setMaxPlayers(int maxPlayers) { 59 | this.maxPlayers = maxPlayers; 60 | } 61 | 62 | public boolean fetchData() throws Exception { 63 | Socket socket = new Socket(); 64 | OutputStream outputStream; 65 | DataOutputStream dataOutputStream; 66 | InputStream inputStream; 67 | InputStreamReader inputStreamReader; 68 | 69 | socket.setSoTimeout(timeout); 70 | socket.setKeepAlive(false); 71 | 72 | socket.connect(address, this.getTimeout()); 73 | outputStream = socket.getOutputStream(); 74 | dataOutputStream = new DataOutputStream(outputStream); 75 | 76 | inputStream = socket.getInputStream(); 77 | inputStreamReader = new InputStreamReader(inputStream, Charset.forName("UTF-16BE")); 78 | dataOutputStream.write(new byte[]{(byte) 0xFE}); 79 | 80 | int packetId = inputStream.read(); 81 | 82 | if (packetId == -1) { 83 | socket.close(); 84 | throw new IOException("Premature end of stream."); 85 | } 86 | 87 | if (packetId != 0xFF) { 88 | socket.close(); 89 | throw new IOException("Invalid packet ID (" + packetId + ")."); 90 | } 91 | 92 | int length = inputStreamReader.read(); 93 | 94 | if (length == -1) { 95 | socket.close(); 96 | throw new IOException("Premature end of stream."); 97 | } 98 | 99 | if (length == 0) { 100 | socket.close(); 101 | throw new IOException("Invalid string length."); 102 | } 103 | 104 | char[] chars = new char[length]; 105 | 106 | if (inputStreamReader.read(chars, 0, length) != length) { 107 | socket.close(); 108 | throw new IOException("Premature end of stream."); 109 | } 110 | 111 | String string = new String(chars); 112 | String[] data = string.split("§"); 113 | 114 | this.motd = data[0]; 115 | this.playersOnline = Integer.parseInt(data[1]); 116 | this.maxPlayers = Integer.parseInt(data[2]); 117 | 118 | dataOutputStream.close(); 119 | outputStream.close(); 120 | 121 | inputStreamReader.close(); 122 | inputStream.close(); 123 | socket.close(); 124 | 125 | return true; 126 | } 127 | } 128 | --------------------------------------------------------------------------------