<commit_before>import java.net.InetAddress;
import java.util.Date;
import java.util.concurrent.TimeUnit;

import com.google.gson.JsonArray;
import com.google.gson.JsonObject;

public class Player implements TileObject {
	private int x, y;
	private Move move;
	private Field field;
	private MessageHandler messageHandler;

	public Player(MessageHandler messageHandler, Field field, int x, int y) {
		super();
		this.x = x;
		this.y = y;
		this.field = field;
		this.move = new Move(Direction.CENTER);
		this.messageHandler = messageHandler;
		field.addPlayer(this);
	}

	public void connect(MessageHandler messageHandeler) {
		this.messageHandler = messageHandeler;
		this.PlayerInfo();
	}

	public void mObject() {
		move.execute();
		this.x += move.getDirection().getX();
		this.y += move.getDirection().getY();
	}

	public int getX() {
		return x;
	}

	public int getY() {
		return y;
	}

	@Override
	public JsonObject getFieldObject() {
		int xS = x;
		int yS = y;
		long time = new Date().getTime() - move.getMoveStart();
		JsonObject json = new JsonObject();
		Direction direction = move.getDirection();
		json.addProperty("direction", direction.toString());
		json.addProperty("startTime", time);
		json.addProperty("executed", move.isExecuted());
		json.addProperty("moveTime", Constants.FieldParams.baseTurnLength);
		json.addProperty("type", "player");
		if (move.isExecuted()) {
			xS -= direction.getX();
			yS -= direction.getY();
		}
		json.addProperty("x", xS);
		json.addProperty("y", yS);
		return json;
	}

	public void jsonHandle(JsonObject json) {
		JsonProccessor.proccess(this, json);
	}

	public void PlayerInfo() {
		int xS = x;
		int yS = y;
		Direction direction = move.getDirection();
		if (move.isExecuted()) {
			xS -= direction.getX();
			yS -= direction.getY();
		}
		int heighOffset = direction.getX();
		int widthOffset = direction.getY();
		int height = Constants.FieldParams.fieldViewHeight;
		int width = Constants.FieldParams.fieldViewWidth;
		int initX = xS - (height + heighOffset - 1) / 2;
		int initY = yS - (width + widthOffset - 1) / 2;
		StringBuilder retTiles = new StringBuilder();
		JsonArray retObjects = new JsonArray();
		for (int i = initX; i < initX + height + (heighOffset + 1) / 2; i++)
			for (int j = initY; j < initY + width + (widthOffset + 1) / 2; j++) {
				Tile tile = field.getTile(i, j);
				retTiles.append(Long.toString(tile.getType())).append(",");
				TileObject fObject = tile.getFObject();
				if (fObject != null) {
					retObjects.add(fObject.getFieldObject());
				}
			}
		retTiles.deleteCharAt(retTiles.length() - 1);
		JsonObject playerJson = new JsonObject();
		playerJson.add("Player", getFieldObject());
		playerJson.addProperty("Name", "Player");
		playerJson.addProperty("Tiles", retTiles.toString());
		playerJson.add("AllPlayers", retObjects);
		if (messageHandler != null) {
			messageHandler.sendMessage(playerJson.toString());
		}
	}
<commit_msg>Server response to movement has been fixed<commit_after>import java.net.InetAddress;
import java.util.Date;
import java.util.concurrent.TimeUnit;

import com.google.gson.JsonArray;
import com.google.gson.JsonObject;

public class Player implements TileObject {
	private int x, y;
	private Move move;
	private Field field;
	private MessageHandler messageHandler;

	public Player(MessageHandler messageHandler, Field field, int x, int y) {
		super();
		this.x = x;
		this.y = y;
		this.field = field;
		this.move = new Move(Direction.CENTER);
		this.messageHandler = messageHandler;
		field.addPlayer(this);
	}

	public void connect(MessageHandler messageHandeler) {
		this.messageHandler = messageHandeler;
		this.PlayerInfo();
	}

	public void mObject() {
		move.execute();
		this.x += move.getDirection().getX();
		this.y += move.getDirection().getY();
	}

	public int getX() {
		return x;
	}

	public int getY() {
		return y;
	}

	@Override
	public JsonObject getFieldObject() {
		int xS = x;
		int yS = y;
		long time = new Date().getTime() - move.getMoveStart();
		JsonObject json = new JsonObject();
		Direction direction = move.getDirection();
		json.addProperty("direction", direction.toString());
		json.addProperty("startTime", time);
		json.addProperty("executed", move.isExecuted());
		json.addProperty("moveTime", Constants.FieldParams.baseTurnLength);
		json.addProperty("type", "player");
		if (move.isExecuted()) {
			xS -= direction.getX();
			yS -= direction.getY();
		}
		json.addProperty("x", xS);
		json.addProperty("y", yS);
		return json;
	}

	public void jsonHandle(JsonObject json) {
		JsonProccessor.proccess(this, json);
	}

	public void PlayerInfo() {
		int xS = x;
		int yS = y;
		Direction direction = move.getDirection();
		if (move.isExecuted()) {
			xS -= direction.getX();
			yS -= direction.getY();
		}
		int heighOffset = direction.getX();
		int widthOffset = direction.getY();
		int height = Constants.FieldParams.fieldViewHeight;
		int width = Constants.FieldParams.fieldViewWidth;
		int initX = xS - height / 2 + heighOffset;
		int initY = yS - width / 2 + widthOffset;
		StringBuilder retTiles = new StringBuilder();
		JsonArray retObjects = new JsonArray();
		for (int i = initX; i < initX + height  + Math.abs(heighOffset); i++)
			for (int j = initY; j < initY + width  + Math.abs(widthOffset); j++) {
				Tile tile = field.getTile(i, j);
				retTiles.append(Long.toString(tile.getType())).append(",");
				TileObject fObject = tile.getFObject();
				if (fObject != null) {
					retObjects.add(fObject.getFieldObject());
				}
			}
		retTiles.deleteCharAt(retTiles.length() - 1);
		JsonObject playerJson = new JsonObject();
		playerJson.add("Player", getFieldObject());
		playerJson.addProperty("Name", "Player");
		playerJson.addProperty("Tiles", retTiles.toString());
		playerJson.add("AllPlayers", retObjects);
		if (messageHandler != null) {
			messageHandler.sendMessage(playerJson.toString());
		}
	}

{'fraction_non_alphanumeric': 0.14458241197482566, 'fraction_numerical': 0.002041163463174009, 'mean_word_length': 4.090909090909091, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '206943', 'n_tokens_mistral': 2127, 'n_tokens_neox': 1930, 'n_words': 458}