Compare commits

...
Sign in to create a new pull request.

5 commits

41 changed files with 730 additions and 75 deletions

3
.gitignore vendored
View file

@ -1,3 +1,6 @@
# Metadata
logs/
# Run-Information
.tools/

View file

@ -1,86 +1,19 @@
version: "2"
version: "3.8"
networks:
backend:
external: true
name: minecraft-backend
services:
# Minecraft Network Proxy Server
mc-bungeecord:
image: itzg/bungeecord
container_name: mc_bungeecord
mem_limit: 2GB
environment:
BUNGEE_JAR_REVISION: "1"
CFG_MOTD: Powered by Docker
REPLACE_ENV_VARIABLES: "true"
SPIGET_PLUGINS: "241,8695,68956,80677,95509"
# External Download:
# - LuckPerms BungeeCord https://luckperms.net/download
ports:
- "25565:25577"
networks:
- backend
volumes:
- ./mc-bungeecord:/server
- ./mc-bungeecord/config.yml:/config/config.yml
# >> Moved to Stack mc-bungeecord/docker-compose.yml
# Minecraft Survival Server
mc-survival:
image: itzg/minecraft-server
container_name: mc_survival
mem_limit: 6GB
environment:
TYPE: "SPIGOT"
EULA: "TRUE"
MEMORY: ""
JVM_XX_OPTS: "-XX:MaxRAMPercentage=75"
ONLINE_MODE: "FALSE"
SPIGET_RESOURCES: "70616,7688,73997,34315,51856,16708,92546,28140,80677"
# External Download:
# - Emotecraft https://github.com/KosmX/emotes/releases/latest
# - 9089 EssentialsX https://essentialsx.net/downloads.html?branch=stable
# - 1884 GriefPrevention https://dev.bukkit.org/projects/grief-prevention/files/3173411
# - 93738 SimpleVoiceChat https://www.curseforge.com/minecraft/bukkit-plugins/simple-voice-chat/files/all
# - 1.19 Update-Issues 1997 ProtocolLib https://ci.dmulloy2.net/job/ProtocolLib/lastSuccessfulBuild/
#ports:
# - "24454:24454"
tty: true
stdin_open: true
restart: unless-stopped
networks:
- backend
volumes:
- ./mc-survival:/data
- ./logs/survival.log:/data/logs/latest.log
# >> Moved to Stack mc-survival/docker-compose.yml
# Minecraft Lobby, Creative, Minigames Server
mc-main:
image: itzg/minecraft-server
container_name: mc_main
mem_limit: 6GB
environment:
TYPE: "PAPER"
EULA: "TRUE"
MEMORY: ""
JVM_XX_OPTS: "-XX:MaxRAMPercentage=75"
ONLINE_MODE: "FALSE"
SPIGET_RESOURCES: "390,6245,7688,25391,63714,70616,28140,1166,80677,53036"
# External Download:
# - Emotecraft https://github.com/KosmX/emotes/releases/latest
# - 51321 AntiCooldown https://www.spigotmc.org/resources/anticooldown-1-9-1-18.51321/
# - 77506 PlotSquared https://www.spigotmc.org/resources/plotsquared-v6.77506/
# - 13932 Fast Async WorldEdit https://ci.athion.net/job/FastAsyncWorldEdit-1.17/lastStableBuild/
ports:
- "60606:60606"
tty: true
stdin_open: true
restart: unless-stopped
networks:
- backend
volumes:
- ./mc-main:/data
- ./logs/main.log:/data/logs/latest.log
# >> Moved to Stack mc-main/docker-compose.yml
# Nginx Proxy for Mod-support
mc-mod-proxy:

5
docker-create-network.sh Normal file
View file

@ -0,0 +1,5 @@
#!/bin/bash
# Encryption only needed if Connected Servers are on different Machines
#docker network create --opt encrypted --driver overlay --attachable minecraft-backend
docker network create --driver overlay --attachable minecraft-backend

View file

@ -1 +0,0 @@
This is an example, to allow docker-compose to recognice the Mount as a file.

6
mc-bungeecord/.env Normal file
View file

@ -0,0 +1,6 @@
BUNGEE_JAR_REVISION: "1"
CFG_MOTD: Powered by Docker
REPLACE_ENV_VARIABLES: "true"
SPIGET_PLUGINS: "241,8695,68956,80677,95509"
# External Download:
# - LuckPerms BungeeCord https://luckperms.net/download

