I've been trying to do this but to no avail. I want to remove the "kicked by admin. reason:" part. Any help?
PHP: public function kick(string $reason = "", bool $isAdmin = false, $quitMessage = null) : bool{ $ev = new PlayerKickEvent($this, $reason, $quitMessage ?? $this->getLeaveMessage()); $ev->call(); if(!$ev->isCancelled()){ $reason = $ev->getReason(); $message = $reason; if($isAdmin){ if(!$this->isBanned()){ $message = "Kicked by admin." . ($reason !== "" ? " Reason: " . $reason : ""); per Player.php
Please use [ PHP ] tag. * Note for plugin developers: use kick() with the isAdmin * flag set to kick without the "Kicked by admin" part instead of this method.
Whoops, sorry about that. Anyways, I think this is what you were looking for. PHP: if($target instanceof Player){ $target->kick(str_replace(["{day}", "{hour}", "{minute}", "{reason}", "{staff}"], [$data[1], $data[2], $data[3], $data[4], $player->getName()], $this->message["KickBanMessage"])); } $this->getServer()->broadcastMessage(str_replace(["{player}", "{day}", "{hour}", "{minute}", "{reason}", "{staff}"], [$this->targetPlayer[$player->getName()], $data[1], $data[2], $data[3], $data[4], $player->getName()], $this->message["BroadcastBanMessage"]));
You didn't make it false?! PHP: if($target instanceof Player){ $target->kick(str_replace(["{day}", "{hour}", "{minute}", "{reason}", "{staff}"], [$data[1], $data[2], $data[3], $data[4], $player->getName()], $this->message["KickBanMessage"]), false);}$this->getServer()->broadcastMessage(str_replace(["{player}", "{day}", "{hour}", "{minute}", "{reason}", "{staff}"], [$this->targetPlayer[$player->getName()], $data[1], $data[2], $data[3], $data[4], $player->getName()], $this->message["BroadcastBanMessage"]));
Ok, makes sense. Also, once I edit the PHP, how would I convert it into a PHAR file to upload as a plugin to my server? Sorry for the noob question.
Install the DevTools plugin, put the folder with the source code into the plugins directory and then run the command "/makeplugin name" (replace name with the name of your plugin as defined in the plugin.yml file)