Skip to content

Instantly share code, notes, and snippets.

View Muqsit's full-sized avatar
👑
A beacon of hope.

Muqsit Muqsit

👑
A beacon of hope.
View GitHub Profile
@Muqsit
Muqsit / loadEveryClassToCheckForErrorsBecauseICannotAffordGoodIDEs
Created July 16, 2017 07:58
loadEveryClassToCheckForErrorsBecauseICannotAffordGoodIDEs
private function loadEveryClassToCheckForErrorsBecauseICannotAffordGoodIDEs($directory = "/root/pmmp/plugins/CosmicCore-master/src/CosmicCore")
{
if(is_dir($directory)) {
$scan = scandir($directory);
unset($scan[0], $scan[1]); //unset . and ..
foreach($scan as $file) {
if(is_dir($directory."/".$file)) {
$this->loadEveryClassToCheckForErrorsBecauseICannotAffordGoodIDEs($directory."/".$file);
} else {
if(strpos($file, '.php') !== false) {
<?php
/**
* This code is licensed under WTFPL
* (Do What The Fuck You Want To Public License)
* http://www.wtfpl.net/
*
* WARNING: PLEASE READ the 'Caution' section at
* http://php.net/manual/en/function.eval.php before
* using or modifying this code.
@Muqsit
Muqsit / epf.php
Last active August 3, 2017 20:07
Enchantment Protection Factor
<?php
//source: https://minecraft.gamepedia.com/Armor#Enchantments
//$damage = EntityDamageEvent::getFinalDamage();
const TYPE_HELMET = 0;
const TYPE_CHESTPLATE = 1;
const TYPE_LEGGINGS = 2;
const TYPE_BOOTS = 3;
@Muqsit
Muqsit / var_dump.php
Last active August 10, 2017 07:52
PocketMine ArmorStand InventoryTransactionEvent dump
<?php//done this just for syntax highlight
//ADDING HELMET
object(pocketmine\network\mcpe\protocol\InventoryTransactionPacket)#36861 (7) {
["actions"]=>
array(1) {
[0]=>
object(stdClass)#36953 (4) {
["inventorySource"]=>
object(stdClass)#36848 (3) {
@Muqsit
Muqsit / redistests.php
Last active December 20, 2017 15:23
Redis PHP get,set
<?php
//This is the redis database being selected
//Databases in redis are integers (0-15) unlike
//mysql where the database can be a string
const REDIS_DATABASE = 0;
$redis = new \Redis();// https://github.com/phpredis/phpredis
$redis->connect("127.0.0.1");
@Muqsit
Muqsit / StringUtils.php
Created January 16, 2018 15:59
minet str center
<?php
/**
* Source from:
* https://github.com/NiclasOlofsson/MiNET/blob/master/src/MiNET/MiNET/Utils/TextUtils.cs
*/
namespace cosmiccore\miscs;
use pocketmine\utils\TextFormat as TF;
class StringUtils {
<?php
namespace villagertrade;
use pocketmine\entity\Villager;
use pocketmine\inventory\BaseInventory;
use pocketmine\item\Item;
use pocketmine\nbt\NetworkLittleEndianNBTStream;
use pocketmine\nbt\tag\{ByteTag, CompoundTag, IntTag, ListTag};
use pocketmine\network\mcpe\protocol\UpdateTradePacket;
use pocketmine\Player;
<?php
namespace imt;
use muqsit\invmenu\{InvMenu, InvMenuHandler};
use pocketmine\block\Block;
use pocketmine\event\block\BlockPlaceEvent;
use pocketmine\event\Listener;
use pocketmine\item\Item;
use pocketmine\Player;
<?php
class A {
/** @var \SplFixedArray */
public $array;
public function __construct(){
$this->array = new \SplFixedArray(1);
@Muqsit
Muqsit / DoubleChestDebug.php
Created June 23, 2018 18:00
Sends viewer count of a double chest and it's pairs.
<?php
/**
* @name DoubleChestDebug
* @main muqsit\dcdcd\Main
* @version 1.0
* @api 3.0.0
*/
namespace muqsit\dcdcd {
use pocketmine\plugin\PluginBase;