Skip to content

Commit 32d6242

Browse files
authored
Merge pull request #7 from jgniecki/main
v3.1
2 parents c1e54a2 + be5ec5c commit 32d6242

16 files changed

+623
-498
lines changed

Dockerfile

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
FROM php:7.4-apache
2+
3+
# Install necessary extensions and tools
4+
RUN apt-get update && apt-get install -y \
5+
zip unzip git curl libpq-dev libonig-dev \
6+
&& docker-php-ext-install mbstring
7+
8+
# Install Composer
9+
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
10+
11+
# Set working directory
12+
WORKDIR /var/www/html
13+
14+
EXPOSE 80

README.md

Lines changed: 44 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# Minecraft Status
22
![](https://img.shields.io/packagist/l/dev-lancer/minecraft-status?style=for-the-badge)
3+
![](https://img.shields.io/packagist/dt/dev-lancer/minecraft-status?style=for-the-badge)
34
![](https://img.shields.io/github/v/release/DeveloperLancer/MinecraftStatus?style=for-the-badge)
45
![](https://img.shields.io/packagist/php-v/dev-lancer/minecraft-status?style=for-the-badge)
56

@@ -11,26 +12,29 @@ This library can be installed by issuing the following command:
1112
composer require dev-lancer/minecraft-status
1213
```
1314

14-
## Differences between Ping and Query
15+
## Differences between MinecraftJavaStatus and MinecraftJavaQuery
1516

16-
### Ping
17-
Ping uses the TCP protocol to communicate with the Minecraft server in the java edition and bedrock edition, it uses the port on which the server is running.
17+
### MinecraftJavaStatus
18+
MinecraftJavaStatus uses the TCP protocol to communicate with the Minecraft server in the java edition and bedrock edition, it uses the port on which the server is running.
1819
Ping provides the most necessary information (hostname, motd, favicon, and a sample of players).
1920
Thanks to its simplicity, it does not require any configuration on the server side, communication works with servers from version 1.7 and above.
2021

21-
To communicate with a server which has a version lower than 1.7, use the `PingPreOld17` class
22+
To communicate with a server which has a version lower than 1.7, use the `MinecraftJavaPreOld17Status` class
2223

23-
### Query
24-
Query uses GameSpy 4 protocol for communication,
24+
For bedrock edition servers use class `MinecraftBedrockStatus`
25+
26+
27+
### MinecraftJavaQuery
28+
MinecraftJavaQuery uses GameSpy 4 protocol for communication,
2529
so you should start listening in the server properties.
2630
Query allows you to request more information about the server,
2731
but has more security vulnerabilities.
2832

2933
## Usage
3034

31-
### Query
35+
### Minecraft Java Edition server with Query
3236

33-
Example: [Query](examples/query.php)
37+
Example: [MinecraftJavaQuery](examples/query.php)
3438

3539
This method uses GameSpy4 protocol, and requires enabling `query` listener in your `server.properties` like this:
3640

@@ -39,7 +43,7 @@ This method uses GameSpy4 protocol, and requires enabling `query` listener in yo
3943
4044
```php
4145
<?php
42-
use \DevLancer\MinecraftStatus\Query;
46+
use \DevLancer\MinecraftStatus\MinecraftJavaQuery;
4347

4448
require_once ("vendor/autoload.php");
4549

@@ -48,14 +52,14 @@ $port = 25565; //from query.port
4852
$timeout = 3;
4953
$resolveSVR = true;
5054

51-
$query = new Query($host, $port, $timeout, $resolveSVR);
55+
$query = new MinecraftJavaQuery($host, $port, $timeout, $resolveSVR);
5256
$query->connect();
5357
print_r($query->getInfo());
5458
```
5559

56-
### QueryBedrock
60+
### Minecraft Bedrock Edition server status
5761

58-
Example: [Bedrock](examples/bedrock.php)
62+
Example: [MinecraftBedrockStatus](examples/bedrock.php)
5963

6064
Use this class for bedrock edition servers
6165

@@ -64,7 +68,7 @@ the port on which the server runs is used to communicate with the server
6468

6569
```php
6670
<?php
67-
use \DevLancer\MinecraftStatus\QueryBedrock;
71+
use \DevLancer\MinecraftStatus\MinecraftBedrockStatus;
6872

6973
require_once ("vendor/autoload.php");
7074

@@ -73,19 +77,19 @@ $port = 19132;
7377
$timeout = 3;
7478
$resolveSVR = true;
7579

76-
$query = new QueryBedrock($host, $port, $timeout, $resolveSVR);
80+
$query = new MinecraftBedrockStatus($host, $port, $timeout, $resolveSVR);
7781
$query->connect();
7882
print_r($query->getInfo());
7983
```
8084

81-
### Ping and PingPreOld17
85+
### Minecraft Java Edition server status
8286

83-
Example: [Ping](examples/ping.php)
87+
Example: [MinecraftJavaStatus](examples/ping.php)
8488

8589
```php
8690
<?php
87-
use \DevLancer\MinecraftStatus\Ping;
88-
use \DevLancer\MinecraftStatus\PingPreOld17;
91+
use \DevLancer\MinecraftStatus\MinecraftJavaStatus;
92+
use \DevLancer\MinecraftStatus\MinecraftJavaPreOld17Status;
8993

9094
require_once ("vendor/autoload.php");
9195

@@ -94,8 +98,8 @@ $port = 25565;
9498
$timeout = 3;
9599
$resolveSVR = true;
96100

97-
$ping = new Ping($host, $port, $timeout, $resolveSVR);
98-
//$ping = new PingPreOld17($host, $port, $timeout, $resolveSVR); //use when version is older than Minecraft 1.7
101+
$ping = new MinecraftJavaStatus($host, $port, $timeout, $resolveSVR);
102+
//$ping = new MinecraftJavaPreOld17Status($host, $port, $timeout, $resolveSVR); //use when version is older than Minecraft 1.7
99103
$ping->connect();
100104
print_r($ping->getInfo());
101105
```
@@ -105,26 +109,26 @@ If you want to get `ping` info from a server that uses a version older than Mine
105109
## Methods
106110

107111
### List of methods
108-
| | Query | QueryBedrock | Ping | PingPreOld17 |
109-
|-------------------|-------|--------------|------|--------------|
110-
| connect() | X | X | X | X |
111-
| isConnected() | X | X | X | X |
112-
| disconnect() | X | X | X | X |
113-
| getPlayers() | X | | X | |
114-
| getCountPlayers() | X | X | X | X |
115-
| getMaxPlayers() | X | X | X | X |
116-
| getInfo() | X | X | X | X |
117-
| getFavicon() | | | X | |
118-
| getDelay() | | | X | |
119-
| setTimeout() | X | X | X | X |
120-
| getTimeout() | X | X | X | X |
121-
| setEncoding() | X | X | X | X |
122-
| getEncoding() | X | X | X | X |
123-
| isResolveSRV() | X | X | X | X |
124-
| getHost() | X | X | X | X |
125-
| getPort() | X | X | X | X |
126-
| getMotd() | X | X | X | X |
127-
| getProtocol() | | X | X | X |
112+
| | MinecraftJavaQuery | MinecraftBedrockStatus | MinecraftJavaStatus | MinecraftJavaPreOld17Status |
113+
|-------------------|--------------------|------------------------|---------------------|-----------------------------|
114+
| connect() | X | X | X | X |
115+
| isConnected() | X | X | X | X |
116+
| disconnect() | X | X | X | X |
117+
| getPlayers() | X | | X | |
118+
| getCountPlayers() | X | X | X | X |
119+
| getMaxPlayers() | X | X | X | X |
120+
| getInfo() | X | X | X | X |
121+
| getFavicon() | | | X | |
122+
| getDelay() | | | X | |
123+
| setTimeout() | X | X | X | X |
124+
| getTimeout() | X | X | X | X |
125+
| setEncoding() | X | X | X | X |
126+
| getEncoding() | X | X | X | X |
127+
| isResolveSRV() | X | X | X | X |
128+
| getHost() | X | X | X | X |
129+
| getPort() | X | X | X | X |
130+
| getMotd() | X | X | X | X |
131+
| getProtocol() | | X | X | X |
128132

129133
### Use before connecting
130134

composer.json

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,13 @@
2020
"autoload": {
2121
"psr-4": {
2222
"DevLancer\\MinecraftStatus\\": "src/"
23-
}
23+
},
24+
"classmap": [
25+
"src/MinecraftBedrockStatus.php",
26+
"src/MinecraftJavaPreOld17Status.php",
27+
"src/MinecraftJavaQuery.php",
28+
"src/MinecraftJavaStatus.php"
29+
]
2430
},
2531
"require-dev": {
2632
"phpstan/phpstan": "^1.10",

0 commit comments

Comments
 (0)