All Projects → Muqsit → FakePlayer

Muqsit / FakePlayer

Licence: other
Specter but targeting PocketMine-MP API 4.0.0

Programming Languages

PHP
23972 projects - #3 most used programming language

Projects that are alternatives of or similar to FakePlayer

InvSee
A PocketMine-MP plugin that lets you view and modify offline and online players' inventories in real-time!
Stars: ✭ 19 (-58.7%)
Mutual labels:  pocketmine-mp, pmmp
Vector-Network-Project
Minecraft Bedrock Edition server plugin
Stars: ✭ 28 (-39.13%)
Mutual labels:  pocketmine-mp, pmmp
NPC
The NPC plugin for PocketMine-MP
Stars: ✭ 28 (-39.13%)
Mutual labels:  pocketmine-mp, pmmp
Emotes
This plugin allows players to use their favorite emotes on the server!
Stars: ✭ 15 (-67.39%)
Mutual labels:  pocketmine-mp, pmmp
Pocketmine Mp
A server software for Minecraft: Bedrock Edition in PHP
Stars: ✭ 2,594 (+5539.13%)
Mutual labels:  pocketmine-mp, pmmp
MysteryBox
Crate implemention for PocketMine-MP (PMMP)
Stars: ✭ 19 (-58.7%)
Mutual labels:  pocketmine-mp, pmmp
IslandArchitect
An plugin to create custom sky island generators for the SkyBlock plugin
Stars: ✭ 12 (-73.91%)
Mutual labels:  pocketmine-mp, pmmp
Pathfinding
A pmmp virion (library) for pathfinding using A*
Stars: ✭ 36 (-21.74%)
Mutual labels:  pocketmine-mp, pmmp
AuctionHouse
Feature-packed auction house plugin for PocketMine-MP (pmmp)
Stars: ✭ 31 (-32.61%)
Mutual labels:  pocketmine-mp, pmmp
SkyBlockUI
Manage your skyblock island in UI!
Stars: ✭ 20 (-56.52%)
Mutual labels:  pocketmine-mp, pmmp
VirionTools
A handy plugin for developers who wish to compile and inject virions without using Poggit.
Stars: ✭ 17 (-63.04%)
Mutual labels:  pocketmine-mp, pmmp
SAC
An AntiCheat software for PockeMine-MP made to detect unfair gamplay advantages.
Stars: ✭ 52 (+13.04%)
Mutual labels:  pocketmine-mp, pmmp
RapidPM
High performance extension that implements parts of PocketMine-MP (PMMP) with Zephir
Stars: ✭ 31 (-32.61%)
Mutual labels:  pocketmine-mp, pmmp
CommandShop
Players have to pay items or money to use specific commands! A PocketMine plugin.
Stars: ✭ 32 (-30.43%)
Mutual labels:  pocketmine-mp, pmmp
EasyEdit
A feature-rich World Editor for PocketMine-MP
Stars: ✭ 26 (-43.48%)
Mutual labels:  pocketmine-mp, pmmp
Pocketmine-School
A Website To Teach Everything About PocketMine-MP
Stars: ✭ 15 (-67.39%)
Mutual labels:  pocketmine-mp, pmmp
CosmeticMenu
Fun and Easy-to-Use Pocketmine Cosmetics plugin. (Gadgets, Particles, Trails, etc)
Stars: ✭ 22 (-52.17%)
Mutual labels:  pocketmine-mp, pmmp
CustomItemLoader
This is a plugin that brings the custom item to your server for PocketMine-MP!
Stars: ✭ 87 (+89.13%)
Mutual labels:  pocketmine-mp, pmmp
MysteryCrate
PLUGIN ARCHIVED. USE https://github.com/DaPigGuy/PiggyCrates instead!
Stars: ✭ 30 (-34.78%)
Mutual labels:  pocketmine-mp, pmmp
Leveryl
An Advanced & Feature Rich Server Software for MC:PE 1.1.x
Stars: ✭ 45 (-2.17%)
Mutual labels:  pocketmine-mp, pmmp

FakePlayer

What does this plugin do?

