Commit 8c580162 authored by adwisatya's avatar adwisatya
Browse files

Handling map

parent b769eb2a
#Mon, 27 Apr 2015 00:13:24 +0700
#Mon, 27 Apr 2015 00:52:16 +0700
C\:\\Users\\adwisatya\\Documents\\Semester\ 6\\Tugas\\IF3230\ Sister\\IF3230-Tugas-Besar-Sister-2015\\src\\server=
{"name" : "Bandar Behari","width" : 4,"height" : 4,"map" :[["R13", "R13", "R13", "R13"],["R13", "R13", "R14", "R14"],["R13", "R14", "R14", "R14"],["R13", "R14", "R14", "R14"]]}
{"name" : "Bandar Behari","width" : 4,"height" : 4,"map" :[["R13", "R13", "R13", "R13"],["R13", "R13", "R14", "R14"],["R13", "R14", "R14", "R14"],["R13", "R14", "R14", "R14"]]}
......@@ -11,12 +11,16 @@ import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.PrintStream;
import java.io.PrintWriter;
import java.net.*;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.sql.SQLException;
......@@ -27,6 +31,7 @@ import java.util.Arrays;
import java.util.Calendar;
import java.util.Date;
import java.util.Enumeration;
import java.util.Scanner;
import java.util.TimeZone;
import java.util.logging.Level;
import java.util.logging.Logger;
......@@ -71,6 +76,7 @@ public class Client extends Thread{
/* Testing database */
clientSentence = "";
char[] buffer = new char[MAX_BUFFER];
loadMap();
while(true){
try{
fromClient = new BufferedReader(new InputStreamReader(connectionSocket.getInputStream()));
......@@ -300,8 +306,8 @@ public class Client extends Thread{
}
/* Sukses */
public void cmdMap(String token) throws IOException, NoSuchAlgorithmException, JSONException{
loadMap();
String response = "";
JSONObject obj = new JSONObject();
try {
obj = database.getMap();
......@@ -551,13 +557,14 @@ public class Client extends Thread{
}
public void loadMap(){
String filename = "map.json";
File f = new File("file.json");
if(f.exists()){
System.out.println("ada");
}else{
System.out.println("tidak ada");
File f = new File("map.json");
System.out.println(f.getPath());
System.out.println(f.getAbsolutePath());
try {
System.out.println(f.getCanonicalPath());
}
catch(Exception e) {}
}
}
{"name" : "Bandar Behari","width" : 4,"height" : 4,"map" :[["R13", "R13", "R13", "R13"],["R13", "R13", "R14", "R14"],["R13", "R14", "R14", "R14"],["R13", "R14", "R14", "R14"]]}
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