Colored Kick Message

Discussion in 'Archived: Plugin Requests' started by Icee2199, Sep 3, 2012.

  1. Offline

    Icee2199

    Hello, Its Icee2199. I have been looking for a plugin that would allow you to kick someone with a color reason like /kick &cEnough and it would show up like this on there kick screen:
    Enough.
    In other words a plugin that could add color support to kicking. I have mcbans and I prefer to use that for kicking so if the plugin could not add a command but add colorcode support to the kick and ban screen that would be great :D

    Thanks,
    Icee2199
     
  2. Offline

    Vandrake

    I don't know if this is possible but its a good idea xD I will test it for myself when I get home.
     
  3. Offline

    Icee2199

    Ok, because I have seen like colorcoded kicks on certain servers. And a few plugins like a whitelist plugin have Whitelist colorcode support.
    Thanks For checking it out so quickly :D
     
  4. Offline

    Vandrake

    Well I managed to make a preset color but I could not add support to other colors like &4 or &5. So in short:
    you can kick them with a color you want just tell me the color and ill manage it for you or...You can wait for someone with more skills to make it for you xD Sorry I'm such a newb D:
     
  5. Offline

    bobacadodl

    Oohh I want to try this :)
     
  6. Offline

    Icee2199

    Thanks for trying Vandrake :D Im following you now
     
  7. Offline

    bobacadodl

    Here it is its untested so let me know if it doesn't work. I also added support for the formatting codes (&l, &m &n &o)
    DOWNLOAD: http://lh.rs/cWXXgYxwnLVQ
     
  8. Offline

    Icee2199

    Thanks :D Ill test it now

    Doesnt seem to be working,

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 28, 2016
  9. Offline

    bobacadodl

    Are there any errors? Also, tag me next time so that I notice that you've replied :)

    Oh, I forgot to tell you the permissions *facepalm* give the users that you want to be able to /ckick someone the permission ckick.kick. Also, the command format is /ckick [playername] [kickmessage]

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 28, 2016
  10. Offline

    Icee2199

    Ohh OK

    Code:
    10:25:40 [SEVERE] null
    org.bukkit.command.CommandException: Unhandled exception executing command 'ckic
    k' in plugin ColorKick v0.1
            at org.bukkit.command.PluginCommand.execute(PluginCommand.java:42)
            at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:16
    8)
            at org.bukkit.craftbukkit.CraftServer.dispatchCommand(CraftServer.java:4
    92)
            at net.minecraft.server.NetServerHandler.handleCommand(NetServerHandler.
    java:878)
            at net.minecraft.server.NetServerHandler.chat(NetServerHandler.java:825)
     
            at net.minecraft.server.NetServerHandler.a(NetServerHandler.java:807)
            at net.minecraftserverhook.NetServerHandlerProxy.a(NetServerHandlerProxy
    .java:124)
            at net.minecraft.server.Packet3Chat.handle(Packet3Chat.java:44)
            at net.minecraft.server.NetworkManager.b(NetworkManager.java:276)
            at net.minecraft.server.NetServerHandler.d(NetServerHandler.java:109)
            at net.minecraft.server.ServerConnection.b(SourceFile:35)
            at net.minecraft.server.DedicatedServerConnection.b(SourceFile:30)
            at net.minecraft.server.MinecraftServer.q(MinecraftServer.java:581)
            at net.minecraft.server.DedicatedServer.q(DedicatedServer.java:212)
            at net.minecraft.server.MinecraftServer.p(MinecraftServer.java:474)
            at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:406)
            at net.minecraft.server.ThreadServerApplication.run(SourceFile:539)
    Caused by: java.lang.ArrayIndexOutOfBoundsException: 0
            at com.github.bobacadodl.ColorKick.ColorKick.onCommand(ColorKick.java:15
    )
            at org.bukkit.command.PluginCommand.execute(PluginCommand.java:40)
            ... 16 more
    
    This is what i get when i do /ckick
    bobacadodl

    And then if I just do /ckick &ctest it shows up as &ctest

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 28, 2016
  11. Offline

    Vandrake

    ye thats what im getting currently too xD if I add ChatColor.(color) + behind the reason I can set it to a color however. Im thinking of a PlayerKickEvent and setReason to the args the player sent. What do you think bob?
     
  12. Offline

    bobacadodl

  13. Offline

    Vandrake

    Cant find the file o.o
     
  14. Offline

    bobacadodl

    Icee2199
    you tag someone by putting an "@" symbol and then their name

    Its under 30 lines too :)
    Code:
    package com.github.bobacadodl.ColorKick;
    import java.util.logging.Level;
    import org.bukkit.Bukkit;
    import org.bukkit.ChatColor;
    import org.bukkit.command.Command;
    import org.bukkit.command.CommandSender;
    import org.bukkit.entity.Player;
    import org.bukkit.plugin.java.JavaPlugin;
    public class ColorKick extends JavaPlugin{
        public void onEnable(){
            this.getLogger().log(Level.INFO,"ColorKick 0.1 by bobacadodl enabled!");
        }
        public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args){
            if(cmd.getName().equalsIgnoreCase("ckick") && sender.hasPermission("ckick.kick")){
                Player kicked = Bukkit.getServer().getPlayer(args[0]);
                if(kicked==null){
                    sender.sendMessage(ChatColor.RED+args[0]+" is not online!");
                    return false;
                }
                String kickmessage = "";
                for(int i=1; i<args.length; i++){
                    kickmessage = kickmessage+args[i]+" ";
                }
                String newkickmessage = kickmessage.replaceAll("&1", "§1").replaceAll("&2", "§2").replaceAll("&3", "§3").replaceAll("&4", "§4").replaceAll("&5", "§5").replaceAll("&6", "§6").replaceAll("&7", "§7").replaceAll("&8", "§8").replaceAll("&9", "§9").replaceAll("&a", "§a").replaceAll("&b", "§b").replaceAll("&c", "§c").replaceAll("&d", "§d").replaceAll("&e", "§e").replaceAll("&f", "§f").replaceAll("&l", "§l").replaceAll("&m", "§m").replaceAll("&n", "§n").replaceAll("&o", "§o");   
                kicked.kickPlayer(newkickmessage);
                return true;
            }
            return false;
        }
    }
    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 28, 2016
  15. Offline

    Vandrake

  16. Offline

    calebbfmv

    lol hey just going to plug my plugin here, but if you want people to be kicked when they start annoying you, just go check out KickOP. Also, this plugin has already been made so I don't see a reason for me to remake it, once he gets the dl link working.
     
  17. Offline

    bobacadodl

  18. Offline

    Vandrake

    I see O.O so to recognize the &4 color we must replace it in the string with §4! :D Thanks! ^^ I learned yet another thing :3 Edit: The link works now :p
     
  19. Offline

    bobacadodl

    calebbfmv I don't think that's what he is looking for.. Also, I just made this for practice :)
     
  20. Offline

    Icee2199

    It Works :D Thanks
     
  21. Offline

    bobacadodl

    Yeah, minecraft uses chat colors by putting those codes in front of the text. Check out this page:
    http://www.minecraftwiki.net/wiki/Classic_server_protocol#Color_Codes

    no problem

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 28, 2016
    FlareLine likes this.
  22. Offline

    Icee2199

    Yeah but the § doesnt show up in chat, you can even do it in chat

    @bobacadodl
    Could you Possibly add a broadcast like [Kick] <name> was kicked by <admin> [<Reason>]
    You dont have to but just a idea

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 28, 2016
  23. Offline

    bobacadodl

    I have to go somewhere right now. I might be able to add it this evening. If not then I will add it tomorrow afternoon
     
  24. Offline

    Icee2199

    ok

    bobacadodl
    I would like to offer you Developer rank on my server since you made such a good plugin and you seem like a good developer.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 28, 2016

Share This Page