From f2bda81933f833dfa282d29263495988472a2f79 Mon Sep 17 00:00:00 2001 From: 502647092 Date: Fri, 20 Jan 2017 20:45:38 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E4=B8=8B=E8=BD=BD?= =?UTF-8?q?=E5=9C=B0=E5=9D=80=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 502647092 --- .../pw/yumc/BukkitInjectedTools/YumTestCommand.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main/java/pw/yumc/BukkitInjectedTools/YumTestCommand.java b/src/main/java/pw/yumc/BukkitInjectedTools/YumTestCommand.java index a52a772..a1db4a6 100644 --- a/src/main/java/pw/yumc/BukkitInjectedTools/YumTestCommand.java +++ b/src/main/java/pw/yumc/BukkitInjectedTools/YumTestCommand.java @@ -4,6 +4,7 @@ import java.io.File; import java.io.IOException; import java.net.URL; import java.nio.file.Files; +import java.nio.file.StandardCopyOption; import org.bukkit.Bukkit; import org.bukkit.OfflinePlayer; @@ -15,6 +16,7 @@ import pw.yumc.YumCore.bukkit.P; import pw.yumc.YumCore.commands.CommandSub; import pw.yumc.YumCore.commands.annotation.Cmd; import pw.yumc.YumCore.commands.annotation.Help; +import pw.yumc.YumCore.commands.annotation.Option; import pw.yumc.YumCore.commands.annotation.Sort; import pw.yumc.YumCore.commands.interfaces.Executor; import pw.yumc.YumCore.kit.PKit; @@ -28,7 +30,6 @@ import pw.yumc.YumCore.kit.PKit; public class YumTestCommand implements Executor { private final String prefix = "§6[§bYum §a注入工具§6]§r "; private boolean downloading = false; - private String nfn = "null"; public YumTestCommand() { Log.setPrefix(prefix); @@ -113,12 +114,11 @@ public class YumTestCommand implements Executor { @Cmd @Help(value = "Yum 线程检测测试", possibleArguments = "文件大小[1 5 10 50]") @Sort(6) - public void thread(final CommandSender sender, String size) throws IOException { + public void thread(final CommandSender sender, @Option("def:5") final String size) throws IOException { if (downloading) { Log.sender(sender, "§c正在主线程下载文件,请勿重复测试...!"); return; } - nfn = "null" + (size != null ? "-" + size : ""); Log.sender(sender, "§c主线程中断测试开始!"); PKit.scheduleTask(new Runnable() { @Override @@ -126,11 +126,11 @@ public class YumTestCommand implements Executor { downloading = true; try { final File nFile = new File(getDataFolder(), "null"); - Files.copy(new URL("https://coding.net/u/502647092/p/YumData/git/raw/master/dd/" + nfn).openStream(), nFile.toPath()); + Files.copy(new URL("https://coding.net/u/502647092/p/YumData/git/raw/master/dd/" + size).openStream(), nFile.toPath(), StandardCopyOption.REPLACE_EXISTING); nFile.delete(); Log.sender(sender, "§a主线程中断测试结束!"); } catch (final IOException e) { - Log.sender(sender, "§a主线程中断测试失败 错误: " + e.getMessage()); + Log.sender(sender, "§a主线程中断测试失败 错误: " + e.getClass().getSimpleName() + " " + e.getMessage()); } downloading = false; }