Sha256: 47d383adcb0e4d7be5babe02844a9843039a2d7631a94cb786f297d5223d01a1

Contents?: true

Size: 912 Bytes

Versions: 2

Compression:

Stored size: 912 Bytes

Contents

package com.game_machine.core;

import akka.actor.ActorSelection;
import GameMachine.Messages.Entity;
import GameMachine.Messages.GameMessage;
import GameMachine.Messages.GameMessages;
import GameMachine.Messages.Player;

public class PlayerCommands {

	public static void sendGameMessage(GameMessage gameMessage, String playerId) {
		GameMessages gameMessages = new GameMessages();
		gameMessages.addGameMessage(gameMessage);
		Entity entity = new Entity();
		entity.setId("0");
		entity.setGameMessages(gameMessages);
		PlayerCommands.sendToPlayer(entity, playerId);
	}
	
	public static void sendToPlayer(Entity entity, String playerId) {
		if (!entity.hasPlayer()) {
			Player player = new Player();
			player.setId(playerId);
			entity.setPlayer(player);
		}
		entity.setSendToPlayer(true);
		
		ActorSelection sel = ActorUtil.getSelectionByName("GameMachine::ClientManager");
		sel.tell(entity, null);
	}
}

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
game_machine-1.0.4 java/project/src/main/java/com/game_machine/core/PlayerCommands.java
game_machine-1.0.2 java/project/src/main/java/com/game_machine/core/PlayerCommands.java