mirror of
https://github.com/ME1312/SubServers-2.git
synced 2024-11-22 10:15:52 +01:00
SubServers 2 & SubServers.Host v2.11.2k/2.11.2b
This commit is contained in:
parent
21dbe876d4
commit
467bb8adf3
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -57,7 +57,6 @@
|
||||
<li><a href="net/ME1312/SubServers/Client/Bukkit/Library/Util.ExceptionRunnable.html" title="interface in net.ME1312.SubServers.Client.Bukkit.Library" target="classFrame"><span class="interfaceName">Util.ExceptionRunnable</span></a></li>
|
||||
<li><a href="net/ME1312/SubServers/Client/Bukkit/Library/Util.ReturnRunnable.html" title="interface in net.ME1312.SubServers.Client.Bukkit.Library" target="classFrame"><span class="interfaceName">Util.ReturnRunnable</span></a></li>
|
||||
<li><a href="net/ME1312/SubServers/Client/Bukkit/Library/Version/Version.html" title="class in net.ME1312.SubServers.Client.Bukkit.Library.Version" target="classFrame">Version</a></li>
|
||||
<li><a href="net/ME1312/SubServers/Client/Bukkit/Library/Version/VersionTokenizer.html" title="class in net.ME1312.SubServers.Client.Bukkit.Library.Version" target="classFrame">VersionTokenizer</a></li>
|
||||
<li><a href="net/ME1312/SubServers/Client/Bukkit/Library/Config/YAMLConfig.html" title="class in net.ME1312.SubServers.Client.Bukkit.Library.Config" target="classFrame">YAMLConfig</a></li>
|
||||
<li><a href="net/ME1312/SubServers/Client/Bukkit/Library/Config/YAMLSection.html" title="class in net.ME1312.SubServers.Client.Bukkit.Library.Config" target="classFrame">YAMLSection</a></li>
|
||||
<li><a href="net/ME1312/SubServers/Client/Bukkit/Library/Config/YAMLValue.html" title="class in net.ME1312.SubServers.Client.Bukkit.Library.Config" target="classFrame">YAMLValue</a></li>
|
||||
|
@ -57,7 +57,6 @@
|
||||
<li><a href="net/ME1312/SubServers/Client/Bukkit/Library/Util.ExceptionRunnable.html" title="interface in net.ME1312.SubServers.Client.Bukkit.Library"><span class="interfaceName">Util.ExceptionRunnable</span></a></li>
|
||||
<li><a href="net/ME1312/SubServers/Client/Bukkit/Library/Util.ReturnRunnable.html" title="interface in net.ME1312.SubServers.Client.Bukkit.Library"><span class="interfaceName">Util.ReturnRunnable</span></a></li>
|
||||
<li><a href="net/ME1312/SubServers/Client/Bukkit/Library/Version/Version.html" title="class in net.ME1312.SubServers.Client.Bukkit.Library.Version">Version</a></li>
|
||||
<li><a href="net/ME1312/SubServers/Client/Bukkit/Library/Version/VersionTokenizer.html" title="class in net.ME1312.SubServers.Client.Bukkit.Library.Version">VersionTokenizer</a></li>
|
||||
<li><a href="net/ME1312/SubServers/Client/Bukkit/Library/Config/YAMLConfig.html" title="class in net.ME1312.SubServers.Client.Bukkit.Library.Config">YAMLConfig</a></li>
|
||||
<li><a href="net/ME1312/SubServers/Client/Bukkit/Library/Config/YAMLSection.html" title="class in net.ME1312.SubServers.Client.Bukkit.Library.Config">YAMLSection</a></li>
|
||||
<li><a href="net/ME1312/SubServers/Client/Bukkit/Library/Config/YAMLValue.html" title="class in net.ME1312.SubServers.Client.Bukkit.Library.Config">YAMLValue</a></li>
|
||||
|
@ -1669,8 +1669,6 @@ the order they are declared.</div>
|
||||
</dd>
|
||||
<dt><span class="memberNameLink"><a href="net/ME1312/SubServers/Client/Bukkit/SubPlugin.html#version">version</a></span> - Variable in class net.ME1312.SubServers.Client.Bukkit.<a href="net/ME1312/SubServers/Client/Bukkit/SubPlugin.html" title="class in net.ME1312.SubServers.Client.Bukkit">SubPlugin</a></dt>
|
||||
<dd> </dd>
|
||||
<dt><a href="net/ME1312/SubServers/Client/Bukkit/Library/Version/VersionTokenizer.html" title="class in net.ME1312.SubServers.Client.Bukkit.Library.Version"><span class="typeNameLink">VersionTokenizer</span></a> - Class in <a href="net/ME1312/SubServers/Client/Bukkit/Library/Version/package-summary.html">net.ME1312.SubServers.Client.Bukkit.Library.Version</a></dt>
|
||||
<dd> </dd>
|
||||
</dl>
|
||||
<a name="I:Y">
|
||||
<!-- -->
|
||||
|
@ -48,7 +48,7 @@ var activeTableTab = "activeTableTab";
|
||||
<div class="subNav">
|
||||
<ul class="navList">
|
||||
<li>Prev Class</li>
|
||||
<li><a href="../../../../../../../net/ME1312/SubServers/Client/Bukkit/Library/Version/VersionTokenizer.html" title="class in net.ME1312.SubServers.Client.Bukkit.Library.Version"><span class="typeNameLink">Next Class</span></a></li>
|
||||
<li>Next Class</li>
|
||||
</ul>
|
||||
<ul class="navList">
|
||||
<li><a href="../../../../../../../index.html?net/ME1312/SubServers/Client/Bukkit/Library/Version/Version.html" target="_top">Frames</a></li>
|
||||
@ -354,7 +354,7 @@ implements java.io.Serializable, java.lang.Comparable<<a href="../../../../..
|
||||
<div class="subNav">
|
||||
<ul class="navList">
|
||||
<li>Prev Class</li>
|
||||
<li><a href="../../../../../../../net/ME1312/SubServers/Client/Bukkit/Library/Version/VersionTokenizer.html" title="class in net.ME1312.SubServers.Client.Bukkit.Library.Version"><span class="typeNameLink">Next Class</span></a></li>
|
||||
<li>Next Class</li>
|
||||
</ul>
|
||||
<ul class="navList">
|
||||
<li><a href="../../../../../../../index.html?net/ME1312/SubServers/Client/Bukkit/Library/Version/Version.html" target="_top">Frames</a></li>
|
||||
|
@ -1,194 +0,0 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||||
<!-- NewPage -->
|
||||
<html lang="en">
|
||||
<head>
|
||||
<!-- Generated by javadoc -->
|
||||
<title>VersionTokenizer (SubServers.Client.Bukkit)</title>
|
||||
<link rel="stylesheet" type="text/css" href="../../../../../../../stylesheet.css" title="Style">
|
||||
<script type="text/javascript" src="../../../../../../../script.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<script type="text/javascript"><!--
|
||||
try {
|
||||
if (location.href.indexOf('is-external=true') == -1) {
|
||||
parent.document.title="VersionTokenizer (SubServers.Client.Bukkit)";
|
||||
}
|
||||
}
|
||||
catch(err) {
|
||||
}
|
||||
//-->
|
||||
</script>
|
||||
<noscript>
|
||||
<div>JavaScript is disabled on your browser.</div>
|
||||
</noscript>
|
||||
<!-- ========= START OF TOP NAVBAR ======= -->
|
||||
<div class="topNav"><a name="navbar.top">
|
||||
<!-- -->
|
||||
</a>
|
||||
<div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div>
|
||||
<a name="navbar.top.firstrow">
|
||||
<!-- -->
|
||||
</a>
|
||||
<ul class="navList" title="Navigation">
|
||||
<li><a href="../../../../../../../overview-summary.html">Overview</a></li>
|
||||
<li><a href="package-summary.html">Package</a></li>
|
||||
<li class="navBarCell1Rev">Class</li>
|
||||
<li><a href="package-tree.html">Tree</a></li>
|
||||
<li><a href="../../../../../../../deprecated-list.html">Deprecated</a></li>
|
||||
<li><a href="../../../../../../../index-all.html">Index</a></li>
|
||||
<li><a href="../../../../../../../help-doc.html">Help</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="subNav">
|
||||
<ul class="navList">
|
||||
<li><a href="../../../../../../../net/ME1312/SubServers/Client/Bukkit/Library/Version/Version.html" title="class in net.ME1312.SubServers.Client.Bukkit.Library.Version"><span class="typeNameLink">Prev Class</span></a></li>
|
||||
<li>Next Class</li>
|
||||
</ul>
|
||||
<ul class="navList">
|
||||
<li><a href="../../../../../../../index.html?net/ME1312/SubServers/Client/Bukkit/Library/Version/VersionTokenizer.html" target="_top">Frames</a></li>
|
||||
<li><a href="VersionTokenizer.html" target="_top">No Frames</a></li>
|
||||
</ul>
|
||||
<ul class="navList" id="allclasses_navbar_top">
|
||||
<li><a href="../../../../../../../allclasses-noframe.html">All Classes</a></li>
|
||||
</ul>
|
||||
<div>
|
||||
<script type="text/javascript"><!--
|
||||
allClassesLink = document.getElementById("allclasses_navbar_top");
|
||||
if(window==top) {
|
||||
allClassesLink.style.display = "block";
|
||||
}
|
||||
else {
|
||||
allClassesLink.style.display = "none";
|
||||
}
|
||||
//-->
|
||||
</script>
|
||||
</div>
|
||||
<div>
|
||||
<ul class="subNavList">
|
||||
<li>Summary: </li>
|
||||
<li>Nested | </li>
|
||||
<li>Field | </li>
|
||||
<li>Constr | </li>
|
||||
<li><a href="#methods.inherited.from.class.java.lang.Object">Method</a></li>
|
||||
</ul>
|
||||
<ul class="subNavList">
|
||||
<li>Detail: </li>
|
||||
<li>Field | </li>
|
||||
<li>Constr | </li>
|
||||
<li>Method</li>
|
||||
</ul>
|
||||
</div>
|
||||
<a name="skip.navbar.top">
|
||||
<!-- -->
|
||||
</a></div>
|
||||
<!-- ========= END OF TOP NAVBAR ========= -->
|
||||
<!-- ======== START OF CLASS DATA ======== -->
|
||||
<div class="header">
|
||||
<div class="subTitle">net.ME1312.SubServers.Client.Bukkit.Library.Version</div>
|
||||
<h2 title="Class VersionTokenizer" class="title">Class VersionTokenizer</h2>
|
||||
</div>
|
||||
<div class="contentContainer">
|
||||
<ul class="inheritance">
|
||||
<li>java.lang.Object</li>
|
||||
<li>
|
||||
<ul class="inheritance">
|
||||
<li>net.ME1312.SubServers.Client.Bukkit.Library.Version.VersionTokenizer</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
<div class="description">
|
||||
<ul class="blockList">
|
||||
<li class="blockList">
|
||||
<hr>
|
||||
<br>
|
||||
<pre>public final class <span class="typeNameLabel">VersionTokenizer</span>
|
||||
extends java.lang.Object</pre>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="summary">
|
||||
<ul class="blockList">
|
||||
<li class="blockList">
|
||||
<!-- ========== METHOD SUMMARY =========== -->
|
||||
<ul class="blockList">
|
||||
<li class="blockList"><a name="method.summary">
|
||||
<!-- -->
|
||||
</a>
|
||||
<h3>Method Summary</h3>
|
||||
<ul class="blockList">
|
||||
<li class="blockList"><a name="methods.inherited.from.class.java.lang.Object">
|
||||
<!-- -->
|
||||
</a>
|
||||
<h3>Methods inherited from class java.lang.Object</h3>
|
||||
<code>equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait</code></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<!-- ========= END OF CLASS DATA ========= -->
|
||||
<!-- ======= START OF BOTTOM NAVBAR ====== -->
|
||||
<div class="bottomNav"><a name="navbar.bottom">
|
||||
<!-- -->
|
||||
</a>
|
||||
<div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div>
|
||||
<a name="navbar.bottom.firstrow">
|
||||
<!-- -->
|
||||
</a>
|
||||
<ul class="navList" title="Navigation">
|
||||
<li><a href="../../../../../../../overview-summary.html">Overview</a></li>
|
||||
<li><a href="package-summary.html">Package</a></li>
|
||||
<li class="navBarCell1Rev">Class</li>
|
||||
<li><a href="package-tree.html">Tree</a></li>
|
||||
<li><a href="../../../../../../../deprecated-list.html">Deprecated</a></li>
|
||||
<li><a href="../../../../../../../index-all.html">Index</a></li>
|
||||
<li><a href="../../../../../../../help-doc.html">Help</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="subNav">
|
||||
<ul class="navList">
|
||||
<li><a href="../../../../../../../net/ME1312/SubServers/Client/Bukkit/Library/Version/Version.html" title="class in net.ME1312.SubServers.Client.Bukkit.Library.Version"><span class="typeNameLink">Prev Class</span></a></li>
|
||||
<li>Next Class</li>
|
||||
</ul>
|
||||
<ul class="navList">
|
||||
<li><a href="../../../../../../../index.html?net/ME1312/SubServers/Client/Bukkit/Library/Version/VersionTokenizer.html" target="_top">Frames</a></li>
|
||||
<li><a href="VersionTokenizer.html" target="_top">No Frames</a></li>
|
||||
</ul>
|
||||
<ul class="navList" id="allclasses_navbar_bottom">
|
||||
<li><a href="../../../../../../../allclasses-noframe.html">All Classes</a></li>
|
||||
</ul>
|
||||
<div>
|
||||
<script type="text/javascript"><!--
|
||||
allClassesLink = document.getElementById("allclasses_navbar_bottom");
|
||||
if(window==top) {
|
||||
allClassesLink.style.display = "block";
|
||||
}
|
||||
else {
|
||||
allClassesLink.style.display = "none";
|
||||
}
|
||||
//-->
|
||||
</script>
|
||||
</div>
|
||||
<div>
|
||||
<ul class="subNavList">
|
||||
<li>Summary: </li>
|
||||
<li>Nested | </li>
|
||||
<li>Field | </li>
|
||||
<li>Constr | </li>
|
||||
<li><a href="#methods.inherited.from.class.java.lang.Object">Method</a></li>
|
||||
</ul>
|
||||
<ul class="subNavList">
|
||||
<li>Detail: </li>
|
||||
<li>Field | </li>
|
||||
<li>Constr | </li>
|
||||
<li>Method</li>
|
||||
</ul>
|
||||
</div>
|
||||
<a name="skip.navbar.bottom">
|
||||
<!-- -->
|
||||
</a></div>
|
||||
<!-- ======== END OF BOTTOM NAVBAR ======= -->
|
||||
</body>
|
||||
</html>
|
@ -13,7 +13,6 @@
|
||||
<h2 title="Classes">Classes</h2>
|
||||
<ul title="Classes">
|
||||
<li><a href="Version.html" title="class in net.ME1312.SubServers.Client.Bukkit.Library.Version" target="classFrame">Version</a></li>
|
||||
<li><a href="VersionTokenizer.html" title="class in net.ME1312.SubServers.Client.Bukkit.Library.Version" target="classFrame">VersionTokenizer</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</body>
|
||||
|
@ -86,10 +86,6 @@
|
||||
<div class="block">Version Class</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="rowColor">
|
||||
<td class="colFirst"><a href="../../../../../../../net/ME1312/SubServers/Client/Bukkit/Library/Version/VersionTokenizer.html" title="class in net.ME1312.SubServers.Client.Bukkit.Library.Version">VersionTokenizer</a></td>
|
||||
<td class="colLast"> </td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</li>
|
||||
|
@ -80,7 +80,6 @@
|
||||
<li type="circle">java.lang.Object
|
||||
<ul>
|
||||
<li type="circle">net.ME1312.SubServers.Client.Bukkit.Library.Version.<a href="../../../../../../../net/ME1312/SubServers/Client/Bukkit/Library/Version/Version.html" title="class in net.ME1312.SubServers.Client.Bukkit.Library.Version"><span class="typeNameLink">Version</span></a> (implements java.lang.Comparable<T>, java.io.Serializable)</li>
|
||||
<li type="circle">net.ME1312.SubServers.Client.Bukkit.Library.Version.<a href="../../../../../../../net/ME1312/SubServers/Client/Bukkit/Library/Version/VersionTokenizer.html" title="class in net.ME1312.SubServers.Client.Bukkit.Library.Version"><span class="typeNameLink">VersionTokenizer</span></a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
|
@ -164,7 +164,6 @@
|
||||
</li>
|
||||
<li type="circle">net.ME1312.SubServers.Client.Bukkit.Library.<a href="net/ME1312/SubServers/Client/Bukkit/Library/Util.html" title="class in net.ME1312.SubServers.Client.Bukkit.Library"><span class="typeNameLink">Util</span></a></li>
|
||||
<li type="circle">net.ME1312.SubServers.Client.Bukkit.Library.Version.<a href="net/ME1312/SubServers/Client/Bukkit/Library/Version/Version.html" title="class in net.ME1312.SubServers.Client.Bukkit.Library.Version"><span class="typeNameLink">Version</span></a> (implements java.lang.Comparable<T>, java.io.Serializable)</li>
|
||||
<li type="circle">net.ME1312.SubServers.Client.Bukkit.Library.Version.<a href="net/ME1312/SubServers/Client/Bukkit/Library/Version/VersionTokenizer.html" title="class in net.ME1312.SubServers.Client.Bukkit.Library.Version"><span class="typeNameLink">VersionTokenizer</span></a></li>
|
||||
<li type="circle">net.ME1312.SubServers.Client.Bukkit.Library.Config.<a href="net/ME1312/SubServers/Client/Bukkit/Library/Config/YAMLConfig.html" title="class in net.ME1312.SubServers.Client.Bukkit.Library.Config"><span class="typeNameLink">YAMLConfig</span></a></li>
|
||||
<li type="circle">net.ME1312.SubServers.Client.Bukkit.Library.Config.<a href="net/ME1312/SubServers/Client/Bukkit/Library/Config/YAMLSection.html" title="class in net.ME1312.SubServers.Client.Bukkit.Library.Config"><span class="typeNameLink">YAMLSection</span></a></li>
|
||||
<li type="circle">net.ME1312.SubServers.Client.Bukkit.Library.Config.<a href="net/ME1312/SubServers/Client/Bukkit/Library/Config/YAMLValue.html" title="class in net.ME1312.SubServers.Client.Bukkit.Library.Config"><span class="typeNameLink">YAMLValue</span></a></li>
|
||||
|
@ -1226,6 +1226,8 @@
|
||||
</dd>
|
||||
<dt><span class="memberNameLink"><a href="net/ME1312/SubServers/Host/Library/Log/Logger.html#message">message</a></span> - Variable in class net.ME1312.SubServers.Host.Library.Log.<a href="net/ME1312/SubServers/Host/Library/Log/Logger.html" title="class in net.ME1312.SubServers.Host.Library.Log">Logger</a></dt>
|
||||
<dd> </dd>
|
||||
<dt><span class="memberNameLink"><a href="net/ME1312/SubServers/Host/Network/Packet/PacketExDeleteServer.html#move-java.io.File-java.io.File-">move(File, File)</a></span> - Method in class net.ME1312.SubServers.Host.Network.Packet.<a href="net/ME1312/SubServers/Host/Network/Packet/PacketExDeleteServer.html" title="class in net.ME1312.SubServers.Host.Network.Packet">PacketExDeleteServer</a></dt>
|
||||
<dd> </dd>
|
||||
</dl>
|
||||
<a name="I:N">
|
||||
<!-- -->
|
||||
|
@ -17,7 +17,7 @@
|
||||
catch(err) {
|
||||
}
|
||||
//-->
|
||||
var methods = {"i0":10,"i1":10,"i2":10};
|
||||
var methods = {"i0":10,"i1":10,"i2":10,"i3":10};
|
||||
var tabs = {65535:["t0","All Methods"],2:["t2","Instance Methods"],8:["t4","Concrete Methods"]};
|
||||
var altColor = "altColor";
|
||||
var rowColor = "rowColor";
|
||||
@ -177,6 +177,11 @@ implements <a href="../../../../../../net/ME1312/SubServers/Host/Network/PacketI
|
||||
<div class="block">Get Packet Version</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="i3" class="rowColor">
|
||||
<td class="colFirst"><code>void</code></td>
|
||||
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../../net/ME1312/SubServers/Host/Network/Packet/PacketExDeleteServer.html#move-java.io.File-java.io.File-">move</a></span>(java.io.File from,
|
||||
java.io.File to)</code> </td>
|
||||
</tr>
|
||||
</table>
|
||||
<ul class="blockList">
|
||||
<li class="blockList"><a name="methods.inherited.from.class.java.lang.Object">
|
||||
@ -276,7 +281,7 @@ implements <a href="../../../../../../net/ME1312/SubServers/Host/Network/PacketI
|
||||
<a name="getVersion--">
|
||||
<!-- -->
|
||||
</a>
|
||||
<ul class="blockListLast">
|
||||
<ul class="blockList">
|
||||
<li class="blockList">
|
||||
<h4>getVersion</h4>
|
||||
<pre>public <a href="../../../../../../net/ME1312/SubServers/Host/Library/Version/Version.html" title="class in net.ME1312.SubServers.Host.Library.Version">Version</a> getVersion()</pre>
|
||||
@ -292,6 +297,16 @@ implements <a href="../../../../../../net/ME1312/SubServers/Host/Network/PacketI
|
||||
</dl>
|
||||
</li>
|
||||
</ul>
|
||||
<a name="move-java.io.File-java.io.File-">
|
||||
<!-- -->
|
||||
</a>
|
||||
<ul class="blockListLast">
|
||||
<li class="blockList">
|
||||
<h4>move</h4>
|
||||
<pre>public void move(java.io.File from,
|
||||
java.io.File to)</pre>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
|
@ -1,5 +1,5 @@
|
||||
Manifest-Version: 1.0
|
||||
Class-Path: BungeeCord.jar
|
||||
Main-Class: net.ME1312.SubServers.Bungee.Launch
|
||||
Implementation-Version: 2.11.2j
|
||||
Implementation-Version: 2.11.2k
|
||||
Specification-Version: 0
|
||||
|
@ -191,22 +191,23 @@ public class ExternalHost extends Host implements ClientHandler {
|
||||
@Override
|
||||
public boolean deleteSubServer(UUID player, String name) throws InterruptedException {
|
||||
if (Util.isNull(name)) throw new NullPointerException();
|
||||
String server = servers.get(name.toLowerCase()).getName();
|
||||
|
||||
SubRemoveServerEvent event = new SubRemoveServerEvent(player, this, getSubServer(name));
|
||||
SubRemoveServerEvent event = new SubRemoveServerEvent(player, this, getSubServer(server));
|
||||
plugin.getPluginManager().callEvent(event);
|
||||
if (!event.isCancelled()) {
|
||||
if (getSubServer(name).isRunning()) {
|
||||
getSubServer(name).stop();
|
||||
getSubServer(name).waitFor();
|
||||
if (getSubServer(server).isRunning()) {
|
||||
getSubServer(server).stop();
|
||||
getSubServer(server).waitFor();
|
||||
}
|
||||
|
||||
System.out.println("SubServers > Saving...");
|
||||
JSONObject info = (plugin.config.get().getSection("Servers").getKeys().contains(servers.get(name.toLowerCase()).getName())) ? plugin.config.get().getSection("Servers").getSection(servers.get(name.toLowerCase()).getName()).toJSON() : new JSONObject();
|
||||
info.put("Name", servers.get(name.toLowerCase()).getName());
|
||||
JSONObject info = (plugin.config.get().getSection("Servers").getKeys().contains(server)) ? plugin.config.get().getSection("Servers").getSection(server).toJSON() : new JSONObject();
|
||||
info.put("Name", server);
|
||||
info.put("Timestamp", Calendar.getInstance().getTime().getTime());
|
||||
try {
|
||||
if (plugin.config.get().getSection("Servers").getKeys().contains(servers.get(name.toLowerCase()).getName())) {
|
||||
plugin.config.get().getSection("Servers").remove(servers.get(name.toLowerCase()).getName());
|
||||
if (plugin.config.get().getSection("Servers").getKeys().contains(server)) {
|
||||
plugin.config.get().getSection("Servers").remove(server);
|
||||
plugin.config.save();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
@ -214,9 +215,9 @@ public class ExternalHost extends Host implements ClientHandler {
|
||||
}
|
||||
|
||||
System.out.println("SubServers > Removing Files...");
|
||||
queue(new PacketExDeleteServer(name, info, json -> {
|
||||
queue(new PacketExDeleteServer(server, info, json -> {
|
||||
if (json.getInt("r") == 0) {
|
||||
servers.remove(name.toLowerCase());
|
||||
servers.remove(server.toLowerCase());
|
||||
System.out.println("SubServers > Done!");
|
||||
} else {
|
||||
System.out.println("SubServers > Couldn't remove server from memory. See " + getName() + " console for more details");
|
||||
|
@ -59,6 +59,8 @@ public class ExternalSubLogger extends SubLogger {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
List<SubLogFilter> filters = new ArrayList<SubLogFilter>();
|
||||
filters.addAll(this.filters);
|
||||
for (SubLogFilter filter : filters) try {
|
||||
filter.start();
|
||||
} catch (Throwable e) {
|
||||
@ -111,6 +113,8 @@ public class ExternalSubLogger extends SubLogger {
|
||||
|
||||
// Filter Message
|
||||
boolean allow = true;
|
||||
List<SubLogFilter> filters = new ArrayList<SubLogFilter>();
|
||||
filters.addAll(this.filters);
|
||||
for (SubLogFilter filter : filters)
|
||||
try {
|
||||
if (allow) allow = filter.log(level, msg);
|
||||
@ -150,6 +154,8 @@ public class ExternalSubLogger extends SubLogger {
|
||||
PacketInExLogMessage.unregister(id);
|
||||
id = null;
|
||||
started = false;
|
||||
List<SubLogFilter> filters = new ArrayList<SubLogFilter>();
|
||||
filters.addAll(this.filters);
|
||||
for (SubLogFilter filter : filters) try {
|
||||
filter.stop();
|
||||
} catch (Throwable e) {
|
||||
@ -157,12 +163,13 @@ public class ExternalSubLogger extends SubLogger {
|
||||
}
|
||||
messages.clear();
|
||||
if (writer != null) {
|
||||
PrintWriter writer = this.writer;
|
||||
this.writer = null;
|
||||
int l = (int) Math.floor((("---------- LOG START \u2014 " + name + " ----------").length() - 9) / 2);
|
||||
String s = "";
|
||||
while (s.length() < l) s += '-';
|
||||
writer.println(s + " LOG END " + s);
|
||||
writer.close();
|
||||
writer = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -138,11 +138,11 @@ public class InternalHost extends Host {
|
||||
@Override
|
||||
public boolean deleteSubServer(UUID player, String name) throws InterruptedException {
|
||||
if (Util.isNull(name)) throw new NullPointerException();
|
||||
|
||||
File from = new File(getDirectory(), servers.get(name.toLowerCase()).getDirectory());
|
||||
if (removeSubServer(player, name)) {
|
||||
String server = servers.get(name.toLowerCase()).getName();
|
||||
File from = new File(getDirectory(), servers.get(server.toLowerCase()).getDirectory());
|
||||
if (removeSubServer(player, server)) {
|
||||
new Thread(() -> {
|
||||
UniversalFile to = new UniversalFile(plugin.dir, "SubServers:Recently Deleted:" + name.toLowerCase());
|
||||
UniversalFile to = new UniversalFile(plugin.dir, "SubServers:Recently Deleted:" + server.toLowerCase());
|
||||
try {
|
||||
if (from.exists()) {
|
||||
System.out.println("SubServers > Removing Files...");
|
||||
@ -158,12 +158,12 @@ public class InternalHost extends Host {
|
||||
}
|
||||
|
||||
System.out.println("SubServers > Saving...");
|
||||
JSONObject json = (plugin.config.get().getSection("Servers").getKeys().contains(servers.get(name.toLowerCase()).getName()))?plugin.config.get().getSection("Servers").getSection(servers.get(name.toLowerCase()).getName()).toJSON():new JSONObject();
|
||||
json.put("Name", servers.get(name.toLowerCase()).getName());
|
||||
JSONObject json = (plugin.config.get().getSection("Servers").getKeys().contains(server))?plugin.config.get().getSection("Servers").getSection(server).toJSON():new JSONObject();
|
||||
json.put("Name", server);
|
||||
json.put("Timestamp", Calendar.getInstance().getTime().getTime());
|
||||
try {
|
||||
if (plugin.config.get().getSection("Servers").getKeys().contains(servers.get(name.toLowerCase()).getName())) {
|
||||
plugin.config.get().getSection("Servers").remove(servers.get(name.toLowerCase()).getName());
|
||||
if (plugin.config.get().getSection("Servers").getKeys().contains(server)) {
|
||||
plugin.config.get().getSection("Servers").remove(server);
|
||||
plugin.config.save();
|
||||
}
|
||||
if (!to.exists()) to.mkdirs();
|
||||
|
@ -59,11 +59,9 @@ public class InternalSubCreator extends SubCreator {
|
||||
exec = new Executable("java -Xmx" + memory + "M -Djline.terminal=jline.UnsupportedTerminal -Dcom.mojang.eula.agree=true -jar Spigot.jar");
|
||||
|
||||
try {
|
||||
generateSpigotYAML(dir);
|
||||
copyFolder(new UniversalFile(host.plugin.dir, "SubServers:Templates:Spigot"), dir);
|
||||
generateProperties(dir, port);
|
||||
System.out.println(host.getName() + "/Creator > Copying Plugins...");
|
||||
generateClient(dir, name, type);
|
||||
copyFolder(new UniversalFile(host.plugin.dir, "SubServers:Plugin Templates:Spigot Plugins"), new UniversalFile(dir, "plugins"));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
@ -72,20 +70,19 @@ public class InternalSubCreator extends SubCreator {
|
||||
exec = new Executable("java -Xmx" + memory + "M -jar Vanilla.jar nogui");
|
||||
|
||||
try {
|
||||
copyFolder(new UniversalFile(host.plugin.dir, "SubServers:Templates:Vanilla"), dir);
|
||||
generateEULA(dir);
|
||||
generateProperties(dir, port);
|
||||
} catch (FileNotFoundException | UnsupportedEncodingException e) {
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
} else if (type == ServerType.SPONGE) {
|
||||
try {
|
||||
exec = new Executable("java -Xmx" + memory + "M -jar Forge.jar");
|
||||
|
||||
new UniversalFile(dir, "config").mkdirs();
|
||||
new UniversalFile(dir, "mods").mkdirs();
|
||||
copyFolder(new UniversalFile(host.plugin.dir, "SubServers:Templates:Sponge"), dir);
|
||||
generateEULA(dir);
|
||||
generateProperties(dir, port);
|
||||
generateSpongeConf(dir);
|
||||
generateClient(dir, name, type);
|
||||
|
||||
System.out.println(host.getName() + "/Creator > Searching Versions...");
|
||||
@ -119,10 +116,6 @@ public class InternalSubCreator extends SubCreator {
|
||||
System.out.println(host.getName() + "/Creator > Found \"forge-" + mcfversion.toString() + '"');
|
||||
|
||||
version = new Version(mcfversion.toString() + "::" + spversion.toString());
|
||||
|
||||
System.out.println(host.getName() + "/Creator > Copying Mods...");
|
||||
copyFolder(new UniversalFile(host.plugin.dir, "SubServers:Plugin Templates:Sponge Config"), new UniversalFile(dir, "config"));
|
||||
copyFolder(new UniversalFile(host.plugin.dir, "SubServers:Plugin Templates:Sponge Mods"), new UniversalFile(dir, "mods"));
|
||||
} catch (ParserConfigurationException | IOException | SAXException | NullPointerException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
@ -261,9 +254,9 @@ public class InternalSubCreator extends SubCreator {
|
||||
|
||||
private void generateClient(File dir, String name, ServerType type) throws IOException {
|
||||
if (type == ServerType.SPIGOT) {
|
||||
new UniversalFile(dir, "plugins:SubServers").mkdirs();
|
||||
new UniversalFile(dir, "plugins:SubServers-Client-Bukkit").mkdirs();
|
||||
Util.copyFromJar(SubPlugin.class.getClassLoader(), "net/ME1312/SubServers/Bungee/Library/Files/bukkit.jar", new UniversalFile(dir, "plugins:SubServers.Client.jar").getPath());
|
||||
YAMLConfig config = new YAMLConfig(new UniversalFile(dir, "plugins:Subservers:config.yml"));
|
||||
YAMLConfig config = new YAMLConfig(new UniversalFile(dir, "plugins:Subservers-Client-Bukkit:config.yml"));
|
||||
YAMLSection settings = new YAMLSection();
|
||||
settings.set("Version", "2.11.2a+");
|
||||
settings.set("Ingame-Access", true);
|
||||
@ -288,321 +281,14 @@ public class InternalSubCreator extends SubCreator {
|
||||
|
||||
writer.close();
|
||||
}
|
||||
private void generateProperties(File dir, int port) throws FileNotFoundException, UnsupportedEncodingException {
|
||||
PrintWriter writer = new PrintWriter(new File(dir, "server.properties"), "UTF-8");
|
||||
|
||||
writer.println("#Minecraft server properties");
|
||||
writer.println("#" + new SimpleDateFormat("EEE MMM d HH:mm:ss z yyyy").format(Calendar.getInstance().getTime()));
|
||||
writer.println("generator-settings=");
|
||||
writer.println("op-permission-level=4");
|
||||
writer.println("allow-nether=true");
|
||||
writer.println("resource-pack-hash=");
|
||||
writer.println("level-name=world");
|
||||
writer.println("enable-query=true");
|
||||
writer.println("allow-flight=false");
|
||||
writer.println("announce-player-achievements=false");
|
||||
writer.println("server-port=" + port);
|
||||
writer.println("max-world-size=29999984");
|
||||
writer.println("level-type=DEFAULT");
|
||||
writer.println("enable-rcon=false");
|
||||
writer.println("level-seed=");
|
||||
writer.println("force-gamemode=false");
|
||||
writer.println("server-ip=" + host.getAddress().toString().substring(1));
|
||||
writer.println("network-compression-threshold=-1");
|
||||
writer.println("max-build-height=256");
|
||||
writer.println("spawn-npcs=true");
|
||||
writer.println("white-list=false");
|
||||
writer.println("spawn-animals=true");
|
||||
writer.println("snooper-enabled=true");
|
||||
writer.println("online-mode=false");
|
||||
writer.println("resource-pack=");
|
||||
writer.println("pvp=true");
|
||||
writer.println("difficulty=1");
|
||||
writer.println("enable-command-block=true");
|
||||
writer.println("gamemode=0");
|
||||
writer.println("player-idle-timeout=0");
|
||||
writer.println("max-players=20");
|
||||
writer.println("max-tick-time=60000");
|
||||
writer.println("spawn-monsters=true");
|
||||
writer.println("generate-structures=true");
|
||||
writer.println("view-distance=10");
|
||||
writer.println("motd=A Generated SubServer");
|
||||
|
||||
private void generateProperties(File dir, int port) throws IOException {
|
||||
File file = new File(dir, "server.properties");
|
||||
String content = Util.readAll(new BufferedReader(new InputStreamReader(new FileInputStream(file)))).replace("server-port=", "server-port=" + port).replace("server-ip=", "server-ip=" + host.getAddress().toString().substring(1));
|
||||
file.delete();
|
||||
PrintWriter writer = new PrintWriter(file, "UTF-8");
|
||||
writer.write(content);
|
||||
writer.close();
|
||||
}
|
||||
private void generateSpigotYAML(File dir) throws FileNotFoundException, UnsupportedEncodingException {
|
||||
PrintWriter writer = new PrintWriter(new File(dir, "spigot.yml"), "UTF-8");
|
||||
|
||||
writer.println("# This is the main configuration file for Spigot.");
|
||||
writer.println("# As you can see, there's tons to configure. Some options may impact gameplay, so use");
|
||||
writer.println("# with caution, and make sure you know what each option does before configuring.");
|
||||
writer.println("# For a reference for any variable inside this file, check out the Spigot wiki at");
|
||||
writer.println("# http://www.spigotmc.org/wiki/spigot-configuration/");
|
||||
writer.println("#");
|
||||
writer.println("# If you need help with the configuration or have any questions related to Spigot,");
|
||||
writer.println("# join us at the IRC or drop by our forums and leave a post.");
|
||||
writer.println("#");
|
||||
writer.println("# IRC: #spigot @ irc.spi.gt ( http://www.spigotmc.org/pages/irc/ )");
|
||||
writer.println("# Forums: http://www.spigotmc.org/");
|
||||
writer.println();
|
||||
writer.println("config-version: 8");
|
||||
writer.println("settings:");
|
||||
writer.println(" debug: false");
|
||||
writer.println(" save-user-cache-on-stop-only: false");
|
||||
writer.println(" bungeecord: true");
|
||||
writer.println(" late-bind: false");
|
||||
writer.println(" sample-count: 12");
|
||||
writer.println(" player-shuffle: 0");
|
||||
writer.println(" filter-creative-items: true");
|
||||
writer.println(" user-cache-size: 1000");
|
||||
writer.println(" int-cache-limit: 1024");
|
||||
writer.println(" moved-wrongly-threshold: 0.0625");
|
||||
writer.println(" moved-too-quickly-threshold: 100.0");
|
||||
writer.println(" timeout-time: 60");
|
||||
writer.println(" restart-on-crash: false");
|
||||
writer.println(" restart-script: ./start.sh");
|
||||
writer.println(" netty-threads: 4");
|
||||
writer.println(" attribute:");
|
||||
writer.println(" maxHealth:");
|
||||
writer.println(" max: 2048.0");
|
||||
writer.println(" movementSpeed:");
|
||||
writer.println(" max: 2048.0");
|
||||
writer.println(" attackDamage:");
|
||||
writer.println(" max: 2048.0");
|
||||
writer.println("commands:");
|
||||
writer.println(" tab-complete: 0");
|
||||
writer.println(" log: true");
|
||||
writer.println(" spam-exclusions:");
|
||||
writer.println(" - /skill");
|
||||
writer.println(" silent-commandblock-console: true");
|
||||
writer.println(" replace-commands:");
|
||||
writer.println(" - setblock");
|
||||
writer.println(" - summon");
|
||||
writer.println(" - testforblock");
|
||||
writer.println(" - tellraw");
|
||||
writer.println("messages:");
|
||||
writer.println(" whitelist: You are not whitelisted on this server!");
|
||||
writer.println(" unknown-command: Unknown command. Type \"/help\" for help.");
|
||||
writer.println(" server-full: The server is full!");
|
||||
writer.println(" outdated-client: Outdated client! Please use {0}");
|
||||
writer.println(" outdated-server: Outdated server! I'm still on {0}");
|
||||
writer.println(" restart: Server is restarting");
|
||||
writer.println("stats:");
|
||||
writer.println(" disable-saving: false");
|
||||
writer.println(" forced-stats: {}");
|
||||
writer.println("world-settings:");
|
||||
writer.println(" default:");
|
||||
writer.println(" verbose: true");
|
||||
writer.println(" wither-spawn-sound-radius: 0");
|
||||
writer.println(" view-distance: 10");
|
||||
writer.println(" item-despawn-rate: 6000");
|
||||
writer.println(" merge-radius:");
|
||||
writer.println(" item: 2.5");
|
||||
writer.println(" exp: 3.0");
|
||||
writer.println(" arrow-despawn-rate: 1200");
|
||||
writer.println(" enable-zombie-pigmen-portal-spawns: true");
|
||||
writer.println(" zombie-aggressive-towards-villager: true");
|
||||
writer.println(" hanging-tick-frequency: 100");
|
||||
writer.println(" max-bulk-chunks: 10");
|
||||
writer.println(" max-entity-collisions: 8");
|
||||
writer.println(" random-light-updates: false");
|
||||
writer.println(" save-structure-info: true");
|
||||
writer.println(" mob-spawn-range: 4");
|
||||
writer.println(" anti-xray:");
|
||||
writer.println(" enabled: true");
|
||||
writer.println(" engine-mode: 1");
|
||||
writer.println(" hide-blocks:");
|
||||
writer.println(" - 14");
|
||||
writer.println(" - 15");
|
||||
writer.println(" - 16");
|
||||
writer.println(" - 21");
|
||||
writer.println(" - 48");
|
||||
writer.println(" - 49");
|
||||
writer.println(" - 54");
|
||||
writer.println(" - 56");
|
||||
writer.println(" - 73");
|
||||
writer.println(" - 74");
|
||||
writer.println(" - 82");
|
||||
writer.println(" - 129");
|
||||
writer.println(" - 130");
|
||||
writer.println(" replace-blocks:");
|
||||
writer.println(" - 1");
|
||||
writer.println(" - 5");
|
||||
writer.println(" dragon-death-sound-radius: 0");
|
||||
writer.println(" seed-village: 10387312");
|
||||
writer.println(" seed-feature: 14357617");
|
||||
writer.println(" hunger:");
|
||||
writer.println(" walk-exhaustion: 0.2");
|
||||
writer.println(" sprint-exhaustion: 0.8");
|
||||
writer.println(" combat-exhaustion: 0.3");
|
||||
writer.println(" regen-exhaustion: 3.0");
|
||||
writer.println(" max-tnt-per-tick: 100");
|
||||
writer.println(" max-tick-time:");
|
||||
writer.println(" tile: 50");
|
||||
writer.println(" entity: 50");
|
||||
writer.println(" entity-activation-range:");
|
||||
writer.println(" animals: 32");
|
||||
writer.println(" monsters: 32");
|
||||
writer.println(" misc: 16");
|
||||
writer.println(" entity-tracking-range:");
|
||||
writer.println(" players: 48");
|
||||
writer.println(" animals: 48");
|
||||
writer.println(" monsters: 48");
|
||||
writer.println(" misc: 32");
|
||||
writer.println(" other: 64");
|
||||
writer.println(" ticks-per:");
|
||||
writer.println(" hopper-transfer: 8");
|
||||
writer.println(" hopper-check: 8");
|
||||
writer.println(" hopper-amount: 1");
|
||||
writer.println(" growth:");
|
||||
writer.println(" cactus-modifier: 100");
|
||||
writer.println(" cane-modifier: 100");
|
||||
writer.println(" melon-modifier: 100");
|
||||
writer.println(" mushroom-modifier: 100");
|
||||
writer.println(" pumpkin-modifier: 100");
|
||||
writer.println(" sapling-modifier: 100");
|
||||
writer.println(" wheat-modifier: 100");
|
||||
writer.println(" netherwart-modifier: 100");
|
||||
writer.println(" nerf-spawner-mobs: false");
|
||||
writer.println(" chunks-per-tick: 650");
|
||||
writer.println(" clear-tick-list: false");
|
||||
writer.println();
|
||||
|
||||
writer.close();
|
||||
}
|
||||
private void generateSpongeConf(File dir) throws FileNotFoundException, UnsupportedEncodingException {
|
||||
new File(dir, "config" + File.separator + "sponge").mkdirs();
|
||||
PrintWriter writer = new PrintWriter(new File(dir, "config" + File.separator + "sponge" + File.separator + "global.conf"), "UTF-8");
|
||||
writer.println("# 1.0");
|
||||
writer.println("#");
|
||||
writer.println("# # If you need help with the configuration or have any questions related to Sponge,");
|
||||
writer.println("# # join us at the IRC or drop by our forums and leave a post.");
|
||||
writer.println("#");
|
||||
writer.println("# # IRC: #sponge @ irc.esper.net ( http://webchat.esper.net/?channel=sponge )");
|
||||
writer.println("# # Forums: https://forums.spongepowered.org/");
|
||||
writer.println("#");
|
||||
writer.println();
|
||||
writer.println("sponge {");
|
||||
writer.println(" block-tracking {");
|
||||
writer.println(" # If enabled, adds player tracking support for block positions. Note: This should only be disabled if you do not care who caused a block to change.");
|
||||
writer.println(" enabled=true");
|
||||
writer.println(" }");
|
||||
writer.println(" bungeecord {");
|
||||
writer.println(" # If enabled, allows BungeeCord to forward IP address, UUID, and Game Profile to this server");
|
||||
writer.println(" ip-forwarding=true");
|
||||
writer.println(" }");
|
||||
writer.println(" commands {}");
|
||||
writer.println(" debug {");
|
||||
writer.println(" # Dump chunks in the event of a deadlock");
|
||||
writer.println(" dump-chunks-on-deadlock=false");
|
||||
writer.println(" # Dump the heap in the event of a deadlock");
|
||||
writer.println(" dump-heap-on-deadlock=false");
|
||||
writer.println(" # Dump the server thread on deadlock warning");
|
||||
writer.println(" dump-threads-on-warn=false");
|
||||
writer.println(" # Enable Java's thread contention monitoring for thread dumps");
|
||||
writer.println(" thread-contention-monitoring=false");
|
||||
writer.println(" }");
|
||||
writer.println(" entity {");
|
||||
writer.println(" # Number of colliding entities in one spot before logging a warning. Set to 0 to disable");
|
||||
writer.println(" collision-warn-size=200");
|
||||
writer.println(" # Number of entities in one dimension before logging a warning. Set to 0 to disable");
|
||||
writer.println(" count-warn-size=0");
|
||||
writer.println(" # Number of ticks before a painting is respawned on clients when their art is changed");
|
||||
writer.println(" entity-painting-respawn-delay=2");
|
||||
writer.println(" # Number of ticks before the fake player entry of a human is removed from the tab list (range of 0 to 100 ticks).");
|
||||
writer.println(" human-player-list-remove-delay=10");
|
||||
writer.println(" # Controls the time in ticks for when an item despawns.");
|
||||
writer.println(" item-despawn-rate=6000");
|
||||
writer.println(" # Max size of an entity's bounding box before removing it. Set to 0 to disable");
|
||||
writer.println(" max-bounding-box-size=1000");
|
||||
writer.println(" # Square of the max speed of an entity before removing it. Set to 0 to disable");
|
||||
writer.println(" max-speed=100");
|
||||
writer.println(" }");
|
||||
writer.println(" entity-activation-range {");
|
||||
writer.println(" ambient-activation-range=32");
|
||||
writer.println(" aquatic-activation-range=32");
|
||||
writer.println(" creature-activation-range=32");
|
||||
writer.println(" minecraft {");
|
||||
writer.println(" creature {");
|
||||
writer.println(" entityhorse=true");
|
||||
writer.println(" pig=true");
|
||||
writer.println(" sheep=true");
|
||||
writer.println(" }");
|
||||
writer.println(" enabled=true");
|
||||
writer.println(" misc {");
|
||||
writer.println(" item=true");
|
||||
writer.println(" minecartchest=true");
|
||||
writer.println(" }");
|
||||
writer.println(" monster {");
|
||||
writer.println(" guardian=true");
|
||||
writer.println(" }");
|
||||
writer.println(" }");
|
||||
writer.println(" misc-activation-range=16");
|
||||
writer.println(" monster-activation-range=32");
|
||||
writer.println(" }");
|
||||
writer.println(" general {");
|
||||
writer.println(" # Forces Chunk Loading on provide requests (speedup for mods that don't check if a chunk is loaded)");
|
||||
writer.println(" chunk-load-override=false");
|
||||
writer.println(" # Disable warning messages to server admins");
|
||||
writer.println(" disable-warnings=false");
|
||||
writer.println(" }");
|
||||
writer.println(" logging {");
|
||||
writer.println(" # Log when blocks are broken");
|
||||
writer.println(" block-break=false");
|
||||
writer.println(" # Log when blocks are modified");
|
||||
writer.println(" block-modify=false");
|
||||
writer.println(" # Log when blocks are placed");
|
||||
writer.println(" block-place=false");
|
||||
writer.println(" # Log when blocks are populated in a chunk");
|
||||
writer.println(" block-populate=false");
|
||||
writer.println(" # Log when blocks are placed by players and tracked");
|
||||
writer.println(" block-tracking=false");
|
||||
writer.println(" # Log when chunks are loaded");
|
||||
writer.println(" chunk-load=false");
|
||||
writer.println(" # Log when chunks are unloaded");
|
||||
writer.println(" chunk-unload=false");
|
||||
writer.println(" # Whether to log entity collision/count checks");
|
||||
writer.println(" entity-collision-checks=false");
|
||||
writer.println(" # Log when living entities are destroyed");
|
||||
writer.println(" entity-death=false");
|
||||
writer.println(" # Log when living entities are despawned");
|
||||
writer.println(" entity-despawn=false");
|
||||
writer.println(" # Log when living entities are spawned");
|
||||
writer.println(" entity-spawn=false");
|
||||
writer.println(" # Whether to log entity removals due to speed");
|
||||
writer.println(" entity-speed-removal=false");
|
||||
writer.println(" # Add stack traces to dev logging");
|
||||
writer.println(" log-stacktraces=false");
|
||||
writer.println(" }");
|
||||
writer.println(" modules {");
|
||||
writer.println(" bungeecord=true");
|
||||
writer.println(" entity-activation-range=true");
|
||||
writer.println(" timings=true");
|
||||
writer.println(" }");
|
||||
writer.println(" # Configuration options related to the Sql service, including connection aliases etc");
|
||||
writer.println(" sql {}");
|
||||
writer.println(" timings {");
|
||||
writer.println(" enabled=true");
|
||||
writer.println(" hidden-config-entries=[");
|
||||
writer.println(" \"sponge.sql\"");
|
||||
writer.println(" ]");
|
||||
writer.println(" history-interval=300");
|
||||
writer.println(" history-length=3600");
|
||||
writer.println(" server-name-privacy=false");
|
||||
writer.println(" verbose=false");
|
||||
writer.println(" }");
|
||||
writer.println(" world {");
|
||||
writer.println(" # Lava behaves like vanilla water when source block is removed");
|
||||
writer.println(" flowing-lava-decay=false");
|
||||
writer.println(" # Vanilla water source behavior - is infinite");
|
||||
writer.println(" infinite-water-source=false");
|
||||
writer.println(" }");
|
||||
writer.println("}");
|
||||
writer.println();
|
||||
|
||||
writer.close();
|
||||
|
||||
}
|
||||
private void copyFolder(File source, File destination) {
|
||||
if (source.isDirectory()) {
|
||||
if (!destination.exists()) {
|
||||
|
@ -63,6 +63,8 @@ public class InternalSubLogger extends SubLogger {
|
||||
}
|
||||
if (out == null) (out = new Thread(() -> start(process.getInputStream(), false))).start();
|
||||
if (err == null) (err = new Thread(() -> start(process.getErrorStream(), true))).start();
|
||||
List<SubLogFilter> filters = new ArrayList<SubLogFilter>();
|
||||
filters.addAll(this.filters);
|
||||
for (SubLogFilter filter : filters) try {
|
||||
filter.start();
|
||||
} catch (Throwable e) {
|
||||
@ -105,6 +107,8 @@ public class InternalSubLogger extends SubLogger {
|
||||
|
||||
// Filter Message
|
||||
boolean allow = true;
|
||||
List<SubLogFilter> filters = new ArrayList<SubLogFilter>();
|
||||
filters.addAll(this.filters);
|
||||
for (SubLogFilter filter : filters)
|
||||
try {
|
||||
if (allow) allow = filter.log(level, msg);
|
||||
@ -158,6 +162,8 @@ public class InternalSubLogger extends SubLogger {
|
||||
private void destroy() {
|
||||
if (started) {
|
||||
started = false;
|
||||
List<SubLogFilter> filters = new ArrayList<SubLogFilter>();
|
||||
filters.addAll(this.filters);
|
||||
for (SubLogFilter filter : filters) try {
|
||||
filter.stop();
|
||||
} catch (Throwable e) {
|
||||
@ -165,12 +171,13 @@ public class InternalSubLogger extends SubLogger {
|
||||
}
|
||||
messages.clear();
|
||||
if (writer != null) {
|
||||
PrintWriter writer = this.writer;
|
||||
this.writer = null;
|
||||
int l = (int) Math.floor((("---------- LOG START \u2014 " + name + " ----------").length() - 9) / 2);
|
||||
String s = "";
|
||||
while (s.length() < l) s += '-';
|
||||
writer.println(s + " LOG END " + s);
|
||||
writer.close();
|
||||
writer = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
BIN
SubServers.Bungee/src/net/ME1312/SubServers/Bungee/Library/Files/templates.zip
Executable file
BIN
SubServers.Bungee/src/net/ME1312/SubServers/Bungee/Library/Files/templates.zip
Executable file
Binary file not shown.
@ -1,6 +1,6 @@
|
||||
package net.ME1312.SubServers.Bungee.Library.Version;
|
||||
|
||||
public final class VersionTokenizer {
|
||||
final class VersionTokenizer {
|
||||
private final String _versionString;
|
||||
private final int _length;
|
||||
|
||||
|
@ -0,0 +1,130 @@
|
||||
package net.ME1312.SubServers.Bungee.Network.Packet;
|
||||
|
||||
import net.ME1312.SubServers.Bungee.Host.Host;
|
||||
import net.ME1312.SubServers.Bungee.Host.SubLogFilter;
|
||||
import net.ME1312.SubServers.Bungee.Host.SubLogger;
|
||||
import net.ME1312.SubServers.Bungee.Host.SubServer;
|
||||
import net.ME1312.SubServers.Bungee.Library.NamedContainer;
|
||||
import net.ME1312.SubServers.Bungee.Library.Util;
|
||||
import net.ME1312.SubServers.Bungee.Library.Version.Version;
|
||||
import net.ME1312.SubServers.Bungee.Network.Client;
|
||||
import net.ME1312.SubServers.Bungee.Network.PacketIn;
|
||||
import net.ME1312.SubServers.Bungee.Network.PacketOut;
|
||||
import net.ME1312.SubServers.Bungee.SubPlugin;
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.logging.Level;
|
||||
|
||||
/**
|
||||
* Server Log Listener Packet
|
||||
*/
|
||||
public class PacketListenServerLog implements PacketIn, PacketOut {
|
||||
private static HashMap<String, NamedContainer<SubLogger, SubLogFilter>> filters = new HashMap<String, NamedContainer<SubLogger, SubLogFilter>>();
|
||||
private SubPlugin plugin;
|
||||
private SubLogger.LogMessage[] lines;
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* New PacketListenServerLog (In)
|
||||
*
|
||||
* @param plugin SubPlugin
|
||||
*/
|
||||
public PacketListenServerLog(SubPlugin plugin) {
|
||||
if (Util.isNull(plugin)) throw new NullPointerException();
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
/**
|
||||
* New PacketListenServerLog (Out)
|
||||
*
|
||||
* @param line Message
|
||||
* @param id Receiver ID
|
||||
*/
|
||||
public PacketListenServerLog(String id, SubLogger.LogMessage... line) {
|
||||
if (Util.isNull(id, line)) throw new NullPointerException();
|
||||
this.lines = line;
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONObject generate() {
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("id", id);
|
||||
JSONArray lines = new JSONArray();
|
||||
for (SubLogger.LogMessage line : this.lines) lines.put(new SimpleDateFormat("hh:mm:ss").format(line.getDate()) + " [" + line.getLevel().getLocalizedName() + "] " + line.getMessage());
|
||||
json.put("lines", lines);
|
||||
return json;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(Client client, JSONObject data) {
|
||||
if (data != null && data.keySet().contains("id")) {
|
||||
if (data.keySet().contains("server")) {
|
||||
if (data.getString("server").length() == 0) {
|
||||
unregister(data.getString("id"));
|
||||
} else {
|
||||
Map<String, SubServer> servers = plugin.api.getSubServers();
|
||||
if (servers.keySet().contains(data.getString("server").toLowerCase())) {
|
||||
register(client, data.getString("id"), servers.get(data.getString("server").toLowerCase()).getLogger());
|
||||
}
|
||||
}
|
||||
} else if (data.keySet().contains("host")) {
|
||||
if (data.getString("host").length() == 0) {
|
||||
unregister(data.getString("id"));
|
||||
} else {
|
||||
Map<String, Host> hosts = plugin.api.getHosts();
|
||||
if (hosts.keySet().contains(data.getString("host").toLowerCase())) {
|
||||
register(client, data.getString("id"), hosts.get(data.getString("host").toLowerCase()).getCreator().getLogger());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void register(Client client, String id, SubLogger logger) {
|
||||
client.sendPacket(new PacketListenServerLog(id, logger.getMessageHistory().toArray(new SubLogger.LogMessage[logger.getMessageHistory().size()])));
|
||||
SubLogFilter filter = new SubLogFilter() {
|
||||
@Override
|
||||
public void start() {
|
||||
if (client.getConnection().isClosed()) {
|
||||
unregister(id);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean log(Level level, String message) {
|
||||
if (client.getConnection().isClosed()) {
|
||||
unregister(id);
|
||||
} else {
|
||||
client.sendPacket(new PacketListenServerLog(id, new SubLogger.LogMessage(level, message)));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stop() {
|
||||
if (client.getConnection().isClosed()) {
|
||||
unregister(id);
|
||||
}
|
||||
}
|
||||
};
|
||||
filters.put(id, new NamedContainer<SubLogger, SubLogFilter>(logger, filter));
|
||||
logger.registerFilter(filter);
|
||||
}
|
||||
|
||||
private void unregister(String id) {
|
||||
if (filters.keySet().contains(id)) {
|
||||
filters.get(id).name().unregisterFilter(filters.get(id).get());
|
||||
filters.remove(id);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Version getVersion() {
|
||||
return new Version("2.11.0a");
|
||||
}
|
||||
}
|
@ -84,6 +84,7 @@ public final class SubDataServer {
|
||||
registerPacket(new PacketInExRequestQueue(plugin), "SubExRequestQueue");
|
||||
registerPacket(new PacketLinkExHost(plugin), "SubLinkExHost");
|
||||
registerPacket(new PacketLinkServer(plugin), "SubLinkServer");
|
||||
registerPacket(new PacketListenServerLog(plugin), "SubListenServerLog");
|
||||
registerPacket(new PacketStartServer(plugin), "SubStartServer");
|
||||
registerPacket(new PacketStopServer(plugin), "SubStopServer");
|
||||
registerPacket(new PacketTeleportPlayer(plugin), "SubTeleportPlayer");
|
||||
@ -106,6 +107,7 @@ public final class SubDataServer {
|
||||
registerPacket(PacketExUpdateServer.class, "SubExUpdateServer");
|
||||
registerPacket(PacketLinkExHost.class, "SubLinkExHost");
|
||||
registerPacket(PacketLinkServer.class, "SubLinkServer");
|
||||
registerPacket(PacketListenServerLog.class, "SubListenServerLog");
|
||||
registerPacket(PacketOutRunEvent.class, "SubRunEvent");
|
||||
registerPacket(PacketOutReset.class, "SubReset");
|
||||
registerPacket(PacketStartServer.class, "SubStartServer");
|
||||
|
@ -23,6 +23,8 @@ import java.net.SocketException;
|
||||
import java.nio.file.Files;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.zip.ZipEntry;
|
||||
import java.util.zip.ZipInputStream;
|
||||
|
||||
/**
|
||||
* Main Plugin Class
|
||||
@ -98,17 +100,9 @@ public final class SubPlugin extends BungeeCord {
|
||||
}
|
||||
}
|
||||
|
||||
if (!(new UniversalFile(dir, "Plugin Templates:Spigot Plugins").exists())) {
|
||||
new UniversalFile(dir, "Plugin Templates:Spigot Plugins").mkdirs();
|
||||
System.out.println("SubServers > Created ~/SubServers/Plugin Templates/Spigot Plugins");
|
||||
}
|
||||
if (!(new UniversalFile(dir, "Plugin Templates:Sponge Config").exists())) {
|
||||
new UniversalFile(dir, "Plugin Templates:Sponge Config").mkdir();
|
||||
System.out.println("SubServers > Created ~/SubServers/Plugin Templates/Sponge Config");
|
||||
}
|
||||
if (!(new UniversalFile(dir, "Plugin Templates:Sponge Mods").exists())) {
|
||||
new UniversalFile(dir, "Plugin Templates:Sponge Mods").mkdir();
|
||||
System.out.println("SubServers > Created ~/SubServers/Plugin Templates/Sponge Mods");
|
||||
if (!(new UniversalFile(dir, "Templates").exists())) {
|
||||
unzip(SubPlugin.class.getResourceAsStream("/net/ME1312/SubServers/Bungee/Library/Files/templates.zip"), dir);
|
||||
System.out.println("SubServers > Created ~/SubServers/Templates");
|
||||
}
|
||||
|
||||
if (new UniversalFile(dir, "Recently Deleted").exists()) {
|
||||
@ -328,4 +322,32 @@ public final class SubPlugin extends BungeeCord {
|
||||
|
||||
super.stopListeners();
|
||||
}
|
||||
|
||||
private void unzip(InputStream zip, File dir) {
|
||||
byte[] buffer = new byte[1024];
|
||||
try{
|
||||
ZipInputStream zis = new ZipInputStream(zip);
|
||||
ZipEntry ze;
|
||||
while ((ze = zis.getNextEntry()) != null) {
|
||||
File newFile = new File(dir + File.separator + ze.getName());
|
||||
if (ze.isDirectory()) {
|
||||
newFile.mkdirs();
|
||||
continue;
|
||||
} else if (!newFile.getParentFile().exists()) {
|
||||
newFile.getParentFile().mkdirs();
|
||||
}
|
||||
FileOutputStream fos = new FileOutputStream(newFile);
|
||||
int len;
|
||||
while ((len = zis.read(buffer)) > 0) {
|
||||
fos.write(buffer, 0, len);
|
||||
}
|
||||
|
||||
fos.close();
|
||||
}
|
||||
zis.closeEntry();
|
||||
zis.close();
|
||||
} catch(IOException ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
package net.ME1312.SubServers.Client.Bukkit.Library.Version;
|
||||
|
||||
public final class VersionTokenizer {
|
||||
final class VersionTokenizer {
|
||||
private final String _versionString;
|
||||
private final int _length;
|
||||
|
||||
|
@ -71,12 +71,9 @@ public class SubCreator {
|
||||
executable = new Executable("java -Xmx" + memory + "M -Djline.terminal=jline.UnsupportedTerminal -Dcom.mojang.eula.agree=true -jar Spigot.jar");
|
||||
|
||||
try {
|
||||
generateSpigotYAML(dir);
|
||||
copyFolder(new UniversalFile(host.dir, "Templates:Spigot"), dir);
|
||||
generateProperties(dir, port);
|
||||
logger.logger.info.println("Copying Plugins...");
|
||||
host.subdata.sendPacket(new PacketOutExLogMessage(address, "Copying Plugins..."));
|
||||
generateClient(dir, name, type);
|
||||
copyFolder(new UniversalFile(host.dir, "Templates:Spigot Plugins"), new UniversalFile(dir, "plugins"));
|
||||
} catch (Exception e) {
|
||||
logger.logger.error.println(e);
|
||||
}
|
||||
@ -85,20 +82,20 @@ public class SubCreator {
|
||||
executable = new Executable("java -Xmx" + memory + "M -jar Vanilla.jar nogui");
|
||||
|
||||
try {
|
||||
copyFolder(new UniversalFile(host.dir, "Templates:Vanilla"), dir);
|
||||
generateEULA(dir);
|
||||
generateProperties(dir, port);
|
||||
} catch (FileNotFoundException | UnsupportedEncodingException e) {
|
||||
} catch (IOException e) {
|
||||
logger.logger.error.println(e);
|
||||
}
|
||||
} else if (type == ServerType.SPONGE) {
|
||||
try {
|
||||
executable = new Executable("java -Xmx" + memory + "M -jar Forge.jar");
|
||||
|
||||
new UniversalFile(dir, "config").mkdirs();
|
||||
new UniversalFile(dir, "mods").mkdirs();
|
||||
copyFolder(new UniversalFile(host.dir, "" +
|
||||
"Templates:Sponge"), dir);
|
||||
generateEULA(dir);
|
||||
generateProperties(dir, port);
|
||||
generateSpongeConf(dir);
|
||||
generateClient(dir, name, type);
|
||||
|
||||
logger.logger.info.println("Searching Versions...");
|
||||
@ -135,11 +132,6 @@ public class SubCreator {
|
||||
host.subdata.sendPacket(new PacketOutExLogMessage(address, "Found \"forge-" + mcfversion.toString() + '"'));
|
||||
|
||||
version = new Version(mcfversion.toString() + "::" + spversion.toString());
|
||||
|
||||
logger.logger.info.println("Copying Mods...");
|
||||
host.subdata.sendPacket(new PacketOutExLogMessage(address, "Copying Mods..."));
|
||||
copyFolder(new UniversalFile(host.dir, "Templates:Sponge Config"), new UniversalFile(dir, "config"));
|
||||
copyFolder(new UniversalFile(host.dir, "Templates:Sponge Mods"), new UniversalFile(dir, "mods"));
|
||||
} catch (ParserConfigurationException | IOException | SAXException | NullPointerException e) {
|
||||
logger.logger.error.println(e);
|
||||
}
|
||||
@ -148,64 +140,66 @@ public class SubCreator {
|
||||
Version ver = version;
|
||||
Executable exec = executable;
|
||||
host.subdata.sendPacket(new PacketDownloadBuildScript(json -> {
|
||||
try {
|
||||
(thread = new Thread(() -> {
|
||||
try {
|
||||
|
||||
PrintWriter writer = new PrintWriter(new UniversalFile(dir, "build.sh"), "UTF-8");
|
||||
Iterator<Object> i = json.getJSONArray("script").iterator();
|
||||
while (i.hasNext()) {
|
||||
String line = (String) i.next();
|
||||
writer.println(line);
|
||||
}
|
||||
writer.close();
|
||||
PrintWriter writer = new PrintWriter(new UniversalFile(dir, "build.sh"), "UTF-8");
|
||||
Iterator<Object> i = json.getJSONArray("script").iterator();
|
||||
while (i.hasNext()) {
|
||||
String line = (String) i.next();
|
||||
writer.println(line);
|
||||
}
|
||||
writer.close();
|
||||
|
||||
if (!(new File(dir, "build.sh").exists())) {
|
||||
logger.logger.info.println("Problem copying build.sh");
|
||||
host.subdata.sendPacket(new PacketOutExLogMessage(address, "Problem copying build.sh"));
|
||||
} else {
|
||||
File gitBash = new File(host.host.getRawString("Git-Bash"), "bin" + File.separatorChar + "bash.exe");
|
||||
if (!(System.getProperty("os.name").toLowerCase().indexOf("win") >= 0)) {
|
||||
Process process = Runtime.getRuntime().exec("chmod +x build.sh", null, dir);
|
||||
if (!(new File(dir, "build.sh").exists())) {
|
||||
logger.logger.info.println("Problem copying build.sh");
|
||||
host.subdata.sendPacket(new PacketOutExLogMessage(address, "Problem copying build.sh"));
|
||||
} else {
|
||||
File gitBash = new File(host.host.getRawString("Git-Bash"), "bin" + File.separatorChar + "bash.exe");
|
||||
if (!(System.getProperty("os.name").toLowerCase().indexOf("win") >= 0)) {
|
||||
Process process = Runtime.getRuntime().exec("chmod +x build.sh", null, dir);
|
||||
try {
|
||||
process.waitFor();
|
||||
Thread.sleep(500);
|
||||
} catch (InterruptedException e) {
|
||||
logger.logger.error.println(e);
|
||||
}
|
||||
if (process.exitValue() != 0) {
|
||||
logger.logger.info.println("Problem Setting Executable Permissions.");
|
||||
host.subdata.sendPacket(new PacketOutExLogMessage(address, "Problem Setting Executable Permissions."));
|
||||
}
|
||||
}
|
||||
|
||||
logger.logger.info.println("Launching build.sh");
|
||||
host.subdata.sendPacket(new PacketOutExLogMessage(address, "Launching build.sh"));
|
||||
this.process = Runtime.getRuntime().exec((System.getProperty("os.name").toLowerCase().indexOf("win") >= 0) ?
|
||||
"\"" + gitBash + "\" --login -i -c \"bash build.sh " + ver.toString() + " " + type.toString().toLowerCase() + "\""
|
||||
: ("bash build.sh " + ver.toString() + " " + type.toString().toLowerCase() + " " + System.getProperty("user.home")), null, dir);
|
||||
logger.process = this.process;
|
||||
logger.log.set(true);
|
||||
logger.address = address;
|
||||
logger.file = new File(dir, "SubCreator-" + type.toString() + "-" + ver.toString().replace("::", "@") + ".log");
|
||||
logger.start();
|
||||
try {
|
||||
process.waitFor();
|
||||
this.process.waitFor();
|
||||
Thread.sleep(500);
|
||||
} catch (InterruptedException e) {
|
||||
logger.logger.error.println(e);
|
||||
}
|
||||
if (process.exitValue() != 0) {
|
||||
logger.logger.info.println("Problem Setting Executable Permissions.");
|
||||
host.subdata.sendPacket(new PacketOutExLogMessage(address, "Problem Setting Executable Permissions."));
|
||||
|
||||
JSONObject info = new JSONObject();
|
||||
info.put("dir", "." + File.separatorChar + name);
|
||||
info.put("exec", exec.toString());
|
||||
host.subdata.sendPacket(new PacketExCreateServer(process.exitValue(), (this.process.exitValue() == 0) ? "Created Server Successfully" : ("Couldn't build the server jar. See \"SubCreator-" + type.toString() + "-" + ver.toString().replace("::", "@") + ".log\" for more details."), info, id));
|
||||
if (this.process.exitValue() != 0) {
|
||||
logger.logger.info.println("Couldn't build the server jar. See \"SubCreator-" + type.toString() + "-" + ver.toString().replace("::", "@") + ".log\" for more details.");
|
||||
}
|
||||
}
|
||||
|
||||
logger.logger.info.println("Launching build.sh");
|
||||
host.subdata.sendPacket(new PacketOutExLogMessage(address, "Launching build.sh"));
|
||||
this.process = Runtime.getRuntime().exec((System.getProperty("os.name").toLowerCase().indexOf("win") >= 0)?
|
||||
"\"" + gitBash + "\" --login -i -c \"bash build.sh " + ver.toString() + " " + type.toString().toLowerCase() + "\""
|
||||
:("bash build.sh " + ver.toString() + " " + type.toString().toLowerCase() + " " + System.getProperty("user.home")), null, dir);
|
||||
logger.process = this.process;
|
||||
logger.log.set(true);
|
||||
logger.address = address;
|
||||
logger.file = new File(dir, "SubCreator-" + type.toString() + "-" + ver.toString().replace("::", "@") + ".log");
|
||||
logger.start();
|
||||
try {
|
||||
this.process.waitFor();
|
||||
Thread.sleep(500);
|
||||
} catch (InterruptedException e) {
|
||||
logger.logger.error.println(e);
|
||||
}
|
||||
|
||||
JSONObject info = new JSONObject();
|
||||
info.put("dir", "." + File.separatorChar + name);
|
||||
info.put("exec", exec.toString());
|
||||
host.subdata.sendPacket(new PacketExCreateServer(process.exitValue(), (this.process.exitValue() == 0)?"Created Server Successfully":("Couldn't build the server jar. See \"SubCreator-" + type.toString() + "-" + ver.toString().replace("::", "@") + ".log\" for more details."), info, id));
|
||||
if (this.process.exitValue() != 0) {
|
||||
logger.logger.info.println("Couldn't build the server jar. See \"SubCreator-" + type.toString() + "-" + ver.toString().replace("::", "@") + ".log\" for more details.");
|
||||
}
|
||||
} catch (IOException e) {
|
||||
host.log.error.println(e);
|
||||
host.subdata.sendPacket(new PacketExCreateServer(-1, "An Exception occurred while running SubCreator. See the " + host.subdata.getName() + " console for more details.", null, id));
|
||||
}
|
||||
} catch (IOException e) {
|
||||
host.log.error.println(e);
|
||||
host.subdata.sendPacket(new PacketExCreateServer(-1, "An Exception occurred while running SubCreator. See the " + host.subdata.getName() + " console for more details.", null, id));
|
||||
}
|
||||
})).start();
|
||||
}));
|
||||
}
|
||||
|
||||
@ -243,9 +237,9 @@ public class SubCreator {
|
||||
|
||||
private void generateClient(File dir, String name, ServerType type) throws IOException {
|
||||
if (type == ServerType.SPIGOT) {
|
||||
new UniversalFile(dir, "plugins:SubServers").mkdirs();
|
||||
new UniversalFile(dir, "plugins:SubServers-Client-Bukkit").mkdirs();
|
||||
Util.copyFromJar(SubServers.class.getClassLoader(), "net/ME1312/SubServers/Host/Library/Files/bukkit.jar", new UniversalFile(dir, "plugins:SubServers.Client.jar").getPath());
|
||||
YAMLConfig config = new YAMLConfig(new UniversalFile(dir, "plugins:Subservers:config.yml"));
|
||||
YAMLConfig config = new YAMLConfig(new UniversalFile(dir, "plugins:Subservers-Client-Bukkit:config.yml"));
|
||||
YAMLSection settings = new YAMLSection();
|
||||
settings.set("Version", "2.11.2a+");
|
||||
settings.set("Ingame-Access", true);
|
||||
@ -270,321 +264,14 @@ public class SubCreator {
|
||||
|
||||
writer.close();
|
||||
}
|
||||
private void generateProperties(File dir, int port) throws FileNotFoundException, UnsupportedEncodingException {
|
||||
PrintWriter writer = new PrintWriter(new File(dir, "server.properties"), "UTF-8");
|
||||
|
||||
writer.println("#Minecraft server properties");
|
||||
writer.println("#" + new SimpleDateFormat("EEE MMM d HH:mm:ss z yyyy").format(Calendar.getInstance().getTime()));
|
||||
writer.println("generator-settings=");
|
||||
writer.println("op-permission-level=4");
|
||||
writer.println("allow-nether=true");
|
||||
writer.println("resource-pack-hash=");
|
||||
writer.println("level-name=world");
|
||||
writer.println("enable-query=true");
|
||||
writer.println("allow-flight=false");
|
||||
writer.println("announce-player-achievements=false");
|
||||
writer.println("server-port=" + port);
|
||||
writer.println("max-world-size=29999984");
|
||||
writer.println("level-type=DEFAULT");
|
||||
writer.println("enable-rcon=false");
|
||||
writer.println("level-seed=");
|
||||
writer.println("force-gamemode=false");
|
||||
writer.println("server-ip=" + host.config.get().getSection("Settings").getRawString("Server-Bind"));
|
||||
writer.println("network-compression-threshold=-1");
|
||||
writer.println("max-build-height=256");
|
||||
writer.println("spawn-npcs=true");
|
||||
writer.println("white-list=false");
|
||||
writer.println("spawn-animals=true");
|
||||
writer.println("snooper-enabled=true");
|
||||
writer.println("online-mode=false");
|
||||
writer.println("resource-pack=");
|
||||
writer.println("pvp=true");
|
||||
writer.println("difficulty=1");
|
||||
writer.println("enable-command-block=true");
|
||||
writer.println("gamemode=0");
|
||||
writer.println("player-idle-timeout=0");
|
||||
writer.println("max-players=20");
|
||||
writer.println("max-tick-time=60000");
|
||||
writer.println("spawn-monsters=true");
|
||||
writer.println("generate-structures=true");
|
||||
writer.println("view-distance=10");
|
||||
writer.println("motd=A Generated SubServer");
|
||||
|
||||
private void generateProperties(File dir, int port) throws IOException {
|
||||
File file = new File(dir, "server.properties");
|
||||
String content = Util.readAll(new BufferedReader(new InputStreamReader(new FileInputStream(file)))).replace("server-port=", "server-port=" + port).replace("server-ip=", "server-ip=" + host.config.get().getSection("Settings").getRawString("Server-Bind"));
|
||||
file.delete();
|
||||
PrintWriter writer = new PrintWriter(file, "UTF-8");
|
||||
writer.write(content);
|
||||
writer.close();
|
||||
}
|
||||
private void generateSpigotYAML(File dir) throws FileNotFoundException, UnsupportedEncodingException {
|
||||
PrintWriter writer = new PrintWriter(new File(dir, "spigot.yml"), "UTF-8");
|
||||
|
||||
writer.println("# This is the main configuration file for Spigot.");
|
||||
writer.println("# As you can see, there's tons to configure. Some options may impact gameplay, so use");
|
||||
writer.println("# with caution, and make sure you know what each option does before configuring.");
|
||||
writer.println("# For a reference for any variable inside this file, check out the Spigot wiki at");
|
||||
writer.println("# http://www.spigotmc.org/wiki/spigot-configuration/");
|
||||
writer.println("#");
|
||||
writer.println("# If you need help with the configuration or have any questions related to Spigot,");
|
||||
writer.println("# join us at the IRC or drop by our forums and leave a post.");
|
||||
writer.println("#");
|
||||
writer.println("# IRC: #spigot @ irc.spi.gt ( http://www.spigotmc.org/pages/irc/ )");
|
||||
writer.println("# Forums: http://www.spigotmc.org/");
|
||||
writer.println();
|
||||
writer.println("config-version: 8");
|
||||
writer.println("settings:");
|
||||
writer.println(" debug: false");
|
||||
writer.println(" save-user-cache-on-stop-only: false");
|
||||
writer.println(" bungeecord: true");
|
||||
writer.println(" late-bind: false");
|
||||
writer.println(" sample-count: 12");
|
||||
writer.println(" player-shuffle: 0");
|
||||
writer.println(" filter-creative-items: true");
|
||||
writer.println(" user-cache-size: 1000");
|
||||
writer.println(" int-cache-limit: 1024");
|
||||
writer.println(" moved-wrongly-threshold: 0.0625");
|
||||
writer.println(" moved-too-quickly-threshold: 100.0");
|
||||
writer.println(" timeout-time: 60");
|
||||
writer.println(" restart-on-crash: false");
|
||||
writer.println(" restart-script: ./start.sh");
|
||||
writer.println(" netty-threads: 4");
|
||||
writer.println(" attribute:");
|
||||
writer.println(" maxHealth:");
|
||||
writer.println(" max: 2048.0");
|
||||
writer.println(" movementSpeed:");
|
||||
writer.println(" max: 2048.0");
|
||||
writer.println(" attackDamage:");
|
||||
writer.println(" max: 2048.0");
|
||||
writer.println("commands:");
|
||||
writer.println(" tab-complete: 0");
|
||||
writer.println(" log: true");
|
||||
writer.println(" spam-exclusions:");
|
||||
writer.println(" - /skill");
|
||||
writer.println(" silent-commandblock-console: true");
|
||||
writer.println(" replace-commands:");
|
||||
writer.println(" - setblock");
|
||||
writer.println(" - summon");
|
||||
writer.println(" - testforblock");
|
||||
writer.println(" - tellraw");
|
||||
writer.println("messages:");
|
||||
writer.println(" whitelist: You are not whitelisted on this server!");
|
||||
writer.println(" unknown-command: Unknown command. Type \"/help\" for help.");
|
||||
writer.println(" server-full: The server is full!");
|
||||
writer.println(" outdated-client: Outdated client! Please use {0}");
|
||||
writer.println(" outdated-server: Outdated server! I'm still on {0}");
|
||||
writer.println(" restart: Server is restarting");
|
||||
writer.println("stats:");
|
||||
writer.println(" disable-saving: false");
|
||||
writer.println(" forced-stats: {}");
|
||||
writer.println("world-settings:");
|
||||
writer.println(" default:");
|
||||
writer.println(" verbose: true");
|
||||
writer.println(" wither-spawn-sound-radius: 0");
|
||||
writer.println(" view-distance: 10");
|
||||
writer.println(" item-despawn-rate: 6000");
|
||||
writer.println(" merge-radius:");
|
||||
writer.println(" item: 2.5");
|
||||
writer.println(" exp: 3.0");
|
||||
writer.println(" arrow-despawn-rate: 1200");
|
||||
writer.println(" enable-zombie-pigmen-portal-spawns: true");
|
||||
writer.println(" zombie-aggressive-towards-villager: true");
|
||||
writer.println(" hanging-tick-frequency: 100");
|
||||
writer.println(" max-bulk-chunks: 10");
|
||||
writer.println(" max-entity-collisions: 8");
|
||||
writer.println(" random-light-updates: false");
|
||||
writer.println(" save-structure-info: true");
|
||||
writer.println(" mob-spawn-range: 4");
|
||||
writer.println(" anti-xray:");
|
||||
writer.println(" enabled: true");
|
||||
writer.println(" engine-mode: 1");
|
||||
writer.println(" hide-blocks:");
|
||||
writer.println(" - 14");
|
||||
writer.println(" - 15");
|
||||
writer.println(" - 16");
|
||||
writer.println(" - 21");
|
||||
writer.println(" - 48");
|
||||
writer.println(" - 49");
|
||||
writer.println(" - 54");
|
||||
writer.println(" - 56");
|
||||
writer.println(" - 73");
|
||||
writer.println(" - 74");
|
||||
writer.println(" - 82");
|
||||
writer.println(" - 129");
|
||||
writer.println(" - 130");
|
||||
writer.println(" replace-blocks:");
|
||||
writer.println(" - 1");
|
||||
writer.println(" - 5");
|
||||
writer.println(" dragon-death-sound-radius: 0");
|
||||
writer.println(" seed-village: 10387312");
|
||||
writer.println(" seed-feature: 14357617");
|
||||
writer.println(" hunger:");
|
||||
writer.println(" walk-exhaustion: 0.2");
|
||||
writer.println(" sprint-exhaustion: 0.8");
|
||||
writer.println(" combat-exhaustion: 0.3");
|
||||
writer.println(" regen-exhaustion: 3.0");
|
||||
writer.println(" max-tnt-per-tick: 100");
|
||||
writer.println(" max-tick-time:");
|
||||
writer.println(" tile: 50");
|
||||
writer.println(" entity: 50");
|
||||
writer.println(" entity-activation-range:");
|
||||
writer.println(" animals: 32");
|
||||
writer.println(" monsters: 32");
|
||||
writer.println(" misc: 16");
|
||||
writer.println(" entity-tracking-range:");
|
||||
writer.println(" players: 48");
|
||||
writer.println(" animals: 48");
|
||||
writer.println(" monsters: 48");
|
||||
writer.println(" misc: 32");
|
||||
writer.println(" other: 64");
|
||||
writer.println(" ticks-per:");
|
||||
writer.println(" hopper-transfer: 8");
|
||||
writer.println(" hopper-check: 8");
|
||||
writer.println(" hopper-amount: 1");
|
||||
writer.println(" growth:");
|
||||
writer.println(" cactus-modifier: 100");
|
||||
writer.println(" cane-modifier: 100");
|
||||
writer.println(" melon-modifier: 100");
|
||||
writer.println(" mushroom-modifier: 100");
|
||||
writer.println(" pumpkin-modifier: 100");
|
||||
writer.println(" sapling-modifier: 100");
|
||||
writer.println(" wheat-modifier: 100");
|
||||
writer.println(" netherwart-modifier: 100");
|
||||
writer.println(" nerf-spawner-mobs: false");
|
||||
writer.println(" chunks-per-tick: 650");
|
||||
writer.println(" clear-tick-list: false");
|
||||
writer.println();
|
||||
|
||||
writer.close();
|
||||
}
|
||||
private void generateSpongeConf(File dir) throws FileNotFoundException, UnsupportedEncodingException {
|
||||
new File(dir, "config" + File.separator + "sponge").mkdirs();
|
||||
PrintWriter writer = new PrintWriter(new File(dir, "config" + File.separator + "sponge" + File.separator + "global.conf"), "UTF-8");
|
||||
writer.println("# 1.0");
|
||||
writer.println("#");
|
||||
writer.println("# # If you need help with the configuration or have any questions related to Sponge,");
|
||||
writer.println("# # join us at the IRC or drop by our forums and leave a post.");
|
||||
writer.println("#");
|
||||
writer.println("# # IRC: #sponge @ irc.esper.net ( http://webchat.esper.net/?channel=sponge )");
|
||||
writer.println("# # Forums: https://forums.spongepowered.org/");
|
||||
writer.println("#");
|
||||
writer.println();
|
||||
writer.println("sponge {");
|
||||
writer.println(" block-tracking {");
|
||||
writer.println(" # If enabled, adds player tracking support for block positions. Note: This should only be disabled if you do not care who caused a block to change.");
|
||||
writer.println(" enabled=true");
|
||||
writer.println(" }");
|
||||
writer.println(" bungeecord {");
|
||||
writer.println(" # If enabled, allows BungeeCord to forward IP address, UUID, and Game Profile to this server");
|
||||
writer.println(" ip-forwarding=true");
|
||||
writer.println(" }");
|
||||
writer.println(" commands {}");
|
||||
writer.println(" debug {");
|
||||
writer.println(" # Dump chunks in the event of a deadlock");
|
||||
writer.println(" dump-chunks-on-deadlock=false");
|
||||
writer.println(" # Dump the heap in the event of a deadlock");
|
||||
writer.println(" dump-heap-on-deadlock=false");
|
||||
writer.println(" # Dump the server thread on deadlock warning");
|
||||
writer.println(" dump-threads-on-warn=false");
|
||||
writer.println(" # Enable Java's thread contention monitoring for thread dumps");
|
||||
writer.println(" thread-contention-monitoring=false");
|
||||
writer.println(" }");
|
||||
writer.println(" entity {");
|
||||
writer.println(" # Number of colliding entities in one spot before logging a warning. Set to 0 to disable");
|
||||
writer.println(" collision-warn-size=200");
|
||||
writer.println(" # Number of entities in one dimension before logging a warning. Set to 0 to disable");
|
||||
writer.println(" count-warn-size=0");
|
||||
writer.println(" # Number of ticks before a painting is respawned on clients when their art is changed");
|
||||
writer.println(" entity-painting-respawn-delay=2");
|
||||
writer.println(" # Number of ticks before the fake player entry of a human is removed from the tab list (range of 0 to 100 ticks).");
|
||||
writer.println(" human-player-list-remove-delay=10");
|
||||
writer.println(" # Controls the time in ticks for when an item despawns.");
|
||||
writer.println(" item-despawn-rate=6000");
|
||||
writer.println(" # Max size of an entity's bounding box before removing it. Set to 0 to disable");
|
||||
writer.println(" max-bounding-box-size=1000");
|
||||
writer.println(" # Square of the max speed of an entity before removing it. Set to 0 to disable");
|
||||
writer.println(" max-speed=100");
|
||||
writer.println(" }");
|
||||
writer.println(" entity-activation-range {");
|
||||
writer.println(" ambient-activation-range=32");
|
||||
writer.println(" aquatic-activation-range=32");
|
||||
writer.println(" creature-activation-range=32");
|
||||
writer.println(" minecraft {");
|
||||
writer.println(" creature {");
|
||||
writer.println(" entityhorse=true");
|
||||
writer.println(" pig=true");
|
||||
writer.println(" sheep=true");
|
||||
writer.println(" }");
|
||||
writer.println(" enabled=true");
|
||||
writer.println(" misc {");
|
||||
writer.println(" item=true");
|
||||
writer.println(" minecartchest=true");
|
||||
writer.println(" }");
|
||||
writer.println(" monster {");
|
||||
writer.println(" guardian=true");
|
||||
writer.println(" }");
|
||||
writer.println(" }");
|
||||
writer.println(" misc-activation-range=16");
|
||||
writer.println(" monster-activation-range=32");
|
||||
writer.println(" }");
|
||||
writer.println(" general {");
|
||||
writer.println(" # Forces Chunk Loading on provide requests (speedup for mods that don't check if a chunk is loaded)");
|
||||
writer.println(" chunk-load-override=false");
|
||||
writer.println(" # Disable warning messages to server admins");
|
||||
writer.println(" disable-warnings=false");
|
||||
writer.println(" }");
|
||||
writer.println(" logging {");
|
||||
writer.println(" # Log when blocks are broken");
|
||||
writer.println(" block-break=false");
|
||||
writer.println(" # Log when blocks are modified");
|
||||
writer.println(" block-modify=false");
|
||||
writer.println(" # Log when blocks are placed");
|
||||
writer.println(" block-place=false");
|
||||
writer.println(" # Log when blocks are populated in a chunk");
|
||||
writer.println(" block-populate=false");
|
||||
writer.println(" # Log when blocks are placed by players and tracked");
|
||||
writer.println(" block-tracking=false");
|
||||
writer.println(" # Log when chunks are loaded");
|
||||
writer.println(" chunk-load=false");
|
||||
writer.println(" # Log when chunks are unloaded");
|
||||
writer.println(" chunk-unload=false");
|
||||
writer.println(" # Whether to log entity collision/count checks");
|
||||
writer.println(" entity-collision-checks=false");
|
||||
writer.println(" # Log when living entities are destroyed");
|
||||
writer.println(" entity-death=false");
|
||||
writer.println(" # Log when living entities are despawned");
|
||||
writer.println(" entity-despawn=false");
|
||||
writer.println(" # Log when living entities are spawned");
|
||||
writer.println(" entity-spawn=false");
|
||||
writer.println(" # Whether to log entity removals due to speed");
|
||||
writer.println(" entity-speed-removal=false");
|
||||
writer.println(" # Add stack traces to dev logging");
|
||||
writer.println(" log-stacktraces=false");
|
||||
writer.println(" }");
|
||||
writer.println(" modules {");
|
||||
writer.println(" bungeecord=true");
|
||||
writer.println(" entity-activation-range=true");
|
||||
writer.println(" timings=true");
|
||||
writer.println(" }");
|
||||
writer.println(" # Configuration options related to the Sql service, including connection aliases etc");
|
||||
writer.println(" sql {}");
|
||||
writer.println(" timings {");
|
||||
writer.println(" enabled=true");
|
||||
writer.println(" hidden-config-entries=[");
|
||||
writer.println(" \"sponge.sql\"");
|
||||
writer.println(" ]");
|
||||
writer.println(" history-interval=300");
|
||||
writer.println(" history-length=3600");
|
||||
writer.println(" server-name-privacy=false");
|
||||
writer.println(" verbose=false");
|
||||
writer.println(" }");
|
||||
writer.println(" world {");
|
||||
writer.println(" # Lava behaves like vanilla water when source block is removed");
|
||||
writer.println(" flowing-lava-decay=false");
|
||||
writer.println(" # Vanilla water source behavior - is infinite");
|
||||
writer.println(" infinite-water-source=false");
|
||||
writer.println(" }");
|
||||
writer.println("}");
|
||||
writer.println();
|
||||
|
||||
writer.close();
|
||||
|
||||
}
|
||||
private void copyFolder(File source, File destination) {
|
||||
if (source.isDirectory()) {
|
||||
if (!destination.exists()) {
|
||||
|
@ -139,12 +139,13 @@ public class SubLogger {
|
||||
if (started) {
|
||||
started = false;
|
||||
if (writer != null) {
|
||||
PrintWriter writer = this.writer;
|
||||
this.writer = null;
|
||||
int l = (int) Math.floor((("---------- LOG START \u2014 " + name + " ----------").length() - 9) / 2);
|
||||
String s = "";
|
||||
while (s.length() < l) s += '-';
|
||||
writer.println(s + " LOG END " + s);
|
||||
writer.close();
|
||||
writer = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
BIN
SubServers.Host/src/net/ME1312/SubServers/Host/Library/Files/templates.zip
Executable file
BIN
SubServers.Host/src/net/ME1312/SubServers/Host/Library/Files/templates.zip
Executable file
Binary file not shown.
@ -119,19 +119,17 @@ public class PacketExDeleteServer implements PacketIn, PacketOut {
|
||||
return new Version("2.11.0a");
|
||||
}
|
||||
|
||||
private boolean move(File sourceFile, File destFile) {
|
||||
if (sourceFile.isDirectory()) {
|
||||
for (File file : sourceFile.listFiles()) {
|
||||
move(file, new File(file.getPath().substring("temp".length()+1)));
|
||||
}
|
||||
public void move(File from, File to) {
|
||||
if (from.isDirectory()) {
|
||||
to.mkdir();
|
||||
for (File file : from.listFiles()) move(file, new File(to, file.getName()));
|
||||
from.delete();
|
||||
} else {
|
||||
try {
|
||||
Files.move(Paths.get(sourceFile.getPath()), Paths.get(destFile.getPath()), StandardCopyOption.REPLACE_EXISTING);
|
||||
return true;
|
||||
Files.move(from.toPath(), to.toPath());
|
||||
} catch (IOException e) {
|
||||
return false;
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
@ -18,8 +18,7 @@ import net.ME1312.SubServers.Host.Library.Version.Version;
|
||||
import net.ME1312.SubServers.Host.Network.SubDataClient;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileReader;
|
||||
import java.io.*;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.net.InetAddress;
|
||||
import java.net.SocketException;
|
||||
@ -28,6 +27,8 @@ import java.net.URLDecoder;
|
||||
import java.nio.file.Files;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.zip.ZipEntry;
|
||||
import java.util.zip.ZipInputStream;
|
||||
|
||||
/**
|
||||
* SubServers.Host Main Class
|
||||
@ -43,7 +44,7 @@ public final class SubServers {
|
||||
public YAMLSection lang = null;
|
||||
public SubDataClient subdata = null;
|
||||
|
||||
public final Version version = new Version("2.11.2a");
|
||||
public final Version version = new Version("2.11.2b");
|
||||
public final Version bversion = null;
|
||||
public final SubAPI api = new SubAPI(this);
|
||||
|
||||
@ -75,17 +76,9 @@ public final class SubServers {
|
||||
log.info.println("Updated ~/config.yml");
|
||||
}
|
||||
|
||||
if (!(new UniversalFile(dir, "Templates:Spigot Plugins").exists())) {
|
||||
new UniversalFile(dir, "Templates:Spigot Plugins").mkdirs();
|
||||
log.info.println("SubServers > Created ~/Templates/Spigot Plugins");
|
||||
}
|
||||
if (!(new UniversalFile(dir, "Templates:Sponge Config").exists())) {
|
||||
new UniversalFile(dir, "Templates:Sponge Config").mkdir();
|
||||
log.info.println("SubServers > Created ~/Templates/Sponge Config");
|
||||
}
|
||||
if (!(new UniversalFile(dir, "Templates:Sponge Mods").exists())) {
|
||||
new UniversalFile(dir, "Templates:Sponge Mods").mkdir();
|
||||
log.info.println("SubServers > Created ~/Templates/Sponge Mods");
|
||||
if (!(new UniversalFile(dir, "Templates").exists())) {
|
||||
unzip(SubServers.class.getResourceAsStream("/net/ME1312/SubServers/Host/Library/Files/templates.zip"), dir);
|
||||
System.out.println("SubServers > Created ~/Templates");
|
||||
}
|
||||
|
||||
if (new UniversalFile(dir, "Recently Deleted").exists()) {
|
||||
@ -338,4 +331,32 @@ public final class SubServers {
|
||||
Util.isException(FileLogger::end);
|
||||
System.exit(event.getExitCode());
|
||||
}
|
||||
|
||||
private void unzip(InputStream zip, File dir) {
|
||||
byte[] buffer = new byte[1024];
|
||||
try{
|
||||
ZipInputStream zis = new ZipInputStream(zip);
|
||||
ZipEntry ze;
|
||||
while ((ze = zis.getNextEntry()) != null) {
|
||||
File newFile = new File(dir + File.separator + ze.getName());
|
||||
if (ze.isDirectory()) {
|
||||
newFile.mkdirs();
|
||||
continue;
|
||||
} else if (!newFile.getParentFile().exists()) {
|
||||
newFile.getParentFile().mkdirs();
|
||||
}
|
||||
FileOutputStream fos = new FileOutputStream(newFile);
|
||||
int len;
|
||||
while ((len = zis.read(buffer)) > 0) {
|
||||
fos.write(buffer, 0, len);
|
||||
}
|
||||
|
||||
fos.close();
|
||||
}
|
||||
zis.closeEntry();
|
||||
zis.close();
|
||||
} catch(IOException ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user