1. The forums will be archived and moved to a read only mode in about 2 weeks (mid march).

Anyone know how to remove the first part of the ban message?

Discussion in 'Help' started by EerieAlchemist, Mar 1, 2020.

  1. EerieAlchemist

    EerieAlchemist Spider Jockey

    Messages:
    36
    I've been trying to do this but to no avail. I want to remove the "kicked by admin. reason:" part. Any help?
     

    Attached Files:

  2. HimbeersaftLP

    HimbeersaftLP Fish

    Messages:
    2,402
    GitHub:
    HimbeersaftLP
  3. EerieAlchemist

    EerieAlchemist Spider Jockey

    Messages:
    36
    Did not work for me.
     
  4. HimbeersaftLP

    HimbeersaftLP Fish

    Messages:
    2,402
    GitHub:
    HimbeersaftLP
    It should though, did you restart (not reload) the server after changing that line in your plugin?
     
  5. EerieAlchemist

    EerieAlchemist Spider Jockey

    Messages:
    36
    I've done that, and the same message appears.
     
  6. EerieAlchemist

    EerieAlchemist Spider Jockey

    Messages:
    36
  7. HimbeersaftLP

    HimbeersaftLP Fish

    Messages:
    2,402
    GitHub:
    HimbeersaftLP
    Can you send the part of code where you use that function?
     
  8. EerieAlchemist

    EerieAlchemist Spider Jockey

    Messages:
    36
    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
     
    Last edited: Mar 8, 2020
  9. Invy55

    Invy55 Witch

    Messages:
    52
    GitHub:
    invy55
    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.
     
  10. HimbeersaftLP

    HimbeersaftLP Fish

    Messages:
    2,402
    GitHub:
    HimbeersaftLP
    Nah, I meant the part of code in your plugin
     
  11. EerieAlchemist

    EerieAlchemist Spider Jockey

    Messages:
    36
    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"]));
     
  12. HimbeersaftLP

    HimbeersaftLP Fish

    Messages:
    2,402
    GitHub:
    HimbeersaftLP
    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"]));
     
  13. EerieAlchemist

    EerieAlchemist Spider Jockey

    Messages:
    36
     
  14. HimbeersaftLP

    HimbeersaftLP Fish

    Messages:
    2,402
    GitHub:
    HimbeersaftLP
    It's there in the code I sent im my last message:
    Code:
              here
                |
                V
    ssage"]), false);
    
     
  15. EerieAlchemist

    EerieAlchemist Spider Jockey

    Messages:
    36
    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.
     
    Last edited: Mar 8, 2020
  16. HimbeersaftLP

    HimbeersaftLP Fish

    Messages:
    2,402
    GitHub:
    HimbeersaftLP
    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)
     
    EerieAlchemist likes this.
  17. EerieAlchemist

    EerieAlchemist Spider Jockey

    Messages:
    36
    Awesome, thanks for the help!
     
    HimbeersaftLP likes this.
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.