MCPcopy Create free account
hub / github.com/catabriga/graphwar / sendFunction

Method sendFunction

src/Graphwar/GameData.java:286–313  ·  view source on GitHub ↗
(String function)

Source from the content-addressed store, hash-verified

284 }
285
286 public void sendFunction(String function)
287 {
288 Player currentPlayer = getCurrentTurnPlayer();
289
290 if(currentPlayer.isLocalPlayer() && drawingFunction == false)
291 {
292 try
293 {
294 @SuppressWarnings("unused")
295 Function func = new Function(function);
296 }
297 catch (MalformedFunction e)
298 {
299 //Function is wrong... dont send it
300 return;
301 }
302
303 try
304 {
305 String message = NetworkProtocol.FIRE_FUNC+"&"+currentPlayer.getID()+"&"+URLEncoder.encode(function, "UTF-8");
306 serverConnection.sendMessage(message);
307 }
308 catch (UnsupportedEncodingException e)
309 {
310 e.printStackTrace();
311 }
312 }
313 }
314
315 public void nextMode()
316 {

Callers 1

actionPerformedMethod · 0.45

Calls 4

getCurrentTurnPlayerMethod · 0.95
isLocalPlayerMethod · 0.95
getIDMethod · 0.95
sendMessageMethod · 0.45

Tested by

no test coverage detected