Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updates PurePerms to API5 #116

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions plugin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@

name: PurePerms
main: _64FF00\PurePerms\PurePerms
version: 2.0.2
api: [4.0.0]
version: 2.1.0
api: [5.0.0]
load: POSTWORLD
author: "Vecnavium , 64FF00 & ProjectInfinity"
authors:
- "DemonicDev (bump to API5)"
permissions:
pperms:
default: op
Expand Down
28 changes: 9 additions & 19 deletions src/_64FF00/PurePerms/PPListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
use _64FF00\PurePerms\EventManager\PPRankExpiredEvent;
use pocketmine\event\Listener;
use pocketmine\event\entity\EntityTeleportEvent;
use pocketmine\event\player\PlayerCommandPreprocessEvent;
use pocketmine\event\server\CommandEvent;
use pocketmine\event\player\PlayerQuitEvent;
use pocketmine\event\player\PlayerLoginEvent;
use pocketmine\lang\Translatable;
Expand Down Expand Up @@ -60,25 +60,15 @@ public function onLevelChange(EntityTeleportEvent $event)
$this->plugin->updatePermissions($player, $event->getTo()->getWorld()->getDisplayName());
}
}

public function onPlayerCommand(PlayerCommandPreprocessEvent $event)
{
$message = $event->getMessage();
$player = $event->getPlayer();

if(substr($message, 0, 1) === "/")
public function onPlayerCommand(CommandEvent $event){
$sender = $event->getSender();
$command = $event->getCommand();
$disableOp = $this->plugin->getConfigValue("disable-op");
$args = explode(" ", $command);
if($disableOp and $args[0] === "op")
{
$command = substr($message, 1);
$args = explode(" ", $command);

$disableOp = $this->plugin->getConfigValue("disable-op");

if($disableOp and $args[0] === "op")
{
$event->cancel();

$player->sendMessage(new Translatable(TextFormat::RED . "%commands.generic.permission"));
}
$event->cancel();
$sender->sendMessage(new Translatable(TextFormat::RED . "%commands.generic.permission"));
}
}

Expand Down