Skip to content

Instantly share code, notes, and snippets.

The LegionPE Hub Plugin

Copyright (C) 2014 PEMapModder (a.k.a. mcpesrccode and MCPE_modder_for_maps)

You may not distribute or use this software or its modifications without prior permission from PEMapModder or MCPE_modder_for_maps from http://formus.pocketmine.net or http://minecraftforum.net or https://github.com.

===

The main plugin (Hub.php) contains the following features:

@PEMapModder
PEMapModder / PocketMine_all.php
Created April 23, 2014 03:11
All of PocketMine, archieved
This file has been truncated, but you can view the full file.
<?php
$web = 'index.php';
if (in_array('phar', stream_get_wrappers()) && class_exists('Phar', 0)) {
Phar::interceptFileFuncs();
set_include_path('phar://' . __FILE__ . PATH_SEPARATOR . get_include_path());
Phar::webPhar(null, $web);
include 'phar://' . __FILE__ . '/' . Extract_Phar::START;
return;

PEMapmodder's Current Projects (PocketMine Plugins)

  • LegionPE Zekkou Cake new plugin
  • After finishing this, I will start on a public API for all servers free to use (with credit). This API allows plugins to register subclasses of Minigame's as minigames and co-work with each other.
  • xEcon
  • Factions
  • PocketRealisticMulti
@PEMapModder
PEMapModder / LegionPE Hub Core.php
Created June 10, 2014 10:52
A snapshot of LegionPE hub's core code
<?php
class HubPlugin extends PluginBase{
public function onChat(PlayerChatEvent $event){ // if session is not self::HUB, monitor it. if session is self::HUB, prevent typing password here
$p = $event->getPlayer();
if(($s = $this->sessions[$p->getID()]) < self::HUB or $s >= self::LOGIN){ // if not authed
$event->setCancelled(true);
}
elseif($this->getDb($p)->get("pw-hash") === $this->hash($event->getMessage())){ // if authed but is telling password
$event->setCancelled(true);
$p->sendMessage("Never talk loudly to others your password!");
@PEMapModder
PEMapModder / YJRW.php
Last active January 25, 2016 13:10
A YAML/JSON reader/writer
<?php
$console = fopen("php://stdin", "r");
$running = true;
while($running){
$line = trim(fgets($console));
if($line){
// echo "Command issued: \"$line\"".PHP_EOL;
$args = explode(" ", $line);
switch($cmd = strtolower(trim(array_shift($args)))){
@PEMapModder
PEMapModder / LegionPE Delta Outline.md
Last active August 29, 2015 14:02
Know more about LegionPE Delta (LegionPE after 0.9.0)

LegionPE Delta

When will it be released?

The date MCPE 0.9.0 is released on iOS and Android is in July I think. PocketMine-MP Alpha_1.4 (Zekkou Cake) will be released not long (probably one or two days) after the release of 0.9.0. Since 0.9.0 can only be connected with servers hosted with Zekkou Cake, we have to update our plugins to support Zekkou Cake. Our promise is at most one week after the release of Zekkou Cake, but as you know, bugs are never predictable and we may come into bugs that take days to solve.

Currently (14/6/2014), the basic structure of the new API plugin is finished and debugged except chat control, which hopefully will only take 3 to 4 hours to debug. Parkour is fully finished and believed to be stable and hopefully will take no more than 15 minutes to debug. Spleef is finished, but it is based on a proof of concept of spleef arena objects by @PEMapModder, so it may take one or two days to finish debugging, and in worst ccircumstances it may need to be rewrited, which

<?php
require_once(dirname(__FILE__)."/Table.php");
$table = new \legendofmcpe\statscore\Table(dirname(__FILE__)."/table.txt");
$table->set("test1", 0, "row one");
$table->set("test2", 0, "row two");
$table->set("test1", 1, true);
$table->set("test2", 1, "true");
$table->save();
@PEMapModder
PEMapModder / IceBucketChallenge.js
Last active August 29, 2015 14:05
Simple ice bucket challenge plugin in PocketMine/ModPE xD
var others = [
"sheep",
"pig",
"cow",
"chicken",
"zombie",
"skeleton",
"spider",
"creeper",
"zombie pigman",
<?php
class BSFReader extends StringReader{
public function readItem(){
$data = unpack("nid/Cdamage/Ccount/Imetadata", $this->read());
$count = $data["metadata"];
$data["metadata"] = [];
for($i = 0; $i < $count; $i++){
$key = $this->readString(2);
$data["metadata"][$key] = $this->readString(2);