View file

@ -0,0 +1,20 @@
version: "3.8"
networks:
backend:
external: true
name: minecraft-backend
services:
# Minecraft Network Proxy Server
mc-bungeecord:
image: itzg/bungeecord
hostname: mc-bungeecord
env_file: .env
ports:
- "25565:25577"
networks:
- backend
volumes:
- ./mc-bungeecord:/server
- ./mc-bungeecord/config.yml:/config/config.yml

10
mc-java/.env Normal file
View file

@ -0,0 +1,10 @@
# Global Vars
TYPE="SPIGOT"
VERSION="1.19"
EULA="TRUE"
ONLINE_MODE="FALSE"
# Docker Vars
JVM_XX_OPTS="-XX:MaxRAMPercentage=75"
# Host Vars
JVM_HOST_OPTS="-Xmx768M -Xms512M -jar spigot.jar nogui"
JAVA_PATH="$JAVA_HOME"

21
mc-java/.gitignore vendored Normal file
View file

@ -0,0 +1,21 @@
# Copyright & Eula
server/spigot-*.jar
server/plugins/*.jar
server/plugins/*/*.jar
server/plugins/*/*/*.jar
server/eula.txt
# Run Data
server/bundler/
server/logs/
# Server and User Data
server/world*
server/banned-*.json
server/ops.json
server/usercache.json
server/whitelist.json
# Uncategorized
server/help.yml

View file

@ -0,0 +1,11 @@
version: '3.8'
services:
mc-java:
image: itzg/minecraft-server
hostname: mc-java
env_file: .env
#ports:
# - "24454:24454"
volumes:
- ./server:/data

19
mc-java/mc-java.service Normal file
View file

@ -0,0 +1,19 @@
[Unit]
Description=Minecraft Server
After=network.target
[Service]
User=minecraft
Nice=1
KillMode=none
SuccessExitStatus=0 1
ProtectHome=true
ProtectSystem=full
PrivateDevices=true
NoNewPrivileges=true
WorkingDirectory=/m/project/kb-one-game-minecraft/mc-java/server
ExecStart=/usr/bin/java -Xmx768M -Xms512M -jar spigot.jar nogui
ExecStop=/m/project/kb-one-game-minecraft/.tools/mcrcon/mcrcon -H 127.0.0.1 -P 25575 -p strong-password stop
[Install]
WantedBy=multi-user.target

7
mc-java/readme.me Normal file
View file

@ -0,0 +1,7 @@
# Example Minecraft Java Server
This Server Example will demonstrate all the ways to start up the Minecraft Server.
On Windows you can start it by executing the ```start.ps1``` Script.
On Linux and Mac you can start it by executing the ```start.sh``` Script.
With Docker you can run ```docker compose up``` in this Directory, or even ```docker stack deploy -c docker-compose.yml mc-java```.

32
mc-java/server/bukkit.yml Normal file
View file

@ -0,0 +1,32 @@
settings:
allow-end: true
warn-on-overload: true
permissions-file: permissions.yml
update-folder: update
plugin-profiling: false
connection-throttle: 4000
query-plugins: true
deprecated-verbose: default
shutdown-message: Server closed
minimum-api: none
use-map-color-cache: true
spawn-limits:
monsters: 70
animals: 10
water-animals: 5
water-ambient: 20
water-underground-creature: 5
axolotls: 5
ambient: 15
chunk-gc:
period-in-ticks: 600
ticks-per:
animal-spawns: 400
monster-spawns: 1
water-spawns: 1
water-ambient-spawns: 1
water-underground-creature-spawns: 1
axolotl-spawns: 1
ambient-spawns: 1
autosave: 6000
aliases: now-in-commands.yml

View file

@ -0,0 +1,5 @@
command-block-overrides: []
ignore-vanilla-permissions: false
aliases:
icanhasbukkit:
- version $1-

View file

@ -0,0 +1,5 @@
# http://mcstats.org
opt-out: true
guid: 002a3092-455b-437a-a12f-ccf517cda3ff
debug: false

View file

