Creating command aliases?

Discussion in 'Plugin Development' started by Mattz, Jan 15, 2013.

  1. Offline

    Mattz

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    Is there an easy way to create aliases for commands in my plugin, instead of copying the entire code for each alias?
     
  2. Offline

    Drkmaster83

    My BukkitDev Profile
    My Plugins (3)
    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    if(commandLabel.equalsIgnoreCase("alias") || commandLabel.equalsIgnoreCase("alias1")
    {
    //Check for args and stuff
    }
    EDIT: The Bukkit plugin.yml setup also supports command aliases (base commands only).
     
  3. Offline

    Mattz

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    Thanks.
    I also just discovered the cmd.getAliases() method. What does that do?
     
  4. Offline

    Drkmaster83

    My BukkitDev Profile
    My Plugins (3)
    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    Stick with the traditional methods. It probably checks from the plugin.yml.
     
  5. Offline

    RainoBoy97

    My BukkitDev Profile
    My Plugins (1)
    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    Mattz
    Code (Text):
    1.  
    2. name: hi
    3. version: 3264587
    4. main: this.no.hi.herp
    5. commands:
    6.   thisisaverylongcommandthatneedsanalias:
    7.     aliases: [thisis, command, hi]
    8.  
    The aliases for "thisisaverylongcommandthatneedsanalias" is now "thisis", "command" and "hi" :p
     
    chasechocolate and CorrieKay like this.
  6. Offline

    theguynextdoor

    My BukkitDev Profile
    My Plugins (3)
    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    Personally, i would recommend you go with RainoBoy's method of adding an alias.

    Why? well, no extra code on your behalf, just simply adding a word Also because if you are doing commands through a separate executor, i have a feeling it wouldn't work without extra code. Also i don't like the use of commandLabel. Oh and while i think about it, it's easier to read if you have say a dozen aliases in the yml than if you had a dozen commandLabel.equalsIgnoreCase("blah").
     
  7. Offline

    Mattz

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    Thanks, it's work all good now.

    Just a quick thing, I'm getting the usage of the command (again), I can't see if I'm missing anything or what.

    Main class:
    Code (Text):
    1. package net.thepvp.broadcaster;
    2.  
    3. import org.bukkit.plugin.java.JavaPlugin;
    4.  
    5. public class AdvancedBroadcaster extends JavaPlugin {
    6.    
    7.     @Override
    8.     public void onEnable() {
    9.         this.saveDefaultConfig();
    10.         getCommand("broadcast").setExecutor(new Commands(this));
    11.         getCommand("bc").setExecutor(new Commands(this));
    12.     }
    13.    
    14.     @Override
    15.     public void onDisable() {
    16.        
    17.     }
    18. }
    19.  
    Commands.java:
    Code (Text):
    1. package net.thepvp.broadcaster;
    2.  
    3. import org.bukkit.ChatColor;
    4. import org.bukkit.command.Command;
    5. import org.bukkit.command.CommandExecutor;
    6. import org.bukkit.command.CommandSender;
    7.  
    8. public class Commands implements CommandExecutor {
    9.    
    10.     // 50 characters long
    11.    
    12.     AdvancedBroadcaster plugin;
    13.     private String notificationPrefix = plugin.getConfig().getString("notificationPrefix");
    14.     private String version = Integer.toString(plugin.getConfig().getInt("pluginVersion"));
    15.     @SuppressWarnings("unused")
    16.     private String savedMessage;
    17.     private String configVariable;
    18.     private String configValue;
    19.    
    20.     public Commands(AdvancedBroadcaster plugin) {
    21.         this.plugin = plugin;
    22.     }
    23.    
    24.     public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
    25.         if(plugin.getConfig().getBoolean("enableBroadcaster") == false) {
    26.             sender.sendMessage("Unknown command. Type \"help\" for help.");
    27.         } else {
    28.             if(args.length == 0) {
    29.                 if(cmd.getName().equalsIgnoreCase("broadcast")) {
    30.                     sender.sendMessage(ChatColor.GOLD + notificationPrefix + ChatColor.GREEN + " AdvancedBroadcaster " + version + ChatColor.BLUE + ", created by Enotho");
    31.                     return true;
    32.                 }
    33.             } else {
    34.                 if(args[0].equals("edit")) {
    35.                     if(plugin.getConfig().getBoolean("consoleEditingOnly") == true) {
    36.                         sender.sendMessage(ChatColor.GOLD + notificationPrefix + ChatColor.BLUE + "You can only edit saved messages from the console!");
    37.                     } else {
    38.                         sender.sendMessage(ChatColor.BLUE + "-- SAVED MESSAGES --------------------------------");
    39.                         //for(ConfigurationSection configurationSection : plugin.getConfig().getConfigurationSection("messages")) {
    40.                         //    savedMessage = configurationSection.getString("message").substring(0, 42);
    41.                         //    sender.sendMessage(ChatColor.GREEN + configurationSection.getName() + ". " + ChatColor.WHITE + "\"" + savedMessage + "\"");
    42.                         //}
    43.                     }
    44.                     return true;
    45.                 } else if(args[0].equals("config")) {
    46.                     if(args[1].equals("get")) {
    47.                         configVariable = args[2];
    48.                         try {
    49.                             configValue = plugin.getConfig().get(configVariable).toString();
    50.                             sender.sendMessage(ChatColor.GOLD + notificationPrefix + " CONFIG: " + ChatColor.BLUE + "The value of \'" + configValue + "\' is " + ChatColor.GOLD + configValue);
    51.                         } catch(Exception e) {
    52.                             sender.sendMessage(ChatColor.GOLD + notificationPrefix + ChatColor.BLUE + " Unknown value \'" + configValue + "\'");
    53.                         }
    54.                     }
    55.                     return true;
    56.                 }
    57.             }
    58.             return true;
    59.         }
    60.         sender.sendMessage("test");
    61.         return false;
    62.     }
    63. }
    64.  
    Plugin.yml has everything it needs.
     
  8. Offline

    devilquak

    My BukkitDev Profile
    My Plugins (4)
    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    Mattz

    Bukkit will return whatever you enter for "usage:" of the command in your plugin.yml whenever the function returns false. So if you don't want to make that message appear, just make sure your command is returning as true, not letting it reach the false at the end.
     
  9. Offline

    Mattz

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    The thing is, I don't even know how it gets down there.

    I set the return false to true, and now essentials took over with its own /broadcast command.
     
  10. Offline

    devilquak

    My BukkitDev Profile
    My Plugins (4)
    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    Are you purposefully letting it reach the point where it has "sender.sendMessage("test");" ?
     
  11. Offline

    Mattz

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    I'm not, actually, it doesn't show the message in chat.

    Normally the code would be...
    Code (Text):
    1. public onCommand() {
    2. if(cmd.getName()) {
    3. } }
    ... but as you can see, it checks in the config file whether or not the plugin is disabled/hidden, then proceeds with the commands.
     
  12. Offline

    Mattz

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    I also just noticed this error in the console:
    Code (Text):
    1. 2013-01-15 19:33:39 [SEVERE] Could not load 'plugins\AdvancedBroadcaster.jar' in
    2.  folder 'plugins'
    3. org.bukkit.plugin.InvalidPluginException: java.lang.ClassNotFoundException: net.
    4. thepvp.broadcaster.AdvancedBroadcaster
    5.         at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.j
    6. ava:184)
    7.         at org.bukkit.plugin.SimplePluginManager.loadPlugin(SimplePluginManager.
    8. java:305)
    9.         at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager
    10. .java:230)
    11.         at org.bukkit.craftbukkit.v1_4_6.CraftServer.loadPlugins(CraftServer.jav
    12. a:239)
    13.         at org.bukkit.craftbukkit.v1_4_6.CraftServer.reload(CraftServer.java:591
    14. )
    15.         at org.bukkit.Bukkit.reload(Bukkit.java:184)
    16.         at org.bukkit.command.defaults.ReloadCommand.execute(ReloadCommand.java:
    17. 23)
    18.         at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:18
    19. 6)
    20.         at org.bukkit.craftbukkit.v1_4_6.CraftServer.dispatchCommand(CraftServer
    21. .java:514)
    22.         at net.minecraft.server.v1_4_6.PlayerConnection.handleCommand(PlayerConn
    23. ection.java:979)
    24.         at net.minecraft.server.v1_4_6.PlayerConnection.chat(PlayerConnection.ja
    25. va:897)
    26.         at net.minecraft.server.v1_4_6.PlayerConnection.a(PlayerConnection.java:
    27. 852)
    28.         at net.minecraft.server.v1_4_6.Packet3Chat.handle(Packet3Chat.java:44)
    29.         at net.minecraft.server.v1_4_6.NetworkManager.b(NetworkManager.java:290)
    30.  
    31.         at net.minecraft.server.v1_4_6.PlayerConnection.d(PlayerConnection.java:
    32. 112)
    33.         at net.minecraft.server.v1_4_6.ServerConnection.b(SourceFile:39)
    34.         at net.minecraft.server.v1_4_6.DedicatedServerConnection.b(SourceFile:30
    35. )
    36.         at net.minecraft.server.v1_4_6.MinecraftServer.r(MinecraftServer.java:59
    37. 8)
    38.         at net.minecraft.server.v1_4_6.DedicatedServer.r(DedicatedServer.java:22
    39. 4)
    40.         at net.minecraft.server.v1_4_6.MinecraftServer.q(MinecraftServer.java:49
    41. 4)
    42.         at net.minecraft.server.v1_4_6.MinecraftServer.run(MinecraftServer.java:
    43. 427)
    44.         at net.minecraft.server.v1_4_6.ThreadServerApplication.run(SourceFile:84
    45. 9)
    46. Caused by: java.lang.ClassNotFoundException: net.thepvp.broadcaster.AdvancedBroa
    47. dcaster
    48.         at java.net.URLClassLoader$1.run(Unknown Source)
    49.         at java.net.URLClassLoader$1.run(Unknown Source)
    50.         at java.security.AccessController.doPrivileged(Native Method)
    51.         at java.net.URLClassLoader.findClass(Unknown Source)
    52.         at org.bukkit.plugin.java.PluginClassLoader.findClass0(PluginClassLoader
    53. .java:80)
    54.         at org.bukkit.plugin.java.PluginClassLoader.findClass(PluginClassLoader.
    55. java:53)
    56.         at java.lang.ClassLoader.loadClass(Unknown Source)
    57.         at java.lang.ClassLoader.loadClass(Unknown Source)
    58.         at java.lang.Class.forName0(Native Method)
    59.         at java.lang.Class.forName(Unknown Source)
    60.         at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.j
    61. ava:173)
    62.         ... 21 more
     
  13. Offline

    devilquak

    My BukkitDev Profile
    My Plugins (4)
    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    Mattz

    That's an error with the whole plugin, it's not loading for some reason. Somewhere your code isn't quite right, it's not necessarily an issue with the code you've been talking about.
     
  14. Offline

    RainoBoy97

    My BukkitDev Profile
    My Plugins (1)
    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    theguynextdoor
    Finally someone that spells my name correctly!

    Mattz
    I would think its an compiling error, or something in the plugin.yml
     
  15. Offline

    Mattz

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    It looks fine to me:
    Code (Text):
    1. name: AdvancedBroadcaster
    2. main: net.thepvp.broadcaster.AdvancedBroadcaster
    3. version: 1.0.0
    4.  
    5. commands:
    6.   broadcast:
    7.     description: Everything you need in AdvancedBroadcaster
    8.     usage: /broadcast
    9.     permission: AdvancedBroadcaster.broadcast
    10.     permission-message: You don't have permission to use this command!
    11.     aliases: [bc]
     
  16. Offline

    tommycake50

    My BukkitDev Profile
    My Plugins (5)
    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    btw if you dont want to use the plugin.yml,
    just have your command call a method outside oncommand and call that same method on the alias too
     
  17. Offline

    Mattz

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    I prefer to have it in the yml, but the issue I'm having is that the command returns the usage.
     
  18. Offline

    Mattz

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    Just got a completely different error:
    Code (Text):
    1. 2013-01-16 17:57:27 [INFO] [AdvancedBroadcaster] Enabling AdvancedBroadcaster v1
    2. .0.0
    3. 2013-01-16 17:57:27 [SEVERE] Error occurred while enabling AdvancedBroadcaster v
    4. 1.0.0 (Is it up to date?)
    5. java.lang.NullPointerException
    6.         at net.thepvp.broadcaster.Commands.<init>(Commands.java:13)
    7.         at net.thepvp.broadcaster.AdvancedBroadcaster.onEnable(AdvancedBroadcast
    8. er.java:10)
    9.         at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:217)
    10.         at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader
    11. .java:457)
    12.         at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManage
    13. r.java:381)
    14.         at org.bukkit.craftbukkit.v1_4_6.CraftServer.loadPlugin(CraftServer.java
    15. :282)
    16.         at org.bukkit.craftbukkit.v1_4_6.CraftServer.enablePlugins(CraftServer.j
    17. ava:264)
    18.         at net.minecraft.server.v1_4_6.MinecraftServer.j(MinecraftServer.java:32
    19. 1)
    20.         at net.minecraft.server.v1_4_6.MinecraftServer.e(MinecraftServer.java:30
    21. 0)
    22.         at net.minecraft.server.v1_4_6.MinecraftServer.a(MinecraftServer.java:25
    23. 9)
    24.         at net.minecraft.server.v1_4_6.DedicatedServer.init(DedicatedServer.java
    25. :149)
    26.         at net.minecraft.server.v1_4_6.MinecraftServer.run(MinecraftServer.java:
    27. 399)
    28.         at net.minecraft.server.v1_4_6.ThreadServerApplication.run(SourceFile:84
    29. 9)
    Main class:
    Code (Text):
    1. package net.thepvp.broadcaster;
    2.  
    3. import org.bukkit.plugin.java.JavaPlugin;
    4.  
    5. public class AdvancedBroadcaster extends JavaPlugin {
    6.    
    7.     @Override
    8.     public void onEnable() {
    9.         this.saveDefaultConfig();
    10.         getCommand("broadcast").setExecutor(new Commands(this));
    11.         getCommand("bc").setExecutor(new Commands(this));
    12.     }
    13.    
    14.     @Override
    15.     public void onDisable() {
    16.        
    17.     }
    18. }
    19.  
    Commands.java:
    Code (Text):
    1. package net.thepvp.broadcaster;
    2.  
    3. import org.bukkit.ChatColor;
    4. import org.bukkit.command.Command;
    5. import org.bukkit.command.CommandExecutor;
    6. import org.bukkit.command.CommandSender;
    7.  
    8. public class Commands implements CommandExecutor {
    9.    
    10.     // 50 characters long
    11.    
    12.     AdvancedBroadcaster plugin;
    13.     private String notificationPrefix = plugin.getConfig().getString("notificationPrefix");
    14.     private String version = Integer.toString(plugin.getConfig().getInt("pluginVersion"));
    15.     @SuppressWarnings("unused")
    16.     private String savedMessage;
    17.     private String configVariable;
    18.     private String configValue;
    19.    
    20.     public Commands(AdvancedBroadcaster plugin) {
    21.         this.plugin = plugin;
    22.     }
    23.    
    24.     @Override
    25.     public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
    26.         if(plugin.getConfig().getBoolean("enableBroadcaster") == false) {
    27.             sender.sendMessage("Unknown command. Type \"help\" for help.");
    28.         } else {
    29.             if(args.length == 0) {
    30.                 if(cmd.getName().equalsIgnoreCase("broadcast")) {
    31.                     sender.sendMessage(ChatColor.GOLD + notificationPrefix + ChatColor.GREEN + " AdvancedBroadcaster " + version + ChatColor.BLUE + ", created by Enotho");
    32.                     return true;
    33.                 }
    34.             } else {
    35.                 if(args[0].equals("edit")) {
    36.                     if(plugin.getConfig().getBoolean("consoleEditingOnly") == true) {
    37.                         sender.sendMessage(ChatColor.GOLD + notificationPrefix + ChatColor.BLUE + "You can only edit saved messages from the console!");
    38.                     } else {
    39.                         sender.sendMessage(ChatColor.BLUE + "-- SAVED MESSAGES --------------------------------");
    40.                         //for(ConfigurationSection configurationSection : plugin.getConfig().getConfigurationSection("messages")) {
    41.                         //    savedMessage = configurationSection.getString("message").substring(0, 42);
    42.                         //    sender.sendMessage(ChatColor.GREEN + configurationSection.getName() + ". " + ChatColor.WHITE + "\"" + savedMessage + "\"");
    43.                         //}
    44.                     }
    45.                     return true;
    46.                 } else if(args[0].equals("config")) {
    47.                     if(args[1].equals("get")) {
    48.                         configVariable = args[2];
    49.                         try {
    50.                             configValue = plugin.getConfig().get(configVariable).toString();
    51.                             sender.sendMessage(ChatColor.GOLD + notificationPrefix + " CONFIG: " + ChatColor.BLUE + "The value of \'" + configValue + "\' is " + ChatColor.GOLD + configValue);
    52.                         } catch(Exception e) {
    53.                             sender.sendMessage(ChatColor.GOLD + notificationPrefix + ChatColor.BLUE + " Unknown value \'" + configValue + "\'");
    54.                         }
    55.                     }
    56.                     return true;
    57.                 }
    58.             }
    59.             return true;
    60.         }
    61.         sender.sendMessage("test");
    62.         return false;
    63.     }
    64. }
    65.  
     
  19. Offline

    fireblast709

    My BukkitDev Profile
    My Plugins (3)
    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    Mattz Don't use plugin before you initialized it
    Code:java
    1. public class Commands implements CommandExecutor {
    2.  
    3. // 50 characters long
    4.  
    5. AdvancedBroadcaster plugin;
    6. private String notificationPrefix;
    7. private String version;
    8. private String savedMessage;
    9. private String configVariable;
    10. private String configValue;
    11.  
    12. public Commands(AdvancedBroadcaster plugin) {
    13. this.plugin = plugin;
    14. notificationPrefix = plugin.getConfig().getString("notificationPrefix");
    15. version = Integer.toString(plugin.getConfig().getInt("pluginVersion"));
    16. }
     
  20. Offline

    Mattz

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    This didn't change the error...
     
  21. Offline

    fireblast709

    My BukkitDev Profile
    My Plugins (3)
    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    should change the error
     
  22. Offline

    Mattz

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    I had a typo, it fixed the other error, but now I'm getting the same one as earlier:
    Code (Text):
    1. 2013-01-16 19:10:16 [SEVERE] Could not load 'plugins\AdvancedBroadcaster.jar' in
    2. folder 'plugins'
    3. org.bukkit.plugin.InvalidPluginException: java.lang.ClassNotFoundException: net.
    4. thepvp.broadcaster.AdvancedBroadcaster
    5.         at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.j
    6. ava:184)
    7.         at org.bukkit.plugin.SimplePluginManager.loadPlugin(SimplePluginManager.
    8. java:305)
    9.         at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager
    10. .java:230)
    11.         at org.bukkit.craftbukkit.v1_4_6.CraftServer.loadPlugins(CraftServer.jav
    12. a:239)
    13.         at org.bukkit.craftbukkit.v1_4_6.CraftServer.reload(CraftServer.java:591
    14. )
    15.         at org.bukkit.Bukkit.reload(Bukkit.java:184)
    16.         at org.bukkit.command.defaults.ReloadCommand.execute(ReloadCommand.java:
    17. 23)
    18.         at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:18
    19. 6)
    20.         at org.bukkit.craftbukkit.v1_4_6.CraftServer.dispatchCommand(CraftServer
    21. .java:514)
    22.         at net.minecraft.server.v1_4_6.PlayerConnection.handleCommand(PlayerConn
    23. ection.java:979)
    24.         at net.minecraft.server.v1_4_6.PlayerConnection.chat(PlayerConnection.ja
    25. va:897)
    26.         at net.minecraft.server.v1_4_6.PlayerConnection.a(PlayerConnection.java:
    27. 852)
    28.         at net.minecraft.server.v1_4_6.Packet3Chat.handle(Packet3Chat.java:44)
    29.         at net.minecraft.server.v1_4_6.NetworkManager.b(NetworkManager.java:290)
    30.  
    31.         at net.minecraft.server.v1_4_6.PlayerConnection.d(PlayerConnection.java:
    32. 112)
    33.         at net.minecraft.server.v1_4_6.ServerConnection.b(SourceFile:39)
    34.         at net.minecraft.server.v1_4_6.DedicatedServerConnection.b(SourceFile:30
    35. )
    36.         at net.minecraft.server.v1_4_6.MinecraftServer.r(MinecraftServer.java:59
    37. 8)
    38.         at net.minecraft.server.v1_4_6.DedicatedServer.r(DedicatedServer.java:22
    39. 4)
    40.         at net.minecraft.server.v1_4_6.MinecraftServer.q(MinecraftServer.java:49
    41. 4)
    42.         at net.minecraft.server.v1_4_6.MinecraftServer.run(MinecraftServer.java:
    43. 427)
    44.         at net.minecraft.server.v1_4_6.ThreadServerApplication.run(SourceFile:84
    45. 9)
    46. Caused by: java.lang.ClassNotFoundException: net.thepvp.broadcaster.AdvancedBroa
    47. dcaster
    48.         at java.net.URLClassLoader$1.run(Unknown Source)
    49.         at java.net.URLClassLoader$1.run(Unknown Source)
    50.         at java.security.AccessController.doPrivileged(Native Method)
    51.         at java.net.URLClassLoader.findClass(Unknown Source)
    52.         at org.bukkit.plugin.java.PluginClassLoader.findClass0(PluginClassLoader
    53. .java:80)
    54.         at org.bukkit.plugin.java.PluginClassLoader.findClass(PluginClassLoader.
    55. java:53)
    56.         at java.lang.ClassLoader.loadClass(Unknown Source)
    57.         at java.lang.ClassLoader.loadClass(Unknown Source)
    58.         at java.lang.Class.forName0(Native Method)
    59.         at java.lang.Class.forName(Unknown Source)
    60.         at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.j
    61. ava:173)
    62.         ... 21 more
     
  23. Offline

    fireblast709

    My BukkitDev Profile
    My Plugins (3)
    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    apparently there is a problem with 'main' in plugin.yml. It cannot find the main class ;3
     
  24. Offline

    Miner_Fil

    My BukkitDev Profile
    My Plugins (1)
    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    Have you put the wrong path?
    Check your plugin.yml
    and it will probably look like this
    main: et.thepvp.broadcaster
     
  25. Offline

    Sagacious_Zed Bukkit Docs

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    the value of main must be the fully qualified name of the class which you extend JavaPlugin.
     
  26. Offline

    Mattz

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    fireblast709 I can see that, but I have no idea what causes the problem.

    Miner_Fil Looks fine to me (maybe the computer is playing tricks on me!)
    [​IMG]

    Sagacious_Zed What do you mean by that?
     
  27. Offline

    Miner_Fil

    My BukkitDev Profile
    My Plugins (1)
    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    Mattz, You need to remove @Override annotations maybe thats why it dosent work
     
  28. Offline

    Miner_Fil

    My BukkitDev Profile
    My Plugins (1)
    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    i made a few changes which will make it work
    Code (Text):
    1. package net.thepvp.broadcaster;
    2.  
    3. import org.bukkit.plugin.java.JavaPlugin;
    4.  
    5. public class AdvancedBroadcaster extends JavaPlugin {
    6.  
    7. public static AdvancedBroadcaster plugin;
    8.  
    9.     public void onEnable() {
    10.         this.saveDefaultConfig();
    11.         getCommand("broadcast").setExecutor(new Commands(this));
    12.         getCommand("bc").setExecutor(new Commands(this));
    13.     }
    14.  
    15.     public void onDisable() {
    16.      
    17.     }
    18. }
     
  29. Offline

    fireblast709

    My BukkitDev Profile
    My Plugins (3)
    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    nope, wouldn't cause the problem
     
    Miner_Fil likes this.
  30. Offline

    Miner_Fil

    My BukkitDev Profile
    My Plugins (1)
    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    well he has to add the public static AdvancedBroadcaster plugin;
     

Share This Page