MCPcopy Create free account
hub / github.com/Neop/mudmap2 / move

Method move

src/main/java/mudmap2/CopyPaste.java:241–254  ·  view source on GitHub ↗

Moves the given place to the new x/y coordinates on the place's layer. @param place @param x @param y @return True if the place was moved

(final Place place, final int x, final int y)

Source from the content-addressed store, hash-verified

239 * @return True if the place was moved
240 */
241 public static boolean move(final Place place, final int x, final int y) {
242 try {
243 final Layer layer = place.getLayer();
244 if (layer.get(x, y) != null) {
245 return false;
246 }
247 layer.remove(place);
248 layer.put(place, x, y);
249 return true;
250 } catch (final Exception e) {
251 Logger.getLogger(Mudmap2.class.getName()).log(Level.SEVERE, null, e);
252 return false;
253 }
254 }
255
256 /**
257 * Returns true, if there are places to paste

Callers 1

actionPerformedMethod · 0.95

Calls 5

getMethod · 0.95
removeMethod · 0.95
putMethod · 0.95
getLayerMethod · 0.45
getNameMethod · 0.45

Tested by

no test coverage detected