Run PHP scripts on the fly at runtime on a PocketMine-MP server (useful for debugging)

Overview

Scripter

Run PHP scripts on the fly at runtime on a PocketMine-MP server.

This is useful for runtime debugging, when you don't want to restart the server to find out what's going on.

How to use it?

  1. Write a PHP script and put it in plugin_data/Scripter/filename_of_your_script.php
  2. Run the script using /script filename_of_your_script.php

Can I edit scripts while the server is running?

Yes, but don't declare classes, functions, or constants in scripts directly. Anything declared by previous scripts will remain in memory.

Use them for pure code only. If you want to make functions, classes etc., declare them in a separate file and then use require_once in your script.

Why not /eval?

eval is too inconvenient - having to write your entire code into the console (or MC game) is just too inconvenient.

I was inspired by mcfunction, which allows you to put a list of complex commands in a file and run them at runtime.

Can I use this in production?

Please don't! I take no responsibility if you get hacked by using this plugin.

Examples

Get the target block of the player mctestDylan and spawn a RedstoneParticle at that block

<?php

declare(strict_types=1);

use pocketmine\block\VanillaBlocks;
use pocketmine\Server;
use pocketmine\world\particle\RedstoneParticle;

$player = Server::getInstance()->getPlayerExact("mctestDylan");
if($player === null){
	echo "no player\n";
	return;
}

$pos = $player->getTargetBlock(100, [VanillaBlocks::AIR()->getId() => true])?->getPosition();
if($pos === null){
	echo "no position\n";
	return;
}

$player->getWorld()->addParticle($pos, new RedstoneParticle(10));
echo "success!\n";
You might also like...
A plugin that allows you to hear the sound "Welcome to the server!" when you join the server by NhanAZ for PocketMine-MP

General A plugin that allows you to hear the sound "Welcome to the server!" when you join the server by NhanAZ for PocketMine-MP Contacts You can cont

Simple, modern looking server status page with administration and some nice features, that can run even on shared webhosting
Simple, modern looking server status page with administration and some nice features, that can run even on shared webhosting

Simple, modern looking server status page with administration and some nice features, that can run even on shared webhosting

Debug - The Debug component provides tools to ease debugging PHP code.

Debug Component CAUTION: this component is deprecated since Symfony 4.4. Instead, use the ErrorHandler component. The Debug component provides tools t

The ErrorHandler component provides tools to manage errors and ease debugging PHP code

ErrorHandler Component The ErrorHandler component provides tools to manage errors and ease debugging PHP code. Getting Started $ composer require symf

Magento 2 Debug Helper Module for easy debugging with Xdebug and PHPStorm or any other IDE

Magento 2 Debug Helper Information and Usage Magento 2 Debug Helper Module usage with PHPStorm and Xdebug Installation To install the Magento 2 Debug

A collection of command-line utilities to aid in debugging browser engines.

Browser debug utilities This project contains several scripts that make the process of debugging browser engines much easier (some special cases excep

The simplest way to create a dynamic sitemap for your self-coded website which you have made by using PHP/HTML/CSS/Js etc... Scripts.

Sitemap_index.xml The simplest way to create a dynamic sitemap for your self-coded website which you have made by using PHP/HTML/CSS/Js etc... Scripts

A set of PHP scripts which leverage MySQL INFORMATION_SCHEMA to create log tables and insert / update triggers

mysql-logtable-php mysql-logtable-php is a set of PHP scripts which leverage MySQL INFORMATION_SCHEMA to create log tables and insert / update trigger

Owner
Dylan's PocketMine-MP Plugins
Source code repositories for my PocketMine-MP plugins and related code
Dylan's PocketMine-MP Plugins
Runtime Code Generator like Lombok for PocketMine-MP

PlumbokPM Runtime Code Generator like Lombok for PocketMine-MP. Code generation starts when additional autoloader detects class uses PlumbokPM annotat

OctoPush 4 Apr 18, 2022
NoFly is a PocketMine-MP plugin that doesn't allow the player to fly

NoFly is a PocketMine-MP plugin that doesn't allow the player to fly

Azel F. 2 Mar 30, 2022
Run a script in real time inside your pocketmine server!

Geral PlayScript is a plugin that allows you to run PHP code directly from the server by command. How to use Move your PHP code (must have a .php exte

LADINO 3 Aug 9, 2022
Run your WP site on github pages, php innovation award winner https://www.phpclasses.org/package/12091-PHP-Make-a-WordPress-site-run-on-GitHub-pages.html

Gitpress Run wordpress directly on github pages Gitpress won the innovation award for may 2021 Read more about this https://naveen17797.github.io/gitp

naveen 13 Nov 18, 2022
This project processes a small database with php all on a web server. This project uses XAMPP to run the web server and the database.

PHP-introduction This project processes a small database with php all on a web server. This project uses XAMPP to run the web server and the database.

Tyler Jacques 1 Jan 6, 2022
A useful PocketMine-MP plugin that allows you to create crates in-game!

ComplexCrates A useful PocketMine-MP plugin that allows you to create crates in-game! Commands Main command: /crate Sub commands: create

Oğuzhan 8 Aug 26, 2021
PeachPie - the PHP compiler and runtime for .NET and .NET Core

PeachPie Compiler The open-source PHP compiler to .NET If you run into any inconsistencies, bugs or incompatibilities, kindly let us know and we'll do

PeachPie Compiler Platform 2.1k Dec 22, 2022
PHP Runtime Layer for AWS Lambda

PHP Layer For AWS Lambda Ever wanted to run PHP websites in AWS Lambda? It's your lucky day! This Lambda Runtime Layer runs the PHP 7.3/7.1 webserver

Stackery 319 Nov 30, 2022
A tool to create php lambda's in AWS via custom runtime api

Getting Started This composer library assists in the creation, configuration, and testing of an AWS Lambda function. It utilizes the AWS Lambda custom

Mike McGrath 0 Jul 13, 2022
TYPO3 Extension for on-the-fly evaluation hints in FormEngine

OTF - A TYPO3 extension to display on-the-fly evaluation hints in FormEngine This TYPO3 extension allows to add a FormEngine FieldWizard to specific T

b13 GmbH 3 Sep 22, 2022