Wait amount of Ticks, then doing Action

Discussion in 'Plugin Development' started by Ian0526, Oct 6, 2013.

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

    Ian0526

    So basically I want an action to happen a certain amount of ticks after an event.
    Here is my code.
    Code:java
    1. package me.Ian0526;
    2.  
    3. import java.util.logging.Logger;
    4.  
    5. import org.bukkit.ChatColor;
    6. import org.bukkit.Effect;
    7. import org.bukkit.Location;
    8. import org.bukkit.Sound;
    9. import org.bukkit.command.Command;
    10. import org.bukkit.command.CommandSender;
    11. import org.bukkit.entity.Player;
    12. import org.bukkit.event.EventHandler;
    13. import org.bukkit.event.Listener;
    14. import org.bukkit.event.player.PlayerJoinEvent;
    15. import org.bukkit.event.player.PlayerLoginEvent;
    16. import org.bukkit.inventory.ItemStack;
    17. import org.bukkit.plugin.Plugin;
    18. import org.bukkit.plugin.RegisteredServiceProvider;
    19. import org.bukkit.plugin.java.JavaPlugin;
    20. import org.bukkit.potion.PotionEffect;
    21. import org.bukkit.potion.PotionEffectType;
    22.  
    23. public class Core extends JavaPlugin implements Listener {
    24. public static Plugin plugin;
    25. public final Logger logger = Logger.getLogger("Minecraft");
    26.  
    27. public void onEnable() {
    28. getServer().getPluginManager().registerEvents(this, this);
    29. }
    30. public void onDisable() {
    31. this.logger.info("[ZetaCraftFJDonor] Plugin Disabled");
    32. logger.info(String.format("[%s] Disabled Version %s", getDescription().getName(), getDescription().getVersion()));
    33. }
    34. @EventHandler
    35. public void PlayerJoin(PlayerJoinEvent event){
    36. Player player = event.getPlayer();
    37. Location loc = player.getLocation();
    38. if(player.hasPlayedBefore()){
    39. }else{
    40. ##Waitevent.300ticksblahblah
    41. player.playEffect(loc, Effect.ENDER_SIGNAL, 2003);
    42. player.addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS, 50, 1));
    43. player.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, 4000, 3));
    44. player.sendMessage("§aWelcome! Take some starter items, money and §2SPEED§a! To get started!");
    45. }
    46. }
    47. }
     
  2. Offline

    mazentheamazin

    Don't you mean "WAT" amount of ticks. Anyways, getting to your problem.. Are you wanting to know how to do it, or Is there a problem because "##Waitevent.300ticksblahblah" Just confuses me.
     
  3. Offline

    Ian0526

    I want to wait an amount of ticks before doing an action after an event.
     
  4. Offline

    mazentheamazin

    Ian0526
    The question I am asking you is: Are you inquiring how to do it? Or is there a problem with your code.
    EDIT: If you're inquiring about it I recommend you watch this video:
     
  5. Offline

    Goblom

    You are looking for SchedualSyncDelayedTask (PS its a Runnable())
     
Thread Status:
Not open for further replies.

Share This Page