Eclipse or Server?

Discussion in 'Plugin Development' started by CraftCreeper6, Apr 15, 2014.

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

    CraftCreeper6

    Hello! This is not a game or anything but I think either my eclipse or server is glitched
    Eclipse code:
    p.sendMessage(pn + "/advertise create [Amount of times] [Advertisement name] [Advertisement Message] - Display your advertisement");

    In game it displays as:
    [AdvertiseMe] /advertise [Amount of times] [Advertisement name] [Advertisement Message] - Display your advertisement

    Can anyone help!?
     
  2. CraftCreeper6
    1. Wrong section. This belongs in Plugin Development
    2. I don't get what's wrong. Is the "create" just not displaying or something?
     
  3. Offline

    CraftCreeper6

    The Gaming Grunts
    1. Yea, did not know what section to put it in :/
    2. Nope, when I export it it just stays as what it was before (It was originally p.sendMessage(pn + "/advertise [Amount of times] [Advertisement name] [Advertisement Message] - Display your advertisement"); Without the create) So I changed the command and it does not change in game.
     
  4. And you are sure you recompiled it.
    (just in case)
     
  5. Offline

    tyzoid

    CraftCreeper6
    Try Building before exporting. That seems like the issue.
     
  6. Offline

    CraftCreeper6

    BlockCat
    What do you mean by recompiled? :p
     
  7. You exported it to .jar and then put it in your server.
     
  8. Offline

    CraftCreeper6

  9. Offline

    tyzoid

    CraftCreeper6
    [​IMG]
    Ignore the fact that "Build" is greyed out, but make sure you build your project before exporting. Otherwise, you are just exporting from the last build that took place.
     
  10. Offline

    CraftCreeper6

  11. Offline

    tyzoid

  12. Offline

    CraftCreeper6

    tyzoid Several times.

    TnT
    Iroh
    Can you move this? Not getting much replys here (Plugin Development :))

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 7, 2016
  13. Offline

    number1_Master

    Are you replacing the old file with the new file? I found out that when I used Eclipse back then, I needed to delete the old file in the plugins folder, then export and drag and drop. Furthermore, building also seemed to fix the issue. Yet, I usually had this issue when moving files into DropBox, not so much my plugins folder.
     
  14. Offline

    CraftCreeper6

    number1_Master
    I remade my server and deleted all plugins but it still wont work D: Maybe because it says my config is null but I don't know how to fix that :/
    Code (If you need):
    Code:java
    1. package me.CraftCreeper6.All;
    2.  
    3. import java.util.ArrayList;
    4.  
    5. import org.bukkit.Bukkit;
    6. import org.bukkit.ChatColor;
    7. import org.bukkit.command.Command;
    8. import org.bukkit.command.CommandSender;
    9. import org.bukkit.entity.Player;
    10. import org.bukkit.plugin.java.JavaPlugin;
    11.  
    12. public class Main extends JavaPlugin{
    13.  
    14. // This is for easy access if you type p.sendMessage(pn + "__") ingame it would display as [AdvertiseMe] __
    15. // Got it?
    16.  
    17. private String pn = ChatColor.GOLD + "[" + ChatColor.GREEN + "Advertise" + ChatColor.RED + "Me" + ChatColor.GOLD + "] " + ChatColor.BLUE;
    18.  
    19. Object OnGoing = getConfig().get("OnGoingAds");
    20.  
    21. public static ArrayList<String> HasAd = new ArrayList<String>();
    22.  
    23. public void onEnable(){
    24.  
    25. System.out.print("AdvertiseMe has been enabled sucessfuly!");
    26.  
    27. getConfig().set("Enabler", 1);
    28. saveConfig();
    29.  
    30. }
    31. public void onDisable(){
    32.  
    33. System.out.print("AdvertiseMe has been disabled succesfully!"); // It's not that bad... Plus it works better -_- You don't need to create a PDF file for EVERY plugi
    34. }
    35.  
    36. public boolean onCommand(CommandSender sender, Command cmd,
    37. String commandLabel, final String[] args) {
    38. Player p = (Player) sender;
    39. if (commandLabel.equalsIgnoreCase("advertise")) {
    40.  
    41. if (args.length == 0) {
    42. p.sendMessage(pn + ChatColor.RED + "Not enough arguments! Type /advertise help for a list of commands!");
    43. } else {
    44. if (args[0].equalsIgnoreCase("help")){
    45. p.sendMessage(pn + "Base command: /advertise");
    46. p.sendMessage(pn + "/advertise help - Display help");
    47. p.sendMessage(pn + "/advertise price - Display the amount of cost each time the advertisement is shown");
    48. p.sendMessage(pn + "/advertise create [Amount of times] [Advertisement name] [Advertisement Message] - Display your advertisement");
    49. p.sendMessage(pn + "/advertise list - List the current Advertisement");
    50. p.sendMessage(pn + "/advertise duration - How long the Advertisement will be displayed for (Monthly, Weekly)");
    51.  
    52. } else if (args[0].equalsIgnoreCase("list")){
    53.  
    54. p.sendMessage(pn + "The current Advertisements are:");
    55. p.sendMessage(pn + OnGoing);
    56.  
    57. } else if (args[0].equalsIgnoreCase("create")){
    58.  
    59. getConfig().set("OnGoingAds", p.getName() + args[2]);
    60.  
    61. p.sendMessage(pn + "You advertisement has been added to the queue! It will be displayed very soon!");
    62.  
    63. saveConfig();
    64.  
    65. final String name = args[1];
    66.  
    67. //String builder for args
    68.  
    69. StringBuilder sb = new StringBuilder();
    70. for(int n=3; args[n]!=null; n++)
    71. sb.append(args[n]+" ");
    72. final String message = sb.toString();
    73.  
    74. //Scheduler for timings (60 secs atm)
    75.  
    76. Bukkit.getScheduler().scheduleSyncDelayedTask(this, new Runnable(){
    77. public void run(){
    78. Bukkit.broadcastMessage(pn + name + message);
    79. }
    80. }, 120);
    81.  
    82. }
    83.  
    84. }
    85. }
    86. return true;
    87. }
    88. }


    Ignore the // I was teaching someone how to code xD
     
  15. Offline

    Garris0n

    Use the report button.

    As for the actual issue, it's probably not exporting correctly.
     
  16. Offline

    TnT

    Moved to the correct forum.
     
Thread Status:
Not open for further replies.

Share This Page