Log Filter not working !

Discussion in 'Plugin Development' started by Trading69, May 17, 2024.

  1. Offline

    Trading69

    I wanted to make a plugin that deletes things like "Player issued server command: /kill Player" so I used java. util. logging.Filter like such :

    Code:
    package me.kavin.betterchat;
    import java.util.logging.Filter;
    import java.util.logging.LogRecord;
    
    public class FilterX implements Filter
    {
    @Override
    public boolean isLoggable(LogRecord record)
    {
    if(record.getMessage().contains("Catz7"))
    {
    return false;
    }
    else
    {
    return true;
    }
    }
    }
    And also in my OnEnable() added :
    Code:
    FilterX filter = new FilterX();
    Betterchat.getInstance().getServer().getLogger().setFilter(filter);
    
    Am I doing smth wrong because the Filter is not working and console still displays :

    C__WINDOWS_system32_cmd.exe 5_18_2024 10_55_33 AM.png
     
    Last edited by a moderator: May 20, 2024
  2. Offline

    timtower Administrator Administrator Moderator

  3. Offline

    Trading69

    @Override
    public void onEnable()
    {
    getServer().getPluginManager().registerEvents(new EntityListener(), this);
    FilterX filter = new FilterX();
    Betterchat.getInstance().getServer().getLogger().setFilter(filter);
    }

    Here
     

Share This Page