Set up personal server manager to be able to create an MCS
This commit is contained in:
parent
095fbfa255
commit
1a3a48115c
@ -20,6 +20,7 @@ import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilMath;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.communities.Community;
|
||||
import mineplex.core.itemstack.ItemStackFactory;
|
||||
import mineplex.core.recharge.Recharge;
|
||||
import mineplex.serverdata.Region;
|
||||
@ -124,7 +125,7 @@ public class PersonalServerManager extends MiniPlugin
|
||||
|
||||
Rank rank = _clientManager.Get(player).GetRank();
|
||||
|
||||
if (eventServer || rank.has(Rank.SNR_MODERATOR) || rank == Rank.YOUTUBE || rank == Rank.TWITCH)
|
||||
if (rank.has(Rank.SNR_MODERATOR) || rank == Rank.YOUTUBE || rank == Rank.TWITCH)
|
||||
{
|
||||
ram = 2048;
|
||||
cpu = 4;
|
||||
@ -140,6 +141,34 @@ public class PersonalServerManager extends MiniPlugin
|
||||
createGroup(player, serverName, ram, cpu, 40, 80, "Smash", eventServer);
|
||||
}
|
||||
|
||||
public void hostCommunityServer(Player host, Community community)
|
||||
{
|
||||
int ram = 2048;
|
||||
int cpu = 4;
|
||||
|
||||
runAsync(() ->
|
||||
{
|
||||
for (ServerGroup existingServerGroup : _repository.getServerGroups(null))
|
||||
{
|
||||
if (existingServerGroup.getPrefix().equalsIgnoreCase("COM-" + community.getName()) || existingServerGroup.getName().equalsIgnoreCase("COM-" + community.getId()))
|
||||
{
|
||||
host.sendMessage(F.main(getName(), "Your server is still being created or already exists. If you have just started it up, wait 20 seconds and type /server COM-" + community.getName() + "-1."));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
final ServerGroup serverGroup = new ServerGroup("COM-" + community.getId(), "COM-" + community.getName(), "COM-" + community.getName(), ram, cpu, 1, 0, UtilMath.random.nextInt(250) + 19999, "", true, "Lobby_MPS.zip", "Arcade.jar", "plugins/Arcade/", 40, 80,
|
||||
true, false, false, "Smash", "", "", "Player", true, false, false, true, false, true, true, false, false, false, false, true, true, true, false, false, "", _us ? Region.US : Region.EU, "", "", "", "");
|
||||
|
||||
_repository.updateServerGroup(serverGroup);
|
||||
runSync(() ->
|
||||
{
|
||||
host.sendMessage(F.main(getName(), "COM-" + community.getName() + "-1 successfully created. You will be able to join it shortly."));
|
||||
host.sendMessage(F.main(getName(), "In around 10 seconds, type /server COM-" + community.getName() + "-1."));
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
private void createGroup(final Player host, final String serverName, final int ram, final int cpu, final int minPlayers, final int maxPlayers, final String games, final boolean event)
|
||||
{
|
||||
getPlugin().getServer().getScheduler().runTaskAsynchronously(getPlugin(), new Runnable()
|
||||
|
Loading…
Reference in New Issue
Block a user