コード例 #1
0
  @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();
  }
コード例 #2
0
 /** 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;
   }
 }
コード例 #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));*/
        }
      }
    }
  }
コード例 #4
0
ファイル: VanillaSky.java プロジェクト: TomyLobo/Vanilla
 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);
   }
 }
コード例 #5
0
 /** Loads inventory on first use. */
 private void loadInventory() {
   if (items == null) {
     items = player.getEntity().getInventory().getContents();
   }
 }