mirror of
https://e.coding.net/circlecloud/BukkitInjectedTools.git
synced 2024-12-28 07:38:49 +00:00
feat: 添加网络下载内容
Signed-off-by: 502647092 <admin@yumc.pw>
This commit is contained in:
parent
5f6f196e97
commit
01d6fa17e5
26
.classpath
26
.classpath
@ -1,21 +1,23 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7">
|
||||
<attributes>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
|
||||
<attributes>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="src" path="src/main/resources" />
|
||||
<classpathentry kind="output" path="target/classes" />
|
||||
<classpathentry kind="src" output="target/classes" path="src/main/java">
|
||||
<attributes>
|
||||
<attribute name="optional" value="true" />
|
||||
<attribute name="maven.pomderived" value="true" />
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="src" path="src/main/resources"/>
|
||||
<classpathentry kind="output" path="target/classes"/>
|
||||
<classpathentry kind="con"
|
||||
path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7">
|
||||
<attributes>
|
||||
<attribute name="maven.pomderived" value="true" />
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="con"
|
||||
path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
|
||||
<attributes>
|
||||
<attribute name="maven.pomderived" value="true" />
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
</classpath>
|
||||
|
@ -21,6 +21,7 @@ import cn.citycraft.PluginHelper.utils.IOUtil;
|
||||
* @author 喵♂呜
|
||||
*/
|
||||
public class BukkitInjectedTools extends JavaPlugin implements HandlerCommands {
|
||||
private boolean downloading = false;
|
||||
|
||||
@HandlerCommand(name = "inject")
|
||||
public void inject(final InvokeCommandEvent e) throws IOException {
|
||||
@ -29,11 +30,23 @@ public class BukkitInjectedTools extends JavaPlugin implements HandlerCommands {
|
||||
|
||||
@HandlerCommand(name = "net")
|
||||
public void net(final InvokeCommandEvent e) throws IOException {
|
||||
if (downloading == true) {
|
||||
e.getSender().sendMessage("§c正在主线程下载文件,请勿重复测试...!");
|
||||
return;
|
||||
}
|
||||
e.getSender().sendMessage("§c主线程访问网络测试!");
|
||||
PluginKit.scheduleTask(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
IOUtil.getData("http://www.yumc.pw");
|
||||
downloading = true;
|
||||
try {
|
||||
final File nFile = new File(getDataFolder(), "null");
|
||||
IOUtil.downloadFile("http://pan.yumc.pw/null", nFile);
|
||||
nFile.delete();
|
||||
} catch (final IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
downloading = false;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user