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.Rectangle;
/**
* creates rectangles.
*
* @author hendrik
*/
public class CreateRectangleAction extends CreateAction {
/**
* creates a rectangle with the requested color, fill 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 fillColor = action.getInt("fill_color");
int thickness = action.getInt("thickness");
int x = action.getInt("x");
int y = action.getInt("y");
int x2 = action.getInt("x2");
int y2 = action.getInt("y2");
Rectangle shape = new Rectangle(color, fillColor, thickness, x, y, x2, y2);
zone.add(shape);
}
}