SubServers Console v2.12a

This commit is contained in:
ME1312 2017-07-23 17:05:33 -04:00
parent df9797496a
commit c02db9890c
12 changed files with 33 additions and 27 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -198,7 +198,7 @@ extends <a href="../../../../../../net/ME1312/SubServers/Bungee/Host/SubCreator.
</tr> </tr>
<tr id="i4" class="altColor"> <tr id="i4" class="altColor">
<td class="colFirst"><code><a href="../../../../../../net/ME1312/SubServers/Bungee/Host/SubLogger.html" title="class in net.ME1312.SubServers.Bungee.Host">SubLogger</a></code></td> <td class="colFirst"><code><a href="../../../../../../net/ME1312/SubServers/Bungee/Host/SubLogger.html" title="class in net.ME1312.SubServers.Bungee.Host">SubLogger</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../../net/ME1312/SubServers/Bungee/Host/External/ExternalSubCreator.html#getLogger-java.lang.String-">getLogger</a></span>(java.lang.String&nbsp;thread)</code> <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../../net/ME1312/SubServers/Bungee/Host/External/ExternalSubCreator.html#getLogger-java.lang.String-">getLogger</a></span>(java.lang.String&nbsp;name)</code>
<div class="block">Gets the Logger for a SubCreator Instance</div> <div class="block">Gets the Logger for a SubCreator Instance</div>
</td> </td>
</tr> </tr>
@ -451,14 +451,14 @@ extends <a href="../../../../../../net/ME1312/SubServers/Bungee/Host/SubCreator.
<ul class="blockList"> <ul class="blockList">
<li class="blockList"> <li class="blockList">
<h4>getLogger</h4> <h4>getLogger</h4>
<pre>public&nbsp;<a href="../../../../../../net/ME1312/SubServers/Bungee/Host/SubLogger.html" title="class in net.ME1312.SubServers.Bungee.Host">SubLogger</a>&nbsp;getLogger(java.lang.String&nbsp;thread)</pre> <pre>public&nbsp;<a href="../../../../../../net/ME1312/SubServers/Bungee/Host/SubLogger.html" title="class in net.ME1312.SubServers.Bungee.Host">SubLogger</a>&nbsp;getLogger(java.lang.String&nbsp;name)</pre>
<div class="block"><span class="descfrmTypeLabel">Description copied from class:&nbsp;<code><a href="../../../../../../net/ME1312/SubServers/Bungee/Host/SubCreator.html#getLogger-java.lang.String-">SubCreator</a></code></span></div> <div class="block"><span class="descfrmTypeLabel">Description copied from class:&nbsp;<code><a href="../../../../../../net/ME1312/SubServers/Bungee/Host/SubCreator.html#getLogger-java.lang.String-">SubCreator</a></code></span></div>
<div class="block">Gets the Logger for a SubCreator Instance</div> <div class="block">Gets the Logger for a SubCreator Instance</div>
<dl> <dl>
<dt><span class="overrideSpecifyLabel">Specified by:</span></dt> <dt><span class="overrideSpecifyLabel">Specified by:</span></dt>
<dd><code><a href="../../../../../../net/ME1312/SubServers/Bungee/Host/SubCreator.html#getLogger-java.lang.String-">getLogger</a></code>&nbsp;in class&nbsp;<code><a href="../../../../../../net/ME1312/SubServers/Bungee/Host/SubCreator.html" title="class in net.ME1312.SubServers.Bungee.Host">SubCreator</a></code></dd> <dd><code><a href="../../../../../../net/ME1312/SubServers/Bungee/Host/SubCreator.html#getLogger-java.lang.String-">getLogger</a></code>&nbsp;in class&nbsp;<code><a href="../../../../../../net/ME1312/SubServers/Bungee/Host/SubCreator.html" title="class in net.ME1312.SubServers.Bungee.Host">SubCreator</a></code></dd>
<dt><span class="paramLabel">Parameters:</span></dt> <dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>thread</code> - Thread ID</dd> <dd><code>name</code> - Thread ID</dd>
<dt><span class="returnLabel">Returns:</span></dt> <dt><span class="returnLabel">Returns:</span></dt>
<dd>SubCreator Logger</dd> <dd>SubCreator Logger</dd>
</dl> </dl>

View File

@ -198,7 +198,7 @@ extends <a href="../../../../../../net/ME1312/SubServers/Bungee/Host/SubCreator.
</tr> </tr>
<tr id="i4" class="altColor"> <tr id="i4" class="altColor">
<td class="colFirst"><code><a href="../../../../../../net/ME1312/SubServers/Bungee/Host/SubLogger.html" title="class in net.ME1312.SubServers.Bungee.Host">SubLogger</a></code></td> <td class="colFirst"><code><a href="../../../../../../net/ME1312/SubServers/Bungee/Host/SubLogger.html" title="class in net.ME1312.SubServers.Bungee.Host">SubLogger</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../../net/ME1312/SubServers/Bungee/Host/Internal/InternalSubCreator.html#getLogger-java.lang.String-">getLogger</a></span>(java.lang.String&nbsp;thread)</code> <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../../net/ME1312/SubServers/Bungee/Host/Internal/InternalSubCreator.html#getLogger-java.lang.String-">getLogger</a></span>(java.lang.String&nbsp;name)</code>
<div class="block">Gets the Logger for a SubCreator Instance</div> <div class="block">Gets the Logger for a SubCreator Instance</div>
</td> </td>
</tr> </tr>
@ -451,14 +451,14 @@ extends <a href="../../../../../../net/ME1312/SubServers/Bungee/Host/SubCreator.
<ul class="blockList"> <ul class="blockList">
<li class="blockList"> <li class="blockList">
<h4>getLogger</h4> <h4>getLogger</h4>
<pre>public&nbsp;<a href="../../../../../../net/ME1312/SubServers/Bungee/Host/SubLogger.html" title="class in net.ME1312.SubServers.Bungee.Host">SubLogger</a>&nbsp;getLogger(java.lang.String&nbsp;thread)</pre> <pre>public&nbsp;<a href="../../../../../../net/ME1312/SubServers/Bungee/Host/SubLogger.html" title="class in net.ME1312.SubServers.Bungee.Host">SubLogger</a>&nbsp;getLogger(java.lang.String&nbsp;name)</pre>
<div class="block"><span class="descfrmTypeLabel">Description copied from class:&nbsp;<code><a href="../../../../../../net/ME1312/SubServers/Bungee/Host/SubCreator.html#getLogger-java.lang.String-">SubCreator</a></code></span></div> <div class="block"><span class="descfrmTypeLabel">Description copied from class:&nbsp;<code><a href="../../../../../../net/ME1312/SubServers/Bungee/Host/SubCreator.html#getLogger-java.lang.String-">SubCreator</a></code></span></div>
<div class="block">Gets the Logger for a SubCreator Instance</div> <div class="block">Gets the Logger for a SubCreator Instance</div>
<dl> <dl>
<dt><span class="overrideSpecifyLabel">Specified by:</span></dt> <dt><span class="overrideSpecifyLabel">Specified by:</span></dt>
<dd><code><a href="../../../../../../net/ME1312/SubServers/Bungee/Host/SubCreator.html#getLogger-java.lang.String-">getLogger</a></code>&nbsp;in class&nbsp;<code><a href="../../../../../../net/ME1312/SubServers/Bungee/Host/SubCreator.html" title="class in net.ME1312.SubServers.Bungee.Host">SubCreator</a></code></dd> <dd><code><a href="../../../../../../net/ME1312/SubServers/Bungee/Host/SubCreator.html#getLogger-java.lang.String-">getLogger</a></code>&nbsp;in class&nbsp;<code><a href="../../../../../../net/ME1312/SubServers/Bungee/Host/SubCreator.html" title="class in net.ME1312.SubServers.Bungee.Host">SubCreator</a></code></dd>
<dt><span class="paramLabel">Parameters:</span></dt> <dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>thread</code> - Thread ID</dd> <dd><code>name</code> - Thread ID</dd>
<dt><span class="returnLabel">Returns:</span></dt> <dt><span class="returnLabel">Returns:</span></dt>
<dd>SubCreator Logger</dd> <dd>SubCreator Logger</dd>
</dl> </dl>

View File

