Solved Schedulers, Events, and No Console Errors [Urgent]

Discussion in 'Plugin Development' started by Build_and_Break, Aug 18, 2014.

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

    Build_and_Break

    Hey all,
    I've been making a plugin to seemingly mimic a server by sending a player messages that are formatted with color like that of a server, in the current case, Hypixel. That's unimportant, don't ask questions about it. Anyway, I've set up schedulers to send fake player chat messages to the player after he/she joins. At this point, none of the messages get relayed to the player and there are no console errors. I compiled successfuly without warnings or errors, and the plugin enables and disables correctly.

    Code: http://hastebin.com/ogulevohiz.avrasm

    Example:

    Code:java
    1. scheduler.scheduleSyncDelayedTask(this, new Runnable() {
    2. @Override
    3. public void run() {
    4. Player p = event.getPlayer();
    5. p.sendMessage(ChatColor.GREEN + "[VIP] Build_and_Break" + ChatColor.WHITE + ": O.o an announcement");
    6. }
    7. }, 40L);


    Before pointing out problems in the example, please see the actual entire code (yes I did:
    Code:java
    1. BukkitScheduler scheduler = Bukkit.getServer().getScheduler();
    )

    Thanks in advance,
    Build_and_Break

    Oh, and yes, I have read the Bukkit wiki page on Schedulers.

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

    moe097

  3. Offline

    br456

    Build_and_Break
    Your class first needs to implement listener
    Then you must register the events in onEnable(): getServer().getPluginManager().registerEvents(this,this);
     
  4. Offline

    Build_and_Break

    Oh my gosh, the stupid things we do when we're too tired. Thanks guys.
     
Thread Status:
Not open for further replies.

Share This Page