Skip to content

Instantly share code, notes, and snippets.

@TheNewHEROBRINEX
Last active May 17, 2023 23:31
Show Gist options
  • Save TheNewHEROBRINEX/7595eb7409ae49a0e45175fb8374f948 to your computer and use it in GitHub Desktop.
Save TheNewHEROBRINEX/7595eb7409ae49a0e45175fb8374f948 to your computer and use it in GitHub Desktop.
<?php
public function onPreCommand(PlayerCommandPreprocessEvent $event) {
$message = $event->getMessage();
if ($message{0} == "/") {
$offset = 1; // /comando
}
elseif (substr($message, 0, 2) == "./") {
$offset = 2; // ./comando
}
else {
return; //non è un commando
}
$label = explode(" ", trim(substr($message, $offset)))[0];
$command = $this->getServer()->getCommandMap()->getCommand($label);
if ($command instanceof Command and in_array($command->getName(), $this->bannedCommands)) {
$event->setCancelled(); // banned
}
}
@ItsGabry
Copy link

vafangul grz

@RubyTemple
Copy link

RubyTemple commented Jan 14, 2020

We uagliù bell stu codice, peccato che non vada con gli spazzi

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment