83 lines
2.2 KiB
Java
83 lines
2.2 KiB
Java
package me.konsolas.aac.api.internal;
|
|
|
|
import me.konsolas.aac.AAC;
|
|
import me.konsolas.aac.api.AACAPI;
|
|
import me.konsolas.aac.api.HackType;
|
|
import me.konsolas.aac.detectors.movement.Fly;
|
|
import me.konsolas.aac.detectors.movement.Phase;
|
|
import me.konsolas.aac.detectors.movement.Speed;
|
|
import me.konsolas.aac.util.Ping;
|
|
import me.konsolas.aac.util.TPS;
|
|
import me.konsolas.aac.util.ground.GroundUtil;
|
|
import org.bukkit.entity.Player;
|
|
|
|
public final class AACAPIImpl implements AACAPI {
|
|
private final AAC plugin;
|
|
|
|
public AACAPIImpl(AAC plugin) {
|
|
this.plugin = plugin;
|
|
}
|
|
|
|
@Override
|
|
public void reloadAAC() {
|
|
this.plugin.reloadPlugin();
|
|
}
|
|
|
|
@Override
|
|
public void reloadPermissionCache() {
|
|
this.plugin.checkManager.clearBypassCache();
|
|
}
|
|
|
|
@Override
|
|
public void invalidateMovementCaches() {
|
|
((Speed) this.plugin.checkManager.getCheck(HackType.SPEED)).clearCaches();
|
|
((Fly) this.plugin.checkManager.getCheck(HackType.FLY)).clearCaches();
|
|
((Phase) this.plugin.checkManager.getCheck(HackType.FLY)).clearCaches();
|
|
}
|
|
|
|
@Override
|
|
public void enableCheck(HackType hackType) {
|
|
this.plugin.checkManager.enableCheck(hackType, false);
|
|
}
|
|
|
|
@Override
|
|
public void disableCheck(HackType hackType) {
|
|
this.plugin.checkManager.disableCheck(hackType, false);
|
|
}
|
|
|
|
@Override
|
|
public boolean isEnabled(HackType hackType) {
|
|
return this.plugin.checkManager.isCheckEnabled(hackType);
|
|
}
|
|
|
|
@Override
|
|
public boolean isBypassed(Player player) {
|
|
return this.plugin.checkManager.isBypassed(player);
|
|
}
|
|
|
|
@Override
|
|
public double getTPS() {
|
|
return TPS.getTps();
|
|
}
|
|
|
|
@Override
|
|
public int getPing(Player player) {
|
|
return Ping.getPing(player);
|
|
}
|
|
|
|
@Override
|
|
public int getViolationLevel(Player player, HackType hackType) {
|
|
return this.plugin.checkManager.getCheck(hackType).getViolationLevel(player);
|
|
}
|
|
|
|
@Override
|
|
public void setViolationLevel(Player player, HackType hackType, int level) {
|
|
this.plugin.checkManager.getCheck(hackType).setViolationLevel(player, level);
|
|
}
|
|
|
|
@Override
|
|
public boolean isPlayerOnGround(Player player) {
|
|
return GroundUtil.isOnGround(player.getLocation());
|
|
}
|
|
}
|