Package org.getspout.spoutapi.player

Examples of org.getspout.spoutapi.player.SpoutPlayer


    output.writeBoolean(compressed);
  }

  @Override
  public void run(int playerId) {
    SpoutPlayer player = SpoutManager.getPlayerFromId(playerId);
    if (player != null) {
      ByteBuffer rawData = ByteBuffer.allocate(data.length);
      rawData.put(data);
      ArrayList<LivingEntity> entities = new ArrayList<LivingEntity>(data.length / 4 + 1);
      for (int i = 0; i < data.length / 4; i++) {
        int index = i * 4;
        int id = rawData.getInt(index);
        Entity entity = SpoutManager.getEntityFromId(id);
        if (entity != null && entity instanceof LivingEntity) {
          entities.add((LivingEntity) entity);
        }
      }
      if (entities.size() > 0) {
        player.sendPacket(new PacketEntityInformation(entities));
        player.updateEntitySkins(entities);
      }
    }
  }
View Full Code Here


    output.writeInt(selection);
  }

  @Override
  public void run(int playerId) {
    SpoutPlayer player = SpoutManager.getPlayerFromId(playerId);

    Widget w = null;
    if (player.getCurrentScreen() != null) {
      w = player.getCurrentScreen().getWidget(uuid);
    }
    if (w == null) {
      w = player.getMainScreen().getWidget(uuid);
    }
    if (w == null && player.getMainScreen().getActivePopup() != null) {
      w = player.getMainScreen().getActivePopup().getWidget(uuid);
    }

    if (w != null && w instanceof GenericComboBox) {
      box = (GenericComboBox) w;
      box.setOpen(open, false);
View Full Code Here

      return; // We can't do anything!
    }
    try {
      ByteArrayInputStream bais = new ByteArrayInputStream(ssAsPng);
      BufferedImage ss = ImageIO.read(bais);
      SpoutPlayer sp = SpoutManager.getPlayerFromId(playerId);
      ScreenshotReceivedEvent sre = new ScreenshotReceivedEvent(sp, ss);
      Bukkit.getServer().getPluginManager().callEvent(sre);
      sp.sendNotification("Sending screenshot...", "Screenshot received", Material.PAINTING);
    } catch (IOException ioe) {
      ioe.printStackTrace();
    }
  }
View Full Code Here

  public void run(int playerId) {
    if (packet != null) {
      SpoutInputStream stream = new SpoutInputStream(ByteBuffer.wrap(data));
      try {
        packet.read(stream);
        SpoutPlayer player = SpoutManager.getPlayerFromId(playerId);
        if (player != null) {
          packet.run(player);
        }
      } catch (Exception e) {
        e.printStackTrace();
View Full Code Here

      dataoutputstream.write(this.settingKeys[i]);
    }
  }

  public void run(int id) {
    SpoutPlayer player = SpoutManager.getPlayerFromId(id);
    if (player != null) {
      player.updateKeys(settingKeys);
      if (pressDown) {
        Bukkit.getServer().getPluginManager().callEvent(new KeyPressedEvent(this.key, player, ScreenType.getType(screenType)));
      } else {
        Bukkit.getServer().getPluginManager().callEvent(new KeyReleasedEvent(this.key, player, ScreenType.getType(screenType)));
      }
View Full Code Here

  public void writeData(SpoutOutputStream output) throws IOException {
  }

  @Override
  public void run(int playerId) {
    SpoutPlayer player = SpoutManager.getPlayerFromId(playerId);
    player.setPreCachingComplete(true);
    Bukkit.getServer().getPluginManager().callEvent(new SpoutcraftPreCacheCompletedEvent(player));
  }
View Full Code Here

  @Override
  public void run(int playerId) {
    RenderDistance currentRender = RenderDistance.getRenderDistanceFromValue(view);
    if (currentRender != null) {
      SpoutPlayer player = SpoutManager.getPlayerFromId(playerId);
      if (player != null) {
        RenderDistanceChangeEvent event = new RenderDistanceChangeEvent(player, currentRender);
        Bukkit.getServer().getPluginManager().callEvent(event);
        if (!event.isCancelled()) {
          player.setRenderDistance(currentRender, false);
        } else {
          player.sendPacket(new PacketRenderDistance(player.getRenderDistance(), null, null));
        }
      }
    }
  }
View Full Code Here

    attachWidget(plugin, health).attachWidget(plugin, bubble).attachWidget(plugin, chat).attachWidget(plugin, chatText).attachWidget(plugin, armor).attachWidget(plugin, hunger).attachWidget(plugin, exp);
  }

  @Override
  public void onTick() {
    SpoutPlayer player = (SpoutPlayer) SpoutManager.getPlayerFromId(playerId);
    if (player != null && player.isSpoutCraftEnabled()) {
      if (getActivePopup() != null) {
        if (getActivePopup().isDirty()) {
          if (!getActivePopup().getType().isServerOnly()) {
            player.sendImmediatePacket(new PacketWidget(getActivePopup(), getId()));
          }
          getActivePopup().setDirty(false);
        }
        getActivePopup().onTick();
      }
View Full Code Here

  @Override
  public boolean closePopup() {
    if (getActivePopup() == null) {
      return false;
    }
    SpoutPlayer player = SpoutManager.getPlayerFromId(playerId);
    ScreenCloseEvent event = new ScreenCloseEvent(player, getActivePopup(), ScreenType.CUSTOM_SCREEN);
    Bukkit.getServer().getPluginManager().callEvent(event);
    if (event.isCancelled()) {
      return false;
    }
    player.sendImmediatePacket(new PacketScreenAction(ScreenAction.Close, ScreenType.CUSTOM_SCREEN));
    activePopup = null;
    player.openScreen(ScreenType.GAME_SCREEN, false);
    return true;
  }
View Full Code Here

    output.writeBoolean(cancel);
  }

  @Override
  public void run(int playerId) {
    SpoutPlayer player = SpoutManager.getPlayerFromId(playerId);
    Music music = Music.getMusicFromId(id);
    if (player != null && music != null) {
      BackgroundMusicEvent event = new BackgroundMusicEvent(music, volumePercent, player);
      Bukkit.getServer().getPluginManager().callEvent(event);
      if (event.isCancelled()) {
        cancel = true;
      }
      player.sendPacket(this);
    }
  }
View Full Code Here

TOP

Related Classes of org.getspout.spoutapi.player.SpoutPlayer

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.