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

Method putPlaceholder

src/main/java/mudmap2/backend/World.java:170–196  ·  view source on GitHub ↗

Creates a placeholder place @param layerId layer @param x x coordinate @param y y coordinate

(int layerId, int x, int y)

Source from the content-addressed store, hash-verified

168 * @param y y coordinate
169 */
170 public void putPlaceholder(int layerId, int x, int y){
171 try {
172 Place place = new Place(Place.PLACEHOLDER_NAME, x, y, null);
173
174 // find or create placeholder group
175 PlaceGroup placeGroup = null;
176 for(PlaceGroup a: placeGroups) if(a.getName().equals("placeholder")){
177 placeGroup = a;
178 break;
179 }
180 // create new placeholder group
181 if(placeGroup == null) addPlaceGroup(placeGroup = new PlaceGroup("placeholder", Color.GREEN));
182
183 place.setPlaceGroup(placeGroup);
184 place.setInfoRing(getInformationColor(0));
185
186 Layer layer = getLayer(layerId);
187 if(layer == null){
188 addLayer(new Layer(layerId, this));
189 layer = getLayer(layerId);
190 }
191 layer.put(place, x, y);
192 } catch(PlaceNotInsertedException ex){ // ignore
193 } catch (Exception ex) {
194 Logger.getLogger(World.class.getName()).log(Level.WARNING, "Couldn't put placeholder to map: " + ex, ex);
195 }
196 }
197
198 // --------- layers --------------------------------------------------------
199 /**

Callers 3

testSetPlaceholderMethod · 0.95
actionPerformedMethod · 0.80
keyPressedMethod · 0.80

Calls 8

addPlaceGroupMethod · 0.95
setPlaceGroupMethod · 0.95
setInfoRingMethod · 0.95
getInformationColorMethod · 0.95
getLayerMethod · 0.95
addLayerMethod · 0.95
putMethod · 0.95
getNameMethod · 0.45

Tested by 1

testSetPlaceholderMethod · 0.76