Plugin not even loading?

Discussion in 'Plugin Development' started by Reddeh, Sep 8, 2014.

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

    Reddeh

    Sorry if it's been asked before, google hasn't come up with anything for some reason.
    Silly google wtf u doin.


    Anyway, I've made a plugin and for some reason it exports fine with no errors, but when I load my server it doesn't do anything. I know it exports fine as well as I get Nameifier.jar with all my stuff there including config and plugin.yml, the server just can't tell it's a thing.
    Is this because I used the same thing as my other plugin? (co.uk.redabsol0.[pluginName], with this being co.uk.redabsol0.nameifier).

    Here's my code:
    Code:java
    1. package co.uk.redabsol0.nameifier;
    2.  
    3. import java.util.ArrayList;
    4. import java.util.List;
    5.  
    6. import org.bukkit.ChatColor;
    7. import org.bukkit.Material;
    8. import org.bukkit.command.Command;
    9. import org.bukkit.command.CommandSender;
    10. import org.bukkit.entity.Player;
    11. import org.bukkit.event.Listener;
    12. import org.bukkit.inventory.meta.ItemMeta;
    13. import org.bukkit.plugin.java.JavaPlugin;
    14.  
    15. public class Main extends JavaPlugin implements Listener
    16. {
    17. public static boolean isEnabled = true;
    18. public static List<String> lore = new ArrayList<String>();
    19.  
    20. @Override
    21. public void onEnable()
    22. {
    23. saveDefaultConfig();
    24. isEnabled = getConfig().getBoolean("isEnabled");
    25. }
    26.  
    27. @Override
    28. public void onDisable()
    29. {
    30. saveConfig();
    31. }
    32.  
    33. @Override
    34. public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args)
    35. {
    36. if(label.equalsIgnoreCase("customName"))
    37. {
    38. if(args.length > 0)
    39. {
    40. StringBuilder msg = new StringBuilder("");
    41. for(int i = 0; i == args.length; i++)
    42. {
    43. msg.append(args[i]).append(" ");
    44. }
    45. String message = msg.toString();
    46. if(sender instanceof Player)
    47. {
    48. Player player = (Player) sender;
    49. if(player.getItemInHand() != null)
    50. {
    51. if(player.getItemInHand().getType() != Material.AIR)
    52. {
    53. ItemMeta im = player.getItemInHand().getItemMeta();
    54. im.setDisplayName(message);
    55. player.getItemInHand().setItemMeta(im);
    56. }
    57. else
    58. {
    59. sender.sendMessage("You need an item in your hand!");
    60. }
    61. }
    62. else
    63. {
    64. sender.sendMessage("You need an item in your hand!");
    65. }
    66. }
    67. else
    68. {
    69. sender.sendMessage("Only players can do that!");
    70. }
    71. }
    72. else
    73. {
    74. sender.sendMessage("Specify arguments!");
    75. }
    76. }
    77. else
    78. if(label.equalsIgnoreCase("customLore"))
    79. {
    80. if(args.length > 0)
    81. {
    82. if(args[0].equalsIgnoreCase("clear"))
    83. {
    84. if(sender instanceof Player)
    85. {
    86. Player player = (Player) sender;
    87. if(player.getItemInHand() != null)
    88. {
    89. if(player.getItemInHand().getType() != Material.AIR)
    90. {
    91. ItemMeta im = player.getItemInHand().getItemMeta();
    92. lore.clear();
    93. im.setLore(lore);
    94. player.getItemInHand().setItemMeta(im);
    95. }
    96. else
    97. {
    98. sender.sendMessage("You need an item in your hand!");
    99. }
    100. }
    101. else
    102. {
    103. sender.sendMessage("You need an item in your hand!");
    104. }
    105. }
    106. else
    107. {
    108. sender.sendMessage("Only players can do that!");
    109. }
    110. }
    111. else
    112. {
    113. StringBuilder msg = new StringBuilder("");
    114. for(int i = 0; i == args.length; i++)
    115. {
    116. msg.append(args[i]).append(" ");
    117. }
    118. String message = msg.toString();
    119. if(sender instanceof Player)
    120. {
    121. Player player = (Player) sender;
    122. if(player.getItemInHand() != null)
    123. {
    124. if(player.getItemInHand().getType() != Material.AIR)
    125. {
    126. ItemMeta im = player.getItemInHand().getItemMeta();
    127. lore.clear();
    128. im.getLore().add(message);
    129. player.getItemInHand().setItemMeta(im);
    130. }
    131. else
    132. {
    133. sender.sendMessage("You need an item in your hand!");
    134. }
    135. }
    136. else
    137. {
    138. sender.sendMessage("You need an item in your hand!");
    139. }
    140. }
    141. else
    142. {
    143. sender.sendMessage("Only players can do that!");
    144. }
    145. }
    146. }
    147. }
    148. else
    149. if(label.equalsIgnoreCase("nameColor"))
    150. {
    151. if(sender instanceof Player)
    152. {
    153. Player player = (Player) sender;
    154. if(player.getItemInHand() != null)
    155. {
    156. if(player.getItemInHand().getType() != Material.AIR)
    157. {
    158. ItemMeta im = player.getItemInHand().getItemMeta();
    159. if(args.length != 1)
    160. {
    161. sender.sendMessage("Too many / Too little arguments!");
    162. }
    163. else
    164. {
    165. String realItemName = im.getDisplayName();
    166. if(im.getDisplayName().startsWith((Character.toString(ChatColor.COLOR_CHAR))))
    167. {
    168. realItemName = im.getDisplayName().substring(2);
    169. }
    170. String itemName = realItemName;
    171. if(args[0].equalsIgnoreCase("red"))
    172. {
    173. itemName = ChatColor.RED + im.getDisplayName();
    174. }
    175. else
    176. if(args[0].equalsIgnoreCase("blue"))
    177. {
    178. itemName = ChatColor.BLUE + im.getDisplayName();
    179. }
    180. else
    181. if(args[0].equalsIgnoreCase("green"))
    182. {
    183. itemName = ChatColor.GREEN + im.getDisplayName();
    184. }
    185. else
    186. if(args[0].equalsIgnoreCase("black"))
    187. {
    188. itemName = ChatColor.BLACK + im.getDisplayName();
    189. }
    190. else
    191. if(args[0].equalsIgnoreCase("white"))
    192. {
    193. itemName = ChatColor.WHITE + im.getDisplayName();
    194. }
    195. else
    196. if(args[0].equalsIgnoreCase("yellow"))
    197. {
    198. itemName = ChatColor.YELLOW + im.getDisplayName();
    199. }
    200. im.setDisplayName(itemName);
    201. player.getItemInHand().setItemMeta(im);
    202. }
    203. }
    204. else
    205. {
    206. sender.sendMessage("You need an item in your hand!");
    207. }
    208. }
    209. else
    210. {
    211. sender.sendMessage("You need an item in your hand!");
    212. }
    213. }
    214. else
    215. {
    216. sender.sendMessage("Only players can do that!");
    217. }
    218. }
    219. return false;
    220. }
    221. }
    222. [/i][/i]

    Plugin.yml:
    Code:
    name: Nameifier
    main: co.uk.redabsol0.nameifier.Main
    version: 1.0.0
    author: Reddeh
    commands:
        customName:
            description: Sets an item's custom name
            usage: /customName [Custom Name] - Set item name
            permission: nameifier.customName
            permission-message: You don't have the permission: nameifier.customName
        customLore:
            description: Adds to an item's custom lore
            usage:
                /customLore [Custom Lore] - Add new line to Lore
                /customLore clear - Clear Lore
            permission: nameifier.customLore
            permission-message: You don't have the permission: nameifier.customLore
        nameColor:
            description: Sets an item name's custom color.
            usage: /nameColor [Color] - Set item name color.
            permission: nameifier.nameColor
            permission-message: You don't have the permission: nameifier.nameColor
        loreColor:
            description: Sets an item name's custom lore color.
            usage: /loreColor [Color] - Set item lore color
            permission: nameifier.loreColor
            permission-message: You don't have the permission: nameifier.loreColor
    Config.yml:
    Code:
    isEnabled: true
    (Puny yes)

    Anything I've done wrong. I bet it's something small as hell.
     
  2. Offline

    Cerberus XII

    Reddeh,
    • Do you have a stacktrace?
    • Is their another plugin on the server using the same package?
     
  3. Offline

    fireblast709

  4. Offline

    Minesuchtiiii

    I personally do my config like this:
    name: ----
    version: ----
    author: ----

    main: ----

    commands: ----

    permissions: ----
     
  5. Offline

    Reddeh

    No. It just doesn't load at all.
    My other plugin uses co.uk.redabsol0.GreenRPG but this uses co.uk.redabsol0.Nameifier
    Ah yes, thank you.
     
  6. Offline

    Nateb1121

    So the server shows no errors or anything related to your plugin? If so, you really should be sure the plugin.jar is in the plugins folder, I know it sounds stupid but play along.
     
  7. Offline

    Reddeh

    It was. Anyway it's working now.
     
  8. Offline

    Nateb1121

    What'd you change? That way people who might look at this later can understand what to do. :)
     
Thread Status:
Not open for further replies.

Share This Page