Example #1
0
 /**
  * @param User $user
  * @return bool
  */
 public function isBlocked(User $user) : bool
 {
     if ($this->config["enabled"]) {
         if (!$user->hasPermission("fish.spamprotect.bypass")) {
             if (isset($this->timers[$user->getAddress()])) {
                 $this->timers[$user->getAddress()] += 1;
                 if ($this->timers[$user->getAddress()] > $this->config["max_commands"]) {
                     return true;
                 }
             } else {
                 $this->timers[$user->getAddress()] = 1;
                 $this->connection->getScheduler()->scheduleDelayedTask(new SpamProtectionResetTask($this, $user), $this->config["time"]);
             }
         }
     }
     return false;
 }
Example #2
0
 /**
  * @param User $user
  */
 public function ban(User $user, $kick = false)
 {
     $this->setMode("b *!*@" . $user->getAddress());
     if ($kick == true) {
         $this->kick($user);
     }
 }