This repository has been archived by the owner on May 30, 2018. It is now read-only.
forked from swagking47/EssentialsPE
-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Tons of changes! Beta 1, here we go!
- Loading branch information
Showing
40 changed files
with
1,039 additions
and
301 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,6 @@ | ||
.idea/* | ||
Nicks.yml | ||
./idea/* | ||
Nicks.yml | ||
.idea/codeStyleSettings.xml | ||
.idea/dictionaries/Jorge_González.xml | ||
*.xml | ||
.idea/EssentialsPE.iml |
Large diffs are not rendered by default.
Oops, something went wrong.
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,8 @@ | ||
#EssentialsPE configuration | ||
#This configuration flie let you modify how EssentialsPE work with some features | ||
|
||
#This option let you disable player damage when they're AFK | ||
safe-afk: true | ||
|
||
#This option let you limit the block distance for players to teleport using "/jump" | ||
#jump-distance: 1000 |
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,76 @@ | ||
<?php | ||
namespace EssentialsPE\Commands; | ||
|
||
use EssentialsPE\BaseCommand; | ||
use EssentialsPE\Loader; | ||
use pocketmine\command\CommandSender; | ||
use pocketmine\Player; | ||
use pocketmine\utils\TextFormat; | ||
|
||
class AFK extends BaseCommand{ | ||
public function __construct(Loader $plugin){ | ||
parent::__construct($plugin, "afk", "Toggle the \"Away From the Keyboard\" status", "/afk [player]", ["away"]); | ||
$this->setPermission("essentials.afk.use"); | ||
} | ||
|
||
public function execute(CommandSender $sender, $alias, array $args){ | ||
if(!$this->testPermission($sender)){ | ||
return false; | ||
} | ||
if(count($args) > 1){ | ||
if(!$sender instanceof Player){ | ||
$sender->sendMessage(TextFormat::RED . "Usage: /afk <player>"); | ||
}else{ | ||
$sender->sendMessage(TextFormat::RED . "Usage: " . $this->getUsage()); | ||
} | ||
return false; | ||
} | ||
switch(count($args)){ | ||
case 0: | ||
if(!$sender instanceof Player){ | ||
$sender->sendMessage(TextFormat::RED . "Usage: /afk <player>"); | ||
return false; | ||
} | ||
$this->getAPI()->switchAFKMode($sender); | ||
if(!$this->getAPI()->isAFK($sender)){ | ||
$sender->sendMessage(TextFormat::YELLOW . "You're no longer AFK"); | ||
$this->broadcastAFKStatus($sender, "is no longer AFK"); | ||
}else{ | ||
$sender->sendMessage(TextFormat::YELLOW . "You're now AFK"); | ||
$this->broadcastAFKStatus($sender, "is now AFK"); | ||
} | ||
return true; | ||
break; | ||
case 1: | ||
if(!$sender->hasPermission("essentials.afk.other")){ | ||
$sender->sendMessage(TextFormat::RED . $this->getPermissionMessage()); | ||
return false; | ||
} | ||
$player = $this->getAPI()->getPlayer($args[0]); | ||
if(!$player instanceof Player){ | ||
$sender->sendMessage(TextFormat::RED . "[Error] Player not found"); | ||
return false; | ||
} | ||
$this->getAPI()->switchAFKMode($player); | ||
if(!$this->getAPI()->isAFK($player)){ | ||
$player->sendMessage(TextFormat::YELLOW . "You're no longer AFK"); | ||
$this->broadcastAFKStatus($player, "is no longer AFK"); | ||
}else{ | ||
$player->sendMessage(TextFormat::YELLOW . "You're now AFK"); | ||
$this->broadcastAFKStatus($player, "is now AFK"); | ||
} | ||
return true; | ||
break; | ||
} | ||
return true; | ||
} | ||
|
||
private function broadcastAFKStatus(Player $player, $message){ | ||
foreach($player->getServer()->getOnlinePlayers() as $p){ | ||
if($p !== $player){ | ||
$p->sendMessage(TextFormat::YELLOW . $player->getDisplayName() . " " . $message); | ||
$player->getServer()->getLogger()->info(TextFormat::GREEN . $player->getDisplayName() . " " . $message); | ||
} | ||
} | ||
} | ||
} |
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
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
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
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
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
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
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
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
Oops, something went wrong.