I'm jython/python bukkit plugin coder and I'm getting weird error.. I'm trying to recode something that's already done (in Java) in Python... Here's the java part of code:

Code:
        HashMap<Player, String> channelList = new HashMap<Player, String>();
        public void useChannel(Player p, String format, String channel){
        if(channel == "main"){
            Bukkit.broadcastMessage(format);
        } else {
              Player[] online = Bukkit.getOnlinePlayers();
              for(int a = 0; a <= online.length - 1; a++){
                  if(channelList.get(online[a]) == channel){
                      online[a].sendMessage("*" + format);
                  }
              }
        }
    }
 
    @EventHandler
    public void onChat(AsyncPlayerChatEvent event){
        event.setCancelled(true);
        String channel = event.getMessage().substring(0, 1);
        String userChannel = "";
        switch(channel){
        case "!": userChannel = "spanish";
        case "?": userChannel = "french";
        case "@": userChannel = "dutch";
        case "$": userChannel = "spanish";
        default: userChannel = "main";     
        }
        useChannel(event.getPlayer(), event.getFormat(), userChannel);
    }
}
and here's what I made in python/jython (have on mind that this maybe is not same and that's the cause of error):


Code:
        channelList = HashMap()

        def useChannel(self):
        format = event.player.AsyncPlayerChatEvent.getFormat()    
        if(channel == "main"):
          Bukkit.broadcastMessage(format)
        else:
            online = Bukkit.getOnlinePlayers()
            b = online.lenght - 1
            a = 0
            for a in a <= b:
                if channelList.get(online[a]) == channel:
                   online[a].sendMessage("* %s"%format)
                   
    def balkanChannel(self):
        userChannel = "balkan"
        return userChannel
    
    def germanChannel(self):
        userChannel = "german"
        return userChannel
        
    @hook.event("player.AsyncPlayerChatEvent", "HIGHEST")
    def onAsyncPlayerChatEvent(event):
        event.setCancelled(1)
        channel = event.getMessage().substring(0, 1)
        userChannel = ""  
        try:
           options = {
                   '!': pyplugin.balkanChannel,
                   '$': pyplugin.germanChannel}
           if value in switch:
              switch[value]() 
           else:
               pass
        except KeyError:
              userChannel = "main"
        pyplugin.useChannel(event.getPlayer(), event.getFormat(), userChannel)
This is chat-related plugin, which should upon AsyncChatPlayerEvent check if there is ! or $ prefix in message... Those prefixes are done as "cases" in Java, but as far as I know, there is no thing like that in Python, so I've done it this way (which maybe is not right way) ?

Here's the error I get upon chatting with those prefixes ($ and !):


Code:
    14:38:59 [SEVERE] java.util.logging.ErrorManager: 5
    >
    Exception: org.python.core.PyException thrown from the UncaughtExceptionHandler
    in thread "Connection #1 read thread"
To sum up, I'm trying to "re-code" above java code to python/jython, but I get some weird error...

Thanks for answering!

P.S. server freezes after it spitts error...