Solved Plugin Not Showing up In-Game

Discussion in 'Plugin Development' started by HexLazer205, Dec 30, 2014.

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

    HexLazer205

    Hi, for the past few plugins I have attempted to create for my server, I have come across a little problem. The plugins aren't showing up in-game! I have tried everything I could to the best of my abilities... I can't "squash this bug." Anyway, I have tried everything I could think of, and I need help with this. I have done the exact same thing, that I'm doing now, in the past, and everything was working as intended. However, I do not get why this is happening now.

    I am not using Maven for my project, as I see it taking too long to get the plugin updated and moved into the plugins folder of my server. Instead, I do what other programmers commonly do, to make quick updates of the plugin as it is being coded: I create a Java Project, I create a package (In this case, I have named my package "io.github.edragon205.pluginx"), and then I create a class file where I put my code, I have named it "PluginX". This is the same name I have given to the main Java Project folder. I put in my code, and here is what I currently have:

    Code:
    package io.github.edragon205.pluginx;
    
    
    
    import java.util.logging.Logger;
    
    
    
    import org.bukkit.Bukkit;
    
    import org.bukkit.command.Command;
    
    import org.bukkit.command.CommandSender;
    
    import org.bukkit.entity.Player;
    
    import org.bukkit.plugin.java.JavaPlugin;
    
    
    
    public class PluginX extends JavaPlugin {
    
      
    
        Logger logger = Bukkit.getLogger();
    
      
    
        public void onEnable() {
    
            logger.info("§aPluginX by HexLazer205 has been enabled and is now active!");
    
        }
    
      
    
        public void onDisable() {
    
            logger.info("§cPluginX by HexLazer205 has been disabled and is no longer active!");
    
        }
    
      
    
        @SuppressWarnings("deprecation")
    
        public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
    
          
    
            Player player = (Player) sender;
    
          
    
            if(cmd.getName().equalsIgnoreCase("smite")) {
    
              
    
                Player target = Bukkit.getPlayer(args[0]);
    
              
    
                if(target != null) {
    
                    player.getWorld().strikeLightningEffect(target.getLocation());
    
                }
    
                else if(target == null) {
    
                    player.sendMessage("§cThat player is not currently online!");
    
                }
    
                return true;
    
            }
    
            return false;
    
        }
    
      
    
    }
    
    Then, of course I would need to create a plugin.yml to put the plugin information in so the server can read the plugin. Here is what I have:

    Code:
    name: PluginX
    
    main: io.github.edragon205.pluginx.PluginX
    
    version: 1.0.0
    
    commands:
    
      smite:
    
          description: §7Strike another player with a lightning effect!
    
          usage: /smite (player)
    
          permission: pluginx.smite
    
          permission-message: §cYou do not have the required permission: §3pluginx.smite
    
    After I am done coding in PluginX.class and plugin.yml, I would export the project into a Jar File (Not a Runnable Jar File, just a Jar File). I had the path set to export directly into the plugins folder of my server. I can even go into my plugins folder and find the jar sitting in there, waiting to be used. I then go and reload my server, and I type "/plugins" finding that my plugin, "PluginX", is not listed. I have tried multiple things to fix this, but I cannot resolve this issue. I have no errors in my code whatsoever.

    If you try to tell me that I am not creating the plugin the correct way, and that I must make a Maven project, then I am afraid to tell you that the fact I have been doing this, with Java Projects and not Maven Projects, has been completely successful and fully working as intended. I suspect that I may be taking a step wrong into this, and if you could possibly help me out with solving this issue.

    I can say that I do not get an error message during the Jar file export. It exports fully as intended, with no errors or warnings. I do not have any errors or warnings in my code. As such, I have, like I said, made plugins the same way in the past, and they have been working fully as intended. However, the plugin before this, and this plugin, seem to not be appearing in the plugin list in my server. The plugin and server versions match, and I do in fact have the CraftBukkit jar in my library build path, to enable me to code with Bukkit.

    I will highly appreciate any help that anyone can give to me, and to help me get past this issue. If I am doing something wrong in one of the steps of the Jar file creative, please let me know and in what way I can fix it. Thank you in advance!
     
  2. Offline

    sipsi133

    Dont use craftbukkit if it is not needed. Use bukkit instead.
    Are you getting errors on server startup? If so, post it here.
     
  3. Offline

    teej107

    There are many things wrong about your code but I'll help you with this problem.
    1. Are you sure you are exporting it to the plugins folder and it is exporting?
    2. Are you sure you are even using the right plugins folder?
    3. Try putting installing a different plugin and see if that shows up.
     
  4. Offline

    HexLazer205

    @teej107 yes, I am sure it is the correct plugins folder and the plugin is being exported successfully. I know there is a problem with something I did because I made a plugin previously before this one for someone else's server, but it never showed up on their server... Yes, the versions match. If I install any working plugin, it is able to work on my server. Also, I especially have a plugin currently working on my server that I have coded in the past.

    @sipsi133 craftbukkit is mostly the same as bukkit, and I have used both and they both come out with the same working code. I started up my server and the plugin was completely unrecognized. No errors or anything.
     
  5. Offline

    HexLazer205

    UPDATE: I fixed my problem, thanks for your help guys!

    SOLUTION: I do not know exactly what the problem was, however my problem has been fixed. I may have been naming the jar file differently than what my plugin name was, when I forgot to change the name during the exports.
     
  6. Offline

    teej107

    @HexLazer205 Weird. Plugin jar file names don't really matter. But since you have this solved, please mark this thread with the solved prefix.
     
  7. Offline

    HexLazer205

    Yeah, I believe it shouldn't. I just had the problem again earlier and i tried naming the jar file the same as the project name, and then it worked.
     
Thread Status:
Not open for further replies.

Share This Page