Commit 112c506c authored by Susanti Gojali's avatar Susanti Gojali
Browse files

fix conflict

parents 71c06876 e4457f5f
......@@ -4,7 +4,7 @@
<open-files xmlns="http://www.netbeans.org/ns/projectui-open-files/2">
<group>
<file>file:/C:/Users/susanti_2/Documents/ITB/IF/netbeans/IF3230-Tugas-Besar-Sister-2015/src/client/src/tcpclient/MainPage.java</file>
<file>file:/C:/Users/susanti_2/Documents/ITB/IF/netbeans/IF3230-Tugas-Besar-Sister-2015/src/client/src/tcpclient/TCPClient.java</file>
<file>file:/C:/Users/susanti_2/Documents/ITB/IF/netbeans/IF3230-Tugas
</group>
</open-files>
</project-private>
package tcpclient;
import java.awt.Graphics;
import java.awt.Image;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import javax.imageio.ImageIO;
import javax.swing.ImageIcon;
import javax.swing.JPanel;
public class LoginPanel extends JPanel {
private Image img;
public LoginPanel() {
// load the background image
try {
img = ImageIO.read(getClass().getResource("images/login.png"));
} catch (Exception e) {
e.printStackTrace();
}
}
@Override
protected void paintComponent(Graphics g) {
super.paintComponent(g);
g.drawImage(img, 0, 0, getWidth(), getHeight(), this);
}
}
......@@ -288,7 +288,7 @@
</Group>
<EmptySpace min="-2" pref="45" max="-2" attributes="0"/>
<Component id="connectButton" min="-2" max="-2" attributes="0"/>
<EmptySpace pref="246" max="32767" attributes="0"/>
<EmptySpace max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
......@@ -346,21 +346,28 @@
<Component id="loginButton" min="-2" max="-2" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0">
<EmptySpace min="-2" pref="161" max="-2" attributes="0"/>
<Component id="loginLabel" min="-2" pref="60" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="52" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="usernameLoginLabel" min="-2" max="-2" attributes="0"/>
<Component id="passwordLoginLabel" min="-2" max="-2" attributes="0"/>
<Group type="102" attributes="0">
<EmptySpace min="-2" pref="161" max="-2" attributes="0"/>
<Component id="loginLabel" min="-2" pref="60" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="175" max="-2" attributes="0"/>
</Group>
<Group type="102" alignment="1" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="1" attributes="0">
<Component id="jLabel3" min="-2" max="-2" attributes="0"/>
<Component id="jLabel2" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace min="-2" pref="110" max="-2" attributes="0"/>
</Group>
</Group>
<EmptySpace min="-2" pref="75" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" max="-2" attributes="0">
<Component id="passwordLoginField" max="32767" attributes="0"/>
<Component id="usernameLoginTextField" min="-2" pref="151" max="-2" attributes="0"/>
</Group>
</Group>
</Group>
<EmptySpace max="32767" attributes="0"/>
<EmptySpace pref="361" max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
......@@ -370,14 +377,14 @@
<EmptySpace min="-2" pref="90" max="-2" attributes="0"/>
<Component id="loginLabel" min="-2" pref="25" max="-2" attributes="0"/>
<EmptySpace type="separate" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="usernameLoginTextField" alignment="1" min="-2" max="-2" attributes="0"/>
<Component id="usernameLoginLabel" min="-2" max="-2" attributes="0"/>
<Group type="103" groupAlignment="1" attributes="0">
<Component id="usernameLoginTextField" min="-2" max="-2" attributes="0"/>
<Component id="jLabel2" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace type="separate" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="passwordLoginLabel" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="passwordLoginField" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jLabel3" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace min="-2" pref="36" max="-2" attributes="0"/>
<Component id="loginButton" min="-2" max="-2" attributes="0"/>
......@@ -392,16 +399,6 @@
<Property name="text" type="java.lang.String" value="LOGIN"/>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="usernameLoginLabel">
<Properties>
<Property name="text" type="java.lang.String" value="Username"/>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="passwordLoginLabel">
<Properties>
<Property name="text" type="java.lang.String" value="Password"/>
</Properties>
</Component>
<Component class="javax.swing.JTextField" name="usernameLoginTextField">
<Properties>
<Property name="text" type="java.lang.String" value="ayam"/>
......@@ -423,6 +420,16 @@
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="loginButtonActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JLabel" name="jLabel2">
<Properties>
<Property name="text" type="java.lang.String" value="Username"/>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLabel3">
<Properties>
<Property name="text" type="java.lang.String" value="Password"/>
</Properties>
</Component>
</SubComponents>
</Container>
<Container class="javax.swing.JPanel" name="registerPanel">
......@@ -1693,7 +1700,7 @@
<Component id="FindIcon" min="-2" max="-2" attributes="0"/>
<Component id="Find" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace min="0" pref="156" max="32767" attributes="0"/>
<EmptySpace min="0" pref="174" max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
......@@ -1738,14 +1745,14 @@
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="FindPotion" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="FindHoney" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="FindHerbs" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="FindClay" alignment="0" min="-2" pref="155" max="-2" attributes="0"/>
<Component id="FindMineral" alignment="0" min="-2" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" max="-2" attributes="0">
<Component id="FindPotion" alignment="0" max="32767" attributes="0"/>
<Component id="FindHoney" alignment="0" max="32767" attributes="0"/>
<Component id="FindHerbs" alignment="0" max="32767" attributes="0"/>
<Component id="FindMineral" alignment="0" max="32767" attributes="0"/>
<Component id="FindClay" alignment="0" max="32767" attributes="0"/>
</Group>
<EmptySpace type="separate" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="36" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="FindIncense" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="FindGems" alignment="0" min="-2" max="-2" attributes="0"/>
......@@ -1764,7 +1771,6 @@
<Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
<Image iconType="3" name="/inventory/images/honey.PNG"/>
</Property>
<Property name="text" type="java.lang.String" value="jButton1"/>
<Property name="horizontalTextPosition" type="int" value="0"/>
<Property name="verticalTextPosition" type="int" value="3"/>
</Properties>
......@@ -1777,7 +1783,6 @@
<Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
<Image iconType="3" name="/inventory/images/herbs.PNG"/>
</Property>
<Property name="text" type="java.lang.String" value="jButton1"/>
<Property name="horizontalTextPosition" type="int" value="0"/>
<Property name="verticalTextPosition" type="int" value="3"/>
</Properties>
......@@ -1790,7 +1795,6 @@
<Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
<Image iconType="3" name="/inventory/images/clay.PNG"/>
</Property>
<Property name="text" type="java.lang.String" value="jButton1"/>
<Property name="horizontalTextPosition" type="int" value="0"/>
<Property name="verticalTextPosition" type="int" value="3"/>
</Properties>
......@@ -1803,7 +1807,6 @@
<Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
<Image iconType="3" name="/inventory/images/mineral.PNG"/>
</Property>
<Property name="text" type="java.lang.String" value="jButton1"/>
<Property name="horizontalTextPosition" type="int" value="0"/>
<Property name="verticalTextPosition" type="int" value="3"/>
</Properties>
......@@ -1816,7 +1819,6 @@
<Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
<Image iconType="3" name="/inventory/images/potion.PNG"/>
</Property>
<Property name="text" type="java.lang.String" value="jButton1"/>
<Property name="horizontalTextPosition" type="int" value="0"/>
<Property name="verticalTextPosition" type="int" value="3"/>
</Properties>
......@@ -1829,7 +1831,6 @@
<Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
<Image iconType="3" name="/inventory/images/stone.PNG"/>
</Property>
<Property name="text" type="java.lang.String" value="jButton1"/>
<Property name="horizontalTextPosition" type="int" value="0"/>
<Property name="verticalTextPosition" type="int" value="3"/>
</Properties>
......@@ -1842,7 +1843,6 @@
<Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
<Image iconType="3" name="/inventory/images/manaCrystal.PNG"/>
</Property>
<Property name="text" type="java.lang.String" value="jButton1"/>
<Property name="horizontalTextPosition" type="int" value="0"/>
<Property name="verticalTextPosition" type="int" value="3"/>
</Properties>
......@@ -1855,7 +1855,6 @@
<Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
<Image iconType="3" name="/inventory/images/lifeElixir.PNG"/>
</Property>
<Property name="text" type="java.lang.String" value="jButton1"/>
<Property name="horizontalTextPosition" type="int" value="0"/>
<Property name="verticalTextPosition" type="int" value="3"/>
</Properties>
......@@ -1868,7 +1867,6 @@
<Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
<Image iconType="3" name="/inventory/images/gems.PNG"/>
</Property>
<Property name="text" type="java.lang.String" value="jButton1"/>
<Property name="horizontalTextPosition" type="int" value="0"/>
<Property name="verticalTextPosition" type="int" value="3"/>
</Properties>
......@@ -1881,7 +1879,6 @@
<Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
<Image iconType="3" name="/inventory/images/incense.PNG"/>
</Property>
<Property name="text" type="java.lang.String" value="jButton1"/>
<Property name="horizontalTextPosition" type="int" value="0"/>
<Property name="verticalTextPosition" type="int" value="3"/>
</Properties>
......@@ -1913,7 +1910,7 @@
</Component>
</SubComponents>
</Container>
<Container class="javax.swing.JPanel" name="tradeitemPanel">
<Container class="javax.swing.JPanel" name="FindOfferItemPanel">
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignCardLayout" value="org.netbeans.modules.form.compat2.layouts.DesignCardLayout$CardConstraintsDescription">
<CardConstraints cardName="TradeItemCard"/>
......@@ -1924,26 +1921,41 @@
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace min="-2" pref="34" max="-2" attributes="0"/>
<Component id="jScrollPane1" min="-2" pref="851" max="-2" attributes="0"/>
<EmptySpace pref="23" max="32767" attributes="0"/>
<EmptySpace min="-2" pref="19" max="-2" attributes="0"/>
<Component id="FindOfferItemScrollPane" min="-2" pref="847" max="-2" attributes="0"/>
<EmptySpace pref="42" max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace min="-2" pref="21" max="-2" attributes="0"/>
<Component id="jScrollPane1" min="-2" pref="497" max="-2" attributes="0"/>
<EmptySpace pref="22" max="32767" attributes="0"/>
<Group type="102" alignment="1" attributes="0">
<EmptySpace pref="20" max="32767" attributes="0"/>
<Component id="FindOfferItemScrollPane" min="-2" pref="500" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="20" max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Container class="javax.swing.JScrollPane" name="jScrollPane1">
<Container class="javax.swing.JScrollPane" name="FindOfferItemScrollPane">
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
<SubComponents>
<Component class="javax.swing.JTable" name="FindOfferItemTable">
<Properties>
<Property name="model" type="javax.swing.table.TableModel" editor="org.netbeans.modules.form.RADConnectionPropertyEditor">
<Connection code="tradeboxModel" type="code"/>
</Property>
<Property name="columnModel" type="javax.swing.table.TableColumnModel" editor="org.netbeans.modules.form.editors2.TableColumnModelEditor">
<TableColumnModel selectionModel="0"/>
</Property>
<Property name="tableHeader" type="javax.swing.table.JTableHeader" editor="org.netbeans.modules.form.editors2.JTableHeaderEditor">
<TableHeader reorderingAllowed="true" resizingAllowed="true"/>
</Property>
</Properties>
</Component>
</SubComponents>
</Container>
</SubComponents>
</Container>
......
This diff is collapsed.
......@@ -256,6 +256,7 @@ public class TCPClient {
return obj;
}
public JSONObject sendFind(String token,int FindId) throws Exception {
openConnection();
......
<<<<<<< HEAD
#Fri, 24 Apr 2015 15:40:25 +0700
=======
#Fri, 24 Apr 2015 15:40:37 +0700
>>>>>>> e4457f5f5bf18c35d13041513c5e876949f2ae72
C\:\\Users\\susanti_2\\Documents\\ITB\\IF\\netbeans\\IF3230-Tugas-Besar-Sister-2015\\src\\server=
compile.on.save=true
<<<<<<< HEAD
=======
>>>>>>> e4457f5f5bf18c35d13041513c5e876949f2ae72
do.depend=false
do.jar=true
javac.debug=true
javadoc.preview=true
<<<<<<< HEAD
user.properties.file=C:\\Users\\susanti_2\\AppData\\Roaming\\NetBeans\\8.0.2\\build.properties
=======
user.properties.file=C:\\Users\\Stephen\\AppData\\Roaming\\NetBeans\\8.0.2\\build.properties
>>>>>>> e4457f5f5bf18c35d13041513c5e876949f2ae72
......@@ -3,7 +3,12 @@
<editor-bookmarks xmlns="http://www.netbeans.org/ns/editor-bookmarks/2" lastBookmarkId="0"/>
<open-files xmlns="http://www.netbeans.org/ns/projectui-open-files/2">
<group>
<<<<<<< HEAD
<file>file:/C:/Users/susanti_2/Documents/ITB/IF/netbeans/IF3230-Tugas-Besar-Sister-2015/src/server/src/tcpserver/TCPServer.java</file>
=======
<file>file:/C:/Users/Stephen/Documents/NetBeansProjects/TubesSister/src/server/src/tcpserver/TCPServer.java</file>
<file>file:/C:/Users/Stephen/Documents/NetBeansProjects/TubesSister/src/server/src/tcpserver/MySQLAccess.java</file>
>>>>>>> e4457f5f5bf18c35d13041513c5e876949f2ae72
</group>
</open-files>
</project-private>
......@@ -299,6 +299,7 @@ public class TCPServer implements Runnable {
}
public JSONObject sendfind(JSONObject clientObject) throws JSONException, UnknownHostException, IOException {
System.out.println("masuk find");
if(clientObject.getString("token").equalsIgnoreCase(token)) {
// isi findOfferTime dengan waktu sekarang
DateFormat dateFormat = new SimpleDateFormat("HH:mm:ss");
......@@ -324,7 +325,7 @@ public class TCPServer implements Runnable {
// do nothing
} else if(server.ipAddress.equalsIgnoreCase(thisIP) && server.port==serverPort) {
// do nothing
} else if(server.ipAddress.equalsIgnoreCase("167.205.32.46")){ // Masih cuma pake kakaknya punya
} else{ // Masih cuma pake kakaknya punya
System.out.println("Searching offer from : " + server.ipAddress + ":" + server.port);
JSONObject tempRequest = new JSONObject();
tempRequest.put("method", "findoffer");
......@@ -347,6 +348,7 @@ public class TCPServer implements Runnable {
inFromServer.read(b);
String response = new String(b, "UTF-8");
System.out.println(response);
JSONObject tempResponse = new JSONObject(response);
if(tempResponse.getString("status").equalsIgnoreCase("ok")) {
......@@ -355,11 +357,13 @@ public class TCPServer implements Runnable {
offers.put(tempResponse.getJSONArray("offers").get(i));
offerHost.add(new Host(server.ipAddress, server.port));
}
}
}
tempsocket.close();
} catch(Exception e) {
e.printStackTrace();
System.out.println("Cannot connect to " + server.ipAddress + ":" + server.port);
}
}
......@@ -374,6 +378,7 @@ public class TCPServer implements Runnable {
return sql.sendfind(clientObject.getInt("item"));
}
} else {
System.out.println("error oi");
JSONObject responseJSON = new JSONObject();
responseJSON.put("status", "error");
return responseJSON;
......@@ -442,91 +447,95 @@ public class TCPServer implements Runnable {
// Membaca request dari client
DataOutputStream outToClient = new DataOutputStream(server.clientSocket.getOutputStream());
DataInputStream inFromClient = new DataInputStream(server.clientSocket.getInputStream());
byte b[] = new byte[4096];
inFromClient.read(b);
server.clientRequest = new String(b, "UTF-8");
System.out.println("Received: " + server.clientRequest + "aaaaaaa");
if(!server.clientRequest.equalsIgnoreCase("") && isJSONValid(server.clientRequest)) {
// Mementuk JSON Object dari request client
JSONObject clientObject = new JSONObject(server.clientRequest);
String method = clientObject.getString("method");
try {
byte b[] = new byte[4096];
inFromClient.read(b);
server.clientRequest = new String(b, "UTF-8");
if(method.equalsIgnoreCase("signup")) { // Jika method request adalah "signup"
JSONObject responseJSON = server.signup(clientObject);
System.out.println("Sent: " + responseJSON.toString());
if(responseJSON.getString("status").equalsIgnoreCase("ok")) {
server.sql.createInventory(clientObject.getString("username"));
}
outToClient.write(responseJSON.toString().getBytes("UTF-8"));
} else if(method.equalsIgnoreCase("login")) { // Jika method request adalah "login"
JSONObject responseJSON = server.login(clientObject);
System.out.println("Sent: " + responseJSON.toString());
if(responseJSON.getString("status").equalsIgnoreCase("ok")) {
server.userID = server.sql.getUserId(clientObject.getString("username"));
server.token = responseJSON.getString("token");
System.out.println("ID : " + server.userID);
System.out.println("token : " + server.token);
System.out.println("Received: " + server.clientRequest + "aaaaaaa");
if(!server.clientRequest.equalsIgnoreCase("") && isJSONValid(server.clientRequest)) {
// Mementuk JSON Object dari request client
JSONObject clientObject = new JSONObject(server.clientRequest);
String method = clientObject.getString("method");
if(method.equalsIgnoreCase("signup")) { // Jika method request adalah "signup"
JSONObject responseJSON = server.signup(clientObject);
System.out.println("Sent: " + responseJSON.toString());
if(responseJSON.getString("status").equalsIgnoreCase("ok")) {
server.sql.createInventory(clientObject.getString("username"));
}
outToClient.write(responseJSON.toString().getBytes("UTF-8"));
} else if(method.equalsIgnoreCase("login")) { // Jika method request adalah "login"
JSONObject responseJSON = server.login(clientObject);
System.out.println("Sent: " + responseJSON.toString());
if(responseJSON.getString("status").equalsIgnoreCase("ok")) {
server.userID = server.sql.getUserId(clientObject.getString("username"));
server.token = responseJSON.getString("token");
System.out.println("ID : " + server.userID);
System.out.println("token : " + server.token);
}
outToClient.write(responseJSON.toString().getBytes("UTF-8"));
} else if(method.equalsIgnoreCase("inventory")) {
JSONObject responseJSON = server.inventory(clientObject);
System.out.println("Sent: " + responseJSON.toString());
outToClient.write(responseJSON.toString().getBytes("UTF-8"));
} else if(method.equalsIgnoreCase("mixitem")) {
JSONObject responseJSON = server.mixitem(clientObject);
System.out.println("Sent: " + responseJSON.toString());
outToClient.write(responseJSON.toString().getBytes("UTF-8"));
} else if(method.equalsIgnoreCase("map")) {
JSONObject responseJSON = server.map(clientObject);
System.out.println("Sent: " + responseJSON.toString());
outToClient.write(responseJSON.toString().getBytes("UTF-8"));
} else if(method.equalsIgnoreCase("move")) {
JSONObject responseJSON = server.move(clientObject);
System.out.println("Sent: " + responseJSON.toString());
outToClient.write(responseJSON.toString().getBytes("UTF-8"));
} else if(method.equalsIgnoreCase("field")) {
JSONObject responseJSON = server.field(clientObject);
System.out.println("Sent: " + responseJSON.toString());
outToClient.write(responseJSON.toString().getBytes("UTF-8"));
} else if(method.equalsIgnoreCase("offer")) {
JSONObject responseJSON = server.offer(clientObject);
System.out.println("Sent: " + responseJSON.toString());
outToClient.write(responseJSON.toString().getBytes("UTF-8"));
} else if(method.equalsIgnoreCase("canceloffer")) {
JSONObject responseJSON = server.canceloffer(clientObject);
System.out.println("Sent: " + responseJSON.toString());
outToClient.write(responseJSON.toString().getBytes("UTF-8"));
} else if(method.equalsIgnoreCase("tradebox")) {
JSONObject responseJSON = server.tradebox(clientObject);
System.out.println("Sent: " + responseJSON.toString());
outToClient.write(responseJSON.toString().getBytes("UTF-8"));
} else if(method.equalsIgnoreCase("fetchitem")) {
JSONObject responseJSON = server.fetchitem(clientObject);
System.out.println("Sent: " + responseJSON.toString());
outToClient.write(responseJSON.toString().getBytes("UTF-8"));
} else if(method.equalsIgnoreCase("findoffer")) {
JSONObject responseJSON = server.findoffer(clientObject);
System.out.println("Sent: " + responseJSON.toString());
outToClient.write(responseJSON.toString().getBytes("UTF-8"));
} else if(method.equalsIgnoreCase("sendfind")) {
JSONObject responseJSON = server.sendfind(clientObject);
System.out.println("Sent: " + responseJSON.toString());
outToClient.write(responseJSON.toString().getBytes("UTF-8"));
} else if(method.equalsIgnoreCase("accept")) {
JSONObject responseJSON = server.accept(clientObject);
System.out.println("Sent: " + responseJSON.toString());
outToClient.write(responseJSON.toString().getBytes("UTF-8"));
} else if(method.equalsIgnoreCase("sendaccept")) {
JSONObject responseJSON = server.sendaccept(clientObject);
System.out.println("Sent: " + responseJSON.toString());
outToClient.write(responseJSON.toString().getBytes("UTF-8"));
} else if(method.equalsIgnoreCase("serverStatus")) {
JSONObject responseJSON = server.serverstatus(clientObject);
System.out.println("Sent: " + responseJSON.toString());
outToClient.write(responseJSON.toString().getBytes("UTF-8"));
}
outToClient.write(responseJSON.toString().getBytes("UTF-8"));
} else if(method.equalsIgnoreCase("inventory")) {
JSONObject responseJSON = server.inventory(clientObject);
System.out.println("Sent: " + responseJSON.toString());
outToClient.write(responseJSON.toString().getBytes("UTF-8"));
} else if(method.equalsIgnoreCase("mixitem")) {
JSONObject responseJSON = server.mixitem(clientObject);
System.out.println("Sent: " + responseJSON.toString());
outToClient.write(responseJSON.toString().getBytes("UTF-8"));
} else if(method.equalsIgnoreCase("map")) {
JSONObject responseJSON = server.map(clientObject);
System.out.println("Sent: " + responseJSON.toString());
outToClient.write(responseJSON.toString().getBytes("UTF-8"));
} else if(method.equalsIgnoreCase("move")) {
JSONObject responseJSON = server.move(clientObject);
System.out.println("Sent: " + responseJSON.toString());
outToClient.write(responseJSON.toString().getBytes("UTF-8"));
} else if(method.equalsIgnoreCase("field")) {
JSONObject responseJSON = server.field(clientObject);
System.out.println("Sent: " + responseJSON.toString());
outToClient.write(responseJSON.toString().getBytes("UTF-8"));
} else if(method.equalsIgnoreCase("offer")) {
JSONObject responseJSON = server.offer(clientObject);
System.out.println("Sent: " + responseJSON.toString());
outToClient.write(responseJSON.toString().getBytes("UTF-8"));
} else if(method.equalsIgnoreCase("canceloffer")) {
JSONObject responseJSON = server.canceloffer(clientObject);
System.out.println("Sent: " + responseJSON.toString());
outToClient.write(responseJSON.toString().getBytes("UTF-8"));
} else if(method.equalsIgnoreCase("tradebox")) {
JSONObject responseJSON = server.tradebox(clientObject);
System.out.println("Sent: " + responseJSON.toString());
outToClient.write(responseJSON.toString().getBytes("UTF-8"));
} else if(method.equalsIgnoreCase("fetchitem")) {
JSONObject responseJSON = server.fetchitem(clientObject);
System.out.println("Sent: " + responseJSON.toString());
outToClient.write(responseJSON.toString().getBytes("UTF-8"));
} else if(method.equalsIgnoreCase("findoffer")) {
JSONObject responseJSON = server.findoffer(clientObject);
System.out.println("Sent: " + responseJSON.toString());
outToClient.write(responseJSON.toString().getBytes("UTF-8"));
} else if(method.equalsIgnoreCase("sendfind")) {
JSONObject responseJSON = server.sendfind(clientObject);
System.out.println("Sent: " + responseJSON.toString());
outToClient.write(responseJSON.toString().getBytes("UTF-8"));
} else if(method.equalsIgnoreCase("accept")) {
JSONObject responseJSON = server.accept(clientObject);
System.out.println("Sent: " + responseJSON.toString());
outToClient.write(responseJSON.toString().getBytes("UTF-8"));
} else if(method.equalsIgnoreCase("sendaccept")) {
JSONObject responseJSON = server.sendaccept(clientObject);
System.out.println("Sent: " + responseJSON.toString());
outToClient.write(responseJSON.toString().getBytes("UTF-8"));
} else if(method.equalsIgnoreCase("serverStatus")) {
JSONObject responseJSON = server.serverstatus(clientObject);
System.out.println("Sent: " + responseJSON.toString());
outToClient.write(responseJSON.toString().getBytes("UTF-8"));