Added Gaussion Blur

This commit is contained in:
unknown
2017-01-19 20:33:24 +08:00
parent b36c194f67
commit ed7c52f09f
138 changed files with 1792 additions and 2063 deletions

View File

@@ -21,7 +21,7 @@ buildscript {
mavenCentral();
dependencies {
classpath 'edu.sc.seis.gradle:launch4j:1.0.6'
classpath 'me.tatarka:gradle-retrolambda:3.1.0'
classpath 'me.tatarka:gradle-retrolambda:3.4.0'
}
}
}

View File

@@ -56,7 +56,7 @@ public class Main {
} catch (ParseException | UnsupportedLookAndFeelException ex) {
HMCLog.warn("Failed to set look and feel", ex);
}
UPDATE_CHECKER.process(false).reg(t -> MessageBox.Show("发现更新!" + t.version)).execute();
UPDATE_CHECKER.process(false).reg(t -> MessageBox.show("发现更新!" + t.version)).execute();
new MainWindow().setVisible(true);
} catch (Throwable t) {
HMCLog.err("There's something wrong when running server holder.", t);

View File

@@ -41,7 +41,6 @@ import org.jackhuang.hellominecraft.util.code.DigestUtils;
import org.jackhuang.hellominecraft.util.system.FileUtils;
import org.jackhuang.hellominecraft.util.system.IOUtils;
import org.jackhuang.hellominecraft.util.MessageBox;
import org.jackhuang.hellominecraft.util.NetUtils;
import org.jackhuang.hellominecraft.util.StrUtils;
import org.jackhuang.hellominecraft.util.tasks.TaskWindow;
import org.jackhuang.hellominecraft.util.tasks.download.FileDownloadTask;
@@ -67,7 +66,7 @@ public class ForgeInstaller {
ZipFile zipFile = new ZipFile(forgeInstaller);
ZipEntry entry = zipFile.getEntry("install_profile.json");
String content = NetUtils.getStreamContent(zipFile.getInputStream(entry));
String content = IOUtils.getStreamContent(zipFile.getInputStream(entry));
InstallProfile profile = gson.fromJson(content, InstallProfile.class);
HMCLog.log("Extracting cauldron server pack..." + profile.install.filePath);
@@ -88,8 +87,8 @@ public class ForgeInstaller {
File minecraftserver = new File(gameDir, "minecraft_server." + profile.install.minecraft + ".jar");
if (minecraftserver.exists() && JOptionPane.showConfirmDialog(null, "已发现官方服务端文件,是否要重新下载?") == JOptionPane.YES_OPTION)
if (!TaskWindow.factory().append(new FileDownloadTask("https://s3.amazonaws.com/Minecraft.Download/versions/{MCVER}/minecraft_server.{MCVER}.jar".replace("{MCVER}", profile.install.minecraft),
minecraftserver).setTag("minecraft_server")).create())
MessageBox.Show("Minecraft官方服务端下载失败");
minecraftserver).setTag("minecraft_server")).execute())
MessageBox.show("Minecraft官方服务端下载失败");
TaskWindow.TaskWindowFactory tw = TaskWindow.factory();
for (MinecraftLibrary library : profile.versionInfo.libraries) {
library.init();
@@ -99,8 +98,8 @@ public class ForgeInstaller {
libURL = library.url;
tw.append(new FileDownloadTask(libURL + library.formatted.replace("\\", "/"), lib).setTag(library.name));
}
if (!tw.create())
MessageBox.Show("压缩库下载失败!");
if (!tw.execute())
MessageBox.show("压缩库下载失败!");
tw = TaskWindow.factory();
for (MinecraftLibrary library : profile.versionInfo.libraries) {
@@ -114,8 +113,8 @@ public class ForgeInstaller {
libURL = library.url;
tw.append(new FileDownloadTask(libURL + library.formatted.replace("\\", "/"), lib).setTag(library.name));
}
if (!tw.create())
MessageBox.Show("库下载失败!");
if (!tw.execute())
MessageBox.show("库下载失败!");
ArrayList<String> badLibs = new ArrayList<>();
for (MinecraftLibrary library : profile.versionInfo.libraries) {
@@ -123,7 +122,7 @@ public class ForgeInstaller {
File packFile = new File(gameDir, "libraries" + File.separator + library.formatted + ".pack.xz");
if (packFile.exists() && packFile.isFile())
try {
unpackLibrary(lib.getParentFile(), NetUtils.getBytesFromStream(FileUtils.openInputStream(packFile)));
unpackLibrary(lib.getParentFile(), IOUtils.getBytesFromStream(FileUtils.openInputStream(packFile)));
if (!checksumValid(lib, Arrays.asList(library.checksums)))
badLibs.add(library.name);
} catch (IOException e) {
@@ -132,7 +131,7 @@ public class ForgeInstaller {
}
}
if (badLibs.size() > 0)
MessageBox.Show("这些库在解压的时候出现了问题" + badLibs.toString());
MessageBox.show("这些库在解压的时候出现了问题" + badLibs.toString());
}
public static void unpackLibrary(File output, byte[] data)
@@ -166,7 +165,7 @@ public class ForgeInstaller {
private static boolean checksumValid(File libPath, List<String> checksums) {
try {
byte[] fileData = NetUtils.getBytesFromStream(FileUtils.openInputStream(libPath));
byte[] fileData = IOUtils.getBytesFromStream(FileUtils.openInputStream(libPath));
boolean valid = (checksums == null) || (checksums.isEmpty()) || (checksums.contains(DigestUtils.sha1Hex(fileData)));
if ((!valid) && (libPath.getName().endsWith(".jar")))
valid = validateJar(libPath, fileData, checksums);

View File

@@ -22,7 +22,7 @@ import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.Date;
import org.jackhuang.hellominecraft.util.logging.HMCLog;
import org.jackhuang.hellominecraft.util.system.Compressor;
import org.jackhuang.hellominecraft.util.system.CompressingUtils;
import org.jackhuang.hellominecraft.svrmgr.setting.SettingsManager;
import org.jackhuang.hellominecraft.svrmgr.util.Utilities;
import org.jackhuang.hellominecraft.util.func.Consumer;
@@ -50,7 +50,7 @@ public class BackupManager {
public void run() {
try {
SimpleDateFormat f = new SimpleDateFormat("yyyy-MM-dd HH-mm-ss");
Compressor.zip(Utilities.getGameDir() + folder + File.separator,
CompressingUtils.zip(Utilities.getGameDir() + folder + File.separator,
backupDir() + "world+" + f.format(new Date()) + "+" + folder + ".zip");
} catch (IOException ex) {
HMCLog.warn("Failed to compress world pack.", ex);
@@ -79,7 +79,7 @@ public class BackupManager {
File world = new File(Utilities.getGameDir() + folder + File.separator);
FileUtils.deleteDirectoryQuietly(world);
world.mkdirs();
Compressor.unzip(backupFile, world);
CompressingUtils.unzip(backupFile, world);
} catch (IOException ex) {
HMCLog.warn("Failed to decompress world pack.", ex);
}
@@ -99,7 +99,7 @@ public class BackupManager {
public void run() {
try {
SimpleDateFormat f = new SimpleDateFormat("yyyy-MM-dd HH-mm-ss");
Compressor.zip(Utilities.getGameDir() + "plugins" + File.separator,
CompressingUtils.zip(Utilities.getGameDir() + "plugins" + File.separator,
backupDir() + "plugin+" + f.format(new Date()) + "+plugins.zip");
} catch (IOException ex) {
HMCLog.warn("Failed to compress world pack with plugins.", ex);

View File

@@ -235,7 +235,7 @@ public class Server implements Event<Integer>, MonitorThread.MonitorThreadListen
try {
run();
} catch (IOException ex) {
MessageBox.Show("重启失败!");
MessageBox.show("重启失败!");
HMCLog.warn("Failed to launch!", ex);
}
isRestart = false;

View File

@@ -2975,7 +2975,7 @@ public final class MainWindow extends javax.swing.JFrame
}
@Override
public void executeTask() {
public void executeTask(boolean areDependTasksSucceeded) {
javax.swing.JTable table = MainWindow.this.lstDownloads;
DefaultTableModel model = (DefaultTableModel) table.getModel();
@@ -2999,7 +2999,7 @@ public final class MainWindow extends javax.swing.JFrame
void refreshDownloads() {
clearListDownloads();
TaskWindow.factory().append(new RefreshDownloadsDone()).create();
TaskWindow.factory().append(new RefreshDownloadsDone()).execute();
}
void refreshInfos() {
@@ -3092,7 +3092,7 @@ public final class MainWindow extends javax.swing.JFrame
lstPlayers.setModel(lstPlayersModel);
});
else
MessageBox.Show("服务器未开启!");
MessageBox.show("服务器未开启!");
}
class ServerBeginListener implements Event<Void> {
@@ -3137,7 +3137,7 @@ public final class MainWindow extends javax.swing.JFrame
else if (option == JOptionPane.NO_OPTION)
FileUtils.write(eula, "eula=false");
} catch (IOException e) {
MessageBox.Show("确认rula失败");
MessageBox.show("确认rula失败");
}
}
File serverproperties = new File(new File(SettingsManager.settings.mainjar).getParentFile(), "server.properties");
@@ -3164,7 +3164,7 @@ public final class MainWindow extends javax.swing.JFrame
try {
Server.getInstance().run();
} catch (IOException ex) {
MessageBox.Show("启动服务端失败!");
MessageBox.show("启动服务端失败!");
HMCLog.err("Failed to launch!", ex);
}
}//GEN-LAST:event_btnLaunchActionPerformed
@@ -3335,7 +3335,7 @@ public final class MainWindow extends javax.swing.JFrame
op.saveAsBoth(new File(dir, "ops.txt"), new File(dir, "ops.json"));
} catch (IOException ex) {
HMCLog.warn("Failed to save ops", ex);
MessageBox.Show("添加失败。。。");
MessageBox.show("添加失败。。。");
}
}
}//GEN-LAST:event_btnAddOPActionPerformed
@@ -3355,7 +3355,7 @@ public final class MainWindow extends javax.swing.JFrame
op.saveAsBoth(new File(dir, "ops.txt"), new File(dir, "ops.json"));
} catch (IOException ex) {
HMCLog.warn("Failed to save ops", ex);
MessageBox.Show("删除失败。。。");
MessageBox.show("删除失败。。。");
}
}
}//GEN-LAST:event_btnDeleteOPActionPerformed
@@ -3374,7 +3374,7 @@ public final class MainWindow extends javax.swing.JFrame
whitelist.saveAsBoth(new File(dir, "white-list.txt"), new File(dir, "white-list.json"));
} catch (IOException ex) {
HMCLog.warn("Failed to save white-list", ex);
MessageBox.Show("添加失败。。。");
MessageBox.show("添加失败。。。");
}
}
}//GEN-LAST:event_btnAddWhiteActionPerformed
@@ -3394,7 +3394,7 @@ public final class MainWindow extends javax.swing.JFrame
whitelist.saveAsBoth(new File(dir, "white-list.txt"), new File(dir, "white-list.json"));
} catch (IOException ex) {
HMCLog.warn("Failed to save white-list", ex);
MessageBox.Show("删除失败。。。");
MessageBox.show("删除失败。。。");
}
}
}//GEN-LAST:event_btnDeleteWhiteActionPerformed
@@ -3421,7 +3421,7 @@ public final class MainWindow extends javax.swing.JFrame
model.addRow(new Object[] { fc.getSelectedFile().getName(), ModType.getModTypeShowName(ModType.getModType(newf)) });
lstExternalMods.updateUI();
} catch (IOException e) {
MessageBox.Show(C.i18n("mods.failed"));
MessageBox.show(C.i18n("mods.failed"));
HMCLog.warn("Failed to add ext mods", e);
}
}//GEN-LAST:event_btnAddExternelModActionPerformed
@@ -3460,7 +3460,7 @@ public final class MainWindow extends javax.swing.JFrame
model.addRow(new Object[] { fc.getSelectedFile().getName(), ModType.getModTypeShowName(ModType.getModType(newf)) });
FileUtils.copyFile(new File(path), newf);
} catch (IOException e) {
MessageBox.Show(C.i18n("mods.failed"));
MessageBox.show(C.i18n("mods.failed"));
HMCLog.warn("Failed to add ext core mod.", e);
}
}//GEN-LAST:event_btnAddExternelCoreModActionPerformed
@@ -3500,7 +3500,7 @@ public final class MainWindow extends javax.swing.JFrame
model.addRow(new Object[] { fc.getSelectedFile().getName(), ModType.getModTypeShowName(ModType.getModType(newf)) });
FileUtils.copyFile(new File(path), newf);
} catch (IOException e) {
MessageBox.Show(C.i18n("mods.failed"));
MessageBox.show(C.i18n("mods.failed"));
HMCLog.warn("Failed to add plugin", e);
}
}//GEN-LAST:event_btnAddPluginsActionPerformed
@@ -3566,7 +3566,7 @@ public final class MainWindow extends javax.swing.JFrame
whitelist.saveAsBoth(new File(dir, "banned-players.txt"), new File(dir, "banned-players.json"));
} catch (IOException ex) {
HMCLog.warn("Failed to save banned-players", ex);
MessageBox.Show(C.i18n("mods.failed"));
MessageBox.show(C.i18n("mods.failed"));
}
}
}//GEN-LAST:event_btnAddBanActionPerformed
@@ -3606,7 +3606,7 @@ public final class MainWindow extends javax.swing.JFrame
resizeBackgroundLabel();
} catch (IOException e) {
HMCLog.warn("Failed to set background path", e);
MessageBox.Show(C.i18n("ui.label.failed_set") + e.getMessage());
MessageBox.show(C.i18n("ui.label.failed_set") + e.getMessage());
}
}//GEN-LAST:event_btnSetBackgroundPathActionPerformed
@@ -3628,7 +3628,7 @@ public final class MainWindow extends javax.swing.JFrame
s.per = Double.parseDouble(txtTimerTaskPeriod.getText());
} catch (NumberFormatException e) {
HMCLog.warn("Failed to parse double: " + txtTimerTaskPeriod.getText(), e);
MessageBox.Show("错误的间隔时间");
MessageBox.show("错误的间隔时间");
return;
}
SettingsManager.settings.schedules.add(s);
@@ -3720,7 +3720,7 @@ public final class MainWindow extends javax.swing.JFrame
serverjar.delete();
String downloadURL = url + "minecraft_server." + id + ".jar";
TaskWindow.factory().append(new FileDownloadTask(downloadURL, serverjar).setTag(id)).create();
TaskWindow.factory().append(new FileDownloadTask(downloadURL, serverjar).setTag(id)).execute();
}//GEN-LAST:event_btnMinecraftServerDownloadActionPerformed
private void btnRefreshInfosActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnRefreshInfosActionPerformed
@@ -3783,7 +3783,7 @@ public final class MainWindow extends javax.swing.JFrame
txtCrashReport.setText(content);
} catch (IOException ex) {
HMCLog.warn("Failed to get crash-report.", ex);
MessageBox.Show("无法获取崩溃报告");
MessageBox.show("无法获取崩溃报告");
}
}//GEN-LAST:event_btnShowReportActionPerformed
@@ -3855,7 +3855,7 @@ public final class MainWindow extends javax.swing.JFrame
BukkitVersion v = cb.get(idx);
File file = new File("craftbukkit-" + ext + "-" + v.version + ".jar");
TaskWindow.factory().append(new FileDownloadTask(v.downloadLink, IOUtils.tryGetCanonicalFile(file)).setTag("bukkit-" + ext + "-" + v.version))
.create();
.execute();
}//GEN-LAST:event_btnDownloadCraftbukkitActionPerformed
private void btnDownloadMCPCActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnDownloadMCPCActionPerformed
@@ -3866,8 +3866,8 @@ public final class MainWindow extends javax.swing.JFrame
String url;
File filepath = new File("forge-installer.jar");
url = v.installer[1];
if (!TaskWindow.factory().append(new FileDownloadTask(url, filepath).setTag("cauldron-" + v.ver)).create())
MessageBox.Show(C.i18n("install.failed_download_forge"));
if (!TaskWindow.factory().append(new FileDownloadTask(url, filepath).setTag("cauldron-" + v.ver)).execute())
MessageBox.show(C.i18n("install.failed_download_forge"));
else
installMCPC(filepath);
}//GEN-LAST:event_btnDownloadMCPCActionPerformed
@@ -3876,10 +3876,10 @@ public final class MainWindow extends javax.swing.JFrame
try {
ForgeInstaller installer = new ForgeInstaller(new File("."), filepath);
installer.install();
MessageBox.Show(C.i18n("install.success"));
MessageBox.show(C.i18n("install.success"));
} catch (Exception e) {
HMCLog.warn("Failed to install liteloader", e);
MessageBox.Show(C.i18n("install.failed_forge"));
MessageBox.show(C.i18n("install.failed_forge"));
}
}
@@ -3907,7 +3907,7 @@ public final class MainWindow extends javax.swing.JFrame
private void btnInstallMCPCActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnInstallMCPCActionPerformed
File filepath = new File("forge-installer.jar");
if (!filepath.exists()) {
MessageBox.Show("您还未下载Cauldron请点击下载按钮下载并自动安装");
MessageBox.show("您还未下载Cauldron请点击下载按钮下载并自动安装");
return;
}
installMCPC(filepath);

View File

@@ -234,7 +234,7 @@ public class PluginInfoDialog extends javax.swing.JDialog {
TaskWindow.factory()
.append(new FileDownloadTask(url, new File(Utilities.getGameDir() + "plugins"
+ File.separator + pi.versions.get(index).filename)))
.create();
.execute();
}//GEN-LAST:event_jButton1ActionPerformed
// Variables declaration - do not modify//GEN-BEGIN:variables

View File

@@ -32,7 +32,7 @@ public class FolderOpener {
f.mkdirs();
java.awt.Desktop.getDesktop().open(f);
} catch (Exception ex) {
MessageBox.Show("无法打开资源管理器: " + ex.getMessage());
MessageBox.show("无法打开资源管理器: " + ex.getMessage());
}
}