Plugin Not Showing Up

Discussion in 'Plugin Development' started by will181, Mar 24, 2014.

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

    will181

    I'm just returning to programming plugins for the first time in a long time, and thought I'd create a plugin just to remind me how to do it. However, I've now finished this plugin, but it doesn't show up or get at all recognised by the server at all.

    The plugin is supposed to clear the chat by just spamming a load of new lines.

    Here's the Source:

    package tk.slothcraft.will181.cc;

    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.PluginManager;
    import org.bukkit.plugin.java.JavaPlugin;

    public class ClearChat extends JavaPlugin{

    PluginManager pm = getServer().getPluginManager();

    public void onEnable(){
    System.out.println("Clear Chat Has Started Successfully!");
    }

    public void onDisable(){
    System.out.println("Clear Chat Has Stopped Successfully!");
    }

    public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args){
    if(!cmd.getName().equalsIgnoreCase("clearchat")){
    return false;
    }
    if(sender instanceof Player){
    Player player = (Player) sender;
    if(!player.hasPermission("clearchat.go")){
    player.sendMessage(ChatColor.DARK_RED + "[CC]" + ChatColor.YELLOW + "You don't have permission!");
    return true;
    }else{
    int x=0;

    while(x<35){
    Bukkit.broadcastMessage("");
    x++;
    }
    Bukkit.broadcastMessage(ChatColor.DARK_RED + "Chat cleared by " + sender);

    return true;
    }
    }
    return true;
    }

    }

    The YML

    name: ClearChat
    main: tk.slothcraft.will181.cc
    version: 0.1
    description: Clear the chat
    commands:
    clearchat:
    description: Clears the chat
    usage: /<command>
    permission: clearchat.go
    permission-message: You do not have permission!

    An Image of the workplace

    http://prntscr.com/33vorw
     
  2. Offline

    Esophose

    The plugin isn't registering because you aren't linking to the main class correctly. The plugin.yml should have
    main: tk.slothcraft.will181.cc.ClearChat
     
  3. Offline

    deasertman

    You did not include the class name in your plugin.yml "main" part. It should be:
    tk.slothcraft.will181.cc.ClearChat

    From the wiki.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 7, 2016
  4. Offline

    will181

    I've made that change and it still isn't working.

    YML now:

    name: ClearChat
    main: tk.slothcraft.will181.cc.ClearChat
    version: 0.1
    description: Clear the chat
    commands:
    clearchat:
    description: Clears the chat
    usage: /clearchat
    permission: clearchat.go
    permission-message: You do not have permission!
     
  5. will181

    Did you put your plugin in the plugins folder?
     
  6. Offline

    will181


    Yeah
     
  7. Offline

    BrushPainter

    will181 You forgot to register your permissions in your plugin.yml:
    Code:
    name: ClearChat
    main: tk.slothcraft.will181.cc.ClearChat
    version: 0.1
    description: Clears the chat.
     
    commands:
      clearchat:
        description: Clears the chat.
        usage: /clearchat
        permission: clearchat.go
        permission-message: You do not have permission!
     
    permissions:
      clearchat.go:
        description: Allows you to clear the chat.
        default: op 
     
  8. Offline

    will181

    That has finally fixed it. Thank you
     
  9. Offline

    BrushPainter

    will181 No problem, but next time please tag me or I do not get notified that you replied to me. :)
     
  10. Offline

    will181

Thread Status:
Not open for further replies.

Share This Page