Removed example folder (added those examples to the wiki)

This commit is contained in:
Shoghi Cervantes Pueyo 2012-12-29 02:19:54 +01:00
parent 8a0c5e4655
commit ca54acd09b
3 changed files with 0 additions and 185 deletions

View File

@ -1,34 +0,0 @@
<?php
/*
__PocketMine Plugin__
name=ExamplePlugin
version=0.0.1
author=shoghicp
class=ExamplePlugin
*/
class ExamplePlugin implements Plugin{
private $api;
public function __construct(ServerAPI $api, $server = false){
$this->api = $api;
}
public function init(){
$this->api->console->register("example", "Example command", array($this, "handleCommand"));
}
public function __destruct(){
}
public function handleCommand($cmd, $arg){
switch($cmd){
case "example":
console("EXAMPLE!!!");
break;
}
}
}

View File

@ -1,46 +0,0 @@
<?php
/*
__PocketMine Plugin__
name=ReactorAsWater
description=Replaces the Nether Reactor with Water
version=0.0.2
author=shoghicp
class=ReactorAsWater
*/
class ReactorAsWater implements Plugin{
private $api;
public function __construct(ServerAPI $api, $server = false){
$this->api = $api;
}
public function init(){
$this->api->addHandler("player.block.action", array($this, "handle"), 15); //Priority higher that API
$this->api->addHandler("player.equipment.change", array($this, "handle"), 15);
}
public function __destruct(){
}
public function handle(&$data, $event){
switch($event){
case "player.equipment.change":
if($data["block"] === 247){
$this->api->player->getByEID($data["eid"])->eventHandler("[ReactorAsWater] Placing water", "server.chat");
$data["block"] = 9;
$data["meta"] = 0;
}
break;
case "player.block.action":
if($data["block"] === 247){ //nether reactor
$data["block"] = 9; //water source
$data["meta"] = 0;
}
break;
}
}
}

View File

@ -1,105 +0,0 @@
<?php
/*
__PocketMine Plugin__
name=SpawnChanger
description=Change the spawn coordinates, or make it default for all players!
version=0.0.1
author=shoghicp
class=SpawnChanger
*/
class SpawnChanger implements Plugin{
private $api, $config, $path;
public function __construct(ServerAPI $api, $server = false){
$this->api = $api;
}
public function init(){
$spawn = $this->api->level->getSpawn();
$this->path = $this->api->plugin->createConfig($this, array(
"spawnX" => $spawn["x"],
"spawnY" => $spawn["y"],
"spawnZ" => $spawn["z"],
"custom-spawn" => false,
"force-spawn" => false,
));
$this->config = $this->api->plugin->readYAML($this->path."config.yml");
if($this->config["custom-spawn"] === false){
$this->config["spawnX"] = $spawn["x"];
$this->config["spawnY"] = $spawn["y"];
$this->config["spawnZ"] = $spawn["z"];
$this->api->plugin->writeYAML($this->path."config.yml", $this->config);
}
$this->api->addHandler("api.player.offline.get", array($this, "handle"), 15);
$this->api->console->register("spawnchanger", "SpawnChanger init point managing", array($this, "command"));
$this->api->console->register("spawn", "Teleports to spawn", array($this, "command"));
}
public function __destruct(){
}
public function command($cmd, $args){
switch($cmd){
case "spawnchanger":
switch(strtolower(array_shift($args))){
case "force":
$l = array_shift($args);
if($l != "0" and $l != "1"){
console("[SpawnChanger] Usage: /spawnchanger force <1 | 0>");
}else{
$this->config["force-spawn"] = $l == "0" ? false:true;
if($this->config["force-spawn"] === true){
console("[SpawnChanger] Forced spawn point");
}else{
console("[SpawnChanger] Freed pawn point");
}
$this->api->plugin->writeYAML($this->path."config.yml", $this->config);
}
break;
case "set":
$z = array_pop($args);
$y = array_pop($args);
$x = array_pop($args);
if($x === null or $y === null or $z === null){
console("[SpawnChanger] Usage: /spawnchanger set <x> <y> <z>");
}else{
$this->config["custom-spawn"] = true;
$this->config["spawnX"] = (float) $x;
$this->config["spawnY"] = (float) $y;
$this->config["spawnZ"] = (float) $z;
console("[SpawnChanger] Spawn point set at X ".$this->config["spawnX"]." Y ".$this->config["spawnY"]." Z ".$this->config["spawnZ"]);
$this->api->plugin->writeYAML($this->path."config.yml", $this->config);
}
break;
default:
console("[SpawnChanger] Always spawn player in spawn point: /spawnchanger force <1 | 0>");
console("[SpawnChanger] Set the spawn point: /spawnchanger set <x> <y> <z>");
break;
}
break;
case "spawn":
if($this->api->player->tppos(implode(" ", $args), $this->config["spawnX"], $this->config["spawnY"], $this->config["spawnZ"]) !== false){
console("[SpawnChanger] Teleported to spawn!");
}else{
console("[SpawnChanger] Usage: /spawn <player>");
}
break;
}
}
public function handle(&$data, $event){
switch($event){
case "api.player.offline.get":
if($this->config["force-spawn"] === true){
$data["spawn"]["x"] = $this->config["spawnX"];
$data["spawn"]["y"] = $this->config["spawnY"];
$data["spawn"]["z"] = $this->config["spawnZ"];
}
break;
}
}
}