This repository has been archived by the owner on Jul 11, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
50f6bb3
commit c8747e8
Showing
13 changed files
with
1,173 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,177 @@ | ||
# ToyBox | ||
A box full of fun toys and tools | ||
<img src="https://raw.githubusercontent.com/alejandroliu/bad-plugins/master/Media/icon-toy-box.png" style="width:64px;height:64px" width="64" height="64"/> | ||
|
||
ToyBox | ||
====== | ||
|
||
* Summary: A box full of fun toys and tools | ||
* Dependency Plugins: N/A | ||
* PocketMine-MP version: 1.4 - API 1.10.0 | ||
* DependencyPlugins: - | ||
* OptionalPlugins: N/A | ||
* Categories: Fun | ||
* Plugin Access: Blocks, Commands | ||
* WebSite: [github](https://github.com/alejandroliu/bad-plugins/tree/master/ToyBox) | ||
|
||
Overview | ||
-------- | ||
|
||
Provide additional items with special functionality to PocketMine. | ||
|
||
* TreeCapitator - axe that destroys trees quickly | ||
* CompassTP - Teleporting compass | ||
* Trampoline - Jump and down blocks | ||
* CloakClock - Clock that gives Invisibility | ||
* PowerTool - pickax that destroys blocks instantly | ||
* Floating Torch - Floating torch that follows you around | ||
* Magic Carpet - Fly with a carpet made of glass | ||
|
||
### TreeCapitator | ||
|
||
Equip an Axe. Then enter the command `/treecapitator`. Go to a tree | ||
and break the lowest block. This will then eliminate the entire tree | ||
above. If it did'nt block the first time, break the next lowest block | ||
(which now is floating over the air). | ||
|
||
### CompassTP | ||
|
||
Holding the compass, tap on the screen for one second. It will | ||
teleport you in the direction you were looking at. | ||
|
||
### Trampoline | ||
|
||
Place some Sponge on the ground. Jump on them. Watch out your | ||
landing! | ||
|
||
### CloakClock | ||
|
||
Holding a Clock, tap on the sreen. If it doesn't work, hold the | ||
screen for 1 second. Will enable invisibility. | ||
|
||
### Power Tool | ||
|
||
Enter the command `/powertool`. Equip a pick axe and start tapping on | ||
blocks. They will be destroyed instantly. | ||
|
||
### Floating Toch | ||
|
||
Equip a torch, and tap on the screen. This will create a torch that | ||
will follow you around iluminating the way you are going. | ||
|
||
### Magic Carpet | ||
|
||
Enter the command `/magiccarpet`. Walk normally, to go up jump, to go | ||
down look down. Be careful when going down as you can easily hurt | ||
yourself. | ||
|
||
|
||
Documentation | ||
------------- | ||
|
||
### Commands | ||
|
||
* *treecapitator* | ||
Toggles treecapitator usage. | ||
* *powertool* | ||
Toggles powertool usage | ||
* *magiccarpet* | ||
Toggle magic carpet | ||
|
||
### Configuration | ||
|
||
--- | ||
# Enable or disable specifif toys | ||
modules: | ||
treecapitator: true | ||
compasstp: true | ||
trampoline: true | ||
powertool: true | ||
cloakclock: true | ||
floating-torch: true | ||
magic-carpet: true | ||
# Configure torch data | ||
floating-torch: | ||
item: TORCH | ||
block: TORCH | ||
# Configure compass items | ||
compasstp: | ||
item: COMPASS | ||
# Configure cloaking item | ||
cloakclock: | ||
item: CLOCK | ||
# Configure power tools | ||
powertool: | ||
ItemIDs: | ||
- IRON_PICKAXE | ||
- WOODEN_PICKAXE | ||
- STONE_PICKAXE | ||
- DIAMOND_PICKAXE | ||
- GOLD_PICKAXE | ||
need-item: true | ||
item-wear: 1 | ||
creative: true | ||
# Configure TeeCapitator | ||
treecapitator: | ||
ItemIDs: | ||
- IRON_AXE | ||
- WOODEN_AXE | ||
- STONE_AXE | ||
- DIAMOND_AXE | ||
- GOLD_AXE | ||
need-item: true | ||
break-leaves: true | ||
item-wear: 1 | ||
broadcast-use: true | ||
creative: true | ||
# Configure trampoline blocks | ||
trampoline: | ||
blocks: | ||
- SPONGE | ||
magic-carpet: | ||
block: GLASS | ||
... | ||
|
||
### Permission Nodes: | ||
|
||
* toybox.treecapitator: Allow treecapitator | ||
* toybox.compasstp: Allow treecapitator | ||
* toybox.powertool: Allow the use of powertool | ||
* toybox.cloakclock.use: Can use cloakclock | ||
* toybox.cloakclock.inmune: Can see players using cloakclock | ||
* toybox.torch: Allow use of torch | ||
* toybox.magiccarpet: Allow use of Magic carpet | ||
|
||
Todo | ||
---- | ||
|
||
* Ball - ?? | ||
|
||
Changes | ||
------- | ||
|
||
* 1.1.0 : Next release | ||
* Added Floating Torch | ||
* Added magic carpet | ||
* Configuration is more readable | ||
* Removed CallbackTask deprecation warnings | ||
* 1.0.0 : First submission | ||
|
||
Copyright | ||
--------- | ||
|
||
ToyBox | ||
Copyright (C) 2015 Alejandro Liu | ||
All Rights Reserved. | ||
|
||
This program is free software: you can redistribute it and/or modify | ||
it under the terms of the GNU General Public License as published by | ||
the Free Software Foundation, either version 2 of the License, or | ||
(at your option) any later version. | ||
|
||
This program is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU General Public License for more details. | ||
|
||
You should have received a copy of the GNU General Public License | ||
along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
|
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
main: aliuly\toybox\Main | ||
api: 1.10.0 | ||
load: POSTWORLD | ||
|
||
name: ToyBox | ||
description: A box full of fun toys and tools | ||
version: 1.1.0 | ||
author: aliuly | ||
|
||
permissions: | ||
toybox.treecapitator: | ||
default: op | ||
description: "Use treecapitator" | ||
toybox.magiccarpet: | ||
default: op | ||
description: "MagicCarpet command" | ||
toybox.compasstp: | ||
default: op | ||
description: "Teleport with compass" | ||
toybox.powertool: | ||
default: op | ||
description: "Allow the use of powertool" | ||
toybox.cloakclock.use: | ||
default: op | ||
description: "Can use cloakclock" | ||
toybox.cloakclock.inmune: | ||
default: op | ||
description: "Can see players using cloakclock" | ||
toybox.torch: | ||
default: op | ||
description: "Can use floating torch" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
<?php | ||
namespace aliuly\toybox; | ||
|
||
use pocketmine\command\CommandExecutor; | ||
use pocketmine\command\CommandSender; | ||
use pocketmine\command\Command; | ||
use pocketmine\command\PluginCommand; | ||
use pocketmine\Player; | ||
|
||
abstract class BaseCommand implements CommandExecutor { | ||
protected $owner; | ||
|
||
public function __construct($owner) { | ||
$this->owner = $owner; | ||
} | ||
|
||
//public function onCommand(CommandSender $sender,Command $command,$label, array $args); | ||
|
||
public function enableCmd($cmd,$yaml) { | ||
$newCmd = new PluginCommand($cmd,$this->owner); | ||
if (isset($yaml["description"])) | ||
$newCmd->setDescription($yaml["description"]); | ||
if (isset($yaml["usage"])) | ||
$newCmd->setUsage($yaml["usage"]); | ||
if(isset($yaml["aliases"]) and is_array($yaml["aliases"])) { | ||
$aliasList = []; | ||
foreach($yaml["aliases"] as $alias) { | ||
if(strpos($alias,":")!== false) { | ||
$this->owner->getLogger()->info("Unable to load alias $alias"); | ||
continue; | ||
} | ||
$aliasList[] = $alias; | ||
} | ||
$newCmd->setAliases($aliasList); | ||
} | ||
if(isset($yaml["permission"])) | ||
$newCmd->setPermission($yaml["permission"]); | ||
if(isset($yaml["permission-message"])) | ||
$newCmd->setPermissionMessage($yaml["permission-message"]); | ||
$newCmd->setExecutor($this); | ||
$cmdMap = $this->owner->getServer()->getCommandMap(); | ||
$cmdMap->register($this->owner->getDescription()->getName(),$newCmd); | ||
} | ||
|
||
public function inGame(CommandSender $sender,$msg = true) { | ||
if (!($sender instanceof Player)) { | ||
if ($msg) $sender->sendMessage("You can only do this in-game"); | ||
return false; | ||
} | ||
return true; | ||
} | ||
|
||
public function getState(CommandSender $player,$default) { | ||
return $this->owner->getState(get_class($this),$player,$default); | ||
} | ||
public function setState(CommandSender $player,$val) { | ||
$this->owner->setState(get_class($this),$player,$val); | ||
} | ||
public function unsetState(CommandSender $player) { | ||
$this->owner->unsetState(get_class($this),$player); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
<?php | ||
namespace aliuly\toybox; | ||
|
||
use pocketmine\event\Listener; | ||
use pocketmine\event\player\PlayerInteractEvent; | ||
use pocketmine\event\player\PlayerItemHeldEvent; | ||
use pocketmine\event\player\PlayerJoinEvent; | ||
use pocketmine\Player; | ||
use pocketmine\item\Item; | ||
|
||
|
||
//use pocketmine\math\Vector3; | ||
|
||
class CloakClock implements Listener { | ||
public $owner; | ||
protected $item; | ||
|
||
private function activate(Player $pl) { | ||
$pl->sendMessage("CloakClock activated"); | ||
$this->owner->setState("CloakClock",$pl,true); | ||
foreach($this->owner->getServer()->getOnlinePlayers() as $online){ | ||
if($online->hasPermission("toybox.cloakclock.inmune")) continue; | ||
$online->hidePlayer($pl); | ||
} | ||
} | ||
private function deactivate(Player $pl) { | ||
$pl->sendMessage("CloakClock de-actived"); | ||
$this->owner->setState("CloakClock",$pl,false); | ||
foreach($this->owner->getServer()->getOnlinePlayers() as $online){ | ||
$online->showPlayer($pl); | ||
} | ||
} | ||
|
||
public function __construct($plugin,$i) { | ||
$this->owner = $plugin; | ||
$this->owner->getServer()->getPluginManager()->registerEvents($this, $this->owner); | ||
$this->item = $this->owner->getItem($i,Item::CLOCK,"cloakclock")->getId(); | ||
} | ||
public function onItemHeld(PlayerItemHeldEvent $e) { | ||
$pl = $e->getPlayer(); | ||
if (!$this->owner->getState("CloakClock",$pl,false)) return; | ||
if ($e->getItem()->getId() != $this->item) $this->deactivate($pl); | ||
} | ||
public function onPlayerJoin(PlayerJoinEvent $e) { | ||
$pl = $e->getPlayer(); | ||
if ($pl->hasPermission("toybox.cloakclock.inmune")) return; | ||
foreach($this->owner->getServer()->getOnlinePlayers() as $online){ | ||
if ($this->owner->getState("CloakClock",$online,false)) { | ||
$pl->hidePlayer($online); | ||
} | ||
} | ||
} | ||
public function onPlayerInteract(PlayerInteractEvent $e) { | ||
// Activate cloak | ||
$pl = $e->getPlayer(); | ||
|
||
if (!$pl->hasPermission("toybox.cloakclock.use")) return; | ||
|
||
$hand = $pl->getInventory()->getItemInHand(); | ||
if ($hand->getID() != $this->item) return; | ||
|
||
$state = $this->owner->getState("CloakClock",$pl,false); | ||
if ($state) { | ||
$this->deactivate($pl); | ||
} else { | ||
$this->activate($pl); | ||
} | ||
} | ||
} |
Oops, something went wrong.