Skip to content
This repository was archived by the owner on Nov 10, 2021. It is now read-only.

Commit 581b745

Browse files
committed
Merge branch 'release/0.1.4'
2 parents b5edfe3 + 79ee65b commit 581b745

27 files changed

+2504
-2
lines changed

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
/target/
2+
.classpath
3+
.project
4+
.settings/
5+
/bin/
6+
LOGS.txt

AUTHORS

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
Contribueurs Projet FroxyNetwork ~ ServerManager (Par ordre alphab�tique)
2+
3+
Contribueurs principaux:
4+
5+
- 0ddlyoko <0ddlyokoOfficial@gmail.com>
6+
7+
Contribueurs secondaires:
8+
9+
En ajoutant votre nom � la liste, vous accordez au projet FroxyNetwork une indemnit� de droit d'auteur compl�te et irr�vocable.

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2019 FroxyNetwork
3+
Copyright (c) 2020 FroxyNetwork
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

LICENSE-3RD-PARTY

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
-----------------------------------------------------------------------------
2+
MIT License
3+
4+
applies to:
5+
- slf4j, Copyright (c) 2004-2007 QOS.ch
6+
https://www.slf4j.org/
7+
- lombok, Copyright (C) 2009-2015 The Project Lombok Authors.
8+
https://github.com/rzwitserloot/lombok
9+
- FroxyNetwork, Copyright (C) 2019 FroxyNetwork.
10+
https://github.com/froxynetwork/froxynetwork
11+
- Java-WebSocket, Copyright (c) 2010-2019 Nathan Rajlich.
12+
https://github.com/TooTallNate/Java-WebSocket
13+
14+
-----------------------------------------------------------------------------
15+
16+
MIT License
17+
18+
Permission is hereby granted, free of charge, to any person obtaining a copy
19+
of this software and associated documentation files (the "Software"), to deal
20+
in the Software without restriction, including without limitation the rights
21+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
22+
copies of the Software, and to permit persons to whom the Software is
23+
furnished to do so, subject to the following conditions:
24+
25+
The above copyright notice and this permission notice shall be included in all
26+
copies or substantial portions of the Software.
27+
28+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
29+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
30+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
31+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
32+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
33+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
34+
SOFTWARE.
35+
36+
-----------------------------------------------------------------------------
37+
The Apache 2.0 License (Apache 2.0)
38+
39+
applies to:
40+
- Apache Commons IO, Copyright 2002-2019 The Apache Software Foundation
41+
https://github.com/google/gson
42+
43+
-----------------------------------------------------------------------------
44+
45+
Licensed under the Apache License, Version 2.0 (the "License");
46+
you may not use this file except in compliance with the License.
47+
You may obtain a copy of the License at
48+
49+
http://www.apache.org/licenses/LICENSE-2.0
50+
51+
Unless required by applicable law or agreed to in writing, software
52+
distributed under the License is distributed on an "AS IS" BASIS,
53+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
54+
See the License for the specific language governing permissions and
55+
limitations under the License.

