forked from DovahDoVolom/PurePerms
-
Notifications
You must be signed in to change notification settings - Fork 42
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
2 changed files
with
178 additions
and
141 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,49 +1,49 @@ | ||
|
||
# PurePerms by 64FF00 (xktiverz@gmail.com, @64ff00 for Twitter) | ||
|
||
name: PurePerms | ||
main: _64FF00\PurePerms\PurePerms | ||
version: 2.0.0 | ||
api: [4.0.0] | ||
load: POSTWORLD | ||
author: "Vecnavium , 64FF00 & ProjectInfinity" | ||
permissions: | ||
pperms: | ||
default: op | ||
description: "PurePerms by 64FF00! (Twitter: @64FF00)" | ||
plperms.command: | ||
default: op | ||
description: "Allows you to use all PurePerms commands." | ||
pperms.command.addrank: | ||
default: op | ||
description: "Allows you to add a new rank" | ||
pperms.command.defrank: | ||
default: op | ||
description: "Allows you to set the default rank manually." | ||
pperms.command.plperms: | ||
default: op | ||
description: "Allows you to find permissions for a specific plugin." | ||
pperms.command.ranks: | ||
default: op | ||
description: "Allows you to see a list of all rank." | ||
pperms.command.listuperms: | ||
default: op | ||
description: "Allows you to see a list of all permissions from a user." | ||
pperms.command.ppinfo: | ||
default: true | ||
description: "Allows you to get current PurePerms information." | ||
pperms.command.rmrank: | ||
default: op | ||
description: "Allows you to remove a rank from the ranks list." | ||
pperms.command.setrank: | ||
default: op | ||
description: "Allows you to set rank for a user." | ||
pperms.command.setuperm: | ||
default: op | ||
description: "Allows you to add a permission to a user." | ||
pperms.command.unsetgperm: | ||
default: op | ||
description: "Allows you to remove a permission from the group." | ||
pperms.command.unsetuperm: | ||
default: op | ||
description: "Allows you to remove a permission from the user." | ||
|
||
# PurePerms by 64FF00 (xktiverz@gmail.com, @64ff00 for Twitter) | ||
|
||
name: PurePerms | ||
main: _64FF00\PurePerms\PurePerms | ||
version: 2.0.0 | ||
api: [4.0.0] | ||
load: POSTWORLD | ||
author: "Vecnavium , 64FF00 & ProjectInfinity" | ||
permissions: | ||
pperms: | ||
default: op | ||
description: "PurePerms by 64FF00! (Twitter: @64FF00)" | ||
plperms.command: | ||
default: op | ||
description: "Allows you to use all PurePerms commands." | ||
pperms.command.addrank: | ||
default: op | ||
description: "Allows you to add a new rank" | ||
pperms.command.defrank: | ||
default: op | ||
description: "Allows you to set the default rank manually." | ||
pperms.command.plperms: | ||
default: op | ||
description: "Allows you to find permissions for a specific plugin." | ||
pperms.command.ranks: | ||
default: op | ||
description: "Allows you to see a list of all rank." | ||
pperms.command.listuperms: | ||
default: op | ||
description: "Allows you to see a list of all permissions from a user." | ||
pperms.command.ppinfo: | ||
default: true | ||
description: "Allows you to get current PurePerms information." | ||
pperms.command.rmrank: | ||
default: op | ||
description: "Allows you to remove a rank from the ranks list." | ||
pperms.command.setrank: | ||
default: op | ||
description: "Allows you to set rank for a user." | ||
pperms.command.setuperm: | ||
default: op | ||
description: "Allows you to add a permission to a user." | ||
pperms.command.unsetgperm: | ||
default: op | ||
description: "Allows you to remove a permission from the group." | ||
pperms.command.unsetuperm: | ||
default: op | ||
description: "Allows you to remove a permission from the user." |
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,93 +1,130 @@ | ||
<?php | ||
|
||
namespace _64FF00\PurePerms; | ||
|
||
use _64FF00\PurePerms\EventManager\PPGroupChangedEvent; | ||
use _64FF00\PurePerms\EventManager\PPRankExpiredEvent; | ||
use pocketmine\event\Listener; | ||
use pocketmine\event\entity\EntityTeleportEvent; | ||
use pocketmine\event\player\PlayerCommandPreprocessEvent; | ||
use pocketmine\event\player\PlayerQuitEvent; | ||
use pocketmine\event\player\PlayerLoginEvent; | ||
use pocketmine\lang\TranslationContainer; | ||
use pocketmine\player\Player; | ||
use pocketmine\utils\TextFormat; | ||
|
||
class PPListener implements Listener | ||
{ | ||
/* | ||
PurePerms by 64FF00 (Twitter: @64FF00) | ||
888 888 .d8888b. d8888 8888888888 8888888888 .d8888b. .d8888b. | ||
888 888 d88P Y88b d8P888 888 888 d88P Y88b d88P Y88b | ||
888888888888 888 d8P 888 888 888 888 888 888 888 | ||
888 888 888d888b. d8P 888 8888888 8888888 888 888 888 888 | ||
888 888 888P "Y88b d88 888 888 888 888 888 888 888 | ||
888888888888 888 888 8888888888 888 888 888 888 888 888 | ||
888 888 Y88b d88P 888 888 888 Y88b d88P Y88b d88P | ||
888 888 "Y8888P" 888 888 888 "Y8888P" "Y8888P" | ||
*/ | ||
|
||
private $plugin; | ||
|
||
/** | ||
* @param PurePerms $plugin | ||
*/ | ||
public function __construct(PurePerms $plugin) | ||
{ | ||
$this->plugin = $plugin; | ||
} | ||
|
||
/** | ||
* @param PPGroupChangedEvent $event | ||
* @priority LOWEST | ||
*/ | ||
public function onGroupChanged(PPGroupChangedEvent $event) | ||
{ | ||
$player = $event->getPlayer(); | ||
$this->plugin->updatePermissions($player); | ||
} | ||
|
||
/** | ||
* @param EntityTeleportEvent $event | ||
* @priority MONITOR | ||
*/ | ||
public function onLevelChange(EntityTeleportEvent $event) | ||
{ | ||
if($event->isCancelled()) return; | ||
$player = $event->getEntity(); | ||
if($player instanceof Player) { | ||
$this->plugin->updatePermissions($player, $event->getTo()->getWorld()->getDisplayName()); | ||
} | ||
} | ||
|
||
/** | ||
* @param PlayerLoginEvent $event | ||
* @priority LOWEST | ||
*/ | ||
public function onPlayerLogin(PlayerLoginEvent $event) | ||
{ | ||
$player = $event->getPlayer(); | ||
$this->plugin->registerPlayer($player); | ||
} | ||
|
||
/** | ||
* @param PlayerQuitEvent $event | ||
* @priority HIGHEST | ||
*/ | ||
public function onPlayerQuit(PlayerQuitEvent $event) | ||
{ | ||
$player = $event->getPlayer(); | ||
$this->plugin->unregisterPlayer($player); | ||
} | ||
|
||
/** | ||
* @param PPRankExpiredEvent $event | ||
* @priority LOWEST | ||
*/ | ||
public function onRankExpired(PPRankExpiredEvent $event) | ||
{ | ||
$player = $event->getPlayer(); | ||
$this->plugin->setGroup($player, $this->plugin->getDefaultGroup()); | ||
} | ||
<?php | ||
|
||
namespace _64FF00\PurePerms; | ||
|
||
use _64FF00\PurePerms\EventManager\PPGroupChangedEvent; | ||
use _64FF00\PurePerms\EventManager\PPRankExpiredEvent; | ||
use pocketmine\event\Listener; | ||
use pocketmine\event\entity\EntityTeleportEvent; | ||
use pocketmine\event\player\PlayerCommandPreprocessEvent; | ||
use pocketmine\event\player\PlayerQuitEvent; | ||
use pocketmine\event\player\PlayerLoginEvent; | ||
use pocketmine\lang\Translatable; | ||
use pocketmine\player\Player; | ||
use pocketmine\utils\TextFormat; | ||
|
||
class PPListener implements Listener | ||
{ | ||
/* | ||
PurePerms by 64FF00 (Twitter: @64FF00) | ||
888 888 .d8888b. d8888 8888888888 8888888888 .d8888b. .d8888b. | ||
888 888 d88P Y88b d8P888 888 888 d88P Y88b d88P Y88b | ||
888888888888 888 d8P 888 888 888 888 888 888 888 | ||
888 888 888d888b. d8P 888 8888888 8888888 888 888 888 888 | ||
888 888 888P "Y88b d88 888 888 888 888 888 888 888 | ||
888888888888 888 888 8888888888 888 888 888 888 888 888 | ||
888 888 Y88b d88P 888 888 888 Y88b d88P Y88b d88P | ||
888 888 "Y8888P" 888 888 888 "Y8888P" "Y8888P" | ||
*/ | ||
|
||
private $plugin; | ||
|
||
/** | ||
* @param PurePerms $plugin | ||
*/ | ||
public function __construct(PurePerms $plugin) | ||
{ | ||
$this->plugin = $plugin; | ||
} | ||
|
||
/** | ||
* @param PPGroupChangedEvent $event | ||
* @priority LOWEST | ||
*/ | ||
public function onGroupChanged(PPGroupChangedEvent $event) | ||
{ | ||
$player = $event->getPlayer(); | ||
$this->plugin->updatePermissions($player); | ||
} | ||
|
||
/** | ||
* @param EntityTeleportEvent $event | ||
* @priority MONITOR | ||
*/ | ||
public function onLevelChange(EntityTeleportEvent $event) | ||
{ | ||
if($event->isCancelled()) return; | ||
$player = $event->getEntity(); | ||
if($player instanceof Player) { | ||
$this->plugin->updatePermissions($player, $event->getTo()->getWorld()->getDisplayName()); | ||
} | ||
} | ||
|
||
public function onPlayerCommand(PlayerCommandPreprocessEvent $event) | ||
{ | ||
$message = $event->getMessage(); | ||
$player = $event->getPlayer(); | ||
|
||
if(substr($message, 0, 1) === "/") | ||
{ | ||
$command = substr($message, 1); | ||
$args = explode(" ", $command); | ||
|
||
if(!$this->plugin->getNoeulAPI()->isAuthed($event->getPlayer())) | ||
{ | ||
$event->cancel(); | ||
|
||
if($args[0] === "ppsudo" or $args[0] === "help") | ||
{ | ||
$this->plugin->getServer()->dispatchCommand($player, $command); | ||
} | ||
else | ||
{ | ||
$this->plugin->getNoeulAPI()->sendAuthMsg($player); | ||
} | ||
} | ||
else | ||
{ | ||
$disableOp = $this->plugin->getConfigValue("disable-op"); | ||
|
||
if($disableOp and $args[0] === "op") | ||
{ | ||
$event->cancel(); | ||
|
||
$player->sendMessage(new Translatable(TextFormat::RED . "%commands.generic.permission")); | ||
} | ||
} | ||
} | ||
} | ||
|
||
/** | ||
* @param PlayerLoginEvent $event | ||
* @priority LOWEST | ||
*/ | ||
public function onPlayerLogin(PlayerLoginEvent $event) | ||
{ | ||
$player = $event->getPlayer(); | ||
$this->plugin->registerPlayer($player); | ||
} | ||
|
||
/** | ||
* @param PlayerQuitEvent $event | ||
* @priority HIGHEST | ||
*/ | ||
public function onPlayerQuit(PlayerQuitEvent $event) | ||
{ | ||
$player = $event->getPlayer(); | ||
$this->plugin->unregisterPlayer($player); | ||
} | ||
|
||
/** | ||
* @param PPRankExpiredEvent $event | ||
* @priority LOWEST | ||
*/ | ||
public function onRankExpired(PPRankExpiredEvent $event) | ||
{ | ||
$player = $event->getPlayer(); | ||
$this->plugin->setGroup($player, $this->plugin->getDefaultGroup()); | ||
} | ||
} |