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