README.md

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,16 @@
11
# ServerManager
2-
Server Manager for Froxy Network
2+
Gestionnaire des serveurs pour le projet Froxy-Network
3+
4+
Ce dépôt contient les sources et la documentation pour la partie ServerManager.
5+
6+
## Librairies
7+
- [slf4j](https://www.slf4j.org/)
8+
- [lombok](https://github.com/rzwitserloot/lombok)
9+
- [FroxyNetwork](https://github.com/froxynetwork/froxynetwork)
10+
- [Apache Commons IO](https://commons.apache.org/proper/commons-io/)
11+
- [Java-WebSocket](https://github.com/TooTallNate/Java-WebSocket/)
12+
13+
## License
14+
This software is available under the following licenses:
15+
16+
- MIT

messages.txt

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
Incoming:
2+
> auth <id> <token> <== Authenticate a Server via WebSocket
3+
> start <uuid> <type> <== Start a new server
4+
> stop <id> <== Stop a running server
5+
> new <id> <== Register a new server
6+
> close <id> <== When a server has shutdown (or crash)
7+
8+
Outcoming:
9+
> auth <id> <token> <== Authenticate this ServerManager via WebSocket
10+
> auth <== Say that specific server is authenticated
11+
> register <uuid> <id> <== A server has opened
12+
> unregister <id> <type> <== A server has shutdowned
13+
> error <uuid> <== When an error occurred while creating specific server

pom.xml

Lines changed: 142 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,142 @@
1+
<project xmlns="http://maven.apache.org/POM/4.0.0"
2+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
4+
<modelVersion>4.0.0</modelVersion>
5+
6+
<groupId>com.froxynetwork</groupId>
7+
<artifactId>ServerManager</artifactId>
8+
<version>0.1.4</version>
9+
<packaging>jar</packaging>
10+
11+
<name>ServerManager</name>
12+
<url>https://github.com/FroxyNetwork/ServerManager</url>
13+
14+
<properties>
15+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
16+
<maven.compiler.source>1.8</maven.compiler.source>
17+
<maven.compiler.target>1.8</maven.compiler.target>
18+
</properties>
19+
20+
<developers>
21+
<developer>
22+
<name>0ddlyoko</name>
23+
<email>0ddlyokoOfficial@gmail.com</email>
24+
<roles>
25+
<role>Developer</role>
26+
</roles>
27+
</developer>
28+
</developers>
29+
30+
<build>
31+
<defaultGoal>clean install</defaultGoal>
32+
<finalName>ServerManager-${project.version}</finalName>
33+
<plugins>
34+
<plugin>
35+
<groupId>org.apache.maven.plugins</groupId>
36+
<artifactId>maven-jar-plugin</artifactId>
37+
<version>2.4</version>
38+
<configuration>
39+
<archive>
40+
<manifest>
41+
<mainClass>com.froxynetwork.servermanager.Main</mainClass>
42+
</manifest>
43+
</archive>
44+
</configuration>
45+
</plugin>
46+
<plugin>
47+
<groupId>org.apache.maven.plugins</groupId>
48+
<artifactId>maven-compiler-plugins</artifactId>
49+
<version>3.8.0</version>
50+
<configuration>
51+
<source>1.8</source>
52+
<target>1.8</target>
53+
</configuration>
54+
</plugin>
55+
<plugin>
56+
<groupId>org.apache.maven.plugins</groupId>
57+
<artifactId>maven-shade-plugin</artifactId>
58+
<version>3.1.0</version>
59+
<executions>
60+
<execution>
61+
<id>shaded</id>
62+
<phase>package</phase>
63+
<goals>
64+
<goal>shade</goal>
65+
</goals>
66+
<configuration>
67+
<shadedArtifactAttached>false</shadedArtifactAttached>
68+
<createDependencyReducedPom>false</createDependencyReducedPom>
69+
<artifactSet>
70+
<excludes>
71+
<exclude>org.projectlombok:lombok</exclude>
72+
</excludes>
73+
</artifactSet>
74+
<filters>
75+
<filter>
76+
<artifact>*:*</artifact>
77+
<excludes>
78+
<exclude>META-INF/*.SF</exclude>
79+
<exclude>META-INF/*.DSA</exclude>
80+
<exclude>META-INF/*.RSA</exclude>
81+
</excludes>
82+
</filter>
83+
</filters>
84+
</configuration>
85+
</execution>
86+
</executions>
87+
</plugin>
88+
</plugins>
89+
</build>
90+
91+
<!-- Configuration of repositories -->
92+
<repositories>
93+
<repository>
94+
<id>jitpack.io</id>
95+
<url>https://jitpack.io</url>
96+
</repository>
97+
</repositories>
98+
99+
<!-- Configuration of dependencies -->
100+
<dependencies>
101+
<!-- Logging -->
102+
<dependency>
103+
<groupId>org.slf4j</groupId>
104+
<artifactId>slf4j-api</artifactId>
105+
<version>1.7.26</version>
106+
</dependency>
107+
<dependency>
108+
<groupId>org.slf4j</groupId>
109+
<artifactId>slf4j-log4j12</artifactId>
110+
<version>1.7.6</version>
111+
</dependency>
112+
113+
<!-- Lombok -->
114+
<dependency>
115+
<groupId>org.projectlombok</groupId>
116+
<artifactId>lombok</artifactId>
117+
<version>1.18.6</version>
118+
<scope>provided</scope>
119+
</dependency>
120+
121+
<!-- Network -->
122+
<dependency>
123+
<groupId>com.froxynetwork</groupId>
124+
<artifactId>FroxyNetwork</artifactId>
125+
<version>0.1.4</version>
126+
</dependency>
127+
128+
<!-- https://mvnrepository.com/artifact/org.apache.commons/commons-io -->
129+
<dependency>
130+
<groupId>commons-io</groupId>
131+
<artifactId>commons-io</artifactId>
132+
<version>2.6</version>
133+
</dependency>
134+
135+
<!-- WebSocket -->
136+
<dependency>
137+
<groupId>org.java-websocket</groupId>
138+
<artifactId>Java-WebSocket</artifactId>
139+
<version>1.4.0</version>
140+
</dependency>
141+
</dependencies>
142+
</project>

script/start.sh

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
#!/bin/sh
2+
# This script will configures a new minecraft server and will starts it
3+
# Here is a list of given variables:
4+
# $1 = type of server
5+
# $2 = server id
6+
# $3 = client secret
7+
# $4 = port of server
8+
9+
if [ "$#" -ne 4 ]; then
10+
echo "Usage: $0 <type> <id> <secret> <port>"
11+
exit 1
12+
fi
13+
14+
# Variables
15+
16+
# EDIT THESE TWO VARIABLES
17+
# The directory where all servers pre-configured are. Do not end this line with a /
18+
INPUTDIRECTORY="/root/test/servers/all"
19+
# The directory where all servers will be. Do not end this line with a /
20+
OUTPUTDIRECTORY="/root/test/servers/servers"
21+
# The minimum amount of ram you want to allocate
22+
MINRAM="-Xms512M"
23+
# The maximum amount of ram you want to allocate
24+
MAXRAM="-Xmx2G"
25+
26+
# DO NOT EDIT HERE
27+
JAVACMD=$(which java)
28+
TYPE=$1
29+
ID=$2
30+
SECRET=$3
31+
PORT=$4
32+
33+
OUTPUT="$OUTPUTDIRECTORY/$ID"
34+
INPUT="$INPUTDIRECTORY/$TYPE"
35+
AUTH="$OUTPUT/plugins/FroxyCore/auth"
36+
SPIGOT="$OUTPUT/spigot.jar"
37+
38+
if [ ! -d "$INPUT" ]; then
39+
echo "Input $INPUT is not a correct directory"
40+
exit 1
41+
fi
42+
43+
# copy directory
44+
cp -r $INPUT $OUTPUT
45+
46+
if [ ! -d "$OUTPUT" ]; then
47+
echo "Output $OUTPUT doesn't exist"
48+
exit 1
49+
fi
50+
51+
# server-port
52+
echo "server-port is $PORT"
53+
echo "server-port=$PORT" >> $OUTPUT/server.properties
54+
55+
# ID & SECRET
56+
mkdir -p $OUTPUT/plugins/FroxyCore
57+
echo $ID > $AUTH
58+
echo $SECRET >> $AUTH
59+
60+
if [ ! -f "$SPIGOT" ]; then
61+
echo "Spigot file $SPIGOT doesn't exist"
62+
exit 1
63+
fi
64+
65+
# Start the server
66+
echo "Starting server"
67+
cd $OUTPUT
68+
# Please be careful when editing this line
69+
screen -A -m -d -L -S $ID $JAVACMD $MINRAM $MAXRAM -XX:+UseG1GC -XX:+ParallelRefProcEnabled -XX:MaxGCPauseMillis=200 -XX:+UnlockExperimentalVMOptions -XX:+DisableExplicitGC -XX:-OmitStackTraceInFastThrow -XX:+AlwaysPreTouch -XX:G1NewSizePercent=30 -XX:G1MaxNewSizePercent=40 -XX:G1HeapRegionSize=8M -XX:G1ReservePercent=20 -XX:G1HeapWastePercent=5 -XX:G1MixedGCCountTarget=8 -XX:InitiatingHeapOccupancyPercent=15 -XX:G1MixedGCLiveThresholdPercent=90 -XX:G1RSetUpdatingPauseTimePercent=5 -XX:SurvivorRatio=32 -XX:MaxTenuringThreshold=1 -Dusing.aikars.flags=true -Daikars.new.flags=true -jar $SPIGOT nogui
70+
71+
exit 0

script/stop.sh

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
#!/bin/sh
2+
# This script will stop an existing minecraft server
3+
# Here is a list of given variables:
4+
# $1 = server id
5+
6+
if [ "$#" -ne 1 ]; then
7+
echo "Usage: $0 <id>"
8+
exit 1
9+
fi
10+
11+
# Variables
12+
13+
# EDIT THESE TWO VARIABLES
14+
# The directory where all servers will be. Do not end this line with a /
15+
SERVERDIRECTORY="/root/test/servers/servers"
16+
17+
# DO NOT EDIT HERE
18+
ID=$1
19+
20+
SERVER="$SERVERDIRECTORY/$ID"
21+
22+
if [ ! -d "$SERVER" ]; then
23+
echo "Directory $SERVER doesn't exist"
24+
# This directory doesn't exist so we assume it is stopped
25+
exit 0
26+
fi
27+
28+
# Stops process
29+
echo "Stopping screen process $ID"
30+
screen -X -S $ID quit
31+
32+
# Wait one second
33+
echo "Waiting ..."
34+
sleep 1
35+
36+
# Delete directory
37+
echo "Deleting directory $SERVER"
38+
rm -rf $SERVER
39+
if [ -d "$SERVER" ]; then
40+
echo "Directory $SERVER still exists !"
41+
exit 1
42+
fi
43+
44+
exit 0

0 commit comments

Comments
 (0)