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 / .htaccess
Created May 10, 2020 10:47
条件付きアクセス拒否
ErrorDocument 404 /error/404.php
ErrorDocument 503 /error/503.php
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_URI} !^/error/.*$
RewriteCond %{REQUEST_FILENAME} !\.(css|js|png|ico)$
# 好きなIP指定する
RewriteCond %{REMOTE_ADDR} !^192.168.0.0$
RewriteRule ^.*$ - [R=503,L]
</IfModule>
@PJZ9n
PJZ9n / .htaccess
Created May 10, 2020 10:46
全てのファイルへのアクセスをブロックする
<Files *>
Order deny,allow
Deny from all
#For Apache 2.4
#Require all denied
</Files>
<?php
declare(strict_types=1);
use pocketmine\item\Item;
/** @var \pocketmine\Player $player */
$count = 0;//アイテムの個数
<?php
declare(strict_types=1);
namespace a;
use pocketmine\command\Command;
use pocketmine\command\CommandExecutor;
use pocketmine\command\CommandSender;
<?php
declare(strict_types=1);
namespace author\plugin;
use Generator;
use pocketmine\command\Command;
use pocketmine\command\CommandSender;
use pocketmine\event\Listener;
@PJZ9n
PJZ9n / NukkitPlugin.java
Created May 4, 2020 12:08
Nukkitでプラグイン作成(Java使用)
package pjz9n.exampleplugin;
import cn.nukkit.Player;
import cn.nukkit.command.Command;
import cn.nukkit.command.CommandSender;
import cn.nukkit.event.EventHandler;
import cn.nukkit.event.EventPriority;
import cn.nukkit.event.Listener;
import cn.nukkit.event.player.PlayerChatEvent;
import cn.nukkit.event.player.PlayerJoinEvent;
<?php
/**
* @name Particle
* @version 1.0.0
* @main PJZ9n\Particle\Main
* @api 3.0.0
*/
declare(strict_types=1);
@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,
]);
@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 / 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";