Package org.spout.vanilla.inventory.window

Examples of org.spout.vanilla.inventory.window.Window


      return;
    }
    args.assertCompletelyParsed();

    WindowHolder holder = ((Player) source).get(WindowHolder.class);
    Window window = holder.getActiveWindow();
    if (window.isOpened()) {
      holder.closeWindow();
    } else {
      holder.openWindow(holder.getDefaultWindow());
    }
  }
View Full Code Here


import org.spout.vanilla.inventory.window.block.BeaconWindow;

public class BeaconHandler extends MessageHandler<BeaconMessage> {
  @Override
  public void handleServer(ServerSession session, BeaconMessage msg) {
    Window window = session.getPlayer().get(WindowHolder.class).getActiveWindow();
    if (!(window instanceof BeaconWindow)) {
      throw new IllegalStateException("Player tried to change Beacon but does not have an opened Beacon.");
    }
    Beacon beacon = ((BeaconWindow) window).getBeacon();
    beacon.setPrimaryEffect(EntityEffectType.get(msg.getPrimaryEffect()));
    beacon.setSecondaryEffect(EntityEffectType.get(msg.getSecondaryEffect()));
    for (InventoryConverter converter : window.getInventoryConverters()) {
      if (converter.getInventory() instanceof BeaconInventory) {
        converter.getInventory().clear();
      }
    }
  }
View Full Code Here

    if (human.isSurvival()) {
      holder.kick("Attempted to use the creative inventory while on survival.");
      return;
    }

    Window window = holder.get(WindowHolder.class).getActiveWindow();
    if (message.get() == null) {
      //Taking item from existing slot
      window.setCursorItem(null);
      ClickArguments args = window.getClickArguments(message.getSlot(), ClickArguments.ClickAction.LEFT_CLICK);
      if (args != null) {
        window.onClick(args);
      }
    } else if (message.getSlot() == -1) {
      window.setCursorItem(message.get());
      window.onOutsideClick();
    } else {
      Slot entry = window.getSlot(message.getSlot());
      if (entry != null) {
        window.onCreativeClick(entry.getInventory(), entry.getIndex(), message.get());
      }
    }
  }
View Full Code Here

public final class WindowClickHandler extends MessageHandler<WindowClickMessage> {
  @Override
  public void handleServer(ServerSession session, WindowClickMessage message) {
    Player player = session.getPlayer();
    Window window = player.get(WindowHolder.class).getActiveWindow();
    boolean result = false;
    int slot = message.getSlot();
    ClickArguments args = window.getClickArguments(slot, ClickArguments.ClickAction.getAction(message.getMode(), message.getButton()));
    if (args != null) {
      result = window.onClick(args);
    }
    session.send(new WindowTransactionMessage(window, message.getTransaction(), result));
  }
View Full Code Here

    Player player = session.getPlayer();
    WindowHolder holder = player.get(WindowHolder.class);
    if (holder == null) {
      return;
    }
    Window window = holder.getActiveWindow();
    ItemStack[] slots = msg.getItems();
    for (int i = 0; i < slots.length; i++) {
      Slot entry = window.getSlot(i);
      if (entry == null) {
        return;
      }
      entry.getInventory().set(entry.getIndex(), slots[i]);
    }
View Full Code Here

TOP

Related Classes of org.spout.vanilla.inventory.window.Window

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.