elementalgodz11 do Code:java @EventHandlerpublic void onKick(PlayerKickEvent event){if(event.getPlayer().isBanned()){event.setQuitMessage(null);}
Do you ban them before or after you kick them? Ban them 1st then use the code given above Code:java if (cmd.getName().equalsIgnoreCase("ban")){if (args.length == 1) { Player p = (Player)sender;String targetname = args[0]; if (Bukkit.getPlayer(targetname) != null){Player target = Bukkit.getPlayer(targetname);target.kickPlayer(targetname);target.setBanned(true);Bukkit.broadcastMessage(ChatColor.GREEN + sender.getName() + ChatColor.GRAY + " banned " + ChatColor.GREEN + target.getName());}else{if (Bukkit.getOfflinePlayer(targetname).hasPlayedBefore()){OfflinePlayer offlinetarget = Bukkit.getOfflinePlayer(targetname);offlinetarget.setBanned(true);Bukkit.broadcastMessage(ChatColor.GREEN + sender.getName() + ChatColor.GRAY + " banned " + ChatColor.GREEN + offlinetarget.getName());}else{p.sendMessage("Unknown player");}} }} Huh? The code i just supplied will resolve an issue of online/offline players. If your message is still not working as expected it will be a problem with your events. Are you regestering your events, show us what your events do This should be: target.kickPlayer(targetname); @EventHandler public void onKick(PlayerKickEvent e){ e.setReason(kickReason) e.setLeaveMessage(leaveMessage) } EDIT by Moderator: merged posts, please use the edit button instead of double posting.
There is no reason why the kick Event message will not work. Thats the purpose of it, and it works for everyone else. Paste your class(es) as they are now What class are the events in yeah, show me Ok, heres what i would do. Code: List<String> kicked = new ArrayList<String>(); //create an arraylist public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args) { if (cmd.getName().equalsIgnoreCase("kick")) { if (sender.hasPermission("kits.kick")) { if (args.length == 2) { Player target = Bukkit.getPlayer(args[0]); if (target != null) { int i = 1; int para = args.length; String MSG = ""; while (i < para) { MSG = MSG + " " + args; i++; } target.kickPlayer(ChatColor.RED + "You was kicked by " + sender.getName() + "\n" + ChatColor.GRAY + MSG); kicked.add(target.getName()); //add the kicked player to the list Bukkit.getServer().broadcastMessage( ChatColor.GREEN + sender.getName() + ChatColor.GRAY + " kicked " + ChatColor.GREEN + target.getName()); } else { sender.sendMessage(ChatColor.RED + "Error: " + ChatColor.GRAY + "Player not found."); } } else { sender.sendMessage(ChatColor.RED + "Usage: " + ChatColor.GRAY + "/kick <player> <reason>"); } } } return false; } then in your quit event: Code: @EventHandler public void onQuit(PlayerQuitEvent e){ Player p = e.getPlayer(); if (KickCommand.kicked.contains(p.getName())){ e.setQuitMessage(null); KickCommand.kicked.remove(p.getName()); return; }else{ if (p.isBanned()) { e.setQuitMessage(null); } else { e.setQuitMessage(ChatColor.GREEN + p.getName() + ChatColor.GREEN + " Left"); } } } EDITED TO FIX A MISTAKE Hmm, are you getting any errors in the console. I wonder if its because your using the target variable (which is an onlinePlayer) after the player has been kicked (making them an offline player) Let me modify the code to test.... try this: Code: public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args) { if (cmd.getName().equalsIgnoreCase("kick")) { if (sender.hasPermission("kits.kick")) { if (args.length == 2) { Player target = Bukkit.getPlayer(args[0]); String targetname = target.getName(); if (target != null) { int i = 1; int para = args.length; String MSG = ""; while (i < para) { MSG = MSG + " " + args; i++; } target.kickPlayer(ChatColor.RED + "You was kicked by " + sender.getName() + "\n" + ChatColor.GRAY + MSG); kicked.add(targetname); // add the kicked player // to the list Bukkit.getServer().broadcastMessage( ChatColor.GREEN + sender.getName() + ChatColor.GRAY + " kicked " + ChatColor.GREEN + targetname); } else { sender.sendMessage(ChatColor.RED + "Error: " + ChatColor.GRAY + "Player not found."); } } else { sender.sendMessage(ChatColor.RED + "Usage: " + ChatColor.GRAY + "/kick <player> <reason>"); } } } return false; } } EDIT by Moderator: merged posts, please use the edit button instead of double posting.
elementalgodz11 Not sure if this has been said ... but maybe another plugin is overriding your quit event. Try setting the priority to Highest or maybe even Monitor.