feat: add bds core, locale updates and safety fixes
This commit is contained in:
62
cores/pmmp.sh
Normal file
62
cores/pmmp.sh
Normal file
@@ -0,0 +1,62 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
core_name_pmmp() {
|
||||
echo "PocketMine-MP"
|
||||
}
|
||||
|
||||
core_default_port_pmmp() {
|
||||
echo "19132"
|
||||
}
|
||||
|
||||
core_protocol_pmmp() {
|
||||
echo "udp"
|
||||
}
|
||||
|
||||
core_runtime_pmmp() {
|
||||
echo "php"
|
||||
}
|
||||
|
||||
core_validate_pmmp() {
|
||||
return 0
|
||||
}
|
||||
|
||||
core_install_pmmp() {
|
||||
info "$(t core_install "$(core_name_pmmp)")"
|
||||
emit_step "core_install" "$(core_name_pmmp)"
|
||||
emit_step "core_resolve_channel" "${BUILD:-latest}"
|
||||
|
||||
local channel="${BUILD}"
|
||||
if [[ "$channel" == "latest" || -z "$channel" ]]; then
|
||||
channel="stable"
|
||||
fi
|
||||
download_url="https://get.pmmp.io"
|
||||
emit_step "core_fetch" "pmmp"
|
||||
run_cmd sudo -u "$SERVER_USER" bash -lc "cd '$SERVER_DIR' && curl -sL '$download_url' | bash -s - -d '$SERVER_DIR' -v '$channel'"
|
||||
emit_step "core_configure" "pmmp"
|
||||
}
|
||||
|
||||
core_post_install_pmmp() {
|
||||
emit_step "core_post" "pmmp"
|
||||
open_firewall_port "$SERVER_PORT" "udp"
|
||||
emit_step "core_service" "pmmp"
|
||||
create_service "$CORE" "$SERVER_DIR" "$SERVICE_MODE" "$SERVER_DIR/start.sh"
|
||||
start_service
|
||||
}
|
||||
|
||||
core_update_pmmp() {
|
||||
info "$(t core_update "$(core_name_pmmp)")"
|
||||
emit_step "core_update" "$(core_name_pmmp)"
|
||||
|
||||
local download_url="https://get.pmmp.io"
|
||||
local channel="${BUILD}"
|
||||
if [[ "$channel" == "latest" || -z "$channel" ]]; then
|
||||
channel="stable"
|
||||
fi
|
||||
|
||||
backup_file "$SERVER_DIR/server.phar"
|
||||
backup_file "$SERVER_DIR/start.sh"
|
||||
|
||||
emit_step "core_fetch" "pmmp"
|
||||
run_cmd sudo -u "$SERVER_USER" bash -lc "cd '$SERVER_DIR' && curl -sL '$download_url' | bash -s - -d '$SERVER_DIR' -v '$channel'"
|
||||
emit_step "core_update_done" "pmmp"
|
||||
}
|
||||
Reference in New Issue
Block a user