Message getting sent multiple times.

Discussion in 'Plugin Development' started by LaxWasHere, Dec 23, 2012.

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

    LaxWasHere

    The code is all basic stuff but I can't seem to find what's causing this.

    http://screencloud.net/v/C8el

    Code:java
    1.  
    2. package net.lazlecraft.LazleCore;
    3.  
    4. import org.bukkit.ChatColor;
    5. import org.bukkit.Material;
    6. import org.bukkit.command.Command;
    7. import org.bukkit.command.CommandExecutor;
    8. import org.bukkit.command.CommandSender;
    9. import org.bukkit.entity.Player;
    10. import org.bukkit.inventory.ItemStack;
    11.  
    12. //CE for LazleCraft - LazleGames
    13. public class lcmd implements CommandExecutor {
    14.  
    15. private LazleCore plugin;
    16.  
    17. public lcmd(LazleCore plugin)
    18. {
    19. this.plugin = plugin;
    20. }
    21.  
    22. @Override
    23. public boolean onCommand(final CommandSender se, Command cmd, String label, String[] args) {
    24. if (se instanceof Player) {
    25. final Player p = ((Player) se).getPlayer();
    26. IconMenu menu = new IconMenu("§aLazleGames", 27, new IconMenu.OptionClickEventHandler() {
    27.  
    28. @Override
    29. public void onOptionClick(IconMenu.OptionClickEvent event) {
    30. String name = ChatColor.stripColor(event.getName());
    31. if (name.equalsIgnoreCase("Website")) {
    32. p.sendMessage("§6=============================================");
    33. p.sendMessage("§aVisit us at [url]http://LazleCraft.net[/url]");
    34. p.sendMessage("§6=============================================");
    35. } else if (name.equalsIgnoreCase("Donate")) {
    36. p.sendMessage("§7=============================================");
    37. p.sendMessage("§aPlease click the link below to donate");
    38. p.sendMessage("§6§lClick --> [url]http://Store.LazleCraft.net[/url]");
    39. p.sendMessage("§7==============================================");
    40. } else if (name.equalsIgnoreCase("Staff")) {
    41. p.sendMessage("§7==============================================");
    42. p.sendMessage("§aOwner - Lazle");
    43. p.sendMessage("§aAdmin - LaxWasHere");
    44. p.sendMessage("§bMod - xPickleHead15x");
    45. p.sendMessage("§bMod - Colby97");
    46. p.sendMessage("§bMod - LisaatjeN");
    47. p.sendMessage("§7=============================================");
    48. } else if (name.equalsIgnoreCase("SG Stats")) {
    49. p.sendMessage("§7=============================================");
    50. p.sendMessage("§6Click the link below to checck your Survival Games stats");
    51. p.sendMessage("§bhttp://sg.lcrft.in/" + se.getName());
    52. p.sendMessage("§7=============================================");
    53. } else if (name.equalsIgnoreCase("Reconnect")) {
    54. p.performCommand("lazlegames");
    55. } else if (name.equalsIgnoreCase("Logout")) {
    56. p.kickPlayer("You have been logged out");
    57.  
    58. }
    59. }
    60. }, plugin);
    61. menu.setOption(2, new ItemStack(Material.EMERALD, 1), "§a§lWebsite", "§6Tells you the LazleCraft website");
    62. menu.setOption(3, new ItemStack(Material.GOLD_INGOT, 1), "§6§lDonate", "§aSupport LazleCraft!");
    63. menu.setOption(4, new ItemStack(Material.NETHER_STAR, 1), "§a§lStaff", "§dList all the LazleCraft staff");
    64. menu.setOption(5, new ItemStack(Material.RAILS, 1), "§a§lSG Stats", "§dGet a link to your SG stats");
    65. menu.setOption(25, new ItemStack(Material.TRAP_DOOR, 1), "§b§lReconnect", "§6Log out and Log back in.");
    66. menu.setOption(26, new ItemStack(Material.BEDROCK, 1), "§7§lLogout", "§6Logs you out of the server.");
    67. menu.open(p);
    68. return true;
    69. }
    70. return false;
    71. }
    72. }
    73.  
     
  2. Offline

    fireblast709

    LaxWasHere I read in another thread that the event is thrown multiple times for the same item. You should detect if there is a change in the item
     
  3. Offline

    LaxWasHere

    Mind giving me the link to the thread?
     
  4. Offline

    fireblast709

Thread Status:
Not open for further replies.

Share This Page