Kick Event

Discussion in 'Plugin Development' started by PatoTheBest, Jan 12, 2014.

Thread Status:
Not open for further replies.
  1. Offline

    PatoTheBest

    Hello, I have been coding a custom ban plugin for my friend but I am wondering how can you remove this messages from the console?
    Code:
    [21:52:11 INFO]: Disconnecting GameProfile{id='---', name='Pato_the_best'} (/127.0.0.1:59127): §4You have been banned from this server!
    §fAuthor: §cCONSOLE, §fDate: §c12-01-2014 21:52:08
    §fExpires in: §c18seconds
    §fReason: §cThe ban hammer has spoken
    [21:52:11 INFO]: GameProfile{id='---', name='Pato_the_best'} (/127.0.0.1:59127) lost connection: §4You have been banned from this server!
    §fAuthor: §cCONSOLE, §fDate: §c12-01-2014 21:52:08
    §fExpires in: §c18seconds
    
    Kick code:
    Code:java
    1. @EventHandler //evil line that I always forget but not his time :p
    2. public void PlayerLoginEvent(PlayerLoginEvent event) {
    3. if (SettingsManager.getInstance().checkBan(event.getPlayer().getName())){
    4. String player = event.getPlayer().getName();
    5. String kickMsg = "";
    6. event.disallow(PlayerLoginEvent.Result.KICK_OTHER, kickMsg);
    7. }
    8. }
     
  2. Offline

    GaaTavares

    As fair I know there is now way to remove it from console since it logs like everything..
     
  3. add a handler for the logger. (search the APIs yourself, if you need help feel free to quote me and ask me :) )
     
  4. Offline

    PatoTheBest

  5. Offline

    RawCode

  6. Offline

    bigteddy98

    You could only send a disconnect packet to the player. Will only disconnect, logs nothing.
     
  7. use isLoggable( or something like that)

    RawCode

    http://jd.bukkit.org/rb/doxygen/d7/d48/JavaPlugin_8java_source.html

    i referred to this, so... is it not updated or something?
     
  8. Offline

    PatoTheBest

    Louis1234567890987654321
    So can you help me? I didn't understand what you posted above. Can you provide me with a piece of code?
     
  9. Offline

    xTrollxDudex

    PatoTheBest
    PHP:
    Logger logger plugin.getLogger();
    public class 
    ConsoleHandler extends Handler {
        
    String[] stringArray = new String[4] { "Console""GameProfile""Expires""Reason" };
     
        @
    Override
        
    public boolean isLoggable(LogRecord record) {
            for(
    String s stringArray) {
                if(
    record.getMessage().contains(s)) {
                    return 
    false;
                }
            }
            return 
    true;
        }
    }
    logger.addHandler(new ConsoleHandler());
    for(
    Handler handler logger.getHandlers()) {
        if(
    handler instanceof ConsoleHandler) {
            
    handler.close();
        }
    }
    Try that.
     
Thread Status:
Not open for further replies.

Share This Page