Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static Thread timer = new Thread(new Runnable() {
- final File file = new File("plugins/BrainChat", "config.yml");
- final FileConfiguration cfg = YamlConfiguration.loadConfiguration(file);
- final File file2 = new File("plugins/BrainChat", "time.yml");
- final FileConfiguration cfg2 = YamlConfiguration.loadConfiguration(file2);
- @Override
- public void run() {
- while(true){
- try {
- Thread.sleep(1000);
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- for(Player p: Bukkit.getOnlinePlayers()){
- int muted = cfg.getInt(p.getName() + ".Muted");
- if(muted == 1){
- int time = cfg2.getInt(p.getName() + ".Time");
- if(time == 1){
- cfg.set(p.getName() + ".Muted", 0);
- try {
- cfg.save(file);
- } catch (IOException e) {
- e.printStackTrace();
- }
- cfg2.set(p.getName() + ".Time", 0);
- try {
- cfg2.save(file2);
- } catch (IOException e) {
- e.printStackTrace();
- }
- p.sendMessage("§2Du bist nicht mehr Stumm.");
- }else{
- int time2 = time - 1;
- cfg2.set(p.getName() + ".Time", time2);
- try {
- cfg2.save(file2);
- } catch (IOException e) {
- e.printStackTrace();
- }
- }
- }
- }
- }
- }
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement