This repository was archived by the owner on Jun 12, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
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
Showing
3 changed files
with
40 additions
and
44 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,68 +1,65 @@ | ||
<?php | ||
|
||
namespace WeaponsPlus\Commands; | ||
|
||
use pocketmine\command\defaults\VanillaCommand; | ||
use pocketmine\command\CommandSender; | ||
use pocketmine\Player; | ||
|
||
class BreakReplaceCommand extends VanillaCommand{ | ||
public function __construct($name, $plugin){ | ||
parent::__construct( | ||
$name, "Toggle weapons", "/weaponsplus" | ||
); | ||
class BreakReplaceCommand extends VanillaCommand { | ||
public function __construct($name, $plugin) { | ||
parent::__construct($name, "Toggle weapons", "/weaponsplus"); | ||
$this->setPermission("weaponsplus.command"); | ||
$this->plugin = $plugin; | ||
} | ||
|
||
public function execute(CommandSender $sender, $currentAlias, array $args){ | ||
if(!$this->testPermission($sender)){ | ||
public function execute(CommandSender $sender, $currentAlias, array $args) { | ||
if(!$this->testPermission($sender)) { | ||
return true; | ||
} | ||
if(!$sender instanceof Player){ | ||
if(!$sender instanceof Player) { | ||
$sender->sendMessage("§cYou must use the command in-game."); | ||
return false; | ||
} | ||
if(!isset($args[0])){ | ||
if(!isset($args[0])) { | ||
$sender->sendMessage("/weaponplus <weapon|list>"); | ||
return false; | ||
} | ||
switch($args[0]){ | ||
switch($args[0]) { | ||
case "effectblade": | ||
case "eb": | ||
if(!$sender->hasPermission("weaponsplus.command.effectblade")){ | ||
if(!$sender->hasPermission("weaponsplus.command.effectblade")) { | ||
return false; | ||
} | ||
if($this->plugin->getEBStatus($sender)){ | ||
if($this->plugin->getEBStatus($sender)) { | ||
$this->plugin->disableEB($sender); | ||
$sender->sendMessage("§aEffectBlades disabled."); | ||
}else{ | ||
} else { | ||
$this->plugin->enableEB($sender); | ||
$sender->sendMessage("§aEffectBlades enabled."); | ||
} | ||
break; | ||
case "list": | ||
if(!isset($args[1])){ | ||
if(!isset($args[1])) { | ||
$page = 1; | ||
}else{ | ||
} else { | ||
$page = $args[1]; | ||
} | ||
if(!is_numeric($page)){ | ||
if(!is_numeric($page)) { | ||
$page = 1; | ||
} | ||
if($page > 1){ | ||
if($page > 1) { | ||
$page = 1; | ||
} | ||
switch($page){ | ||
switch($page) { | ||
case 0: | ||
case 1: | ||
$sender->sendMessage("--- Weapons Page 1 of 1---\n§2effectblades"); | ||
break; | ||
} | ||
return true; | ||
} | ||
} | ||
return true; | ||
} | ||
} | ||
return true; | ||
} | ||
|
||
} |
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
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