@ -0,0 +1,59 @@
#Minecraft server properties
#Wed Mar 22 00:55:41 CET 2023
allow-flight=false
allow-nether=true
broadcast-console-to-ops=true
broadcast-rcon-to-ops=true
debug=false
difficulty=easy
enable-command-block=false
enable-jmx-monitoring=false
enable-query=false
enable-rcon=false
enable-status=true
enforce-secure-profile=true
enforce-whitelist=false
entity-broadcast-range-percentage=100
force-gamemode=false
function-permission-level=2
gamemode=survival
generate-structures=true
generator-settings={}
hardcore=false
hide-online-players=false
initial-disabled-packs=
initial-enabled-packs=vanilla
level-name=world
level-seed=
level-type=minecraft\:normal
max-chained-neighbor-updates=1000000
max-players=20
max-tick-time=60000
max-world-size=29999984
motd=A Minecraft Server
network-compression-threshold=256
online-mode=true
op-permission-level=4
player-idle-timeout=0
prevent-proxy-connections=false
pvp=true
query.port=25565
rate-limit=0
rcon.password=
rcon.port=25575
require-resource-pack=false
resource-pack=
resource-pack-prompt=
resource-pack-sha1=
server-ip=
server-port=25565
simulation-distance=10
spawn-animals=true
spawn-monsters=true
spawn-npcs=true
spawn-protection=16
sync-chunk-writes=true
text-filtering-config=
use-native-transport=true
view-distance=10
white-list=false

149
mc-java/server/spigot.yml Normal file
View file

@ -0,0 +1,149 @@
# This is the main configuration file for Spigot.
# As you can see, there's tons to configure. Some options may impact gameplay, so use
# with caution, and make sure you know what each option does before configuring.
# For a reference for any variable inside this file, check out the Spigot wiki at
# http://www.spigotmc.org/wiki/spigot-configuration/
#
# If you need help with the configuration or have any questions related to Spigot,
# join us at the Discord or drop by our forums and leave a post.
#
# Discord: https://www.spigotmc.org/go/discord
# Forums: http://www.spigotmc.org/
settings:
debug: false
timeout-time: 60
restart-on-crash: true
restart-script: ./start.sh
netty-threads: 4
attribute:
maxHealth:
max: 2048.0
movementSpeed:
max: 2048.0
attackDamage:
max: 2048.0
moved-too-quickly-multiplier: 10.0
save-user-cache-on-stop-only: false
moved-wrongly-threshold: 0.0625
user-cache-size: 1000
bungeecord: false
sample-count: 12
player-shuffle: 0
log-villager-deaths: true
log-named-deaths: true
world-settings:
default:
below-zero-generation-in-existing-chunks: true
verbose: true
nerf-spawner-mobs: false
item-despawn-rate: 6000
merge-radius:
item: 2.5
exp: 3.0
simulation-distance: default
view-distance: default
thunder-chance: 100000
arrow-despawn-rate: 1200
trident-despawn-rate: 1200
seed-village: 10387312
seed-desert: 14357617
seed-igloo: 14357618
seed-jungle: 14357619
seed-swamp: 14357620
seed-monument: 10387313
seed-shipwreck: 165745295
seed-ocean: 14357621
seed-outpost: 165745296
seed-endcity: 10387313
seed-slime: 987234911
seed-nether: 30084232
seed-mansion: 10387319
seed-fossil: 14357921
seed-portal: 34222645
max-tick-time:
tile: 50
entity: 50
max-tnt-per-tick: 100
hunger:
jump-walk-exhaustion: 0.05
jump-sprint-exhaustion: 0.2
combat-exhaustion: 0.1
regen-exhaustion: 6.0
swim-multiplier: 0.01
sprint-multiplier: 0.1
other-multiplier: 0.0
enable-zombie-pigmen-portal-spawns: true
dragon-death-sound-radius: 0
wither-spawn-sound-radius: 0
end-portal-sound-radius: 0
hanging-tick-frequency: 100
mob-spawn-range: 6
growth:
cactus-modifier: 100
cane-modifier: 100
melon-modifier: 100
mushroom-modifier: 100
pumpkin-modifier: 100
sapling-modifier: 100
beetroot-modifier: 100
carrot-modifier: 100
potato-modifier: 100
wheat-modifier: 100
netherwart-modifier: 100
vine-modifier: 100
cocoa-modifier: 100
bamboo-modifier: 100
sweetberry-modifier: 100
kelp-modifier: 100
twistingvines-modifier: 100
weepingvines-modifier: 100
cavevines-modifier: 100
ticks-per:
hopper-transfer: 8
hopper-check: 1
hopper-amount: 1
hopper-can-load-chunks: false
entity-activation-range:
animals: 32
monsters: 32
raiders: 48
misc: 16
tick-inactive-villagers: true
ignore-spectators: false
entity-tracking-range:
players: 48
animals: 48
monsters: 48
misc: 32
other: 64
zombie-aggressive-towards-villager: true
messages:
restart: Server is restarting
whitelist: You are not whitelisted on this server!
unknown-command: Unknown command. Type "/help" for help.
server-full: The server is full!
outdated-client: Outdated client! Please use {0}
outdated-server: Outdated server! I'm still on {0}
commands:
silent-commandblock-console: false
replace-commands:
- setblock
- summon
- testforblock
- tellraw
spam-exclusions:
- /skill
log: true
tab-complete: 0
send-namespaced: true
advancements:
disable-saving: false
disabled:
- minecraft:story/disabled
players:
disable-saving: false
config-version: 12
stats:
disable-saving: false
forced-stats: {}

