Created
June 17, 2017 21:49
-
-
Save TheMasteredPanda/9fb59b161c15ed21564b13af38343626 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.hcsurvival.hcbooster.config; | |
import com.themasteredpanda.library.config.yaml.BaseConfig; | |
import com.themasteredpanda.library.plugin.MPlugin; | |
import com.themasteredpanda.library.utils.Players; | |
import com.themasteredpanda.library.utils.TryUtils; | |
import java.util.List; | |
import java.util.UUID; | |
public class MuteConfig extends BaseConfig | |
{ | |
public MuteConfig(MPlugin instance) | |
{ | |
super(instance, "muted"); | |
} | |
public boolean hasNotificationsMuted(UUID uuid) | |
{ | |
return this.config.getStringList("Players").contains(uuid.toString()); | |
} | |
public void add(UUID uuid) | |
{ | |
if (hasNotificationsMuted(uuid)) { | |
System.out.println(Players.get(uuid).getName() + " is not in muted.yml."); | |
return; | |
} | |
List<String> list = this.config.getStringList("Players"); | |
list.add(uuid.toString()); | |
this.config.set("Players", list); | |
TryUtils.sneaky(() -> this.config.save(this.configFile)); | |
} | |
public void remove(UUID uuid) | |
{ | |
if (!hasNotificationsMuted(uuid)) { | |
return; | |
} | |
this.config.set("Players." + uuid.toString(), null); | |
TryUtils.sneaky(() -> this.config.save(this.configFile)); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment