Advertisement
Guest User

Untitled

a guest
Oct 25th, 2014
139
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. public static Thread timer = new Thread(new Runnable() {
  2. final File file = new File("plugins/BrainChat", "config.yml");
  3. final FileConfiguration cfg = YamlConfiguration.loadConfiguration(file);
  4. final File file2 = new File("plugins/BrainChat", "time.yml");
  5. final FileConfiguration cfg2 = YamlConfiguration.loadConfiguration(file2);
  6. @Override
  7. public void run() {
  8. while(true){
  9. try {
  10. Thread.sleep(1000);
  11. } catch (InterruptedException e) {
  12. e.printStackTrace();
  13. }
  14. for(Player p: Bukkit.getOnlinePlayers()){
  15. int muted = cfg.getInt(p.getName() + ".Muted");
  16. if(muted == 1){
  17. int time = cfg2.getInt(p.getName() + ".Time");
  18. if(time == 1){
  19. cfg.set(p.getName() + ".Muted", 0);
  20. try {
  21. cfg.save(file);
  22. } catch (IOException e) {
  23. e.printStackTrace();
  24. }
  25. cfg2.set(p.getName() + ".Time", 0);
  26. try {
  27. cfg2.save(file2);
  28. } catch (IOException e) {
  29. e.printStackTrace();
  30. }
  31. p.sendMessage("§2Du bist nicht mehr Stumm.");
  32. }else{
  33. int time2 = time - 1;
  34. cfg2.set(p.getName() + ".Time", time2);
  35. try {
  36. cfg2.save(file2);
  37. } catch (IOException e) {
  38. e.printStackTrace();
  39. }
  40. }
  41. }
  42. }
  43. }
  44. }
  45. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement