Skip to content

Commit

Permalink
added 'stop message' that is actually just a kick message followed by…
Browse files Browse the repository at this point in the history
… a server stop
  • Loading branch information
dries007 committed Oct 14, 2014
1 parent a52cc0d commit f14d4ff
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
8 changes: 6 additions & 2 deletions src/main/java/net/doubledoordev/backend/server/Server.java
Expand Up @@ -147,6 +147,7 @@ public void run()
{
try
{
renewQuery();
RCon rCon = getRCon();
for (String user : getPlayerList())
rCon.send("kick", user, NAME + " is taking over! Server Reboot!");
Expand Down Expand Up @@ -854,13 +855,16 @@ public void printLine(String line)
* @return true if successful via RCon
* @throws ServerOnlineException
*/

public boolean stopServer() throws ServerOnlineException
public boolean stopServer(String message) throws ServerOnlineException
{
if (!getOnline()) return false;
try
{
renewQuery();
makeRcon();
printLine("----=====##### STOPPING SERVER WITH RCON #####=====-----");
for (String user : getPlayerList())
getRCon().send("kick", user, message);
getRCon().stop();
return true;
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/templates/server.ftl
Expand Up @@ -6,7 +6,7 @@
<div class="btn-group">
<button type="button" <#if allowModify && !server.online>onclick="call('server', '${server.name}', 'startServer')" <#else>disabled</#if> class="btn btn-success">Start</button>
<button type="button" class="btn btn-info" <#if allowModify>onclick="openPopup('/serverconsole/${server.name}')" <#else>disabled</#if>>Console</button>
<button type="button" <#if allowModify && server.online>onclick="call('server', '${server.name}', 'stopServer')" <#else>disabled</#if> class="btn btn-warning">Stop</button>
<button type="button" <#if allowModify && server.online>onclick="call('server', '${server.name}', 'stopServer', prompt('Message?', 'Server is stopping.'))" <#else>disabled</#if> class="btn btn-warning">Stop</button>
<button type="button" <#if allowModify && server.online>onclick="if (confirm('Are you sure?')) call('server', '${server.name}', 'forceStopServer');" <#else>disabled</#if> class="btn btn-danger">Kill</button>
</div>
</p>
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/templates/serverlist.ftl
Expand Up @@ -23,7 +23,7 @@
<div class="btn-group">
<button type="button" <#if !server.online>onclick="call('server', '${server.name}', 'startServer')" <#else>disabled</#if> class="btn btn-success btn-xs">Start</button>
<button type="button" class="btn btn-info btn-xs" onclick="openPopup('/console/${server.name}')">Console</button>
<button type="button" <#if server.online>onclick="call('server', '${server.name}', 'stopServer')" <#else>disabled</#if> class="btn btn-warning btn-xs">Stop</button>
<button type="button" <#if server.online>onclick="call('server', '${server.name}', 'stopServer', prompt('Message?', 'Server is stopping.'))" <#else>disabled</#if> class="btn btn-warning btn-xs">Stop</button>
<button type="button" <#if server.online>onclick="if (confirm('Are you sure?')) call('server', '${server.name}', 'forceStopServer');" <#else>disabled</#if> class="btn btn-danger btn-xs">Kill</button>
</div>
</td>
Expand Down

0 comments on commit f14d4ff

Please sign in to comment.