@Override
  public void handle(Session session, Player player, PingMessage message) {
    if (!(player.getEntity().getController() instanceof VanillaPlayer)) {
      return;
    }

    VanillaPlayer mp = (VanillaPlayer) player.getEntity().getController();
    mp.resetTimeoutTicks();
  }
 /** Flush any changes. This is called at the end. */
 @Override
 public void flushChanges() {
   if (items != null) {
     Inventory inv = player.getEntity().getInventory();
     for (int i = 0; i < items.length && i < player.getEntity().getInventorySize(); ++i) {
       inv.setItem(items[i], i);
     }
     items = null;
   }
 }
Esempio n. 3
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));*/
        }
      }
    }
  }
Esempio n. 4
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);
   }
 }
 /** Loads inventory on first use. */
 private void loadInventory() {
   if (items == null) {
     items = player.getEntity().getInventory().getContents();
   }
 }