Skip to content

Commit d8e7bda

Browse files
feat: fully working command system with autocompletion (excludes entity targets) (#17)
* feat: fully working command system with autocompletion (excludes entity targets) * refactor: add php bins to install script for: macos arm64 and x86_64, linux x86_64, windows x64
1 parent 26f788a commit d8e7bda

2 files changed

Lines changed: 21 additions & 39 deletions

File tree

examples/plugins/php/setup.sh

Lines changed: 18 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -15,40 +15,20 @@ if [[ "$OS" == MINGW* ]] || [[ "$OS" == MSYS* ]] || [[ "$OS" == CYGWIN* ]]; then
1515
OS="Windows"
1616
fi
1717

18-
# OVERRIDE: Force x86_64 builds on unsupported platforms (macOS, Linux ARM64)
19-
# Set to false to restore original behavior
20-
FORCE_X86_64_OVERRIDE=true
21-
22-
if [ "$FORCE_X86_64_OVERRIDE" = true ]; then
23-
if [ "$OS" = "Darwin" ]; then
24-
echo "⚠️ Using x86_64 build on macOS (will use Rosetta 2 on ARM Macs)"
25-
OS="Linux"
26-
ARCH="x86_64"
27-
elif [ "$OS" = "Linux" ] && ([ "$ARCH" = "aarch64" ] || [ "$ARCH" = "arm64" ]); then
28-
echo "⚠️ Using x86_64 build on Linux ARM64 (requires emulation support)"
29-
ARCH="x86_64"
30-
fi
31-
fi
32-
33-
# PHP build URL (PocketMine PHP 8.4 with gRPC built-in)
34-
# Note: Only Linux x86_64 and Windows x64 pre-built binaries are available
18+
# PHP build URL (PocketMine PHP 8.3 with gRPC built-in)
19+
# Source: secmc/PHP-Binaries
3520
if [ "$OS" = "Darwin" ]; then
36-
echo "❌ Pre-built PHP binaries are not available for macOS"
37-
echo ""
38-
echo "Please use one of these alternatives:"
39-
echo ""
40-
echo " Option 1: Use system PHP with manual gRPC installation"
41-
echo " - Install PHP 8.1+ via Homebrew: brew install php"
42-
echo " - Install gRPC extension: pecl install grpc"
43-
echo " - Install protobuf extension: pecl install protobuf"
44-
echo ""
45-
echo " Option 2: Use Docker"
46-
echo " - See CUSTOM_PHP.md for Docker setup instructions"
47-
echo ""
48-
echo " Option 3: Run on Linux (VM or WSL)"
49-
echo " - Transfer your plugin to a Linux x86_64 system"
50-
echo ""
51-
exit 1
21+
# macOS - both arm64 and x86_64 supported!
22+
if [ "$ARCH" = "arm64" ]; then
23+
PHP_BUILD_URL="https://github.com/secmc/PHP-Binaries/releases/download/pm5-php-8.3-latest/PHP-8.3-MacOS-arm64-PM5.tar.gz"
24+
PHP_BIN="bin/php7/bin/php"
25+
IS_WINDOWS=false
26+
else
27+
# x86_64 or other arch - use x86_64 build
28+
PHP_BUILD_URL="https://github.com/secmc/PHP-Binaries/releases/download/pm5-php-8.3-latest/PHP-8.3-MacOS-x86_64-PM5.tar.gz"
29+
PHP_BIN="bin/php7/bin/php"
30+
IS_WINDOWS=false
31+
fi
5232
elif [ "$OS" = "Linux" ]; then
5333
if [ "$ARCH" = "aarch64" ] || [ "$ARCH" = "arm64" ]; then
5434
echo "❌ Pre-built PHP binaries are not available for Linux ARM64"
@@ -67,18 +47,18 @@ elif [ "$OS" = "Linux" ]; then
6747
exit 1
6848
else
6949
# Linux x86_64 - supported!
70-
PHP_BUILD_URL="https://github.com/NetherGamesMC/php-build-scripts/releases/download/pm5-php-8.4-latest/PHP-8.4-Linux-x86_64-PM5.tar.gz"
50+
PHP_BUILD_URL="https://github.com/secmc/PHP-Binaries/releases/download/pm5-php-8.3-latest/PHP-8.3-Linux-x86_64-PM5.tar.gz"
7151
PHP_BIN="bin/php7/bin/php"
7252
IS_WINDOWS=false
7353
fi
7454
elif [ "$OS" = "Windows" ]; then
7555
# Windows x64 - supported!
76-
PHP_BUILD_URL="https://github.com/NetherGamesMC/php-build-scripts/releases/download/pm5-php-8.4-latest/PHP-8.4-Windows-x64-PM5.zip"
56+
PHP_BUILD_URL="https://github.com/secmc/PHP-Binaries/releases/download/pm5-php-8.3-latest/PHP-8.3-Windows-x64-PM5.zip"
7757
PHP_BIN="bin/php/php.exe"
7858
IS_WINDOWS=true
7959
else
8060
echo "❌ Unsupported OS: $OS"
81-
echo " Pre-built binaries available for: Linux x86_64, Windows x64"
61+
echo " Pre-built binaries available for: macOS (arm64/x86_64), Linux x86_64, Windows x64"
8262
echo " See CUSTOM_PHP.md for manual installation on other platforms"
8363
exit 1
8464
fi
@@ -91,8 +71,8 @@ if [ -f "$PHP_BIN" ]; then
9171
PHP_VERSION=$($PHP_BIN -v | head -n 1)
9272
echo " $PHP_VERSION"
9373
else
94-
echo "📥 Downloading pre-compiled PHP 8.4 with gRPC..."
95-
echo " Source: NetherGamesMC/php-build-scripts"
74+
echo "📥 Downloading pre-compiled PHP 8.3 with gRPC..."
75+
echo " Source: secmc/PHP-Binaries"
9676
echo ""
9777

9878
# Download PHP build

go.mod

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ module github.com/secmc/plugin
22

33
go 1.25.0
44

5+
replace github.com/df-mc/dragonfly => ./dragonfly
6+
57
require (
68
github.com/df-mc/dragonfly v0.10.10-0.20251115132555-564b905699ba
79
github.com/didntpot/pregdk v0.0.0-20251104095621-63cf2e4d7716
@@ -35,4 +37,4 @@ require (
3537
golang.org/x/text v0.27.0 // indirect
3638
google.golang.org/genproto/googleapis/rpc v0.0.0-20250804133106-a7a43d27e69b // indirect
3739
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect
38-
)
40+
)

0 commit comments

Comments
 (0)