-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added server templates and server class with mongodb integration
- Loading branch information
Showing
3 changed files
with
107 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
src/main/java/com/twoweeksmc/lobbyserver/server/Server.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package com.twoweeksmc.lobbyserver.server; | ||
|
||
import java.util.List; | ||
|
||
public class Server { | ||
private final int weeks; | ||
private final int maxPlayers; | ||
private final int maxMemory; | ||
private final List<String> plugins; | ||
|
||
public Server(int weeks, int maxPlayers, int maxMemory, List<String> plugins) { | ||
this.weeks = weeks; | ||
this.maxPlayers = maxPlayers; | ||
this.maxMemory = maxMemory; | ||
this.plugins = plugins; | ||
} | ||
|
||
public static Server getFromTemplate(ServerTemplate template) { | ||
return new Server(template.getWeeks(), template.getMaxPlayers(), template.getMaxMemory(), | ||
template.getPlugins()); | ||
} | ||
|
||
public List<String> getPlugins() { | ||
return plugins; | ||
} | ||
|
||
public int getMaxMemory() { | ||
return maxMemory; | ||
} | ||
|
||
public int getMaxPlayers() { | ||
return maxPlayers; | ||
} | ||
|
||
public int getWeeks() { | ||
return weeks; | ||
} | ||
} |
49 changes: 49 additions & 0 deletions
49
src/main/java/com/twoweeksmc/lobbyserver/server/ServerTemplate.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
package com.twoweeksmc.lobbyserver.server; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
public enum ServerTemplate { | ||
DEFAULT_SURVIVAL(2, 4, 2048, new ArrayList<>(List.of("2weeksmc-core"))), | ||
DEFAULT_BUILDING(2, 2, 2048, new ArrayList<>(List.of( | ||
"2weeksmc-core", "fastasyncworldedit", "voxelsniper"))), | ||
PREMIUM_SURVIVAL(4, 4, 4096, new ArrayList<>(List.of( | ||
"2weeksmc-core", "2weeksmc-survival-premium"))), | ||
PREMIUM_BUILDING(4, 4, 4096, new ArrayList<>(List.of( | ||
"2weeksmc-core", "fastasyncworldedit", "voxelsniper", "gobrush", "gopaint"))), | ||
ENTERPRISE_SURVIVAL(8, 8, 6144, new ArrayList<>(List.of( | ||
"2weeksmc-core", | ||
"2weeksmc-survival-enterprise"))), | ||
ENTERPRISE_BUILDING(8, 8, | ||
6144, new ArrayList<>(List.of( | ||
"2weeksmc-core", "fastasyncworldedit", "voxelsniper", "gobrush", "gopaint", "craftflowers", | ||
"armostandtools"))); | ||
|
||
private final int weeks; | ||
private final int maxPlayers; | ||
private final int maxMemory; | ||
private final List<String> plugins; | ||
|
||
ServerTemplate(int weeks, int maxPlayers, int maxMemory, List<String> plugins) { | ||
this.weeks = weeks; | ||
this.maxPlayers = maxPlayers; | ||
this.maxMemory = maxMemory; | ||
this.plugins = plugins; | ||
} | ||
|
||
public List<String> getPlugins() { | ||
return plugins; | ||
} | ||
|
||
public int getMaxMemory() { | ||
return maxMemory; | ||
} | ||
|
||
public int getMaxPlayers() { | ||
return maxPlayers; | ||
} | ||
|
||
public int getWeeks() { | ||
return weeks; | ||
} | ||
} |