Kicking a player from hell causes a crash

Discussion in 'Plugin Development' started by Raphfrk, Feb 4, 2011.

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

    Raphfrk

    Has anyone else seen this?

    I tried a simple testcase.

    Code:
        public void onPlayerCommand(PlayerChatEvent event) {
            
            String[] split = event.getMessage().split(" ",-1);
            
            if( split[0].equals("/clear")) {
                event.getPlayer().getInventory().clear(Integer.parseInt(split[1]));
                event.setCancelled(true);
                return;
            }
            
            if( split.length > 1 && split[0].equals("/kickme")) {
                event.getPlayer().kickPlayer(split[1]);
                event.setCancelled(true);   
            }
    
        }
    
    If I type "/kickme testing" into the console it crashes the server.

    This also happens with the onMoveEvent. I am guessing this is a known bug with the main server?
     
  2. Offline

    xupwup

    Maybe you should check if the player is online before trying to kick him? I think the reason for the crash is that the server is trying to kick a player that does not exist.
     
  3. Offline

    Raphfrk

    The above code kicks the player who types the command. I think the client is just going crazy.
     
Thread Status:
Not open for further replies.

Share This Page