Similar to Specter, this plugin spawns players to debug stuff on your server. However, this plugin strictly supports API version 4.0.0.

Usage

Who the heck is BoxierChimera37?
My alt xbox live account.

When you first run this plugin, BoxierChimera37 will join the server. You can edit the players.json file to add as many players as you wish. Does this fake your server player count? Yes, but that's not the point of this plugin.
players.json structure:

{
	"uuid-v4-string": {
		"xuid": "required",
		"gamertag": "required",
		"extra_data": {} // this field is OPTIONAL
		"behaviours": [] // this field is OPTIONAL
	}
}

Once a fake player joins, you can chat or run commands on their behalf using:
/fp <player> chat hello wurld!
/fp <player> chat /help 4

API Documentation

Adding a fake player

Loader::addPlayer(FakePlayerInfo $info) : Promise;

Fake players can be spawned in during runtime using Loader::addPlayer(). FakePlayerInfo consists of player identity and miscellaneous data and can be built easily using FakePlayerInfoBuilder.

/** @var Loader $plugin */
$plugin = Server::getInstance()->getPluginManager()->getPlugin("FakePlayer");
$plugin->addPlayer(FakePlayerInfoBuilder::create()
	->setUsername("BlahCoast30765")
	->setXuid("2535431208141398")
	->setUuid("815e76d4-6248-3c27-9dc5-e49230a5dec4")
	->setSkin(/* some skin */) // optional ;), defaults to a white skin
	// ...
->build());

// To obtain a Player instance after adding a player
$plugin->addPlayer(...)->onCompletion(
	function(Player $player) : void{
		echo "Added player ", $player->getName(), " successfully";
	},
	function() : void{
		// adding player failed
	}
);

Test for fake player

/**
 * @param Player $player
 */
Loader::isFakePlayer(Player $player) : bool;

Removing a fake player

/**
 * NOTE: $player MUST be a fake player, or else an InvalidArgumentException will
 * be thrown.
 * @param Player $player
 */
Loader::removePlayer(Player $player) : void;

Listeners

Registering/Unregistering a fake player listener

Loader::registerListener(FakePlayerListener $listener) : void;
Loader::unregisterListener(FakePlayerListener $listener) : void;

Example:

Loader::registerListener(new ClosureFakePlayerListener(
	function(Player $player) : void{
		Server::getInstance()->broadcastMessage("Fake player joined: " . $player->getName());
	},
	function(Player $player) : void{
		Server::getInstance()->broadcastMessage("Fake player is kil: " . $player->getName());
	}
));

Listening to packets sent

Each fake player holds a FakePlayerNetworkSession that you can register packet listeners to.

/** @var Player $fake_player */
/** @var FakePlayerNetworkSession $session */
$session = $fake_player->getNetworkSession();

There are two kinds of packet listeners you can register:

  1. A catch-all packet listener that is notified for every packet sent.
  2. A specific packet listener
Registering a catch-all packet listener
$session->registerPacketListener(new ClosureFakePlayerPacketListener(
	function(ClientboundPacket $packet, NetworkSession $session) : void{
		// do something
	}
));
Registering a specific packet listener
$session->registerSpecificPacketListener(TextPacket::class, new ClosureFakePlayerPacketListener(
	function(ClientboundPacket $packet, NetworkSession $session) : void{
		/** @var TextPacket $packet */
		Server::getInstance()->broadcastMessage($session->getPlayer()->getName() . " was sent text: " . $packet->message);
	}
));

Fake Player Behaviours

Behaviours are basically a way you can do anything you like on a fake player every tick. By default, there's a fakeplayer:pvp behaviour which makes the fake player fight all living entities except non-survival mode players. You can add multiple behaviours to a fake player. Make sure to register your custom behaviours during PluginBase::onEnable().
To register a fake player behaviour:

FakePlayerBehaviourManager::register("myplugin:cool_ai", MyCoolAIThatImplementsFakePlayerBehaviour::class);

To add a behaviour to a player, pass it during Loader::addPlayer() OR specify it in the players.json file.

Frequently Asked Questions

Q. Does this work with encryption enabled?
A. Yes

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].