diff --git a/LaunchServer/src/main/java/pro/gravit/launchserver/socket/handlers/NettyWebAPIHandler.java b/LaunchServer/src/main/java/pro/gravit/launchserver/socket/handlers/NettyWebAPIHandler.java index f145bd02..39a657a3 100644 --- a/LaunchServer/src/main/java/pro/gravit/launchserver/socket/handlers/NettyWebAPIHandler.java +++ b/LaunchServer/src/main/java/pro/gravit/launchserver/socket/handlers/NettyWebAPIHandler.java @@ -38,19 +38,17 @@ public SeverletPathPair(String key, SimpleSeverletHandler callback) { this.callback = callback; } } - private static ArrayList severletList = new ArrayList<>(); + private static TreeSet severletList = new TreeSet<>(Comparator.comparingInt((e) -> -e.key.length())); public static SeverletPathPair addNewSeverlet(String path, SimpleSeverletHandler callback) { SeverletPathPair pair = new SeverletPathPair("/webapi/".concat(path), callback); severletList.add(pair); - severletList.sort(Comparator.comparingInt((a) -> -a.key.length())); return pair; } public static SeverletPathPair addUnsafeSeverlet(String path, SimpleSeverletHandler callback) { SeverletPathPair pair = new SeverletPathPair(path, callback); severletList.add(pair); - severletList.sort(Comparator.comparingInt((a) -> -a.key.length())); return pair; } public static void removeSeverlet(SeverletPathPair pair)