Made it Java 6 compatible

As a major part of servers is running on Java 6 I had to remove
multi-case statements, as they are only available in Java 7+.

Also fixed some casting errors and other mistakes.

Signed-off-by: FroznMine <pesafrre@arcor.de>