Solved Plugin not working

Discussion in 'Plugin Development' started by Trumpet99, Mar 5, 2020.

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

    Trumpet99

    I'm not sure how to delete a post but I just wanted to say I figured it out about 5 minutes after I posted this. THE ANSWER: My minecraft server is running on 1.7.10 but my plugin was made using java SE 1.13, so I changed it to 1.7 and it worked. Mods can delete this post or change tag to solved

    Hello, I have just started getting into plugin development. I followed a tutorial on how to make your own plugin then export it, so it can work with your server. However, it does not when I do /pl. I reload the server beforehand as they said to do. I have downloaded some plugins, such as world edit, and they work fine, only my custom one doesn't work.

    I think these are what people call the logs: https://pastebin.com/MbQuJTXp

    Code:
    Main:
    Code:
    package me.trumpet.helloworld;
    
    import me.trumpet.helloworld.commands.HelloCommand;
    import org.bukkit.plugin.java.JavaPlugin;
    
    public class Main extends JavaPlugin{
     
        @Override
        public void onEnable()
        {
            System.out.println("Plugin works woohoo!");
            new HelloCommand(this);
        }
     
    
    }
    
    HelloCommand
    Code:
    package me.trumpet.helloworld.commands;
    
    import me.trumpet.helloworld.Main;
    import org.bukkit.command.Command;
    import org.bukkit.command.CommandExecutor;
    import org.bukkit.command.CommandSender;
    import org.bukkit.entity.Player;
    
    
    
    public class HelloCommand implements CommandExecutor {
        @SuppressWarnings("unused")
        private Main plugin;
     
        public HelloCommand(Main plugin)
        {
            this.plugin = plugin;
            plugin.getCommand("hello").setExecutor(this);
        }
     
        @Override
        public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
            if(!(sender instanceof Player))
            {
                sender.sendMessage("Only players may execute!");
                return true;
            }
            Player p = (Player) sender;
         
            if(p.hasPermission("hello.use"))
            {
                p.sendMessage("First plugin yess!");
                return true;
            }
            else
            {
                p.sendMessage("You do not have permission to execute this command!");
             
            }
         
            return false;
        }
    }


    Code:
    plugin.yml
    name: HelloWorld
    version: 1.0
    author: trumpet
    main: me.trumpet.helloworld.Main
    description: first minecraft spigot plugin!
    
    commands:
        hello:
            aliases: [hi]
     
  2. Offline

    timtower Administrator Administrator Moderator

    @Trumpet99 You are compiling with a higher java version than the server is running.
     
Thread Status:
Not open for further replies.

Share This Page