✨A simple way to create a GUI on servers based on PocketMine-MP 4.0!✨

Overview

FakeInventories

A simple way to create a GUI on servers based on PocketMine-MP 4.0! (https://youtu.be/D1NIx8E2UPg)

Features

  • Fast opening without any delay
  • Opening a FakeInventory behind the player so the player cannot see it
  • Simple un-clicking item
  • Example patterns
  • Simple API
  • Tested on several servers

Installation

  1. Download plugin by clicking here
  2. Put the plugin into your plugins folder

Usage

Construct FakeInventory

public function __construct() {
    // "Test1" it's a title
    // FakeInventorySize::LARGE_CHEST is a size of FakeInventory (for small chest just type FakeInventorySize::SMALL_CHEST)
    // The "true" at the end is whether the FakeInventory should appear behind the player
    
    parent::__construct("Test1", FakeInventorySize::LARGE_CHEST, true);
}

Setting items (you need to add this function)

public function setItems() : void {
    //$this->setItem(slot, item);
    $this->setItem(0, VanillaItems::DIAMOND());
}

At the end actions which are to be performed after clicking on an item

// $player - Player which cliekd on item
// $sourceItem - It's the item that was clicked
// $targetItem - It's the item that was clicked (almost useless)
// $slot - It's a slot which was clicked by player
public function onTransaction(Player $player, Item $sourceItem, Item $targetItem, int $slot) : bool {
    // returned value means whether transaction is cancelled or not
    // example if return value is true then transaction is cancelled otherwise not
    return true;
}

Changing inventory

$this->changeInventory($player, (new YourFakeInventory($player)));

Closing inventory

$this->closeFor($player);

Opening inventory

//if you want to open an inventory from a command level or another class, use
(new YourFakeInventory($player))->openFor([$player]);

//otherwise use this
$this->openFor([$player]);

Un-clicking item

$this->unClickItem($player);

That's all, your code should looks like this

<?php

declare(strict_types=1);

namespace your\namespace;

use fakeinventory\inventories\FakeInventory;
use pocketmine\item\Item;
use pocketmine\item\ItemIds;
use pocketmine\item\VanillaItems;
use pocketmine\player\Player;

class ExampleInventory extends FakeInventory {

    public function __construct() {
        parent::__construct("Second inventory");
    }

    public function setItems() : void {
        $this->setItem(0, VanillaItems::GOLD_INGOT());
    }

    public function onTransaction(Player $player, Item $sourceItem, Item $targetItem, int $slot) : bool {
        if($sourceItem->getId() === ItemIds::GOLD_INGOT) {
            $this->changeInventory($player, new YourInventory());
        }

        return true;
    }
}
You might also like...
Plugin pocketmine 4.0.0 for create simple rank 🎈
Plugin pocketmine 4.0.0 for create simple rank 🎈

RankEasy Simple plugin to create ranks 🎈 Config: # YAML #https://www.digminecraft.com/lists/color_list_pc.php for all color in minecraft default: "

Elevator - A simple PocketMine-MP plugin that allows to create elevators on your server
Elevator - A simple PocketMine-MP plugin that allows to create elevators on your server

Elevator - A simple PocketMine-MP plugin that allows to create elevators on your server. How to use You just have to setup an id in the config.yml. Plac

MOP is a php query handling and manipulation library providing easy and reliable way to manipulate query and get result in a fastest way
MOP is a php query handling and manipulation library providing easy and reliable way to manipulate query and get result in a fastest way

Mysql Optimizer mysql optimizer also known as MOP is a php query handling and manipulation library providing easy and reliable way to manipulate query

 Execute Artisan commands on remote servers
Execute Artisan commands on remote servers

Execute Artisan commands on remote servers This package provides a command to execute Artisan command on a remote server. Here's an example that will

Block ads for other servers.

[] NoAdvertisings| v0.0.1 Block ads for other servers. Features Block server ads. Easy to setup. Block server address ads when chatting, using command

A small library to help run PHP servers easily and quickly.

PHP Server A small library to help run PHP servers easily and quickly. Installation composer require ahmard/php-server Usage PHP Built-In Server An i

Custom NPC for pocket-mine servers
Custom NPC for pocket-mine servers

[Description] Click on above picture to see tutorial video of the plugin. This is an NPC plugin with super easy customization for pocket-mine. Note: W

A tool for managing SSH key access to any number of servers.

Revons - SSH Key Authority Features Easily manage SSH key access for all accounts on your servers. Manage user access and server-to-server access rule

Cool economy plugin for PM-like servers. API included.

Economy Description Cool and easy to use economy plugin API: 2.0.0 Plugin version: 1.0.0 Default money value on first join: 1000 (can be changed in co

Owner
iDarkQ
iDarkQ
Dnsmasq GUI is a simple Web GUI for editing the /etc/hosts file on a computer

dnsmasq GUI is a simple Web GUI for editing the /etc/hosts file on a computer, with the intention of using it for easily setting up results for dnsmasq use.

Alex Cheer 4 Nov 27, 2022
Creates a WorldBorder for PocketMine-MP servers!

This plugin is not yet ready for Poggit or download It is going through mass changes over the next few days Message my Discord to recieve an older eli

Soulz 9 Sep 5, 2021
A Customizable Fishing Rod for PocketMine-MP servers.

Custom Fishing Rod About [ENG] This is a PocketMine-MP (or forks) plugin that implements a customizable fishing rod to your server. [FRA] C'est un plu

null 6 May 25, 2022
Allows the connection of Minecraft: JE clients to PocketMine servers. Made for PM4

JavaPlayer Allows the connection of Minecraft: JE clients to PocketMine servers. Made for PM4 MCJE VER: 1.18.2 Need implemented Chunks (convert proble

kanison konkla 30 Dec 7, 2022
The best announcer for PocketMine-MP 4.0 servers, make messages for your users very easily

BroadcastACM The best announcer for PocketMine-MP 4.0 servers, make messages for your users very easily. Make the best announcements for your server w

fernanACM 3 May 30, 2022
API server and modernized control panel for PocketMine servers.

WebConsole API server and modernized control panel for PocketMine servers. The WebConsole plugin provides an HTTP API server that can be extended with

Jonathan Chan Kwan Yin 5 Aug 26, 2022
Configure Magento 2 to send email using Google App, Gmail, Amazon Simple Email Service (SES), Microsoft Office365 and many other SMTP (Simple Mail Transfer Protocol) servers

Magento 2 SMTP Extension - Gmail, G Suite, Amazon SES, Office 365, Mailgun, SendGrid, Mandrill and other SMTP servers. For Magento 2.0.x, 2.1.x, 2.2.x

MagePal :: Magento Extensions 303 Oct 7, 2022
ATVController for android devices running with RDM > POGO > ATLAS. Quick, simple and dirty add controls with a GUI view

ATVController - WIP - Much to add and fix. ATVController for android devices running with RDM > POGO > ATLAS. Quick, simple and dirty adb controls wit

null 7 Nov 21, 2022
This is wegare tools but all-in-one installer only, exclude GUI

All In One Installer for Wegare Tools This is wegare tools, but this is all-in-one. Here is the source https://github.com/wegare123?tab=repositories I

Helmi Amirudin 3 Jul 29, 2022
The GUI bandwidth limiter for iptables-mod-hashlimit

MulImiter OpenWrt bandwidth limiter through iptables firewall with PHP GUI Features Limit download speed per client/IP Limit upload speed per client/I

Teguh Santoso 13 Sep 15, 2022