27
mc-java/start.ps1 Normal file
View file

@ -0,0 +1,27 @@
$basedir=(Get-Location)
$buildtools=$basedir.Path + "\..\.tools\buildtools"
$version="1.19.4"
$java=$env:JAVA_HOME
if ( $args.count -eq 0 ) {
Set-Location ($basedir.Path+"\server")
& $java\bin\java.exe -jar (".\spigot-"+$version+".jar") --nogui
}
elseif ($args[0] -eq "background") {
$serverProcess = New-Object System.Diagnostics.ProcessStartInfo;
$serverProcess.FileName = ($java + "\bin\java.exe"); #process file
$serverProcess.Arguments = ("-jar " + $basedir.Path + "\server\spigot-"+$version+".jar --nogui");
$serverProcess.WorkingDirectory = ($basedir.Path+"\server");
$serverProcess.UseShellExecute = $false; #start the process from it's own executable file
$serverProcess.RedirectStandardInput = $true; #enable the process to read from standard input
$p = [System.Diagnostics.Process]::Start($serverProcess);
Start-Sleep -s 50 #wait 2 seconds so that the process can be up and running
$p.StandardInput.WriteLine("stop"); #StandardInput property of the Process is a .NET StreamWriter object
}
Set-Location $basedir

0
mc-java/start.sh Normal file
View file

10
mc-java/update.ps1 Normal file
View file

@ -0,0 +1,10 @@
$basedir=(Get-Location)
$buildtools=$basedir.Path + "\..\.tools\buildtools"
$version="1.19.4"
$java=$env:JAVA_HOME
Set-Location $buildtools
& $java\bin\java.exe -jar .\BuildTools.jar --rev $version
Set-Location $basedir
Move-Item ($buildtools + "\spigot-" + $version + ".jar") .\server\.

11
mc-main/.env Normal file
View file

@ -0,0 +1,11 @@
TYPE: "PAPER"
EULA: "TRUE"
MEMORY: ""
JVM_XX_OPTS: "-XX:MaxRAMPercentage=75"
ONLINE_MODE: "FALSE"
SPIGET_RESOURCES: "390,6245,7688,25391,63714,70616,28140,1166,80677,53036"
# External Download:
# - Emotecraft https://github.com/KosmX/emotes/releases/latest
# - 51321 AntiCooldown https://www.spigotmc.org/resources/anticooldown-1-9-1-18.51321/
# - 77506 PlotSquared https://www.spigotmc.org/resources/plotsquared-v6.77506/
# - 13932 Fast Async WorldEdit https://ci.athion.net/job/FastAsyncWorldEdit-1.17/lastStableBuild/

View file

@ -0,0 +1,18 @@
version: '3.8'
networks:
backend:
external: true
name: minecraft-backend
services:
mc-main:
image: itzg/minecraft-server
hostname: mc-main
env_file: .env
# ports:
# - "60606:60606"
networks:
- backend
volumes:
- ./mc-main:/data

12
mc-survival/.env Normal file
View file

