7 static Map<String,String[]> $usr = null;
\r
8 static TCP $tcp = null;
\r
9 static UDP $udp = null;
\r
10 static Config $cfg = new Config("server");
\r
12 static public void main(String[] $args)throws Exception{
\r
13 System.out.println("SERVER Starting...");
\r
15 $usr = Collections.synchronizedMap(new HashMap());
\r
16 BufferedReader $bufr = new BufferedReader(new InputStreamReader(ClassLoader.getSystemResourceAsStream("users.properties")));
\r
18 while(($line = $bufr.readLine()) != null){
\r
19 $line = $line.trim();
\r
20 if($line.length() > 1 && $line.charAt(0) == '=')continue;
\r
21 if($line.length() <= 1)continue;
\r
22 String[] $tmp = $line.split("=");
\r
23 String[] $udata = new String[3];
\r
24 $udata[0]=$tmp[0].trim(); //usrnme
\r
25 if($tmp.length >= 2)$udata[1]=$tmp[1].trim(); else throw new Exception("All users have to have a password! check your user-file");//passwd
\r
26 $udata[2]="never seen online!";
\r
27 $usr.put($udata[0],$udata);
\r
29 System.out.println("SERVER Users.");
\r
31 $tcp = new TCP($cfg.getInt("tcp.port"));
\r
32 $udp = new UDP($cfg.getInt("udp.port"));
\r
34 System.out.println("SERVER Running. Hit ENTER for shutdown.");
\r
36 int $i = Helper.readByte(System.in);
\r
37 System.out.println($i);
\r
38 if($i == 10 || $i == 13)break;
\r
40 System.out.println("SERVER shutting down...");
\r
44 //save userfile - NOT to implement
\r
46 System.out.println("SERVER bye!");
\r