本文整理汇总了Java中org.mcupdater.util.MCUpdater类的典型用法代码示例。如果您正苦于以下问题:Java MCUpdater类的具体用法?Java MCUpdater怎么用?Java MCUpdater使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MCUpdater类属于org.mcupdater.util包,在下文中一共展示了MCUpdater类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: SettingsManager
点赞 3
import org.mcupdater.util.MCUpdater; //导入依赖的package包/类
public SettingsManager() {
if (!configFile.toFile().exists()) {
System.out.println("New config file does not exist!");
File oldConfig = MCUpdater.getInstance().getArchiveFolder().resolve("config.properties").toFile();
if (oldConfig.exists()) {
System.out.println("Importing old config file");
this.settings = convertOldSettings(oldConfig);
} else {
System.out.println("Creating default config");
this.settings = getDefaultSettings();
}
saveSettings();
return;
}
System.out.println("Loading config");
loadSettings();
}
开发者ID:MCUpdater,
项目名称:MCU-API,
代码行数:18,
代码来源:SettingsManager.java
示例2: loadSettings
点赞 3
import org.mcupdater.util.MCUpdater; //导入依赖的package包/类
public void loadSettings() {
try {
BufferedReader reader = Files.newBufferedReader(configFile, StandardCharsets.UTF_8);
this.settings = gson.fromJson(reader, Settings.class);
reader.close();
Path jrePath = Paths.get(this.settings.getJrePath());
if (!jrePath.toFile().exists()) {
this.settings.setJrePath(System.getProperty("java.home"));
MCUpdater.getInstance().getParent().alert("Java was not found at: " + jrePath.toString() + " JRE path has automatically been changed to: " + this.settings.getJrePath() + ".");
saveSettings();
}
this.dirty=false;
fireStateUpdate();
fireSettingsUpdate();
} catch (IOException e) {
e.printStackTrace();
}
}
开发者ID:MCUpdater,
项目名称:MCU-API,
代码行数:19,
代码来源:SettingsManager.java
示例3: getDefaultSettings
点赞 3
import org.mcupdater.util.MCUpdater; //导入依赖的package包/类
public Settings getDefaultSettings() {
Settings newSettings = new Settings();
newSettings.setMinMemory(MCUpdater.defaultMemory);
newSettings.setMaxMemory(MCUpdater.defaultMemory);
newSettings.setPermGen(MCUpdater.defaultPermGen);
newSettings.setResWidth(1280);
newSettings.setResHeight(720);
newSettings.setFullScreen(false);
newSettings.setJrePath(System.getProperty("java.home"));
newSettings.setJvmOpts("");
newSettings.setInstanceRoot(MCUpdater.getInstance().getArchiveFolder().resolve("instances").toString());
newSettings.setProgramWrapper("");
newSettings.setTimeoutLength(5000);
newSettings.setAutoConnect(true);
newSettings.setMinimizeOnLaunch(true);
newSettings.setMinecraftToConsole(true);
return newSettings;
}
开发者ID:MCUpdater,
项目名称:MCU-API,
代码行数:19,
代码来源:SettingsManager.java
示例4: main
点赞 2
import org.mcupdater.util.MCUpdater; //导入依赖的package包/类
public static void main(String args[]) {
System.setProperty("java.net.preferIPv4Stack", "true");
instance = new MCUCLI();
OptionParser optParser = new OptionParser();
optParser.accepts("help", "Show help").forHelp();
optParser.formatHelpWith(new BuiltinHelpFormatter(160, 3));
ArgumentAcceptingOptionSpec<URL> packSpec = optParser.accepts("pack", "Pack URL").withRequiredArg().ofType(URL.class).required();
ArgumentAcceptingOptionSpec<String> serverSpec = optParser.accepts("server", "Server ID").withRequiredArg().ofType(String.class).required();
ArgumentAcceptingOptionSpec<File> pathSpec = optParser.accepts("path", "Install Path").withRequiredArg().ofType(File.class).required();
ArgumentAcceptingOptionSpec<ModSide> sideSpec = optParser.accepts("side", "Installation side").withRequiredArg().ofType(ModSide.class).defaultsTo(ModSide.SERVER);
optParser.accepts("debug", "Enable debugging");
optParser.accepts("clean", "Do clean install");
final OptionSet options = optParser.parse(args);
if (options.has("debug")) {
DEBUG = true;
}
if (options.has("help")) {
try {
optParser.printHelpOn(System.out);
} catch (IOException e) {
e.printStackTrace();
}
return;
}
URL pack = packSpec.value(options);
String server = serverSpec.value(options);
Path installPath = pathSpec.value(options).toPath();
ModSide side = sideSpec.value(options);
if (side.equals(ModSide.BOTH)) {
instance.baseLogger.severe("Invalid side specified!");
return;
}
MCUpdater.getInstance(installPath.toFile()).setParent(instance);
instance.doUpdate(pack, server, installPath, side, options.has("clean"));
}
开发者ID:MCUpdater,
项目名称:MCU-CLI,
代码行数:36,
代码来源:MCUCLI.java
示例5: AssetIndexInfo
点赞 2
import org.mcupdater.util.MCUpdater; //导入依赖的package包/类
public AssetIndexInfo(String id) {
this.id = id;
try {
// This is a legacy URL. The new URL should be returned in the version definition.
this.url = new URL("https://s3.amazonaws.com/Minecraft.Download/indexes/" + id + ".json");
} catch (MalformedURLException e) {
MCUpdater.apiLogger.log(Level.SEVERE, "Error getting asset index!", e);
}
this.known = false;
}
开发者ID:MCUpdater,
项目名称:MCU-API,
代码行数:11,
代码来源:AssetIndexInfo.java
示例6: getAssets
点赞 2
import org.mcupdater.util.MCUpdater; //导入依赖的package包/类
private static Set<Downloadable> getAssets(File baseDirectory, MinecraftVersion version){
Gson gson = new Gson();
Set<Downloadable> assets = new HashSet<>();
String indexName = version.getAssets();
if (indexName == null) {
indexName = "legacy";
}
try {
File objectsPath = new File(baseDirectory, "objects");
File indexesPath = new File(baseDirectory, "indexes");
File indexFile = new File(indexesPath, indexName + ".json");
URL indexUrl = version.getAssetIndex().getUrl();
//new URL("https://s3.amazonaws.com/Minecraft.Download/indexes/" + indexName + ".json");
URL resourceUrl = new URL("http://resources.download.minecraft.net/");
URL localUrl = MCUpdater.getInstance().getMCFolder().resolve("assets").toFile().toURI().toURL();
InputStream indexStream = indexUrl.openConnection().getInputStream();
String json = IOUtils.toString(indexStream);
FileUtils.writeStringToFile(indexFile, json);
AssetIndex index = gson.fromJson(json, AssetIndex.class);
for (AssetIndex.Asset object : index.getUniqueObjects()) {
String assetName = object.getHash().substring(0, 2) + "/" + object.getHash();
File asset = new File(objectsPath, assetName);
if ((!asset.isFile()) || (FileUtils.sizeOf(asset) != object.getSize())) {
List<URL> urls = new ArrayList<>();
File localAsset = MCUpdater.getInstance().getMCFolder().resolve("assets").resolve("objects").resolve(object.getHash().substring(0, 2)).resolve(object.getHash()).toFile();
if ((localAsset.isFile()) && (FileUtils.sizeOf(localAsset) == object.getSize())) {
urls.add(new URL(localUrl + "objects" + "/" + assetName));
} else {
urls.add(new URL(resourceUrl + assetName));
}
Downloadable download = new Downloadable(object.getHash(),"objects" + "/" + assetName, HashAlgorithm.SHA, object.getHash(), object.getSize(),urls);
assets.add(download);
}
}
} catch (Exception e) {}
return assets;
}
开发者ID:MCUpdater,
项目名称:MCU-API,
代码行数:40,
代码来源:AssetManager.java
示例7: getMD5
点赞 2
import org.mcupdater.util.MCUpdater; //导入依赖的package包/类
public String getMD5() {
if (md5 == null) {
MCUpdater.apiLogger.warning("No MD5 for Module " + this.id);
return "";
}
return md5;
}
开发者ID:MCUpdater,
项目名称:MCU-API,
代码行数:8,
代码来源:GenericModule.java
示例8: getMD5
点赞 2
import org.mcupdater.util.MCUpdater; //导入依赖的package包/类
public String getMD5()
{
if (md5 == null) {
MCUpdater.apiLogger.warning("No MD5 for ConfigFile: " + path);
return "";
}
return md5;
}
开发者ID:MCUpdater,
项目名称:MCU-API,
代码行数:9,
代码来源:ConfigFile.java
示例9: main
点赞 2
import org.mcupdater.util.MCUpdater; //导入依赖的package包/类
public static void main(String[] args) {
MCUpdater.getInstance();
List<Module> mods;
mods = new ArrayList<>(ServerPackParser.loadFromURL(args[0],args[1]).getModules().values());
Collections.sort(mods, new ModuleComparator(ModuleComparator.Mode.HIERARCHY));
for (Module x : mods) {
System.out.println(x.getParent() + "\t" + x.getName() + "\t" + x.getId() + "\t" + x.getUrls().get(0) + "\t" + x.getMeta().get("version"));
if (x.hasSubmodules()) {
for (GenericModule sub : x.getSubmodules()) {
System.out.println(sub.getParent() + "\t" + sub.getName() + "\t" + sub.getId() + "\t" + sub.getUrls().get(0) + "\t" + sub.getMeta().get("version"));
}
}
}
}
开发者ID:MCUpdater,
项目名称:MCU-API,
代码行数:15,
代码来源:PackList.java
示例10: main
点赞 2
import org.mcupdater.util.MCUpdater; //导入依赖的package包/类
public static void main(String[] args) {
MCUpdater.getInstance();
String ver = "1.12.1";
MinecraftVersion mcVer = MinecraftVersion.loadVersion(ver);
for (Library lib : mcVer.getLibraries()) {
if (lib.validForOS()) {
System.out.println("libraries/"+lib.getFilename());
}
}
}
开发者ID:MCUpdater,
项目名称:MCU-API,
代码行数:12,
代码来源:TestLibs.java
示例11: main
点赞 2
import org.mcupdater.util.MCUpdater; //导入依赖的package包/类
public static void main(final String[] args) {
System.setProperty("java.net.preferIPv4Stack", "true");
File basePath;
if(System.getProperty("os.name").startsWith("Windows"))
{
basePath = new File(new File(System.getenv("APPDATA")),".MCUpdater");
} else if(System.getProperty("os.name").startsWith("Mac"))
{
basePath = new File(new File(new File(new File(System.getProperty("user.home")),"Library"),"Application Support"),"MCUpdater");
}
else
{
basePath = new File(new File(System.getProperty("user.home")),".MCUpdater");
}
final MCUpdater mcu = MCUpdater.getInstance(basePath);
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
for (UIManager.LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) {
System.out.println("Installed L&F: " + info.getName());
if ("Nimbus".equals(info.getName())) {
UIManager.setLookAndFeel(info.getClassName());
break;
}
}
if (UIManager.getLookAndFeel().getName().equals("Metal")) {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
}
UIManager.addAuxiliaryLookAndFeel(new LookAndFeel() {
private final UIDefaults defaults = new UIDefaults() {
@Override
public javax.swing.plaf.ComponentUI getUI(JComponent c) {
if (c instanceof javax.swing.text.JTextComponent) {
if (c.getClientProperty(this) == null) {
c.setComponentPopupMenu(TextContextMenu.INSTANCE);
c.putClientProperty(this, Boolean.TRUE);
}
}
return null;
}
};
@Override public UIDefaults getDefaults() { return defaults; }
@Override public String getID() { return "TextContextMenu"; }
@Override public String getName() { return getID(); }
@Override public String getDescription() { return getID(); }
@Override public boolean isNativeLookAndFeel() { return false; }
@Override public boolean isSupportedLookAndFeel() { return true; }
});
new MainForm();
} catch (IllegalAccessException | InstantiationException | UnsupportedLookAndFeelException | ClassNotFoundException e) {
e.printStackTrace();
}
}
});
}
开发者ID:MCUpdater,
项目名称:PackBuilder,
代码行数:57,
代码来源:Main.java