-
Notifications
You must be signed in to change notification settings - Fork 7
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
Flavius12
committed
Dec 27, 2014
1 parent
85d8dcc
commit 9473b40
Showing
1 changed file
with
59 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,59 @@ | ||
<?php | ||
|
||
/* | ||
* ChestLocker (v1.2) by EvolSoft | ||
* Developer: EvolSoft (Flavius12) | ||
* Website: http://www.evolsoft.tk | ||
* Date: 27/12/2014 03:32 PM (UTC) | ||
* Copyright & License: (C) 2014 EvolSoft | ||
* Licensed under MIT (https://github.com/EvolSoft/ChestLocker/blob/master/LICENSE) | ||
*/ | ||
|
||
namespace ChestLocker\Commands; | ||
|
||
use pocketmine\plugin\PluginBase; | ||
use pocketmine\permission\Permission; | ||
use pocketmine\command\Command; | ||
use pocketmine\command\CommandExecutor; | ||
use pocketmine\command\CommandSender; | ||
use pocketmine\Player; | ||
use pocketmine\Server; | ||
use pocketmine\utils\Config; | ||
use pocketmine\utils\TextFormat; | ||
|
||
use ChestLocker\Main; | ||
|
||
class UnlockChest extends PluginBase{ | ||
public function __construct(Main $plugin){ | ||
$this->plugin = $plugin; | ||
} | ||
|
||
public function onCommand(CommandSender $sender, Command $cmd, $label, array $args) { | ||
$fcmd = strtolower($cmd->getName()); | ||
switch($fcmd){ | ||
case "unlockchest": | ||
if($sender->hasPermission("chestlocker.commands.unlockchest")){ | ||
//Player Sender | ||
if($sender instanceof Player){ | ||
if($this->plugin->getCommandStatus($sender->getName()) == 0 || $this->plugin->getCommandStatus($sender->getName()) == 1){ | ||
$this->plugin->setCommandStatus(2, $sender->getName()); | ||
$sender->sendMessage($this->plugin->translateColors("&", Main::PREFIX . "&2" . Main::ITEM_NAME . " unlock command enabled. Click the " . Main::ITEM_NAME_2 . " to unlock")); | ||
}else{ | ||
$this->plugin->setCommandStatus(0, $sender->getName()); | ||
$sender->sendMessage($this->plugin->translateColors("&", Main::PREFIX . "&4" . Main::ITEM_NAME . " unlock command disabled.")); | ||
} | ||
} | ||
//Console Sender | ||
else{ | ||
$sender->sendMessage($this->plugin->translateColors("&", Main::PREFIX . "&cYou can only perform this command as a player")); | ||
return true; | ||
} | ||
}else{ | ||
$sender->sendMessage($this->plugin->translateColors("&", "&cYou don't have permissions to use this command")); | ||
break; | ||
} | ||
return true; | ||
} | ||
} | ||
} | ||
?> |