add server
This commit is contained in:
parent
d5269922b9
commit
76ecfb39ab
25 changed files with 603 additions and 520 deletions
11
java/src/game/util/Tuple.java
Normal file
11
java/src/game/util/Tuple.java
Normal 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;
|
||||
}
|
||||
}
|
|
@ -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, ' ');
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue