Skip to content

Instantly share code, notes, and snippets.

View PJZ9n's full-sized avatar
🏠
Working from home

PJZ9n PJZ9n

🏠
Working from home
View GitHub Profile
@PJZ9n
PJZ9n / form.php
Last active April 22, 2020 23:30
PocketMineでFormを扱うサンプル。動作未確認。
<?php
declare(strict_types=1);
class selectForm implements \pocketmine\form\Form
{
public function handleResponse(\pocketmine\Player $player, $data): void
{
if ($data === null) {
@PJZ9n
PJZ9n / form.php
Created April 22, 2020 23:34
jojoe77777\FormAPIを扱うサンプル。動作未確認。
<?php
declare(strict_types=1);
$form = new \jojoe77777\FormAPI\SimpleForm(function (\pocketmine\Player $player, $data): void {
if ($data === null) {
//閉じられた
return;
}
switch ($data) {
@PJZ9n
PJZ9n / filter.php
Created April 26, 2020 12:14
PHPのfilter_varをPMMPのコマンドで使う例
<?php
declare(strict_types=1);
$label = "pay";//送金コマンド
$args = [
"hoge",//名前
"-1"//金額
];
@PJZ9n
PJZ9n / command.php
Last active April 26, 2020 15:36
PMMPでPluginCommandを使うときの例
<?php
declare(strict_types=1);
namespace sample;
use pocketmine\command\Command;
use pocketmine\command\CommandExecutor;
use pocketmine\command\CommandSender;
use pocketmine\command\PluginCommand;
@PJZ9n
PJZ9n / config.php
Created April 26, 2020 15:55
PluginBaseでConfigを使用する
<?php
declare(strict_types=1);
namespace sample;
use pocketmine\plugin\PluginBase;
class Main extends PluginBase
{
@PJZ9n
PJZ9n / generator.php
Created April 26, 2020 16:00
1チャンクしか生成させないやつ
<?php
declare(strict_types=1);
namespace sample;
use pocketmine\level\generator\GeneratorManager;
use pocketmine\level\generator\normal\Normal;
use pocketmine\plugin\PluginBase;
@PJZ9n
PJZ9n / AsyncTask_Example.php
Created May 2, 2020 23:52
PocketMineでAsyncTaskを使う例(動作未確認)
<?php
declare(strict_types=1);
//パターン1: 非同期で処理だけする
class Task1 extends \pocketmine\scheduler\AsyncTask
{
/** @var string POST先URL */
private const URL = "https://example.com/api";
@PJZ9n
PJZ9n / ParticleTest.php
Created May 3, 2020 03:20
パーティクルを試すプラグイン。コマンド/pt
<?php
declare(strict_types=1);
/**
* @name ParticleTest
* @version 1.0.0
* @main PJZ9n\ParticleTest\Main
* @api 3.11.0
*/
@PJZ9n
PJZ9n / item.php
Last active May 3, 2020 08:32
アイテム
<?php
declare(strict_types=1);
/** @var \pocketmine\plugin\Plugin $this */
$config = new \pocketmine\utils\Config($this->getDataFolder() . "config.yml", \pocketmine\utils\Config::YAML, [
"cooldowntick" => 10,
]);
<?php
/**
* @name Particle
* @version 1.0.0
* @main PJZ9n\Particle\Main
* @api 3.0.0
*/
declare(strict_types=1);