├── .poggit.yml ├── README.md ├── plugin.yml ├── resources └── accept.yml └── src └── MultiProtocol └── Main.php /.poggit.yml: -------------------------------------------------------------------------------- 1 | --- # Poggit-CI Manifest. Open the CI at https://poggit.pmmp.io/ci/BajanVlogs/MultiProtocol 2 | branches: 3 | - master 4 | projects: 5 | MultiProtocol: 6 | path: "" 7 | ... 8 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # MultiProtocol Plugin 2 | 3 | A PocketMine-MP plugin for supporting multiple versions of Minecraft Bedrock Edition. 4 | 5 | ## Description 6 | 7 | This PocketMine-MP plugin allows servers to support multiple versions of Minecraft Bedrock Edition by filtering out login attempts from unsupported client versions. 8 | 9 | ## Usage 10 | 11 | 1. Place the `MultiProtocol` folder inside the `plugins` folder of your PocketMine-MP server. 12 | 2. Start or restart your PocketMine-MP server. 13 | 3. The plugin will automatically filter out login attempts from unsupported client versions according to the specified accepted versions in the `accept.yml` file. 14 | 15 | ## Configuration 16 | 17 | The `accept.yml` file located in the `plugins/MultiProtocol` folder contains the list of accepted Minecraft Bedrock Edition versions. 18 | 19 | Example `accept.yml` content: 20 | ```yaml 21 | accept-versions: 22 | - "1.19.0" 23 | - "1.20.0" 24 | 25 | -------------------------------------------------------------------------------- /plugin.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: MultiProtocol 3 | main: MultiProtocol\Main 4 | api: [5.0.0] 5 | version: 0.0.1 6 | author: BajanVlogs 7 | commands: [] 8 | permissions: [] 9 | ... 10 | -------------------------------------------------------------------------------- /resources/accept.yml: -------------------------------------------------------------------------------- 1 | # accept.yml 2 | 3 | # List of accepted Bedrock versions 4 | accept-versions: 5 | - "1.19.0" 6 | - "1.20.0" 7 | # Add more versions as needed... 8 | -------------------------------------------------------------------------------- /src/MultiProtocol/Main.php: -------------------------------------------------------------------------------- 1 | getServer()->getPluginManager()->registerEvents($this, $this); 20 | $this->getLogger()->info("MultiProtocol Plugin Enabled!"); 21 | 22 | @mkdir($this->getDataFolder()); 23 | $config = new Config($this->getDataFolder() . "accept.yml", Config::YAML); 24 | $this->acceptVersions = $config->get("accept-versions", []); 25 | if (empty($this->acceptVersions)) { 26 | $this->acceptVersions = [ // Earliest supported Bedrock version is 1.19 27 | "1.19.0", 28 | "1.20.0", // Add more versions as needed 29 | ]; 30 | $config->set("accept-versions", $this->acceptVersions); 31 | $config->save(); 32 | } 33 | } 34 | 35 | public function onDataPacketReceive(DataPacketReceiveEvent $event): void { 36 | $packet = $event->getPacket(); 37 | if ($packet instanceof \pocketmine\network\mcpe\protocol\LoginPacket) { 38 | if (!isset($packet->clientData["GameVersion"])) { 39 | return; // Invalid packet, ignore it 40 | } 41 | 42 | $clientVersion = $packet->clientData["GameVersion"]; 43 | if (!in_array($clientVersion, $this->acceptVersions)) { 44 | // Cancel the login attempt for unsupported versions 45 | $event->cancel(); 46 | 47 | // Optionally, you can kick the player or send a message explaining why they can't join. 48 | $player = $event->getOrigin()->getPlayer(); 49 | if (!$player == null) { 50 | $player->kick("Your version of Minecraft Bedrock is not supported by this server."); 51 | } 52 | } 53 | } 54 | } 55 | } 56 | --------------------------------------------------------------------------------