Solved Help with Time Delay.

Discussion in 'Plugin Development' started by timbragg12, Nov 7, 2014.

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

    timbragg12

    Hello there!
    I am making a "bot plugin" where there is basically a fake player that helps players around my server but I'm having some trouble making a time delay.
    This is my code so far but it broadcasts the message twice and I dont know why!
    Code:java
    1. //A little snippet
    2. if (m.equalsIgnoreCase("ty bob")
    3. || m.equalsIgnoreCase("thanks bob")
    4. || m.equalsIgnoreCase("thank you bob")
    5. || m.equalsIgnoreCase("thx bob")
    6. || m.equalsIgnoreCase("ty")
    7. || m.equalsIgnoreCase("thanks")
    8. || m.equalsIgnoreCase("thank you")
    9. || m.equalsIgnoreCase("thx")) {
    10. Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(this, new Runnable() {
    11. public void run() {
    12. Bukkit.broadcastMessage((ChatColor.WHITE + "[" + ChatColor.GREEN + "Hub"
    13. + ChatColor.WHITE + "] [" + ChatColor.DARK_RED + "Guest Relations"
    14. + ChatColor.WHITE + "]" + ChatColor.DARK_RED + ChatColor.BOLD + "Bob"
    15. + ChatColor.WHITE + ": Your Welcome! Enjoy your stay and if you need any help, be sure to ask me!"));
    16. }}, 60L);
    17. }

    Hopefully I am just making an amateur mistake and someone will be able to help me quickly. Thanks in advance,
    Tim.

    EDIT: Solved myself.
     
  2. Offline

    lycano

    timbragg12 i hope that you dont use player entity from Craftbukkit to do that ... You could better spawn npc and just catch events from him and use ConversationAPI (included in bukkit) for a guided menu.
     
Thread Status:
Not open for further replies.

Share This Page