@ -120,8 +120,8 @@ public class ExternalSubCreator extends SubCreator {
@Override @Override
public void terminate(String name) { public void terminate(String name) {
if (this.thread.keySet().contains(name)) { if (this.thread.keySet().contains(name.toLowerCase())) {
host.getSubData().sendPacket(new PacketExCreateServer(name)); host.getSubData().sendPacket(new PacketExCreateServer(name.toLowerCase()));
} }
} }
@ -136,7 +136,7 @@ public class ExternalSubCreator extends SubCreator {
@Override @Override
public void waitFor(String name) throws InterruptedException { public void waitFor(String name) throws InterruptedException {
while (this.thread.keySet().contains(name)) { while (this.thread.keySet().contains(name.toLowerCase())) {
Thread.sleep(250); Thread.sleep(250);
} }
} }
@ -157,8 +157,8 @@ public class ExternalSubCreator extends SubCreator {
} }
@Override @Override
public SubLogger getLogger(String thread) { public SubLogger getLogger(String name) {
return this.thread.get(thread); return this.thread.get(name.toLowerCase());
} }
@Override @Override

View File

@ -141,7 +141,7 @@ public class InternalSubCreator extends SubCreator {
try { try {
System.out.println(name + "/Creator > Launching " + template.getBuildOptions().getRawString("Shell-Location")); System.out.println(name + "/Creator > Launching " + template.getBuildOptions().getRawString("Shell-Location"));
thread.set(Runtime.getRuntime().exec((System.getProperty("os.name").toLowerCase().indexOf("win") >= 0)?"\"" + gitBash + "\" --login -i -c \"bash " + template.getBuildOptions().getRawString("Shell-Location") + ' ' + version.toString() + '\"':("bash " + template.getBuildOptions().getRawString("Shell-Location") + ' ' + version.toString() + " " + System.getProperty("user.home")), null, dir)); thread.set(Runtime.getRuntime().exec((System.getProperty("os.name").toLowerCase().indexOf("win") >= 0) ? "\"" + gitBash + "\" --login -i -c \"bash " + template.getBuildOptions().getRawString("Shell-Location") + ' ' + version.toString() + '\"' : ("bash " + template.getBuildOptions().getRawString("Shell-Location") + ' ' + version.toString() + " " + System.getProperty("user.home")), null, dir));
thread.name().log.set(host.plugin.config.get().getSection("Settings").getBoolean("Log-Creator")); thread.name().log.set(host.plugin.config.get().getSection("Settings").getBoolean("Log-Creator"));
thread.name().file = new File(dir, "SubCreator-" + template.getName() + "-" + version.toString().replace(" ", "@") + ".log"); thread.name().file = new File(dir, "SubCreator-" + template.getName() + "-" + version.toString().replace(" ", "@") + ".log");
thread.name().process = thread.get(); thread.name().process = thread.get();
@ -151,6 +151,8 @@ public class InternalSubCreator extends SubCreator {
Thread.sleep(500); Thread.sleep(500);
if (thread.get().exitValue() != 0) error = true; if (thread.get().exitValue() != 0) error = true;
} catch (InterruptedException e) {
error = true;
} catch (Exception e) { } catch (Exception e) {
error = true; error = true;
e.printStackTrace(); e.printStackTrace();
@ -244,11 +246,11 @@ public class InternalSubCreator extends SubCreator {
@Override @Override
public void terminate(String name) { public void terminate(String name) {
if (this.thread.get(name).get().get() != null && this.thread.get(name).get().get().isAlive()) { if (this.thread.get(name.toLowerCase()).get().get() != null && this.thread.get(name.toLowerCase()).get().get().isAlive()) {
this.thread.get(name).get().get().destroyForcibly(); this.thread.get(name.toLowerCase()).get().get().destroyForcibly();
} }
if (this.thread.get(name).name() != null && this.thread.get(name).name().isAlive()) { if (this.thread.get(name.toLowerCase()).name() != null && this.thread.get(name.toLowerCase()).name().isAlive()) {
this.thread.get(name).name().interrupt(); this.thread.get(name.toLowerCase()).name().interrupt();
} }
} }
@ -263,7 +265,7 @@ public class InternalSubCreator extends SubCreator {
@Override @Override
public void waitFor(String name) throws InterruptedException { public void waitFor(String name) throws InterruptedException {
while (this.thread.get(name).name() != null && this.thread.get(name).name().isAlive()) { while (this.thread.get(name.toLowerCase()) != null && this.thread.get(name.toLowerCase()).name() != null && this.thread.get(name.toLowerCase()).name().isAlive()) {
Thread.sleep(250); Thread.sleep(250);
} }
} }
@ -290,8 +292,8 @@ public class InternalSubCreator extends SubCreator {
} }
@Override @Override
public SubLogger getLogger(String thread) { public SubLogger getLogger(String name) {
return this.thread.get(thread).get().name(); return this.thread.get(name.toLowerCase()).get().name();
} }
@Override @Override

View File

@ -1,4 +1,4 @@
name: SubServers-Console name: SubServers-Console
main: net.ME1312.SubServers.Console.ConsolePlugin main: net.ME1312.SubServers.Console.ConsolePlugin
version: 2.11.2b version: 2.12a
author: ME1312 author: ME1312

View File

@ -64,9 +64,9 @@ public final class ConsolePlugin extends Plugin implements Listener {
public void onServerCreate(SubCreateEvent event) { public void onServerCreate(SubCreateEvent event) {
if (!event.isCancelled() && config.get().getStringList("Enabled-Creators").contains(event.getHost().getName().toLowerCase())) { if (!event.isCancelled() && config.get().getStringList("Enabled-Creators").contains(event.getHost().getName().toLowerCase())) {
if (!cCurrent.keySet().contains(event.getHost().getName().toLowerCase())) { if (!cCurrent.keySet().contains(event.getHost().getName().toLowerCase())) {
SwingUtilities.invokeLater(() -> cCurrent.put(event.getHost().getName().toLowerCase(), new ConsoleWindow(this, event.getHost().getCreator().getLogger()))); SwingUtilities.invokeLater(() -> cCurrent.put(event.getName().toLowerCase(), new ConsoleWindow(this, event.getHost().getCreator().getLogger(event.getName().toLowerCase()))));
} else { } else {
cCurrent.get(event.getHost().getName().toLowerCase()).clear(); cCurrent.get(event.getName().toLowerCase()).clear();
} }
} }
} }

View File

@ -99,17 +99,19 @@ public final class PopoutCommand {
Map<String, Host> hosts = plugin.getProxy().api.getHosts(); Map<String, Host> hosts = plugin.getProxy().api.getHosts();
if (hosts.keySet().contains(args[0].toLowerCase())) { if (hosts.keySet().contains(args[0].toLowerCase())) {
boolean success = false; boolean success = false;
if (hosts.get(args[0].toLowerCase()).getCreator().isBusy()) { if (hosts.get(args[0].toLowerCase()).getCreator().getReservedNames().size() > 0) {
if (!plugin.cCurrent.keySet().contains(args[0].toLowerCase())) { if (!plugin.cCurrent.keySet().contains(args[0].toLowerCase())) {
SwingUtilities.invokeLater(() -> { SwingUtilities.invokeLater(() -> {
ConsoleWindow window = new ConsoleWindow(plugin, hosts.get(args[0].toLowerCase()).getCreator().getLogger()); for (String reserved : hosts.get(args[0].toLowerCase()).getCreator().getReservedNames()) {
plugin.cCurrent.put(args[0].toLowerCase(), window); ConsoleWindow window = new ConsoleWindow(plugin, hosts.get(args[0].toLowerCase()).getCreator().getLogger(reserved));
window.open(); plugin.cCurrent.put(reserved.toLowerCase(), window);
window.open();
}
}); });
} else { } else {
plugin.cCurrent.get(args[0].toLowerCase()).open(); plugin.cCurrent.get(args[0].toLowerCase()).open();
} }
System.out.println("SubConsole > Opening Window..."); System.out.println("SubConsole > Opening Windows...");
success = true; success = true;
} }

View File

@ -283,6 +283,8 @@ public class SubCreator {
Thread.sleep(500); Thread.sleep(500);
if (thread.get().exitValue() != 0) error = true; if (thread.get().exitValue() != 0) error = true;
} catch (InterruptedException e) {
error = true;
} catch (Exception e) { } catch (Exception e) {
error = true; error = true;
thread.name().logger.error.println(e); thread.name().logger.error.println(e);