package net.sf.arianne.marboard.server.action.create;
import marauroa.common.game.RPAction;
import net.sf.arianne.marboard.server.core.engine.MarboardZone;
import net.sf.arianne.marboard.server.entity.meta.User;
import net.sf.arianne.marboard.server.entity.shape.StraightLine;
/**
* creates lines.
*
* @author hendrik
*/
public class CreateStraightLineAction extends CreateAction {
/**
* creates a straight line with the requested color and thickness
* at the requested coordinates.
*
* @param user the user wanting to execute the action
* @param action the action to be executed
*/
@Override
protected void perform(User user, RPAction action) {
MarboardZone zone = user.getZone();
int color = action.getInt("color");
int thickness = action.getInt("thickness");
int startX = action.getInt("x");
int startY = action.getInt("y");
int x2 = action.getInt("x2");
int y2 = action.getInt("y2");
StraightLine curve = new StraightLine(color, thickness, startX, startY, x2, y2);
zone.add(curve);
}
}