Easy Plugin Help!

Discussion in 'Plugin Development' started by popcorn1012345, Mar 10, 2014.

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

    popcorn1012345

    I think I got everything right, but for some reason it won't work.

    Colors.Java:
    package me.popcorn1012345.colors;

    import org.bukkit.ChatColor;
    import org.bukkit.command.Command;
    import org.bukkit.command.CommandSender;
    import org.bukkit.plugin.java.JavaPlugin;

    public class Colors extends JavaPlugin {

    public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args) {
    if (cmd.getName().equalsIgnoreCase("chatcolors")) {

    sender.sendMessage(ChatColor.AQUA + "Aqua = &b");
    sender.sendMessage(ChatColor.GREEN + "Light green = &a");
    sender.sendMessage(ChatColor.LIGHT_PURPLE + "Pink = &d");
    sender.sendMessage(ChatColor.YELLOW + "Yellow = &e");
    sender.sendMessage(ChatColor.WHITE + "White = &f");
    sender.sendMessage(ChatColor.DARK_BLUE + "Dark Blue = &1");
    sender.sendMessage(ChatColor.DARK_GREEN + "Dark Green = &2");
    sender.sendMessage(ChatColor.DARK_AQUA + "Dark Aqua = &3");
    sender.sendMessage(ChatColor.DARK_RED + "Dark Red = &4");
    sender.sendMessage(ChatColor.DARK_PURPLE + "Purple = &5");
    sender.sendMessage(ChatColor.GOLD + "Gold = &6");
    sender.sendMessage(ChatColor.GRAY + "Gray = &7");
    sender.sendMessage(ChatColor.DARK_GRAY + "Dark Gray = &8");
    sender.sendMessage(ChatColor.BLUE + "Blue = &9");
    sender.sendMessage(ChatColor.BLACK + "Black = &0");

    }

    if (cmd.getName().equalsIgnoreCase("ChatEffects")) {
    sender.sendMessage(ChatColor.YELLOW + "[" + ChatColor.AQUA + "FishCraft" + ChatColor.YELLOW + "]");
    sender.sendMessage(ChatColor.BOLD + "Bold = &l");
    sender.sendMessage(ChatColor.UNDERLINE + "Underline = &n");
    sender.sendMessage(ChatColor.STRIKETHROUGH + "Strikethrough = &m");
    sender.sendMessage(ChatColor.ITALIC + "Italic = &o");
    sender.sendMessage("Reset formatting = &r");
    sender.sendMessage("Magic " + ChatColor.MAGIC + "ggg" + ChatColor.RESET + " = &k");
    }
    returnfalse;

    }

    }




    plugin.yml:


    name: Colors
    version: 1.0
    main: me.popcorn1012345.colors.Colors
    author: popcorn1012345
    description: List all color codes!

    commands:
    chatcolors:
    usage: /<command>
    description: Lists all color codes!
    chateffects:
    usage: /<command>
    description: Lists all Chat effects!
     
  2. Offline

    adam753

    There are a few mistakes you could be making that would cause it not to work. The first question is, what do you mean by "doesn't work"? Does it not compile, or does the server give an error message in the console, or does it start up normally but the commands don't work?
     
  3. Offline

    jboy44

    popcorn1012345
    To add onto what adam753 said: when posting your code, make sure to use some sort of pasting website such as this one.

    Not only does this make it easier for us to read allowing us to see indentations etc, but it also makes your thread more organized.
     
  4. Offline

    adam753

    jboy44
    Or just use [syntax=java][/syntax] if there's not a huge amount of code. (or [code][/code] if there's just a few lines)
     
Thread Status:
Not open for further replies.

Share This Page