mirror of
https://e.coding.net/circlecloud/BukkitInjectedTools.git
synced 2024-10-31 22:18:49 +00:00
fix: 修复下载地址错误
Signed-off-by: 502647092 <admin@yumc.pw>
This commit is contained in:
parent
1cb1d87b90
commit
f2bda81933
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user