Skip to content

- The virion makes it possible for your server to call out your parameters through a form for notifications or words displayed on the player's interface.

License

Notifications You must be signed in to change notification settings

VennDev/VPlaceHolder

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

49 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

VPlaceHolder

  • The virion makes it possible for your server to call out your parameters through a form for notifications or words displayed on the player's interface.

Links

  • Shop Modules PlaceHolder: Link

Virion Required

Features

  • ✔ Support Title, Messages, ... all related to the chat displayed to the player.
  • ✔ Support Scoreboard, Bossbar, Form
  • ✔ Support Name Item or Lore Item in inventory player or all type inventories.
  • ✔ Support asynchronous tasks coming from LibVapmPMMP via Async and Promise methods

Notes

  • The modules_placeholder directory will be created when there is a certain plugin in your server that init virion.
  • That directory will help you design the available holders from the developers, and if you're interested, create a module and send it to me for review! :D

API

  • You want register one placeholder ?
  • You should init virion before plugin enable.
VPlaceHolder::init($this);
  • Register with type string|int|float value
VPlaceHolder::registerPlaceHolder('{player}', 'venndev');
$player->sendTip("Hello {player}"); // Output: Hello venndev
  • Register with type callable value
VPlaceHolder::registerPlaceHolder("{player}", function (string $player, int $age) {
    return "Hello $player, your age is $age";
});
$player->sendTip("{player}(VennDev, 1000)"); // Output: Hello VennDev, your age is 1000
VPlaceHolder::registerPlaceHolder("{say_player}", function (string $player, string $message) {
    return $message . $player;
});
$player->sendTip("{say_player}(VennDev, 'Hello, you')"); // Output: Hello, you VennDev
  • Register Async PlaceHolder
VPlaceHolder::registerPlaceHolder("{get_money_all_players}", function (): \vennv\vapm\Async {
    return new \vennv\vapm\Async(function (): string {
        $players = Server::getInstance()->getOnlinePlayers();
        $moneyLists = \vennv\vapm\Async::await(Money::getInstance()->getMoneyAll($players));
        return implode(", ", $moneyList);
    });
}, isPromise: true);
$player->sendTip("{get_money_all_players}(A)"); // Output: <list money all players>

One example more here: Link

  • Use your closure with VPlaceHolder, use to call libraries from VPlaceHolder to retrieve the results and process the results without skipping the fumble from checking the relevant data to be retrieved.
VPlaceHolder::registerPlaceHolder("//player", "VennDev");
VPlaceHolder::closureOnePlaceHolder("//player", function (string $player) {
    var_dump($player); // string(8) "VennDev"
});

Suppose you want to call a PlaceHolder that automatically assigns a player?

  • Parameter A represents the input that is the player you want to announce.
$player->sendTip("{x}(A)"); // Output: player's position x.
  • Note that this A parameter only works when you have made a prior notification of player designation such as events or methods with player presence.
  • Of course it can't be applied in the VPlaceHolder::closureOnePlaceHolder(...)

Credits

About

- The virion makes it possible for your server to call out your parameters through a form for notifications or words displayed on the player's interface.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages