Skip to content
This repository has been archived by the owner on Jun 7, 2022. It is now read-only.

Commit

Permalink
Merge pull request #58 from CloudNetService/development
Browse files Browse the repository at this point in the history
Merge development branch into master branch
  • Loading branch information
byRoadrunner authored Oct 12, 2018
2 parents 1c1492f + f3a2568 commit 7a13480
Show file tree
Hide file tree
Showing 19 changed files with 261 additions and 75 deletions.
2 changes: 1 addition & 1 deletion .template/CloudNet-Master/start.bat
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
title CloudNet-Master
java -XX:+UseG1GC -XX:MaxGCPauseMillis=50 -XX:+OptimizeStringConcat -XX:CompileThreshold=100 -XX:MaxPermSize=256M -Xmx128m -jar CloudNet-Master.jar --ssl
java -XX:+UseG1GC -XX:MaxGCPauseMillis=50 -XX:CompileThreshold=100 -XX:MaxPermSize=256M -Xmx128m -jar CloudNet-Master.jar
2 changes: 1 addition & 1 deletion .template/CloudNet-Master/start.command
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
cd "$(dirname "$0")"
while true
do
java -XX:+UseG1GC -XX:MaxGCPauseMillis=50 -XX:MaxPermSize=256M -XX:+OptimizeStringConcat -XX:CompileThreshold=100 -Xmx128m -jar CloudNet-Master.jar
java -XX:+UseG1GC -XX:MaxGCPauseMillis=50 -XX:MaxPermSize=256M -XX:CompileThreshold=100 -Xmx128m -jar CloudNet-Master.jar
echo "If you want to completely stop the server process now, press Ctrl+C before
the time is up!"
echo "Rebooting in:"
Expand Down
2 changes: 1 addition & 1 deletion .template/CloudNet-Master/start.sh
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
#!/bin/sh
screen -S CloudNet java -XX:+UseG1GC -XX:MaxGCPauseMillis=50 -XX:+OptimizeStringConcat -XX:CompileThreshold=100 -XX:MaxPermSize=256M -Xmx128m -jar CloudNet-Master.jar --ssl
screen -S CloudNet java -XX:+UseG1GC -XX:MaxGCPauseMillis=50 -XX:CompileThreshold=100 -XX:MaxPermSize=256M -Xmx128m -jar CloudNet-Master.jar
2 changes: 1 addition & 1 deletion .template/CloudNet-Wrapper/start.bat
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
title CloudNet-Wrapper
java -XX:+UseG1GC -XX:MaxGCPauseMillis=50 -XX:MaxPermSize=256M -XX:+OptimizeStringConcat -XX:CompileThreshold=100 -Xmx128m -jar CloudNet-Wrapper.jar --ssl
java -XX:+UseG1GC -XX:MaxGCPauseMillis=50 -XX:MaxPermSize=256M -XX:CompileThreshold=100 -Xmx128m -jar CloudNet-Wrapper.jar
2 changes: 1 addition & 1 deletion .template/CloudNet-Wrapper/start.command
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
cd "$(dirname "$0")"
while true
do
java -XX:+UseG1GC -XX:MaxGCPauseMillis=50 -XX:MaxPermSize=256M -XX:+OptimizeStringConcat -XX:CompileThreshold=100 -Xmx128m -jar CloudNet-Wrapper.jar
java -XX:+UseG1GC -XX:MaxGCPauseMillis=50 -XX:MaxPermSize=256M -XX:CompileThreshold=100 -Xmx128m -jar CloudNet-Wrapper.jar
echo "If you want to completely stop the server process now, press Ctrl+C before
the time is up!"
echo "Rebooting in:"
Expand Down
2 changes: 1 addition & 1 deletion .template/CloudNet-Wrapper/start.sh
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
#!/bin/sh
screen -S Wrapper-1 java -XX:+UseG1GC -XX:MaxGCPauseMillis=50 -XX:+OptimizeStringConcat -XX:CompileThreshold=100 -XX:MaxPermSize=256M -Xmx64m -jar CloudNet-Wrapper.jar --ssl
screen -S Wrapper-1 java -XX:+UseG1GC -XX:MaxGCPauseMillis=50 -XX:CompileThreshold=100 -XX:MaxPermSize=256M -Xmx64m -jar CloudNet-Wrapper.jar
2 changes: 1 addition & 1 deletion Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ pipeline {
}
stage('Version') {
steps {
sh 'mvn versions:set -DnewVersion=2.1.11'
sh 'mvn versions:set -DnewVersion=2.1.12'
}
}
stage('Compile') {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@

package de.dytanic.cloudnet.bridge.internal.command.proxied;

import com.google.common.collect.ImmutableList;
import de.dytanic.cloudnet.api.CloudAPI;
import de.dytanic.cloudnet.bridge.CloudProxy;
import de.dytanic.cloudnet.bridge.internal.util.StringUtil;
import de.dytanic.cloudnet.lib.DefaultType;
import de.dytanic.cloudnet.lib.NetworkUtils;
import de.dytanic.cloudnet.lib.database.Database;
Expand All @@ -19,6 +21,7 @@
import de.dytanic.cloudnet.lib.server.info.ProxyInfo;
import de.dytanic.cloudnet.lib.server.info.ServerInfo;
import de.dytanic.cloudnet.lib.server.template.Template;
import de.dytanic.cloudnet.lib.service.ServiceId;
import de.dytanic.cloudnet.lib.utility.Acceptable;
import de.dytanic.cloudnet.lib.utility.CollectionWrapper;
import de.dytanic.cloudnet.lib.utility.document.Document;
Expand All @@ -31,6 +34,7 @@

import java.util.*;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;

/**
* Created by Tareko on 02.06.2017.
Expand Down Expand Up @@ -544,7 +548,7 @@ public boolean isAccepted(Template value)
CloudAPI.getInstance().getPrefix() + "§7/cloud startcs <name> <memory> <priorityStop>",
CloudAPI.getInstance().getPrefix() + "§7/cloud cmds (command server) <server> <command>",
CloudAPI.getInstance().getPrefix() + "§7/cloud cmdp (command proxy) <proxy> <command>",
CloudAPI.getInstance().getPrefix() + "§7/cloud stop <serverId>",
CloudAPI.getInstance().getPrefix() + "§7/cloud stop <server>",
CloudAPI.getInstance().getPrefix() + "§7/cloud stopGroup <group>",
CloudAPI.getInstance().getPrefix() + "§7/cloud ustopGroup <group>",
CloudAPI.getInstance().getPrefix() + "§7/cloud listProxys",
Expand Down Expand Up @@ -581,6 +585,103 @@ private boolean checkAsNumber(String input)
@Override
public Iterable<String> onTabComplete(CommandSender commandSender, String[] args)
{
return new LinkedList<>(CloudProxy.getInstance().getCachedServers().keySet());
List<String> tabCompletes = ImmutableList
.of();
switch (args.length)
{
case 1:
{
tabCompletes = ImmutableList
.of("toggle", "setMaxPlayers", "whitelist", "start", "startcs", "cmds", "cmdp", "stop", "stopGroup"
, "ustopGroup", "listProxys", "listOnline", "listServers", "log", "listGroups", "rl", "list"
, "maintenance", "copy", "version", "statistics");
break;
}
case 2:
{
switch (args[0].toLowerCase())
{
case "toggle":
{
tabCompletes = ImmutableList.of("autoslot", "maintenance");
break;
}
case "whitelist":
{
tabCompletes = ImmutableList.of("add", "remove");
break;
}
case "start":
case "stopgroup":
case "ustopgroup":
{
tabCompletes = getProxyAndServerGroups();
break;
}
case "stop":
{
tabCompletes = getProxiesAndServers();
break;
}
case "log":
{
tabCompletes = new LinkedList<>(CloudProxy.getInstance().getCachedServers().keySet());
break;
}
case "maintenance":
{
tabCompletes = new LinkedList<>(CloudAPI.getInstance().getServerGroupMap().keySet());
break;
}

case "cmds":
{
tabCompletes = CloudAPI.getInstance().getServers().stream()
.map(ServerInfo::getServiceId).map(ServiceId::getServerId).collect(Collectors.toList());
break;
}
case "cmdp":
{
tabCompletes = CloudAPI.getInstance().getProxys().stream()
.map(ProxyInfo::getServiceId).map(ServiceId::getServerId).collect(Collectors.toList());
break;
}

}
break;
}
case 3:
{
switch (args[0].toLowerCase())
{
case "whitelist":
{
tabCompletes = CloudAPI.getInstance().getOnlinePlayers()
.stream().map(CloudPlayer::getName).collect(Collectors.toList());
break;
}
}
break;
}
}
return new LinkedList<>(StringUtil.copyPartialMatches(args[args.length - 1], tabCompletes, new ArrayList<>(tabCompletes.size())));
}

private LinkedList<String> getProxyAndServerGroups()
{
LinkedList<String> groups = new LinkedList<>(CloudAPI.getInstance().getProxyGroupMap().keySet());
groups.addAll(CloudAPI.getInstance().getServerGroupMap().keySet());
groups.sort(Collections.reverseOrder());
return groups;
}

private LinkedList<String> getProxiesAndServers()
{
LinkedList<String> groups = new LinkedList<>(CloudAPI.getInstance().getProxys().stream()
.map(ProxyInfo::getServiceId).map(ServiceId::getServerId).collect(Collectors.toList()));
groups.addAll(CloudAPI.getInstance().getServers().stream()
.map(ServerInfo::getServiceId).map(ServiceId::getServerId).collect(Collectors.toList()));
groups.sort(Collections.reverseOrder());
return groups;
}
}
Loading

0 comments on commit 7a13480

Please sign in to comment.