Package org.spout.api.entity

Examples of org.spout.api.entity.Player


    this.session = session;
  }

  @Override
  public void uncaughtException(Message message, MessageHandler<?> handle, Exception ex) {
    Player player = session.getPlayer();
    player.getEngine().getLogger().log(Level.SEVERE, "Message handler for " + message.getClass().getSimpleName() + " threw exception for player " + (session.getPlayer() != null ? session.getPlayer().getName() : "null"));
    ex.printStackTrace();
    if (player.hasPermission("vanilla.exception.paste")) {
      StringBuilder builder = new StringBuilder("Vanilla Error Report:\n");
      builder.append("( Please submit this report to http://spout.in/issues )\n");
      builder.append("    Version: ").append(VanillaPlugin.getInstance().getDescription().getVersion()).append("\n");
      builder.append("----------------------------------------------------------------------").append("\n");
      builder.append("Stack Trace:").append("\n");
      builder.append("    Exception: ").append(ex.getClass().getSimpleName()).append("\n");
      logTrace(builder, ex);
      Runnable task = new PasteRunnable(session, builder.toString(), "Message handler exception for " + message.getClass().getSimpleName());
      player.getEngine().getScheduler().scheduleAsyncDelayedTask(VanillaPlugin.getInstance(), task, 0, TaskPriority.CRITICAL);
    } else {
      session.disconnect("Message handler exception for " + message.getClass().getSimpleName());
    }
  }
View Full Code Here


  @Override
  public void onInteract(final EntityInteractEvent<?> event) {
    if (event instanceof PlayerInteractEntityEvent) {
      final PlayerInteractEntityEvent pie = (PlayerInteractEntityEvent) event;
      final Player player = (Player) pie.getEntity();
      switch (pie.getAction()) {
        case RIGHT_CLICK:
          player.add(WindowHolder.class).openWindow(new ChestWindow(player, getInventory(), "Minecart"));
      }
    }
    super.onInteract(event);
  }
View Full Code Here

  @Override
  public void onInteract(final EntityInteractEvent<?> event) {
    if (event instanceof PlayerInteractEntityEvent) {
      final PlayerInteractEntityEvent pie = (PlayerInteractEntityEvent) event;
      final Player player = (Player) pie.getEntity();
      switch (pie.getAction()) {
        case LEFT_CLICK:
          Slot slot = PlayerUtil.getHeldSlot(player);
          if (slot.get() != null) {
            ItemStack stack = slot.get();
View Full Code Here

  @Override
  public void onInteract(final EntityInteractEvent<?> event) {
    if (event instanceof PlayerInteractEntityEvent) {
      final PlayerInteractEntityEvent pie = (PlayerInteractEntityEvent) event;
      final Player player = (Player) pie.getEntity();
      switch (pie.getAction()) {
        case RIGHT_CLICK:
          player.add(WindowHolder.class).openWindow(new HopperWindow(player, getInventory(), "Minecart"));
      }
    }
    super.onInteract(event);
  }
View Full Code Here

  @Override
  public void onInteract(final EntityInteractEvent<?> event) {
    if (event instanceof PlayerInteractEntityEvent) {
      final PlayerInteractEntityEvent pie = (PlayerInteractEntityEvent) event;
      final Player player = (Player) pie.getEntity();
      switch (pie.getAction()) {
        case RIGHT_CLICK:
          //TODO: Make player enter Minecart here
          System.out.println("MINECART ENTER: " + player.getName());
      }
    }
  }
View Full Code Here

  @Override
  public void handleServer(ServerSession session, CommandBlockMessage msg) {
    int x = msg.getX(), y = msg.getY(), z = msg.getZ();
    String text = msg.getCommand();
    CommandBlock c = VanillaPlugin.getInstance().getEngine().getDefaultWorld().getBlock(x, y, z).get(CommandBlock.class);
    Player player = session.getPlayer();
    String prefix = VanillaPlugin.getInstance().getPrefix();
    if (c == null || !(c instanceof CommandBlock)) {
      player.getEngine().getLogger().warning("CommandBlock information received, but there is no CommandBlock at {" + x + "," + y + "," + z + "}.");
      return;
    }
    c.setCommand(text, new PlayerCause(player));
  }
View Full Code Here

  @Override
  public void onInteract(final EntityInteractEvent<?> event) {
    if (event instanceof PlayerInteractEntityEvent) {
      final PlayerInteractEntityEvent pie = (PlayerInteractEntityEvent) event;
      final Player player = (Player) pie.getEntity();
      switch (pie.getAction()) {
        case RIGHT_CLICK:
          //TODO Open Window
      }
    }
View Full Code Here

    Engine engine = Spout.getEngine();

    // kill count criteria
    Object lastDamager = event.getLastDamager();
    if (lastDamager instanceof Player) {
      Player killer = (Player) lastDamager;
      String killerName = killer.getName();
      String[] criteria = {Objective.CRITERIA_TOTAL_KILL_COUNT, Objective.CRITERIA_PLAYER_KILL_COUNT};
      if (entity instanceof Player) {
        // killed a player? update total and player kill count
        evaluateCriteria(killerName, 1, true, criteria);
      } else {
        // just an entity? only update total kill count
        evaluateCriteria(killerName, 1, true, criteria[0]);
      }
    }

    if (!(entity instanceof Player) || !(engine instanceof Server)) {
      return;
    }

    // player death criteria
    Player player = (Player) entity;
    evaluateCriteria(player.getName(), 1, true, Objective.CRITERIA_DEATH_COUNT);
  }
View Full Code Here

    Engine engine = Spout.getEngine();
    if (!(entity instanceof Player) || !(engine instanceof Server)) {
      return;
    }

    Player player = (Player) entity;
    evaluateCriteria(player.getName(), (int) (player.get(Health.class).getHealth() + event.getChange()), false, Objective.CRITERIA_HEALTH);
  }
View Full Code Here

  @Override
  public void onInteract(final EntityInteractEvent<?> event) {
    if (event instanceof PlayerInteractEntityEvent) {
      final PlayerInteractEntityEvent pie = (PlayerInteractEntityEvent) event;
      final Player player = (Player) pie.getEntity();
      switch (pie.getAction()) {
        case RIGHT_CLICK:
          final QuickbarInventory playerQuickbar = PlayerUtil.getQuickbar(player);
          if (playerQuickbar == null) {
            return;
View Full Code Here

TOP

Related Classes of org.spout.api.entity.Player

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.