66 lines
1.6 KiB
Bash
66 lines
1.6 KiB
Bash
#!/usr/bin/env bash
|
|
|
|
core_name_velocity() {
|
|
echo "Velocity"
|
|
}
|
|
|
|
core_default_port_velocity() {
|
|
echo "25577"
|
|
}
|
|
|
|
core_protocol_velocity() {
|
|
echo "tcp"
|
|
}
|
|
|
|
core_runtime_velocity() {
|
|
echo "java"
|
|
}
|
|
|
|
core_validate_velocity() {
|
|
return 0
|
|
}
|
|
|
|
core_install_velocity() {
|
|
info "$(t core_install "$(core_name_velocity)")"
|
|
emit_step "core_install" "$(core_name_velocity)"
|
|
|
|
local url
|
|
emit_step "core_resolve_download" "velocity"
|
|
url="$(get_papermc_download_url "velocity" "${MC_VERSION:-latest}")"
|
|
download_as_user "$url" "$SERVER_DIR/velocity.jar"
|
|
run_cmd bash -c "cat > '$SERVER_DIR/start.sh' <<EOF
|
|
#!/usr/bin/env bash
|
|
set -e
|
|
cd \"\$(dirname \"\$0\")\"
|
|
exec java -Xms${RAM} -Xmx${RAM} -jar velocity.jar
|
|
EOF"
|
|
run_cmd chmod +x "$SERVER_DIR/start.sh"
|
|
emit_step "chmod_start_script" "$SERVER_DIR/start.sh"
|
|
emit_step "core_render" "velocity"
|
|
}
|
|
|
|
core_post_install_velocity() {
|
|
emit_step "core_post" "Velocity"
|
|
run_cmd bash -lc "chown -R ${SERVER_USER}:${SERVER_USER} '$SERVER_DIR'"
|
|
emit_step "core_chown" "Velocity"
|
|
open_firewall_port "$SERVER_PORT" "tcp"
|
|
emit_step "core_service" "Velocity"
|
|
create_service "$CORE" "$SERVER_DIR" "$SERVICE_MODE" "$SERVER_DIR/start.sh"
|
|
start_service
|
|
}
|
|
|
|
core_update_velocity() {
|
|
info "$(t core_update "$(core_name_velocity)")"
|
|
emit_step "core_update" "$(core_name_velocity)"
|
|
|
|
local target="$SERVER_DIR/velocity.jar"
|
|
backup_file "$target"
|
|
emit_step "core_backup" "$target"
|
|
|
|
local url
|
|
emit_step "core_resolve_download" "velocity"
|
|
url="$(get_papermc_download_url "velocity" "${MC_VERSION:-latest}")"
|
|
download_as_user_atomic "$url" "$target"
|
|
emit_step "core_update_done" "Velocity"
|
|
}
|