// Path: src/main/java/top/dreamcity/AntiCheat/AntiCheatAPI.java
// public interface AntiCheatAPI {
// 
//     static AntiCheat getInstance() {
//         return AntiCheat.getInstance();
//     }
// 
//     MasterConfig getMasterConfig();
// 
//     void addRecord(Player player, top.dreamcity.AntiCheat.Cheat.AntiCheat.CheatType cheatType);
// 
// }
// 
// Path: src/main/java/top/dreamcity/AntiCheat/Cheat/Report.java
// public class Report extends AsyncTask {
//     protected Player player;
// 
//     public Report(Player player) {
//         this.player = player;
//     }
// 
//     public void onRun() {
// 
//     }
// }
// 
// Path: src/main/java/top/dreamcity/AntiCheat/Cheat/Study/Study.java
// public class Study {
//     public final static String API_ADDRESS_SPEED = "http://14.29.54.37:88/AntiCheat/SpeedCheat.php";
// 
//     public static void SpeedStudy(double maxSpeed, double avgSpeed, boolean isCheat) {
//         sendGet(API_ADDRESS_SPEED, "maxspeed=" + maxSpeed + "&averageSpeed=" + avgSpeed + "&isCheating=" + isCheat);
//     }
// 
//     public static boolean SpeedPredict(double maxSpeed, double avgSpeed) {
//         try {
//             Gson gson = new Gson();
//             Map<?, ?> json = gson.fromJson(sendGet(API_ADDRESS_SPEED, "maxspeed=" + maxSpeed + "&averageSpeed=" + avgSpeed), Map.class);
//             return json.get("isCheating").toString().equals("true");
//         } catch (Exception e) {
//             Server.getInstance().getLogger().error("AntiCheat-MLSystem >> Error to predict speed cheat.");
//             return false;
//         }
//     }
// 
//     private static String sendGet(String url, String param) {
//         String result = "";
//         BufferedReader in = null;
//         try {
//             String urlNameString = url + "?" + param;
//             URL realUrl = new URL(urlNameString);
//             URLConnection connection = realUrl.openConnection();
//             connection.setRequestProperty("accept", "*/*");
//             connection.setRequestProperty("connection", "Keep-Alive");
//             connection.setRequestProperty("user-agent",
//                     "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;SV1)");
//             connection.connect();
//             in = new BufferedReader(new InputStreamReader(
//                     connection.getInputStream()));
//             String line;
//             while ((line = in.readLine()) != null) {
//                 result += line;
//             }
//         } catch (Exception e) {
//             System.out.println("Send get error" + e);
//             e.printStackTrace();
//         } finally {
//             try {
//                 if (in != null) {
//                     in.close();
//                 }
//             } catch (Exception e2) {
//                 e2.printStackTrace();
//             }
//         }
//         return result;
//     }
// 
// }


