funkemunky

Fiona API Class

Apr 1st, 2018
180
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.27 KB | None | 0 0
  1. import java.util.ArrayList;
  2. import java.util.Map;
  3.  
  4. import org.bukkit.configuration.file.FileConfiguration;
  5. import org.bukkit.entity.Player;
  6.  
  7. import anticheat.detections.Checks;
  8. import anticheat.detections.ChecksManager;
  9. import anticheat.user.User;
  10.  
  11. public class FionaAPI {
  12.    
  13.     private static FionaAPI api;
  14.  
  15.     public FionaAPI() {
  16.         api = this;
  17.     }
  18.    
  19.     public static FionaAPI getAPI() {
  20.         return api;
  21.     }
  22.    
  23.     public Map<Checks, Integer> getViolations(Player player) {
  24.         return Fiona.getUserManager().getUser(player.getUniqueId()).getVLs();
  25.     }
  26.    
  27.     public void clearViolations(Player player) {
  28.         Fiona.getUserManager().getUser(player.getUniqueId()).getVLs().clear();
  29.     }
  30.    
  31.     public void clearAllViolations() {
  32.         Fiona.getAC().clearVLS();
  33.     }
  34.  
  35.     public void saveMessage() {
  36.         Fiona.getAC().saveMessages();
  37.     }
  38.  
  39.     public void saveConfig() {
  40.         Fiona.getAC().saveConfig();
  41.     }
  42.  
  43.     public FileConfiguration getConfig() {
  44.         return Fiona.getAC().getConfig();
  45.     }
  46.  
  47.     public void reloadConfig() {
  48.         Fiona.getAC().reloadConfig();
  49.     }
  50.  
  51.     public void reloadMessages() {
  52.         Fiona.getAC().reloadMessages();
  53.     }
  54.  
  55.     public void saveMessages() {
  56.         Fiona.getAC().saveMessages();
  57.     }
  58.  
  59.     public String getPrefix() {
  60.         return Fiona.getAC().getPrefix();
  61.     }
  62.    
  63.     public Checks getLastViolation(Player player) {
  64.         User user = Fiona.getUserManager().getUser(player.getUniqueId());
  65.         if(user.getVLs().size() > 0) {
  66.             return (Checks) user.getVLs().keySet().toArray()[user.getVLs().keySet().size() - 1];
  67.         }
  68.         return null;
  69.     }
  70.    
  71.     public void addCheck(Checks check) {
  72.         ChecksManager.detections.add(check);
  73.     }
  74.    
  75.     public Checks getCheckByName(String string) {
  76.         return Fiona.getAC().getChecks().getCheckByName(string);
  77.     }
  78.    
  79.     public void removeCheck(Checks check) {
  80.         ChecksManager.detections.remove(check);
  81.     }
  82.    
  83.     public ArrayList<Player> getPlayersBanned() {
  84.         return Fiona.getAC().playersBanned;
  85.     }
  86.    
  87.     public double getTPS() {
  88.         return Fiona.getAC().getPing().getTPS();
  89.     }
  90.    
  91.     public int getPing(Player player) {
  92.         return Fiona.getAC().getPing().getPing(player);
  93.     }
  94.    
  95.     public boolean hasAlerts(Player player) {
  96.         return Fiona.getUserManager().getUser(player.getUniqueId()).isHasAlerts();
  97.     }
  98.    
  99.     public String getVersion() {
  100.         return Fiona.getAC().getDescription().getVersion();
  101.     }
  102. }
Advertisement
Add Comment
Please, Sign In to add comment