public void startService() { try { InputStream is = mRemote.getInputStream(); BufferedReader br = new BufferedReader(new InputStreamReader(is)); BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(mRemote.getOutputStream())); String line; while ((line = br.readLine()) != null) { if (line.equals("LOOP_END")) { break; } else if (line.equals("MAIN_END")) { mMain.mIsRunning = false; break; } bw.append("echo : " + line); bw.flush(); } br.close(); bw.close(); } catch (IOException e) { e.printStackTrace(); } try { mRemote.close(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } }
public static void rotateEntity(boolean clockwise, int uid) { EntityManager.rotateEntity(clockwise, uid); ServerMain.sendToAll( PacketBuilder.entityMove( uid, entities.get(uid).getLocation().x, entities.get(uid).getLocation().y, entities.get(uid).getDirection())); }
public static void moveEntity(boolean forward, int uid) { EntityManager.moveEntity(forward, uid); ServerMain.sendToAll( PacketBuilder.entityMove( uid, entities.get(uid).getLocation().x, entities.get(uid).getLocation().y, entities.get(uid).getDirection())); }
public static void sendLocations() { for (Integer id : entities.keySet()) { ServerMain.sendToAll( PacketBuilder.entityMove( id, entities.get(id).getLocation().x, entities.get(id).getLocation().y, entities.get(id).getDirection())); } }
public static void removeEntity(int uid) { EntityManager.removeEntity(uid); ServerMain.sendToAll(PacketBuilder.removeEntity(uid)); }
/** Wrap ServerMain(). Sets mongo as the db provider. */ public static void main(String[] args) throws Exception { DBService.setDb(MongoDBService.getDb()); ServerMain.main(args); }