Plugin Help /hub instead of /spawn help!!!

Discussion in 'Plugin Help/Development/Requests' started by ironicflunky541, Jan 20, 2015.

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

    ironicflunky541

    Hey guys, I have ran a server for a while and decided its time to take the next step and develop plugins for it.
    I tried to make a plugin that does that, however when I load up the server nothing happens and it doesn't appear in plugins help!!! Here is my Code:

    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.java.JavaPlugin;
    public class Hub extends JavaPlugin{
    public void onEnable() {
    getLogger().info("Plugin Enabled");
    }
    public void onDisable() {
    getLogger().info("Plugin Disabled");
    }
    public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
    if(sender instanceof Player) {
    Player player = (Player) sender;
    if(cmd.getName().equalsIgnoreCase("hub")){
    String hub = "spawn " + player.getName();
    Bukkit.dispatchCommand(Bukkit.getConsoleSender(), hub);
    player.sendMessage(ChatColor.GOLD + "Returning To Hub!");

    }
    }
    return false;
    }
    }




    Plugin.yml:

    name: Hub
    author: ironicflunky541
    version: 1
    description: Allows User to Teleport To Spawn via /hub
    Hub: me.zack.Hub.Hub
    commands:
    hub:
    description: Teleport To Hub!
     
  2. Offline

    pie_flavor

    What in the hell are you doing that for? Just open commands.yml in your server folder and make it look like this:
    Code:
    aliases:
      hub:
        spawn $$1-
     
  3. Offline

    ironicflunky541

    I wanted to try and make my own plugin for once that works..... I just want to know what I'm doing wrong. I think I have the code right, however in the console it says this: Could not load 'plugins\spawnhub.jar' in folder 'plugins' org.bukkit.plugin.invalidPluginException: Cannot find main class 'me.zack.spawnhub.spawnhub. <--- that was my class I made.
     
  4. Offline

    pie_flavor

    @ironicflunky541 Did you copy and paste the code? Because I don't see a package statement.
     
  5. Offline

    17xDillz1997

    How many classes do you have? Are you sure that's the main class?
     
  6. Offline

    KrypticIce

    If you have more than 1 class you need a class to register the rest that is what you put there.
     
Thread Status:
Not open for further replies.

Share This Page