Commit 43695263 authored by Akhmad Fakhoni Listiyan Dede's avatar Akhmad Fakhoni Listiyan Dede
Browse files

Merging

parents 13fddbe0 1cf7eae5
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package server.helper;
/**
*
* @author user
*/
public class Map {
private String[][] map;
private String token;
public Map(String token){
map = Store.getMap();
this.token = token;
}
public String[][] getMap(){
return map;
}
public String getToken(){
return token;
}
}
......@@ -683,33 +683,37 @@ public class Message {
String response = null;
List<String> listResponse = null;
JSONObject jsonObj = null;
JSONObject jsonAllOffers = null;
try{
// if(Database.isExist())
// ArrayList<ArrayList<Object>> allOffers = Database.getTradebox(offer_token);
jsonObj = new JSONObject();
jsonObj.put("method", "accept");
jsonObj.put("offer_token", offer_token);
listResponse = ServerHandler.broadcast(jsonObj.toString());
listResponse.add("{\"status\":\"ok\",\"offers\":[[3,2,4,3,false,\"553c35e53c892b1b9ddb1b86\"],[4,5,6,2,true,\"553c36143c892b1bbf7723d6\"],[4,1,5,3,false,\"553c372f3c892b1c27a0e924\"]]}");
OUTER:
for (String temp : listResponse) {
JSONObject tempJSON = new JSONObject(temp);
switch (tempJSON.getString("status")) {
case "ok":
response = tempJSON.toString();
break OUTER;
case "fail":
case "error":
response = tempJSON.toString();
break;
JSONObject jsonAllOffers = null;
if(Database.isExist(offer_token)){
Database.changeLocalTradeboxToFalse(offer_token);
}
else{
try{
jsonObj = new JSONObject();
jsonObj.put("method", "accept");
jsonObj.put("offer_token", offer_token);
listResponse = ServerHandler.broadcast(jsonObj.toString());
// listResponse.add("{\"status\":\"ok\",\"offers\":[[3,2,4,3,false,\"553c35e53c892b1b9ddb1b86\"],[4,5,6,2,true,\"553c36143c892b1bbf7723d6\"],[4,1,5,3,false,\"553c372f3c892b1c27a0e924\"]]}");
OUTER:
for (String temp : listResponse) {
JSONObject tempJSON = new JSONObject(temp);
switch (tempJSON.getString("status")) {
case "ok":
response = tempJSON.toString();
break OUTER;
case "fail":
case "error":
response = tempJSON.toString();
break;
}
}
}
catch(JSONException ex)
{
response = error();
}
}
catch(JSONException ex)
{
response = error();
}
if(log)
System.out.println(response);
return response;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment