Plugin Help Why wont my Plugin Work?

Discussion in 'Plugin Help/Development/Requests' started by Eperl33, May 15, 2015.

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

    Eperl33

    I am trying to code my first plugin, and it seems that it is not working. Can someone help me out?

    Here is my code:
    Code:
    package me.Eperl33.Test;
    
    import org.bukkit.ChatColor;
    import org.bukkit.GameMode;
    import org.bukkit.command.Command;
    import org.bukkit.command.CommandSender;
    import org.bukkit.entity.Player;
    import org.bukkit.plugin.java.JavaPlugin;
    
    public class Test extends JavaPlugin{
         @Override
            public void onEnable() {
                     getLogger().info("Plugin Test has been enabled");
                 }
        
            @Override
            public void onDisable() {
                    getLogger().info("Plugin Test has been disabled");
               
            }
    
        public boolean onCommand(CommandSender sender, Command cmd, String label, String []args){
            Player player = (Player) sender;
                if(label.equalsIgnoreCase("c")){
                    if(player.hasPermission("GameMode.c")){
                        player.setGameMode(GameMode.CREATIVE);
                   
                }else{
                    player.sendMessage(ChatColor.RED + "Permission denied");
                }
               
            }
            if(label.equalsIgnoreCase("s")){
                if(player.hasPermission("GameMode.s")){
                    player.setGameMode(GameMode.SURVIVAL);
                   
                }else{
                    player.sendMessage(ChatColor.RED + "Permission denied");
                }
               
            }
            return false;
           
           
               
               
               
               
            }
        }
    


    Also, this is my plugin.yml:


    Code:
    name: Test
    main: me.Eperl33.Test.Test
    version: 1.0
    commands:
           c:
             description: gamemode c
                usage: /<command>
          s:
            description: gamemode s
            usage: /<command>
    Thanks for the help! :)
     
  2. Offline

    pie_flavor

    @Eperl33 If that's your plugin.yml, I found the problem. Your spacing is off. C is a space forward from S. To make this easier, just use 2 spaces as your indent.
     
Thread Status:
Not open for further replies.

Share This Page