Fiona API

Apr 7, 2018
Fiona API
  • The Fiona API Guide
    A complete guide on the Fiona Anticheat API.

    Full Deobfuscated Class
    Code (Text):
    package anticheat;

    import java.util.ArrayList;
    import java.util.Map;

    import org.bukkit.configuration.file.FileConfiguration;
    import org.bukkit.entity.Player;

    import anticheat.detections.Checks;
    import anticheat.detections.ChecksManager;
    import anticheat.user.User;

    public class FionaAPI {
     
        private static FionaAPI api;

        public FionaAPI() {
            api = this;
        }
     
        public static FionaAPI getAPI() {
            return api;
        }
     
        public Map<Checks, Integer> getViolations(Player player) {
            return Fiona.getUserManager().getUser(player.getUniqueId()).getVLs();
        }
     
        public void clearViolations(Player player) {
            Fiona.getUserManager().getUser(player.getUniqueId()).getVLs().clear();
        }
     
        public void clearAllViolations() {
            Fiona.getAC().clearVLS();
        }

        public void saveMessage() {
            Fiona.getAC().saveMessages();
        }

        public void saveConfig() {
            Fiona.getAC().saveConfig();
        }

        public FileConfiguration getConfig() {
            return Fiona.getAC().getConfig();
        }

        public void reloadConfig() {
            Fiona.getAC().reloadConfig();
        }

        public void reloadMessages() {
            Fiona.getAC().reloadMessages();
        }

        public void saveMessages() {
            Fiona.getAC().saveMessages();
        }

        public String getPrefix() {
            return Fiona.getAC().getPrefix();
        }
     
        public Checks getLastViolation(Player player) {
            User user = Fiona.getUserManager().getUser(player.getUniqueId());
            if (user.getVLs().size() > 0) {
                return (Checks) user.getVLs().keySet().toArray()[user.getVLs().keySet().size() - 1];
            }
            return null;
        }
     
        public void addCheck(Checks check) {
            ChecksManager.detections.add(check);
        }
     
        public Checks getCheckByName(String string) {
            return Fiona.getAC().getChecks().getCheckByName(string);
        }
     
        public void removeCheck(Checks check) {
            ChecksManager.detections.remove(check);
        }
     
        public ArrayList<Player> getPlayersBanned() {
            return Fiona.getAC().playersBanned;
        }
     
        public double getTPS() {
            return Fiona.getAC().getPing().getTPS();
        }
     
        public int getPing(Player player) {
            return Fiona.getAC().getPing().getPing(player);
        }
     
        public boolean hasAlerts(Player player) {
            return Fiona.getUserManager().getUser(player.getUniqueId()).isHasAlerts();
        }
     
        public String getVersion() {
            return Fiona.getAC().getDescription().getVersion();
        }
    }


    Configuration


    Save the Fiona Config or Messages Config
    Code (Text):
    public void saveConfig() {
        Fiona.getAC().saveConfig();
    }
    public void saveMessage() {
       Fiona.getAC().saveMessages();
    }
    Get the config.yml or messages.yml
    Code (Text):
    public FileConfiguration getConfig() {
        return Fiona.getAC().getConfig();
    }
     
    public FileConfiguration getMessages() {
        return Fiona.getAC().getMessages();
    }
    Reload config.yml or messages.yml.
    Code (Text):
    public void reloadConfig() {
        Fiona.getAC().reloadConfig();
    }

    public void reloadMessages() {
        Fiona.getAC().reloadMessages();
    }
    Get Prefix
    Code (Text):
    public String getPrefix() {
        return Fiona.getAC().getPrefix();
    }

    Violations

    Get last player check set off.
    Code (Text):
    public Checks getLastViolation(Player player) {
        User user = Fiona.getUserManager().getUser(player.getUniqueId());
        if(user.getVLs().size() > 0) {
            return (Checks) user.getVLs().keySet().toArray()[user.getVLs().keySet().size() - 1];
        }
        return null;
    }
    Reset Fiona violations for all players.
    Code (Text):
    public void clearAllViolations() {
        Fiona.getAC().clearVLS();
    }
    Reset Fiona violations for a specific player.

    Code (Text):
    public void clearViolations(Player player) {
        Fiona.getUserManager().getUser(player.getUniqueId()).getVLs().clear();
    }
    Get the violations of a specific player.
    Code (Text):
    public Map<Checks, Integer> getViolations(Player player) {
        return Fiona.getUserManager().getUser(player.getUniqueId()).getVLs();
    }



    Checks

    Add a check to Fiona.
    Code (Text):
    public void addCheck(Checks check) {
        ChecksManager.detections.add(check);
    }
    Get a check by name.
    Code (Text):
    public Checks getCheckByName(String string) {
        return Fiona.getAC().getChecks().getCheckByName(string);
    }
    Remove check form Fiona.
    Code (Text):
    public void removeCheck(Checks check) {
        ChecksManager.detections.remove(check);
    }

    Utilities

    Get the version of Fiona.
    Code (Text):
    public String getVersion() {
        return Fiona.getAC().getDescription().getVersion();
    }
    Check if a player has alerts on.
    Code (Text):
    public boolean hasAlerts(Player player) {
        return Fiona.getUserManager().getUser(player.getUniqueId()).isHasAlerts();
    }
    Get a player's ping (cross-version utility)
    Code (Text):
    public int getPing(Player player) {
        return Fiona.getAC().getPing().getPing(player);
    }
    Get the current TPS of the server.
    Code (Text):
    public double getTPS() {
        return Fiona.getAC().getPing().getTPS();
    }
    Get the players banned by Fiona this restart.
    Code (Text):
    public ArrayList<Player> getPlayersBanned() {
        return Fiona.getAC().playersBanned;
    }
  • Loading...
  • Loading...