fix: отключено отключения сокет сервера в случае ошибки
- Добавлен аргумент -snowfall_everywhere - Убран NativeNetworking.NetworkLoopHandler.CLIENT_HANDLER - Добавлена поддержка ников в глобальном бане
This commit is contained in:
@@ -75,7 +75,11 @@ public class Main {
|
||||
loader.registerHooksInitializationForClass(LevelHooks.class);
|
||||
loader.registerHooksInitializationForClass(ItemUtils.class);
|
||||
loader.registerHooksInitializationForClass(AndroidHooks.class);
|
||||
// loader.registerHooksInitializationForClass(SnowfallEverywhere.class);
|
||||
|
||||
for(String arg : args)
|
||||
if(arg.equals("-snowfall_everywhere"))
|
||||
loader.registerHooksInitializationForClass(SnowfallEverywhere.class);
|
||||
|
||||
// loader.registerHooksInitializationForClass(BiomesHooks.class);
|
||||
loader.registerHooksInitializationForClass(GlobalBanList.class);
|
||||
|
||||
|
||||
@@ -43,9 +43,7 @@ public class GlobalBanList implements HookClass {
|
||||
|
||||
list = new JSONArray(result);
|
||||
}
|
||||
} catch (Exception ignored) {
|
||||
ignored.printStackTrace();
|
||||
}
|
||||
} catch (Exception ignored) {}
|
||||
|
||||
final String[] banListGit = new String[list.length()];
|
||||
for(int i = 0;i < banListGit.length;i++)
|
||||
@@ -55,12 +53,9 @@ public class GlobalBanList implements HookClass {
|
||||
|
||||
@Inject
|
||||
public static boolean isBanned(BanList self, String name){
|
||||
final String file = ReflectHelper.getField(self, "file");
|
||||
|
||||
if(file != null && file.endsWith("banned-ips.json"))
|
||||
for(final String ip : banList)
|
||||
if(ip.equals(name))
|
||||
return true;
|
||||
for(final String ip : banList)
|
||||
if(ip.equals(name))
|
||||
return true;
|
||||
|
||||
if (!self.isEnable() || name == null)
|
||||
return false;
|
||||
|
||||
@@ -187,7 +187,7 @@ public class Network {
|
||||
//shutdown();
|
||||
|
||||
NativeNetworking.NetworkLoopHandler handler = new NativeNetworking.NetworkLoopHandler(
|
||||
NativeNetworking.NetworkLoopHandler.GLOBAL_HANDLER | NativeNetworking.NetworkLoopHandler.SERVER_HANDLER | NativeNetworking.NetworkLoopHandler.CLIENT_HANDLER
|
||||
NativeNetworking.NetworkLoopHandler.GLOBAL_HANDLER | NativeNetworking.NetworkLoopHandler.SERVER_HANDLER
|
||||
).start();
|
||||
|
||||
startServer(port);
|
||||
|
||||
@@ -43,6 +43,8 @@ public class SocketServer {
|
||||
continue;
|
||||
}
|
||||
|
||||
Logger.debug("New socket connection "+socket.getInetAddress());
|
||||
|
||||
try {
|
||||
int protocol = socket.getInputStream().read();
|
||||
DataChannel channel = DataChannelFactory.newDataChannelViaSupportedProtocol(socket, protocol);
|
||||
@@ -53,8 +55,7 @@ public class SocketServer {
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
isRunning = false;
|
||||
return;
|
||||
continue;
|
||||
}
|
||||
|
||||
boolean isChannelManaged = false;
|
||||
@@ -70,7 +71,6 @@ public class SocketServer {
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
isRunning = false;
|
||||
}
|
||||
}
|
||||
}).start();
|
||||
|
||||
Reference in New Issue
Block a user