1. Welcome to skUnity!

    Welcome to skUnity! This is a forum where members of the Skript community can communicate and interact. Skript Resource Creators can post their Resources for all to see and use.

    If you haven't done so already, feel free to join our official Discord server to expand your level of interaction with the comminuty!

    Now, what are you waiting for? Join the community now!

Dismiss Notice
This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Skript to Java

Discussion in 'Java' started by sandor_1234, Apr 22, 2017.

  1. sandor_1234

    sandor_1234 Active Member

    Joined:
    Jan 26, 2017
    Messages:
    165
    Likes Received:
    5
    How do you use the:
    Code (Skript):
    1. Wait 3 seconds
    in java? Cuz i need a sort off cooldown.
     
  2. ShaneBee

    Moderator Resource Staff Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,184
    Likes Received:
    225
    Schedule a BukkitRunnable.
     
  3. ShaneBee

    Moderator Resource Staff Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,184
    Likes Received:
    225
    Sorry i am really new to java, how would i do that with this code:
    Code (Java):
    1. package nl.sandor.cooldown;
    2.  
    3. import java.util.HashMap;
    4.  
    5. import org.bukkit.Bukkit;
    6. import org.bukkit.ChatColor;
    7. import org.bukkit.entity.Player;
    8. import org.bukkit.event.EventHandler;
    9. import org.bukkit.event.EventPriority;
    10. import org.bukkit.event.Listener;
    11. import org.bukkit.event.player.PlayerInteractEvent;
    12.  
    13. public class listerner
    14. implements Listener
    15. {
    16. @EventHandler(priority=EventPriority.HIGH)
    17. public void onPlayerInteract(PlayerInteractEvent event)
    18. {
    19.     if ((event.getAction().toString().equals("LEFT_CLICK_BLOCK"))  || (event.getAction().toString().equals("LEFT_CLICK_AIR"))){
    20.     if ((event.getItem().getItemMeta().getLore().contains(ChatColor.MAGIC + "$"))){
    21.     if ((event.getItem().getItemMeta().getDisplayName().equals(ChatColor.RED + "Empire Wand"))){
    22. #set the lore to &kc
    23. #Wait 3 seconds
    24. #Set lore back to &k$
    25. }
    26. }
    27. }
    28. }
    29. }
     
  4. ShaneBee

    Moderator Resource Staff Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,184
    Likes Received:
    225
    Code (Java):
    1. Bukkit.getScheduler().runTaskLater(this, new Runnable() {
    2.            
    3.             @Override
    4.             public void run() {
    5.                 // After 3 seconds
    6.                
    7.             }
    8.         }, 3*20); //20 TICKS = 1 SECOND
     

Share This Page

Loading...