Пример #1
0
 public void broadcastMessage(Message message) {
   for (Player player : world.getPlayers()) {
     if (!player.isOnline()) {
       continue;
     }
     if (!player.getEntity().getWorld().getName().equals(world.getName())) {
       continue;
     }
     player.getSession().send(message);
   }
 }
Пример #2
0
  public void run() {
    if (player.isOnline()) {
      // Inform the new player of existing players
      for (Player p : Spout.getGame().getOnlinePlayers()) {
        if (!p.equals(player)) {
          Point playerPoint = p.getEntity().getLiveTransform().getPosition();
          float playerPitch = p.getEntity().getLiveTransform().getRotation().getAxisAngles().getZ();
          float playerYaw = p.getEntity().getLiveTransform().getRotation().getAxisAngles().getY();

          /*player.getSession().send(
          new SpawnPlayerMessage(p.getEntity().getId(), p.getName(), (int)(playerPoint.getX() * 32),
          (int)(playerPoint.getY() * 32), (int)(playerPoint.getZ() * 32),
          (int)(playerYaw  * 256.0F / 360.0F), (int)(playerPitch * 256.0F / 360.0F), 0));*/
        }
      }
    }
  }