Browse Source

Release 26 Beta

master
Defend 8 years ago
parent
commit
faca09d1d8
  1. 32
      src/client.java
  2. 4
      src/eventHandler.java

32
src/client.java

@ -63,22 +63,26 @@ public class client extends Thread {
while (socketInfo.isOnline(socketid)) { while (socketInfo.isOnline(socketid)) {
msg = readSocket(); msg = readSocket();
parseInput(msg); parseInput(msg);
eventExecute();
}
}
int id = socketInfo.findSocket.bySID(socketid); public void eventExecute(){
if(id == -1){return;} int id = socketInfo.findSocket.bySID(socketid);
switch (socketInfo.EVENT.get(id)){ if(id == -1){return;}
case "play": eventHandler.play(socketid); switch (socketInfo.EVENT.get(id)){
break; case "play": eventHandler.play(socketid);
case "pause": eventHandler.pause(socketid); break;
break; case "pause": eventHandler.pause(socketid);
case "next": eventHandler.next(socketid); break;
break; case "next": eventHandler.next(socketid);
case "prev": eventHandler.prev(socketid); break;
break; case "prev": eventHandler.prev(socketid);
case "wind": eventHandler.wind(socketid); break;
break; case "wind": eventHandler.wind(socketid);
} break;
} }
} }
private String bytesToStringUTFCustom(int[] ints) { private String bytesToStringUTFCustom(int[] ints) {

4
src/eventHandler.java

@ -10,7 +10,8 @@ import java.util.ArrayList;
*/ */
public class eventHandler { public class eventHandler {
//TODO: переписать почти весь код здесь
//Нужно покончить с этим быдланством
public static synchronized void connect(Integer sid){ public static synchronized void connect(Integer sid){
JsonObjectBuilder creator = Json.createObjectBuilder(); JsonObjectBuilder creator = Json.createObjectBuilder();
creator.add("EVENT","SERVICE"); creator.add("EVENT","SERVICE");
@ -40,6 +41,7 @@ public class eventHandler {
socketInfo.CLIENT.get(a.get(i)).sendSocket(lc.toString()); socketInfo.CLIENT.get(a.get(i)).sendSocket(lc.toString());
} }
} }
socketInfo.CLIENT.get(id).eventExecute();
} }
} }

Loading…
Cancel
Save