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
<?php
/**
* @name ClosureTaskTest
* @version 1.0.0
* @main PJZ9n\ClosureTaskTest\ClosureTaskTest
* @api 3.12.0
*/
declare(strict_types=1);
@PJZ9n
PJZ9n / array.php
Created June 13, 2020 19:45
formの間違い例
<?php
//動かない例
[
"content" => [
"type" => "input",
"text" => "入力してください",
],
];
//動く例
[
@PJZ9n
PJZ9n / getThePlayerName.php
Last active June 13, 2020 06:55
オンラインプレイヤーの名前を取得する
<?php
declare(strict_types=1);
use pocketmine\Server;
use pocketmine\Player;
//オンラインのプレイヤーを全員取得
//[object Player, object Player, object Player]
$onlinePlayers = Server::getInstance()->getOnlinePlayers();
@PJZ9n
PJZ9n / serversettings-test.php
Created June 13, 2020 06:23
Test for ServerSettings.
<?php
/**
* @name SSTest
* @version 1.0.0
* @main PJZ9n\SSTest\SSTest
* @api 3.12.0
*/
declare(strict_types=1);
@PJZ9n
PJZ9n / serversettings.php
Last active June 12, 2020 13:07
ServerSettings
<?php
public function onDataPacketReceive(DataPacketReceiveEvent $event): void
{
$receivePacket = $event->getPacket();
if ($receivePacket instanceof ServerSettingsRequestPacket) {
$responsePacket = new ServerSettingsResponsePacket();
$responsePacket->formId = 12345;//Form ID
//適当なCustomFormデータ
$responsePacket->formData = json_encode([
"type" => "custom_form",
@PJZ9n
PJZ9n / form.php
Created June 12, 2020 12:49
Formを使った脆弱なコード
<?php
//脆弱なコード(一部省略)
$data = [
"buttons" => [
[
"text" => "クリエイティブになる",
],
[
"text" => "サバイバルになる",
<?php
public function onDataPacketReceive(DataPacketReceiveEvent $event)
{
$packet = $event->getPacket();
if ($packet instanceof PlayerActionPacket) {
$name = $event->getPlayer()->getName();
switch ($packet->action) {
case PlayerActionPacket::ACTION_START_BREAK://破壊開始
$this->isBreaking[$name] = true;
break;
@PJZ9n
PJZ9n / followback.php
Created June 10, 2020 22:51
自動フォローバックのソースコード。最悪な実装です。
<?php
/**
* Copyright (c) 2020 PJZ9n.
*
* This file is part of Tuihai.
*
* Tuihai is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
@PJZ9n
PJZ9n / tuihaibot.php
Created June 10, 2020 22:46
ツイ廃botのソースコード、とりあえず動くレベルの最悪な実装です。少しでも弄ると壊れます。
<?php
/**
* Copyright (c) 2020 PJZ9n.
*
* This file is part of Tuihai.
*
* Tuihai is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
@PJZ9n
PJZ9n / twitter.php
Created June 8, 2020 19:37
個人用、本番環境用ではない、テスト用。
<?php
/**
* Copyright (c) 2020 PJZ9n.
*
* This file is part of Hello-TwitterAPI.
*
* Hello-TwitterAPI is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or