import cn.nukkit.Player;
import cn.nukkit.Server;
import cn.nukkit.math.Vector3;
import cn.nukkit.utils.TextFormat;
import top.dreamcity.AntiCheat.AntiCheatAPI;
import top.dreamcity.AntiCheat.Cheat.Report;
import top.dreamcity.AntiCheat.Cheat.Study.Study;
import java.util.ArrayList;
import java.util.Collections;

                        if (move >= m || move2 >= m) {
                            if (move >= m && move2 >= m) {
                                flag = true;
                            }
                            if (!flag) {
                                if (Math.abs(move2 - move) >= m - Math.min(move, move2)) {
                                    flag = true;
                                }
                            }
                        }
                    }

                    if (flag) {
                        player.kick(TextFormat.AQUA + "Cheat Type: " + TextFormat.RED + "Speed");
                    }
                }
                Thread.sleep(1000);
            }
            ArrayList<Double> speedList = new ArrayList<>();
            for (int i = 0; i < 10 && player.isOnline(); i++) {
                speedList.add((double) AntiSpeedThread.getMove(player.getName()));
                Thread.sleep(1000);
            }
            if (player.isOnline()) {
                double maxSpeed = Collections.max(speedList);
                double allSpeed = 0;
                for (double speed : speedList) {
                    allSpeed = allSpeed + speed;
                }
                double avgSpeed = allSpeed / (double) speedList.size();

// Path: src/main/java/top/dreamcity/AntiCheat/AntiCheatAPI.java
// public interface AntiCheatAPI {
// 
//     static AntiCheat getInstance() {
//         return AntiCheat.getInstance();
//     }
// 
//     MasterConfig getMasterConfig();
// 
//     void addRecord(Player player, top.dreamcity.AntiCheat.Cheat.AntiCheat.CheatType cheatType);
// 
// }
// 
// Path: src/main/java/top/dreamcity/AntiCheat/Cheat/Report.java
// public class Report extends AsyncTask {
//     protected Player player;
// 
//     public Report(Player player) {
//         this.player = player;
//     }
// 
//     public void onRun() {
// 
//     }
// }
// 
// Path: src/main/java/top/dreamcity/AntiCheat/Cheat/Study/Study.java
// public class Study {
//     public final static String API_ADDRESS_SPEED = "http://14.29.54.37:88/AntiCheat/SpeedCheat.php";
// 
//     public static void SpeedStudy(double maxSpeed, double avgSpeed, boolean isCheat) {
//         sendGet(API_ADDRESS_SPEED, "maxspeed=" + maxSpeed + "&averageSpeed=" + avgSpeed + "&isCheating=" + isCheat);
//     }
// 
//     public static boolean SpeedPredict(double maxSpeed, double avgSpeed) {
//         try {
//             Gson gson = new Gson();
//             Map<?, ?> json = gson.fromJson(sendGet(API_ADDRESS_SPEED, "maxspeed=" + maxSpeed + "&averageSpeed=" + avgSpeed), Map.class);
//             return json.get("isCheating").toString().equals("true");
//         } catch (Exception e) {
//             Server.getInstance().getLogger().error("AntiCheat-MLSystem >> Error to predict speed cheat.");
//             return false;
//         }
//     }
// 
//     private static String sendGet(String url, String param) {
//         String result = "";
//         BufferedReader in = null;
//         try {
//             String urlNameString = url + "?" + param;
//             URL realUrl = new URL(urlNameString);
//             URLConnection connection = realUrl.openConnection();
//             connection.setRequestProperty("accept", "*/*");
//             connection.setRequestProperty("connection", "Keep-Alive");
//             connection.setRequestProperty("user-agent",
//                     "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;SV1)");
//             connection.connect();
//             in = new BufferedReader(new InputStreamReader(
//                     connection.getInputStream()));
//             String line;
//             while ((line = in.readLine()) != null) {
//                 result += line;
//             }
//         } catch (Exception e) {
//             System.out.println("Send get error" + e);
//             e.printStackTrace();
//         } finally {
//             try {
//                 if (in != null) {
//                     in.close();
//                 }
//             } catch (Exception e2) {
//                 e2.printStackTrace();
//             }
//         }
//         return result;
//     }
// 
// }


// Path: src/main/java/top/dreamcity/AntiCheat/Cheat/move/ReportSpeedThread.java
import cn.nukkit.Player;
import cn.nukkit.Server;
import cn.nukkit.math.Vector3;
import cn.nukkit.utils.TextFormat;
import top.dreamcity.AntiCheat.AntiCheatAPI;
import top.dreamcity.AntiCheat.Cheat.Report;
import top.dreamcity.AntiCheat.Cheat.Study.Study;
import java.util.ArrayList;
import java.util.Collections;

                        if (move >= m || move2 >= m) {
                            if (move >= m && move2 >= m) {
                                flag = true;
                            }
                            if (!flag) {
                                if (Math.abs(move2 - move) >= m - Math.min(move, move2)) {
                                    flag = true;
                                }
                            }
                        }
                    }

                    if (flag) {
                        player.kick(TextFormat.AQUA + "Cheat Type: " + TextFormat.RED + "Speed");
                    }
                }
                Thread.sleep(1000);
            }
            ArrayList<Double> speedList = new ArrayList<>();
            for (int i = 0; i < 10 && player.isOnline(); i++) {
                speedList.add((double) AntiSpeedThread.getMove(player.getName()));
                Thread.sleep(1000);
            }
            if (player.isOnline()) {
                double maxSpeed = Collections.max(speedList);
                double allSpeed = 0;
                for (double speed : speedList) {
                    allSpeed = allSpeed + speed;
                }
                double avgSpeed = allSpeed / (double) speedList.size();

                boolean isCheating = Study.SpeedPredict(maxSpeed, avgSpeed);
