Skip to content

Commit 0d68c3f

Browse files
authored
Merge pull request #4 from MCParks/codespace-stunning-waddle-6wpvv9r9p434gw
Devcontainer setup
2 parents fe2942d + 90da346 commit 0d68c3f

File tree

6 files changed

+104
-0
lines changed

6 files changed

+104
-0
lines changed

.devcontainer.json

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
{
2+
"name": "ShowScript Development",
3+
"build": {
4+
"dockerfile": "sandbox/Dockerfile",
5+
"args": {
6+
"VARIANT": "11",
7+
"INSTALL_MAVEN": "true",
8+
"INSTALL_GRADLE": "true"
9+
}
10+
},
11+
"customizations": {
12+
"vscode": {
13+
"settings": {
14+
"terminal.integrated.shell.linux": "/bin/bash"
15+
},
16+
"extensions": [
17+
"vscjava.vscode-java-pack",
18+
"vscjava.vscode-maven",
19+
"vscjava.vscode-gradle",
20+
"vscjava.vscode-java-test",
21+
"vscjava.vscode-java-debug",
22+
"vscjava.vscode-java-dependency",
23+
"groovy.groovy",
24+
"redhat.vscode-yaml"
25+
]
26+
}
27+
},
28+
"postCreateCommand": "bash sandbox/scripts/setup-environment.sh",
29+
"runArgs": [
30+
"--name", "showscript_dev_container",
31+
"-p", "25565:25565"
32+
],
33+
"forwardPorts": [25565]
34+
// "workspaceMount": "source=${localWorkspaceFolder},target=/workspaces,type=bind",
35+
// "workspaceFolder": "/workspaces/ShowScript"
36+
}

sandbox/Dockerfile

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Use Paper 1.12.2 as the base image
2+
FROM itzg/minecraft-server:latest
3+
4+
# Set environment variables for Minecraft server
5+
ENV TYPE=PAPER
6+
ENV VERSION=1.12.2
7+
ENV EULA=TRUE
8+
ENV ENABLE_AUTOPAUSE=FALSE
9+
ENV MEMORY=2G
10+
ENV MAX_WORLD_SIZE=1000
11+
ENV MODE=creative
12+
ENV LEVEL_TYPE=FLAT
13+
ENV MOTD=ShowScriptSandbox
14+
ENV ALLOW_NETHER=FALSE
15+
16+
# Expose the Minecraft server port
17+
EXPOSE 25565
18+
19+
ENTRYPOINT [ "" ]

sandbox/plugins.csv

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
EssentialsX,https://ci.ender.zone/job/EssentialsX/lastSuccessfulBuild/artifact/jars/EssentialsX-2.21.0-dev+81-cde7184.jar
2+
WorldEdit,https://dev.bukkit.org/projects/worldedit/files/2597538/download
3+
WorldGuard,https://dev.bukkit.org/projects/worldguard/files/2610618/download

sandbox/scripts/build-plugin.sh

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/bin/bash
2+
3+
# Navigate to the project root directory
4+
cd "$(dirname "$0")/../.."
5+
6+
# Build the ShowScript plugin
7+
./gradlew build
8+
9+
# Ensure the plugins directory exists
10+
mkdir -p /workspaces/ShowScript/sandbox/server/plugins
11+
12+
# Move the built plugin jar to the plugins directory
13+
mv build/libs/showscript.jar /workspaces/ShowScript/sandbox/server/plugins/
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#!/bin/bash
2+
3+
# Navigate to the plugins directory
4+
cd /workspaces/ShowScript/sandbox/server/plugins
5+
6+
# Read each line from the CSV file
7+
while IFS=, read -r pluginName directDownloadUrl
8+
do
9+
# Check if the plugin jar already exists
10+
if [ ! -f "$pluginName.jar" ]; then
11+
echo "Downloading $pluginName..."
12+
# Download the plugin jar from the direct download URL
13+
wget -O "$pluginName.jar" "$directDownloadUrl"
14+
else
15+
echo "$pluginName already exists, skipping download."
16+
fi
17+
done < /workspaces/ShowScript/sandbox/plugins.csv
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/bin/bash
2+
3+
# Run script to build ShowScript
4+
bash /workspaces/ShowScript/sandbox/scripts/build-plugin.sh
5+
6+
# Run script to fetch other plugins if they don't exist
7+
bash /workspaces/ShowScript/sandbox/scripts/download-plugins.sh
8+
9+
10+
11+
# Start the Minecraft server
12+
cd /workspaces/ShowScript/sandbox
13+
14+
ln -s /data /workspaces/ShowScript/sandbox
15+
16+
# Attach the VSCode Console to the Minecraft server

0 commit comments

Comments
 (0)