Skip to content

Instantly share code, notes, and snippets.

@PEMapModder
PEMapModder / build_receiver.php
Last active April 6, 2022 23:46
StatsCore Travis-CI build script
<?php
$extension = "phar";
if(!isset($_POST["commit"], $_POST["branch"], $_POST["pr"], $_FILE["build"], $_POST["repo-id"])){
echo "400 bad request - Insufficient parameters passed";
http_response_code(400);
}
else{
switch($_POST["repo-id"]){
case "0":
$repo_url = "https://github.com/LegendOfMCPE/StatsCore";
dispatcher.registerCommand(
literal("scoreboard").then(
literal("players").then(
literal("reset").then(
argument("players", players()).then(
optional("objective", objective())
).executes(SOME_COMMAND)
)
).then(
literal("list").then(
@PEMapModder
PEMapModder / How to implement plugin permissions.md
Created December 20, 2014 07:59
How to implement plugin permissions (for all servers written in OOP languages with PocketMine-style API: commands, events, schedules) in code for access to API functions

How to implement plugin permisisons (for all servers written in OOP languages with PocketMine-style API: commands, events, schedules) in code for access to API functions

The principle of this system is to make use of the characteristic of executing code on one thread - code flows single-direction - to identify what context (server or what plugin or what) the code is flowing to currently and decide whether the current context has permission to do something.

First, the server has to declare a class that extends a class called Context and instantiate an object that has any permissions. The object serves as a lock and shall not be accessible by plugins. Every object that represents a plugin (but these objects must not be declared by the plugin) should have a context too. This is an example for the Context class in Java:

import java.util.List;

public class Context{
@PEMapModder
PEMapModder / legionpe.agenda.md
Created January 8, 2015 07:21
PEMapModder's agenda on LegionPE

PEMapModder's Agenda on LegionPE

  • Basic KitPvP things
  • Friends
  • W.I.P. Shops, hopefully done at the end of January 2015
  • Spleef, hopefully done in Feburary
  • Infected; not sure when I will get it done, or when the map is ready
  • KitPvP teams; we may as well extend this to Spleef and Infected too
  • Parkour; no offense whoever created it but it didn't look promising to me. Anyway when I have enough time I will work on it if I have enough resources.
@PEMapModder
PEMapModder / LegionPE user commands.md
Created January 17, 2015 16:55
LegionPE User Commands

LegionPE User Commands

/auth

Usage: /auth <option> <value>

Description: change your auth settings

Option Value

Source: http://www.cprogramming.com/tutorial/lesson12.html

Let's look at these different access restrictions for a moment. Why would you want to declare something private instead of public? The idea is that some parts of the class are intended to be internal to the class--only for the purpose of implementing features. On the other hand, some parts of the class are supposed to be available to anyone using the class--these are the public class functions. Think of a class as though it were an appliance like a microwave: the public parts of the class correspond to the parts of the microwave that you can use on an everyday basis--the keypad, the start button, and so forth. On the other hand, some parts of the microwave are not easily accessible, but they are no less important--it would be hard to get at the microwave generator. These would correspond to the protected or private parts of the class--the things that are necessary for the class to function, but that nobody who uses the class should need to know abo

<?php
require_once("readline.php");
$thread = new ConsoleThread;
$thread->start();
while(true){
sleep(10);
echo "I am still alive!" . PHP_EOL;
}
class ConsoleThread extends Thread{
public function run(){
@PEMapModder
PEMapModder / LegionPE importance ranks perks.md
Created February 26, 2015 15:26
LegionPE Donator/VIP ranks and perks

LegionPE Donator/VIP ranks and perks

Ranks

Name Price
Donator $3
Donator+ $6
VIP $9
@PEMapModder
PEMapModder / LegionPE importance ranks perks.md
Created February 26, 2015 15:26
LegionPE Donator/VIP ranks and perks

LegionPE Donator/VIP ranks and perks

Ranks

Name Price
Donator $3
Donator+ $6
VIP $9
@PEMapModder
PEMapModder / LegionPE importance ranks perks.md
Created February 26, 2015 15:26
LegionPE Donator/VIP ranks and perks

LegionPE Donator/VIP ranks and perks

Ranks

Name Price
Donator $3
Donator+ $6
VIP $9