Plugin help

Discussion in 'Spigot Plugin Development' started by forseth11, Jun 14, 2015.

  1. Someone told me that a plugin I made for them is causing their server to not let people join and they get kicked with this error: http://gyazo.com/8d59d6beb037e2c6d40d5cf4a2fb2cd4

    They said that the error was because of a chat size limit I made.

    From the information they given my I found two pieces of code which could be causing this problem but I have no idea what part is:

    Code (Text):
    @EventHandler
        public void join(PlayerJoinEvent event){
            long value = main.getPlayerLogConfig().getLong(event.getPlayer().getUniqueId().toString());
            if(value == 0){
                main.getPlayerLogConfig().set(event.getPlayer().getUniqueId().toString(), System.currentTimeMillis());
               
                try {
                    main.getPlayerLogConfig().save(main.getPlayerLogFile());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
           
            if(event.getPlayer().hasPermission("MinStaff.forseth11.admin")){
                int reportSize = main.getConfigC().getList("reports").size();
                int issueSize = main.getConfigC().getList("issues").size();
               
                Player p = event.getPlayer();
                p.sendMessage("§4§l>> §cReports: §2" + reportSize);
                p.sendMessage("§4§l>> §cIssues: §2" + issueSize);
                p.sendMessage("§4§l>> §cUnreviewed Chat: §2" + main.getChat().size());
            }
           
            if(event.getPlayer().hasPermission("MinStaff.forseth11.adminPass")){
                main.setAdminPass(true);
            }
        }
    Code (Text):
    @EventHandler
        public void chat(AsyncPlayerChatEvent event){
            if(event.getMessage().length() > main.getChatLength() && !event.getPlayer().hasPermission("MinStaff.forseth11.admin")){
                long time = System.currentTimeMillis() - main.getPlayerLogConfig().getLong(event.getPlayer().getUniqueId().toString());
                if(time < (main.getChatDelay() * 1000)){
                    event.getPlayer().sendMessage("§4You must wait " + (main.getChatDelay()-(time / 1000)) + " seconds before you can chat messages longer than " + main.getChatLength() + " characters.");
                    event.setCancelled(true);
                }
            }
           
            if(!event.isCancelled()){
                if(!main.isAdminPass()){
                    if(main.getChat().size() > 10000){
                        main.getChat().remove(0);
                    }
                    main.getChat().add(event.getPlayer().getName().replace("%", "%0").replace(".", "%1") + "." + System.currentTimeMillis() + "." + event.getMessage().replace("%", "%0").replace(".", "%1"));
                }
            }
        }
    What is wrong with this code that is causing this error.