/
regrowthwrapper.sh
212 lines (145 loc) · 4.74 KB
/
regrowthwrapper.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
#! /bin/bash
#set -x
WORKDIR=$(pwd)
OUTSIDEDIR=$WORKDIR/world
#server.properties check
#testing whether server.properties exist and generating default one with whitelist and difficulty set to normal
if test -f "$OUTSIDEDIR/server.properties";
then
ln -s $OUTSIDEDIR/server.properties $WORKDIR/server.properties ;
else
cat > $OUTSIDEDIR/server.properties <<-LIMITSTRING
#Minecraft server properties
#$(date)
generator-settings=
op-permission-level=4
allow-nether=true
level-name=world
enable-query=false
allow-flight=false
announce-player-achievements=true
server-port=25565
level-type=DEFAULT
enable-rcon=false
level-seed=
force-gamemode=false
server-ip=
max-build-height=256
spawn-npcs=true
white-list=true
spawn-animals=true
hardcore=false
snooper-enabled=true
online-mode=true
resource-pack=
pvp=true
difficulty=2
enable-command-block=false
gamemode=0
player-idle-timeout=0
max-players=20
spawn-monsters=true
view-distance=10
motd=A Regrowth Server
LIMITSTRING
ln -s $OUTSIDEDIR/server.properties $WORKDIR/server.properties ;
fi
# whitelist.json check
#checks if whitelist.json exists and if parameters are given creates one. In both cases links the accessible files to be used correctly inside the container. Else exits.
if test -f "$OUTSIDEDIR/whitelist.json";
then
echo
echo "Whitelist exists and will be used."
ln -s $OUTSIDEDIR/whitelist.json $WORKDIR/whitelist.json
elif test -n "$UUID" -a -n "$NAME";
then
echo
echo "whitelist doesn't exist and will now be generated with the parameters given."
cat > $OUTSIDEDIR/whitelist.json <<-LIMITSTRING
[
{
"uuid": "$UUID",
"name": "$NAME"
}
]
LIMITSTRING
ln -s $OUTSIDEDIR/whitelist.json $WORKDIR/whitelist.json
else
echo
echo "Please enter you Minecraft name and UUID by using \"docker run -e NAME=yourminecraftname -e UUID=yourminecraftUUID .... \""
exit 1
fi
# ops.json check
#checks if ops.json exists and if parameters are given creates one. In both cases links the accessible files to be used correctly inside the container. Else exits.
if test -f "$OUTSIDEDIR/ops.json";
then
echo
echo "Ops list exists and will be used."
ln -s $OUTSIDEDIR/ops.json $WORKDIR/ops.json ;
elif test -n "$UUID" -a -n "$NAME";
then
echo
echo "Ops list doesn't exist and will now be generated with the parameters given."
cat > $OUTSIDEDIR/ops.json <<-LIMITSTRING
[
{
"uuid": "$UUID",
"name": "$NAME",
"level": "4"
}
]
LIMITSTRING
ln -s $OUTSIDEDIR/ops.json $WORKDIR/ops.json ;
else
echo
echo "Please enter you Minecraft name and UUID by using \"docker run -e NAME=yourminecraftname -e UUID=yourminecraftUUID .... \""
exit 1
fi
# banned-ips.json check
#checks if banned-ips.json exists. If not creates an example file. In any case links accessible and inside files.
if test -f "$OUTSIDEDIR/banned-ips.json";
then
echo
echo "The ips banned will still be banned as per the banned-ips.json supplied."
ln -s $OUTSIDEDIR/banned-ips.json $WORKDIR/banned-ips.json;
else
echo
echo "An example and future link file will now be generated."
cat > $OUTSIDEDIR/banned-ips.json <<-LIMITSTRING
#[
# {
# "ip": "xxx.xxx.xxx.xxx",
# "created": "year-MM-DD HH:MM:SS +0000",
# "source": "opswhobanned",
# "expires": "howlong",
# "reason": "Banned by an operator or sumthin."
# }
#]
LIMITSTRING
ln -s $OUTSIDEDIR/banned-ips.json $WORKDIR/banned-ips.json;
fi
# banned-players.json check
#checks if banned-players.json exists. If not creates an example file. In any case links accessible and inside files.
if test -f "$OUTSIDEDIR/banned-players.json";
then
echo
echo "The players banned will still be banned as per the banned-players.json supplied."
ln -s $OUTSIDEDIR/banned-players.json $WORKDIR/banned-players.json;
else
echo
echo "An example and future link file will now be generated."
cat > $OUTSIDEDIR/banned-players.json <<-LIMITSTRING
#[
# {
# "uuid": "UUIDofbannedplayer",
# "name": "nameofbannedplayer",
# "created": "year-MM-DD HH:MM:SS +0000",
# "source": "opswhobanned",
# "expires": "howlong",
# "reason": "Banned by an operator or sumthin."
# }
#]
LIMITSTRING
ln -s $OUTSIDEDIR/banned-players.json $WORKDIR/banned-players.json;
fi
exec java -Xms2048m -Xmx4096m -XX:PermSize=256m -jar forge-1.7.10-10.13.4.1558-1.7.10-universal.jar nogui