Skip to content
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
7 changes: 3 additions & 4 deletions .poggit.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
--- # Poggit-CI Manifest. Open the CI at https://poggit.pmmp.io/ci/adeynes/cucumber
--- # Poggit-CI Manifest. Open the CI at https://poggit.pmmp.io/ci/BlackD14/cucumber
branches:
- master
- stable

projects:
cucumber:
libs:
- src: poggit/libasynql/libasynql
version: ^3.3.0
- src: adeynes/parsecmd/parsecmd
- src: BlackD14/parsecmd/parsecmd
version: ^5.0.0
- src: adeynes/asyncio/asyncio
- src: BlackD14/asyncio/asyncio
version: ^0.1.0
...
4 changes: 2 additions & 2 deletions plugin.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: cucumber
main: adeynes\cucumber\Cucumber
version: 3.0.0
api: 4.0.0
api: 5.0.0
author: adeynes
description: Advanced, flexible moderation plugin
website: https://github.com/adeynes/cucumber
Expand Down Expand Up @@ -87,4 +87,4 @@ permissions:

cucumber.command.history:
description: "Allows for the user of /history"
default: op
default: op
12 changes: 7 additions & 5 deletions src/adeynes/cucumber/CucumberListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,12 @@
use adeynes\cucumber\utils\Queries;
use pocketmine\event\Listener;
use pocketmine\event\player\PlayerChatEvent;
use pocketmine\event\player\PlayerCommandPreprocessEvent;
use pocketmine\event\server\CommandEvent as PlayerCommandEvent;
use pocketmine\event\player\PlayerJoinEvent;
use pocketmine\event\player\PlayerLoginEvent;
use pocketmine\event\player\PlayerPreLoginEvent;
use pocketmine\event\player\PlayerQuitEvent;
use pocketmine\player\Player;

final class CucumberListener implements Listener
{
Expand Down Expand Up @@ -66,10 +67,11 @@ public function onChat(PlayerChatEvent $ev)
}
}

public function onCommandPreprocess(PlayerCommandPreprocessEvent $ev)
public function onPlayerCommand(PlayerCommandEvent $ev)
{
if (str_starts_with(($command = $ev->getMessage()), '/') && $this->log_command) {
(new CommandEvent($ev->getPlayer(), $command))->call();
$sender = $ev->getSender();
if ($sender instanceof Player && $this->log_command) {
(new CommandEvent($sender, $ev->getCommand()))->call();
}
}

Expand Down Expand Up @@ -124,4 +126,4 @@ public function onCucumberEvent(CucumberEvent $ev)
$log_dispatcher->log($log_dispatcher->formatEventMessage($ev), $ev->getSeverity());
}

}
}
4 changes: 2 additions & 2 deletions src/adeynes/cucumber/event/CommandEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,12 @@ public function getCommand(): string

public function getFormatData(): array
{
return parent::getFormatData() + ['command' => $this->getCommand()];
return parent::getFormatData() + ['command' => '/' . $this->getCommand()];
}

public function getMessagesPath(): string
{
return 'log.command';
}

}
}
4 changes: 2 additions & 2 deletions src/adeynes/cucumber/utils/ds/Enum.php
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,8 @@ public static function __callStatic(string $name, mixed $arguments)
throw new BadMethodCallException("No static method or enum constant '$name' in class " . get_called_class());
}

public function jsonSerialize()
public function jsonSerialize(): array
{
return $this->getValue();
}
}
}
4 changes: 2 additions & 2 deletions src/adeynes/cucumber/utils/ds/Stack.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public function rewind(): void
$this->position = 0;
}

public function current()
public function current(): mixed
{
return $this->peek($this->position);
}
Expand Down Expand Up @@ -74,4 +74,4 @@ public function peek(int $index = 0): mixed
return $this->stack[$index] ?? null;
}

}
}