feat: add bds core, locale updates and safety fixes
This commit is contained in:
65
cores/powernukkitx.sh
Normal file
65
cores/powernukkitx.sh
Normal file
@@ -0,0 +1,65 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
core_name_powernukkitx() {
|
||||
echo "PowerNukkitX"
|
||||
}
|
||||
|
||||
core_default_port_powernukkitx() {
|
||||
echo "19132"
|
||||
}
|
||||
|
||||
core_protocol_powernukkitx() {
|
||||
echo "udp"
|
||||
}
|
||||
|
||||
core_runtime_powernukkitx() {
|
||||
echo "java"
|
||||
}
|
||||
|
||||
core_validate_powernukkitx() {
|
||||
return 0
|
||||
}
|
||||
|
||||
core_install_powernukkitx() {
|
||||
info "$(t core_install "$(core_name_powernukkitx)")"
|
||||
emit_step "core_install" "$(core_name_powernukkitx)"
|
||||
|
||||
local url
|
||||
emit_step "core_resolve_download" "powernukkitx"
|
||||
url="$(get_github_release_asset_url PowerNukkitX/PowerNukkitX 'powernukkitx.*\\.jar')"
|
||||
if [[ -z "$url" || "$url" == "null" ]]; then
|
||||
fail "$(t no_stable_build "PowerNukkitX" "$BUILD")"
|
||||
fi
|
||||
download_as_user "$url" "$SERVER_DIR/powernukkitx.jar"
|
||||
create_powernukkit_start_script "$SERVER_DIR" "$RAM"
|
||||
emit_step "core_render" "powernukkitx"
|
||||
}
|
||||
|
||||
core_post_install_powernukkitx() {
|
||||
emit_step "core_configure" "eula"
|
||||
run_cmd bash -lc "printf 'eula=true\n' > '$SERVER_DIR/eula.txt'"
|
||||
emit_step "core_chown" "PowerNukkitX"
|
||||
run_cmd bash -lc "chown -R ${SERVER_USER}:${SERVER_USER} '$SERVER_DIR'"
|
||||
open_firewall_port "$SERVER_PORT" "udp"
|
||||
emit_step "core_service" "PowerNukkitX"
|
||||
create_service "$CORE" "$SERVER_DIR" "$SERVICE_MODE" "$SERVER_DIR/start.sh"
|
||||
start_service
|
||||
}
|
||||
|
||||
core_update_powernukkitx() {
|
||||
info "$(t core_update "$(core_name_powernukkitx)")"
|
||||
emit_step "core_update" "$(core_name_powernukkitx)"
|
||||
|
||||
local target="$SERVER_DIR/powernukkitx.jar"
|
||||
backup_file "$target"
|
||||
emit_step "core_backup" "$target"
|
||||
|
||||
local url
|
||||
emit_step "core_resolve_download" "powernukkitx"
|
||||
url="$(get_github_release_asset_url PowerNukkitX/PowerNukkitX 'powernukkitx.*\\.jar')"
|
||||
if [[ -z "$url" || "$url" == "null" ]]; then
|
||||
fail "$(t no_stable_build "PowerNukkitX" "$BUILD")"
|
||||
fi
|
||||
download_as_user_atomic "$url" "$target"
|
||||
emit_step "core_update_done" "PowerNukkitX"
|
||||
}
|
||||
Reference in New Issue
Block a user