Skip to content
This repository has been archived by the owner on May 30, 2018. It is now read-only.

Commit

Permalink
Fixes some bugs related to "nicks", "warps" and "homes" command logs.…
Browse files Browse the repository at this point in the history
….. Going to 1.1.2 >:(
  • Loading branch information
iksaku committed Aug 11, 2015
1 parent 064b4d1 commit 9c90276
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 5 deletions.
2 changes: 1 addition & 1 deletion plugin.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: EssentialsPE
main: EssentialsPE\Loader
version: 1.1.1
version: 1.1.2
api: 1.12.0
author: LegendsOfMCPE Team
website: https://github.com/LegendOfMCPE/EssentialsPE
Expand Down
5 changes: 4 additions & 1 deletion src/EssentialsPE/Commands/Home/SetHome.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,10 @@ public function execute(CommandSender $sender, $alias, array $args){
return false;
}
$existed = $this->getPlugin()->homeExists($sender, $args[0]);
$this->getPlugin()->setHome($sender, strtolower($args[0]), $sender->getLocation(), $sender->getYaw(), $sender->getPitch());
if(!$this->getPlugin()->setHome($sender, strtolower($args[0]), $sender->getLocation(), $sender->getYaw(), $sender->getPitch())){
$sender->sendMessage(TextFormat::RED . "Invalid home name given! Please be sure to only use alphanumerical characters and underscores");
return false;
}
$sender->sendMessage(TextFormat::GREEN . "Home successfuly " . ($existed ? "updated" : "created"));
return true;
}
Expand Down
10 changes: 8 additions & 2 deletions src/EssentialsPE/Commands/Nick.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,10 @@ public function execute(CommandSender $sender, $alias, array $args){
return false;
}
$nickname = $args[0];
$nickname === "off" ? $this->getPlugin()->removeNick($sender) : $this->getPlugin()->setNick($sender, $nickname);
if(!($nickname === "off" ? $this->getPlugin()->removeNick($sender) : $this->getPlugin()->setNick($sender, $nickname))){
$sender->sendMessage(TextFormat::RED . "Invalid warp name given! Please be sure to only use alphanumerical characters and underscores");
return false;
}
$sender->sendMessage(TextFormat::GREEN . "Your nick " . ($nickname === "off" ? "has been removed" : "is now " . $nickname));
break;
case 2:
Expand All @@ -47,7 +50,10 @@ public function execute(CommandSender $sender, $alias, array $args){
return false;
}
$nickname = $args[0];
$nickname === "off" ? $this->getPlugin()->removeNick($player) : $this->getPlugin()->setNick($player, $nickname);
if(!($nickname === "off" ? $this->getPlugin()->removeNick($player) : $this->getPlugin()->setNick($player, $nickname))){
$sender->sendMessage(TextFormat::RED . "Invalid warp name given! Please be sure to only use alphanumerical characters and underscores");
return false;
}
$sender->sendMessage(TextFormat::GREEN . $player->getName() . (substr($player->getName(), -1, 1) === "s" ? "'" : "'s") . " nick " . ($nickname === "off" ? "has been removed" : "is now " . $nickname));
$player->sendMessage(TextFormat::GREEN . "Your nick " . ($nickname === "off" ? "has been removed" : "is now " . $nickname));
break;
Expand Down
5 changes: 4 additions & 1 deletion src/EssentialsPE/Commands/Warp/Setwarp.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,10 @@ public function execute(CommandSender $sender, $alias, array $args){
$sender->sendMessage(TextFormat::RED . "[Error] You can't modify this warp position");
return false;
}
$this->getPlugin()->setWarp($args[0], $sender->getPosition(), $sender->getYaw(), $sender->getPitch());
if(!$this->getPlugin()->setWarp($args[0], $sender->getPosition(), $sender->getYaw(), $sender->getPitch())){
$sender->sendMessage(TextFormat::RED . "Invalid warp name given! Please be sure to only use alphanumerical characters and underscores");
return false;
}
$sender->sendMessage(TextFormat::GREEN . "Warp successfully " . ($existed ? "updated!" : "created!"));
return true;
}
Expand Down

0 comments on commit 9c90276

Please sign in to comment.