fix(multiplayer): bind to 0.0.0.0 instead of 127.0.0.1.

This commit is contained in:
huanghongxun
2021-09-27 12:38:43 +08:00
parent 3515ce1034
commit 35f2d89a23
11 changed files with 170 additions and 12 deletions

View File

@@ -330,6 +330,25 @@ public final class Lang {
return optional.map(Stream::of).orElseGet(Stream::empty);
}
public static <T> Iterable<T> toIterable(Enumeration<T> enumeration) {
if (enumeration == null) {
throw new NullPointerException();
}
return () -> new Iterator<T>() {
public boolean hasNext() {
return enumeration.hasMoreElements();
}
public T next() {
return enumeration.nextElement();
}
public void remove() {
throw new UnsupportedOperationException();
}
};
}
public static <T> Iterable<T> toIterable(Stream<T> stream) {
return stream::iterator;
}

View File

@@ -1,6 +1,6 @@
/*
* Hello Minecraft! Launcher
* Copyright (C) 2020 huangyuhui <huanghongxun2008@126.com> and contributors
* Copyright (C) 2021 huangyuhui <huanghongxun2008@126.com> and contributors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -72,6 +72,16 @@ public final class Logging {
LOG.addHandler(streamHandler);
}
public static void initForTest() {
LOG.setLevel(Level.ALL);
LOG.setUseParentHandlers(false);
ConsoleHandler consoleHandler = new ConsoleHandler();
consoleHandler.setFormatter(DefaultFormatter.INSTANCE);
consoleHandler.setLevel(Level.FINER);
LOG.addHandler(consoleHandler);
}
public static byte[] getRawLogs() {
return storedLogs.toByteArray();
}