@ -0,0 +1,12 @@
TYPE: "SPIGOT"
EULA: "TRUE"
MEMORY: ""
JVM_XX_OPTS: "-XX:MaxRAMPercentage=75"
ONLINE_MODE: "FALSE"
SPIGET_RESOURCES: "70616,7688,73997,34315,51856,16708,92546,28140,80677"
# External Download:
# - Emotecraft https://github.com/KosmX/emotes/releases/latest
# - 9089 EssentialsX https://essentialsx.net/downloads.html?branch=stable
# - 1884 GriefPrevention https://dev.bukkit.org/projects/grief-prevention/files/3173411
# - 93738 SimpleVoiceChat https://www.curseforge.com/minecraft/bukkit-plugins/simple-voice-chat/files/all
# - 1.19 Update-Issues 1997 ProtocolLib https://ci.dmulloy2.net/job/ProtocolLib/lastSuccessfulBuild/

View file

@ -0,0 +1,18 @@
version: '3.8'
networks:
backend:
external: true
name: minecraft-backend
services:
mc-survival:
image: itzg/minecraft-server
hostname: mc-survival
env_file: .env
#ports:
# - "24454:24454"
networks:
- backend
volumes:
- ./mc-survival:/data

View file

112
servertool.sh Normal file
View file

@ -0,0 +1,112 @@
#/bin/bash
# How to Execute this Multi-Purpose script:
# -----------------------------------------
# execute this Script in a Linux Console or Windows Powershell with:
# bash servertool
# fill script variables
BASEDIR=$(pwd)
COMMAND=$1;
shift
CONFIG=("$@")
# Help function prints information about usage of this script.
function print_help {
echo -e "
Welcome to the All in one Minecraft Server Tool
-----------------------------------------------
Usage: servertool [command] [configuration]
COMMAND\tDESCRIPTION\t\t\tEXAMPLE
setup \tInteractive Setup
create \tCreates new configuration \tservertool create test
-----------------------------------------------";
# echo -e "start \tStarts configuration";
# echo -e "stop \tStops running configuration";
# echo -e "status \tShows Information about configuration";
# echo -e "remove \tRemoves configuration";
}
function list_server {
echo -e "You have currently configured following Servers: "
for i in $(ls -d */); do
echo ${i%%/};
done
}
function create_info {
echo -e "$1"
}
# Creates a new Server Configuration
function create_server {
local name=$1; # any string-value, please no stupid characters
local type=$2; # spigot, paper, bungeecord, waterfall, velocity, etc...
echo -e "Creating Server $name running $type"
echo -e "${#my_array[@]}"
if [ -z "${#my_array[@]}" ]; then
echo "Print create command Help"
elif [ -d "$name" ]; then
echo -e "Server $name allready exists!"
else
# mkdir "$name"
# mkdir "$name/server"
echo -e "version: '3.8'
services:
$name:
image: itzg/minecraft-server
hostname: $name
environment:
TYPE: \"$type\"
EULA: \"$eula\"
JVM_XX_OPTS: \"-XX:MaxRAMPercentage=75\"
ONLINE_MODE: \"$online\"
SPIGET_RESOURCES: \"70616,7688,73997,34315,51856,16708,92546,28140,80677\"
volumes:
- ./mc-survival:/data"
fi
}
# Select Command
if [[ -z "$COMMAND" || "$COMMAND" = "help" || "$COMMAND" = "--help" || "$COMMAND" = "-h" ]]; then
print_help
elif [ "$COMMAND" = "create" ]; then
echo "Creating Server";
create_server $CONFIG;
elif [ "$COMMAND" = "create" ]; then
list_server;
else
print_help
fi
#if ("$COMMAND"=="" || "$COMMAND"=="help" || "$COMMAND"=="--help" || "$COMMAND"=="-h"); then
# print_help;
#fi;
# Enable job control
set -m
while false :
do
read -t 10 -p "input> " input
[[ $input == finish ]] && break
# set SIGINT to default action
trap - SIGINT
# Run the command in background
bash -c "$input" &
# Set our signal mask to ignore SIGINT
trap "" SIGINT
# Move the command back-into foreground
fg %-
done

92
setup-tools-noroot.ps1 Normal file
View file

