"bit cannot be cast to fm" in banning plugin

Discussion in 'Plugin Development' started by JasonDL13, Feb 15, 2014.

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

    JasonDL13

    EDIT:
    I have fixed this issue by changing the EventPriority to LOWEST (Since HIGHEST is not needed
    Changed the Event to PlayerLoginEvent and change the kicked method to e.disallow
    with the result as null. That shows the kick message, even with color.
    Also it does not show a join message by default, so that is not needed.

    So I am making an essentials type plugin and I'm making a custom banning system.

    The way how it works is there is a ArrayList<String> filled with banned players in the format:
    PlayerName:Reason:WhoBanned
    (Since every thing else has failed)

    So this is my ban listener code:

    Code:java
    1. @EventHandler(priority = EventPriority.HIGHEST)
    2. public void onPlayerJoin(PlayerJoinEvent e) {
    3.  
    4. Player player = e.getPlayer();
    5.  
    6. for (String s : Banned.getBanned()) {
    7.  
    8. String[] info = s.split(":");
    9.  
    10. if(info[0].equalsIgnoreCase(player.getName())) {
    11.  
    12. String msg = ChatColor.RED + "You have been banned by " + info[2] + " for " + info[1];
    13.  
    14. player.kickPlayer(msg);
    15. e.setJoinMessage(null);
    16.  
    17. return;
    18.  
    19. }
    20.  
    21. }
    22.  
    23. }


    and the problem is, even though it works. In stead of saying the proper kick message like:

    You have been banned by JasonDL13 for cheating

    it says:

    Internal Exception: java.lang.ClassCastException: bit cannot be cast to fm.

    This only happens to banned players.

    Thanks.

    Jason
     
Thread Status:
Not open for further replies.

Share This Page