add server

This commit is contained in:
Sen 2025-05-01 15:13:38 +02:00
parent d5269922b9
commit 76ecfb39ab
25 changed files with 603 additions and 520 deletions

View file

@ -0,0 +1,11 @@
package game.util;
public class Tuple<S, T> {
public final S first;
public final T second;
public Tuple(S first, T second) {
this.first = first;
this.second = second;
}
}

View file

@ -1,7 +1,10 @@
package game.util;
import java.awt.GraphicsEnvironment;
import java.util.function.Function;
import javax.swing.JOptionPane;
import game.log.Log;
import game.properties.IStringSerializable;
@ -293,4 +296,30 @@ int utf_len(const char *str) {
return (color & 0xff000000) | ((((color >> 16 & 255) * mul) / 255) << 16) | ((((color >> 8 & 255) * mul) / 255) << 8) |
(((color & 255) * mul) / 255);
}
public static void checkOs() {
if(System.getProperty("os.name").startsWith("Windows") || System.getProperty("os.name").startsWith("Mac")) {
String info = "Inkompatibles Betriebssystem";
String msg = "Linux oder *BSD ist erforderlich, um dieses Programm auszuführen.\n" +
"Alle Versionen von Windows und Mac OS (X) sind nicht kompatibel.";
System.err.println("#################################################################");
System.err.println("*** " + info + " ***");
System.err.println(msg);
System.err.println("#################################################################");
if(!GraphicsEnvironment.isHeadless())
JOptionPane.showMessageDialog(null, msg, info, JOptionPane.ERROR_MESSAGE);
System.exit(1);
}
}
public static Tuple<String, String> getKeyValue(String text, char separator) {
int index = text.indexOf(separator);
if(index == -1)
return new Tuple<String, String>(text, null);
return new Tuple<String, String>(text.substring(0, index), text.substring(index + 1));
}
public static Tuple<String, String> getKeyValue(String text) {
return getKeyValue(text, ' ');
}
}