@ -0,0 +1,92 @@
param (
[switch]$Force,
[switch]$Testing
)
$basedir=(Get-Location).Path
$toolsdir=($basedir + "\.tools")
if (!(Test-Path ".tools")){New-Item ".tools" -ItemType Directory | Out-Null; Write-Host ("Created Directory .tools")}
function setup-mcrcon {
if (!(Test-Path ($toolsdir+"\mcrcon"))) {
New-Item ".tools/mcrcon" -ItemType Directory | Out-Null; Write-Host ("Created Directory .tools/mcrcon")
}
Set-Location ($toolsdir+"\mcrcon")
$release = (Invoke-RestMethod -Uri "https://api.github.com/repos/Tiiffi/mcrcon/releases/latest")
$download = ($release.assets.Where({$_.name -like "*windows*x86-64*"},"First",1))
if (!((Test-Path $download.name -PathType Leaf) -and (Test-Path "mcrcon.exe" -PathType Leaf))){
Write-Output ("Downloading mcrcon Version '" + $release.tag_name + "' in '" + (Get-Location) + "'.")
Remove-Item "mcrcon-*-windows-x86-64.zip"
Invoke-WebRequest -Uri $download.browser_download_url -OutFile $download.name
Expand-Archive $download.name .
} else { Write-Output ("Download skipped, mcrcon Version '" + $release.tag_name + "' is allready downloaded.") }
}
function setup-buildtools {
if (!(Test-Path ($toolsdir+"\buildtools"))) {
New-Item ".tools/buildtools" -ItemType Directory | Out-Null; Write-Host ("Created Directory .tools/buildtools");
}
Set-Location ($toolsdir+"\buildtools")
if (!(Test-Path "BuildTools.jar" -PathType Leaf) -or (((get-date)-(get-item "BuildTools.jar").LastWriteTime) -gt (new-timespan -hours 2))){
Write-Output ("Downloading Build Tools in '" + (Get-Location) + "'.")
if (Test-Path "BuildTools.jar" -PathType Leaf) { Remove-Item "BuildTools.jar" }
Invoke-WebRequest -Uri https://hub.spigotmc.org/jenkins/job/BuildTools/lastSuccessfulBuild/artifact/target/BuildTools.jar -OutFile BuildTools.jar
} else { Write-Output ("Download skipped, File .tools/buildtools/BuildTools.jar is newer than 2h.") }
}
function setup-nssm {
if (!(Test-Path ($toolsdir+"\nssm"))) {
New-Item ".tools/nssm" -ItemType Directory | Out-Null; Write-Host ("Created Directory .tools/nssm")
}
Set-Location $basedir/.tools/nssm
$release = (Invoke-WebRequest -Uri https://nssm.cc/builds).Links.Where({$_.href -like "*ci/nssm*"},"First",1)
$archive_name = $release.href.SubString(4,22)
if (!((Test-Path ($archive_name+".zip") -PathType Leaf) -and (Test-Path "win64/nssm.exe" -PathType Leaf))) {
Write-Output ("Downloading NSSM Version '"+$archive_name.SubString(5,8)+"' in '" + (Get-Location) + "'.")
Remove-Item -Recurse *
Invoke-WebRequest -Uri ("https://nssm.cc"+$release.href) -OutFile ($archive_name+".zip")
Expand-Archive ($archive_name+".zip") .
Move-Item ($archive_name+"\*") .
Remove-Item $archive_name
} else {
Write-Output ("Download skipped, NSSM Version '"+$archive_name.SubString(5,8)+"' is allready downloaded.")
}
}
# Only Setup everything locally, if Parameter force is used
if ($Force) {
Write-Output "Forcing local setup of all required tools";
setup-buildtools;
setup-mcrcon;
setup-nssm;
}
# Testing Stuff here
if ($Testing) {
if (!(Test-Path ($toolsdir+"\java" ))){New-Item ".tools/java" -ItemType Directory | Out-Null; Write-Host ("Created Directory .tools/java" )}
# Java Download needed?
$possible_java_dirs = ($env:Path -split ';' | where{$_ -notlike "*WINDOWS*"})
$javas = @();
foreach($dir in $possible_java_dirs){
Write-Output ("Searching Java Installs in "+$dir)
Get-Childitem -Path $dir -Filter 'java.exe' -Recurse -ErrorAction SilentlyContinue | ForEach-Object {
Write-Output ("Found Java Version " + (Get-Command $_.FullName | Select-Object -ExpandProperty Version) + " at '" + $_.FullName + "'.")
$java = New-Object PsCustomObject
$java | Add-Member -type NoteProperty -name Path -Value $_.FullName
$java | Add-Member -type NoteProperty -name Version -Value (Get-Command $_.FullName | Select-Object -ExpandProperty Version)
$javas += $java
}
}
$favourite_java = "";
if (![string]::IsNullOrEmpty($env:JAVA_HOME)) {
$favourite_java = ($env:JAVA_HOME+"\bin\java.exe")
Write-Output ("You have set JAVA_HOME Environment Variable to use Java Version " + (Get-Command ($env:JAVA_HOME+"\bin\java.exe") | Select-Object -ExpandProperty Version) + ". ")
}
else {$favourite_java = "placeholder"}
Write-Output ($javas | Sort-Object -Property Version -Descending)
}
# ---------------------------------
# Go Back to Script-Location
Set-Location $basedir

27
setup-tools-noroot.sh Normal file
View file

@ -0,0 +1,27 @@
#!/bin/bash
BASEDIR=$(pwd)
# Helper
get_latest_release() { # Source: https://gist.github.com/lukechilds/a83e1d7127b78fef38c2914c4ececc3c
curl --silent "https://api.github.com/repos/$1/releases/latest" | # Get latest release from GitHub api
grep '"tag_name":' | # Get tag line
sed -E 's/.*"([^"]+)".*/\1/' # Pluck JSON value
}
# Create File Structure
mkdir -p ${BASEDIR}/.tools/buildtools && \
mkdir -p ${BASEDIR}/.tools/mcrcon && \
mkdir -p ${BASEDIR}/.tools/java
# Setup mcrcon
cd ${BASEDIR}/.tools/mcrcon/ && \
LATEST=$(get_latest_release Tiiffi/mcrcon) && \
ARCHIVE_NAME="mcrcon-${LATEST[@]/v/}-linux-x86-64.tar.gz" && \
curl -L -o ${ARCHIVE_NAME} https://github.com/Tiiffi/mcrcon/releases/download/${LATEST}/${ARCHIVE_NAME} && \
tar xfz ${ARCHIVE_NAME}
#chmod +x mcrcon #Needed?
# Setup BuildTools
cd ${BASEDIR}/.tools/buildtools && \
curl -L -o BuildTools.jar https://hub.spigotmc.org/jenkins/job/BuildTools/lastSuccessfulBuild/artifact/target/BuildTools.jar

44
setup-tools.sh Normal file
View file

@ -0,0 +1,44 @@
#!/bin/bash
BASEDIR=$(pwd)
# Helper
get_latest_release() { # Source: https://gist.github.com/lukechilds/a83e1d7127b78fef38c2914c4ececc3c
curl --silent "https://api.github.com/repos/$1/releases/latest" | # Get latest release from GitHub api
grep '"tag_name":' | # Get tag line
sed -E 's/.*"([^"]+)".*/\1/' # Pluck JSON value
}
# Install Essentials
#sudo apt-get update
#sudo apt-get -yq install git build-essential gnupg curl
# Open JDK install Zulu: Package-Manager apt
#sudo apt-key adv \
# --keyserver hkp://keyserver.ubuntu.com:80 \
# --recv-keys 0xB1998361219BD9C9
#sudo apt-get update
#sudo apt-get install zulu16-jdk
# Open JDK install Zulu: Direct Download
#curl -O https://cdn.azul.com/zulu/bin/zulu-repo_1.0.0-2_all.deb
#sudo apt-get install ./zulu-repo_1.0.0-2_all.deb
# Open JDK install Zulu: Portable
#curl -o jdk17.tar.gz https://cdn.azul.com/zulu/bin/zulu17.40.19-ca-jdk17.0.6-linux_x64.tar.gz
#tar xfz jdk17.tar.gz
# Create File Structure
mkdir -p ${BASEDIR}/.tools/buildtools && \
mkdir -p ${BASEDIR}/.tools/java && \
# Setup mcrcon
LATEST=$(get_latest_release Tiiffi/mcrcon)
curl -o ${BASEDIR}/tools/mcrcon/mcrcon https://github.com/Tiiffi/mcrcon/releases/download/${LATEST}/mcrcon-${LATEST[@]/v/}-windows-x86-64.zip
cd ${BASEDIR}/tools && git clone https://github.com/Tiiffi/mcrcon.git \
&& cd ${BASEDIR}/tools/mcrcon && gcc -std=gnu11 -pedantic -Wall -Wextra -O2 -s -o mcrcon mcrcon.c
# Setup Spigot
cd ${BASEDIR}/tools/buildtools && curl -o BuildTools.jar https://hub.spigotmc.org/jenkins/job/BuildTools/lastSuccessfulBuild/artifact/target/BuildTools.jar \
&& java -jar BuildTools.jar --rev 1.17