package slimpleslickgame;

import org.newdawn.slick.GameContainer;
import org.newdawn.slick.Input;
import org.newdawn.slick.geom.Vector2f;

import client.ByteMonitor;
import client.MessageWrapper;

public class LocalPlayer extends Player{

	private GameContainer gc;
	private ByteMonitor bm;
	
	public LocalPlayer(GameContainer gc, ByteMonitor bm, byte id){
		this.gc = gc;
		this.bm = bm;
		super.id = id;
	}
	
	public void update(int delta) {
		if(processInput(gc.getInput())){
			if(bm != null){
				bm.putArrayToServer(getPositionBytes(position), id);
			}
			super.updatePosition();
		}
	}
	
	private boolean processInput(Input input) {
		Vector2f direction = new Vector2f(0, 0);
		boolean dirChanged = false;

		if (input.isKeyDown(Input.KEY_LEFT)) {
			direction.add(new Vector2f(-1, 0));
			dirChanged = true;
		}

		if (input.isKeyDown(Input.KEY_RIGHT)) {
			direction.add(new Vector2f(1, 0));
			dirChanged = true;
		}

		if (input.isKeyDown(Input.KEY_UP)) {
			direction.add(new Vector2f(0, -1));
			dirChanged = true;
		}

		if (input.isKeyDown(Input.KEY_DOWN)) {
			direction.add(new Vector2f(0, 1));
			dirChanged = true;
		}
		//System.out.println("Input processed, direction: " + direction);
		// TODO: add shooting capabilities
		super.setDirection(direction);
		return dirChanged;
	}
	
	public byte[] getPositionBytes(Vector2f pos){
		return MessageWrapper.getPositionBytes(pos);
	}

}

package slimpleslickgame;

import org.newdawn.slick.GameContainer;
import org.newdawn.slick.Input;
import org.newdawn.slick.geom.Vector2f;

import client.ByteMonitor;
import client.MessageWrapper;

public class LocalPlayer extends Player{

	private GameContainer gc;
	private ByteMonitor bm;
	
	public LocalPlayer(GameContainer gc, ByteMonitor bm, byte id){
		this.gc = gc;
		this.bm = bm;
		super.id = id;
	}
	
	public void update(int delta) {
		if(processInput(gc.getInput())){
			if(bm != null){
				bm.putArrayToServer(MessageWrapper.getPositionBytes(position), id);
			}
			super.updatePosition();
		}
	}
	
	private boolean processInput(Input input) {
		Vector2f direction = new Vector2f(0, 0);
		boolean dirChanged = false;

		if (input.isKeyDown(Input.KEY_LEFT)) {
			direction.add(new Vector2f(-1, 0));
			dirChanged = true;
		}

		if (input.isKeyDown(Input.KEY_RIGHT)) {
			direction.add(new Vector2f(1, 0));
			dirChanged = true;
		}

		if (input.isKeyDown(Input.KEY_UP)) {
			direction.add(new Vector2f(0, -1));
			dirChanged = true;
		}

		if (input.isKeyDown(Input.KEY_DOWN)) {
			direction.add(new Vector2f(0, 1));
			dirChanged = true;
		}
		//System.out.println("Input processed, direction: " + direction);
		// TODO: add shooting capabilities
		super.setDirection(direction);
		return dirChanged;
	}

}

remove nilles useless method