Advertisement
Pablo380YT

Untitled

May 3rd, 2017
105
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. public class live extends Command {
  2.  
  3. public live() {
  4. super("live", "crgamers.live");
  5. }
  6. HashMap<String, Integer> cooldowns = new HashMap<String, Integer>();
  7. HashMap<String, Integer> Task = new HashMap<String, Integer>();
  8.  
  9.  
  10.  
  11. @Override
  12. public void execute(CommandSender sender, String[] args) {
  13. if (args.length == 0) {
  14.  
  15. ProxiedPlayer p = (ProxiedPlayer)sender;
  16. if (sender instanceof ProxiedPlayer) {
  17. p.sendMessage(ChatColor.translateAlternateColorCodes('&', "&4Cr&3Gamers&7&l> &eUso &7/&clive &7<&cURL&7>"));
  18. } else {
  19. sender.sendMessage(ChatColor.translateAlternateColorCodes('&', Main.getInstance().getConfig().getString("Consola")));
  20. }
  21. } if (args.length == 1) {
  22. final ProxiedPlayer p = (ProxiedPlayer)sender;
  23. if(!cooldowns.containsKey(p.getName()) || cooldowns.get(p.getName()) == 0) {
  24. p.sendMessage(ChatColor.translateAlternateColorCodes('&', "&4Cr&3Gamers&7&l> &c&lEn Directo&7> &a"+p.getName()+"&7:&e "+args[0]));
  25. cooldowns.put(p.getName(), 300);
  26. Main.getInstance().getProxy().getScheduler().schedule(Main.getInstance(), new Runnable() {
  27. @Override
  28. public void run() {
  29. cooldowns.put(p.getName(), cooldowns.get(p) - 1);
  30. if (cooldowns.get(p) == 0 ) {
  31. cooldowns.remove(p);
  32. Task.remove(p);
  33. }
  34. }
  35.  
  36. }, 1, 1, TimeUnit.SECONDS);
  37.  
  38.  
  39. } else {
  40. p.sendMessage(ChatColor.translateAlternateColorCodes('&', "&4Cr&3Gamers&7&l> &cTienes que esperar &e"+cooldowns.get(p.getName())+" segundos &c para volver a publicar tu directo"));
  41. }
  42. } else {
  43. sender.sendMessage(ChatColor.translateAlternateColorCodes('&', "&4Cr&3Gamers&7&l> &eUso &7/&clive &7<&cURL&7>"));
  44. }
  45. }
  46.  
  47. }
Advertisement
RAW Paste Data Copied
Advertisement