Package org.getspout.spoutapi.player

Examples of org.getspout.spoutapi.player.SpoutPlayer


    if (event.getEntity() instanceof LivingEntity) {

      LivingEntity ent = (LivingEntity) event.getEntity();
      if (event.getDamager() instanceof SpoutPlayer) {
        SpoutPlayer p = (SpoutPlayer) event.getDamager();

        if (event.getDamage() >= ent.getHealth()) {

          if (event.getEntity().getType() == EntityType.CHICKEN
              && ConflictPlugin.skillFoodChicken.get(p.getName()) > 0) {

            p.getWorld().dropItem(p.getLocation(), new ItemStack(365));

          }
          if (event.getEntity().getType() == EntityType.COW
              && ConflictPlugin.skillFoodCow.get(p.getName()) > 0) {

            p.getWorld().dropItem(p.getLocation(), new ItemStack(363));
          }
          if (event.getEntity().getType() == EntityType.PIG
              && ConflictPlugin.skillFoodPork.get(p.getName()) > 0) {

            p.getWorld().dropItem(p.getLocation(), new ItemStack(319));

          }

        }
      }
View Full Code Here


    }
    // *****************************************************************

    // TeamChat
    if (commandName.equals("t")) {
      SpoutPlayer player = (SpoutPlayer) sender;
      StringBuilder message = new StringBuilder();
      for (int i = 0; i < args.length; i++) {
        message.append(args[i] + " ");
      }
      if (ConflictPlugin.playerIsInTeam(player).equals("red")) {
        for (SpoutPlayer p : ConflictPlugin.playersRed) {
          p.sendMessage("[" + sender.getName() + "]: " + message.toString());
        }
      } else {
        for (SpoutPlayer p : ConflictPlugin.playersBlue) {
          p.sendMessage("[" + sender.getName() + "]: " + message.toString());
        }
      }

    }

    // BaseBlockRed
    if (commandName.equals("bbr")) {
      if (ConflictPlugin.allowBBR) {
        Player player = (Player) sender;

        if (ConflictPlugin.playersRed.contains((SpoutPlayer) player)) {
          player.getInventory().addItem(new SpoutItemStack(ConflictPlugin.baseBlockRed, 1));
          ConflictPlugin.allowBBR = false; // nur 1x
          Bukkit.getServer()
              .broadcastMessage("Spieler &c" + player.getName() + " &fhat den roten BaseBlock!");
        } else {
          sender.sendMessage(ChatColor.RED
              + "Du musst im roten Team sein um diesen Befehl ausf�hren zu k�nnen!");
        }

      } else {
        sender.sendMessage(ChatColor.RED + "Roter BaseBlock wurde bereits verteilt!");
      }
      return true;
    }

    // BaseBlockBlue
    if (commandName.equals("bbb")) {
      if (ConflictPlugin.allowBBB) {
        Player player = (Player) sender;
        if (ConflictPlugin.playersBlue.contains((SpoutPlayer) player)) {
          player.getInventory().addItem(new SpoutItemStack(ConflictPlugin.baseBlockBlue, 1));
          ConflictPlugin.allowBBB = false; // nur 1x
          Bukkit.getServer().broadcastMessage(
              "Spieler &1" + player.getName() + " &fhat den blauen BaseBlock!");
        } else {
          sender.sendMessage(ChatColor.RED
              + "Du musst im blauen Team sein um diesen Befehl ausf�hren zu k�nnen!");
        }

      } else {
        sender.sendMessage(ChatColor.RED + "Blauer BaseBlock wurde bereits verteilt!");
      }
      return true;
    }

    // Artefakt Stufe 1
    if (commandName.equals("art")) {
      try {
        Player player = (Player) sender;
        int a = Integer.parseInt(args[0]);
        int b = Integer.parseInt(args[1]);
        int amount = Integer.parseInt(args[2]);
        switch (a) {
        case 1:
          player.getInventory().addItem(new SpoutItemStack(ConflictPlugin.artifact1Grow.get(b), amount));
          Bukkit.getServer().broadcastMessage(
              "Spieler &c" + player.getName() + " &fhat sich einen ArtefaktBlock ercheatet!");
          break;
        case 2:
          player.getInventory().addItem(new SpoutItemStack(ConflictPlugin.artifact2Grow.get(b), amount));
          Bukkit.getServer().broadcastMessage(
              "Spieler &c" + player.getName() + " &fhat sich einen ArtefaktBlock ercheatet!");
          break;
        case 3:
          player.getInventory().addItem(new SpoutItemStack(ConflictPlugin.artifact3Grow.get(b), amount));
          Bukkit.getServer().broadcastMessage(
              "Spieler &c" + player.getName() + " &fhat sich einen ArtefaktBlock ercheatet!");
          break;
        }

      } catch (Exception e) {
        sender.sendMessage(ChatColor.RED + "Invalid arguments");
      }
    }

    // basedef Bl�cke generieren
    if (commandName.equals("basedef")) {
      try {
        Player player = (Player) sender;
        int a = Integer.parseInt(args[0]);
        int amount = Integer.parseInt(args[1]);
        switch (a) {
        case 1:
          player.getInventory().addItem(new SpoutItemStack(ConflictPlugin.defenseTower, amount));
          Bukkit.getServer().broadcastMessage(
              "Spieler &c" + player.getName() + " &fhat sich einen DefenseTower ercheatet!");
          break;
        case 2:
          player.getInventory().addItem(new SpoutItemStack(ConflictPlugin.damageTower, amount));
          Bukkit.getServer().broadcastMessage(
              "Spieler &c" + player.getName() + " &fhat sich einen DamageTower ercheatet!");
          break;
        case 3:
          player.getInventory().addItem(new SpoutItemStack(ConflictPlugin.radarTower, amount));
          Bukkit.getServer().broadcastMessage(
              "Spieler &c" + player.getName() + " &fhat sich einen RadarTower ercheatet!");
          break;
        }

      } catch (Exception e) {
        sender.sendMessage(ChatColor.RED + "Invalid arguments");
      }
    }

    // generiere VuduBrick
    if (commandName.equals("vb")) {
      try {
        Player player = (Player) sender;
        int amount = Integer.parseInt(args[0]);
        player.getInventory().addItem(new SpoutItemStack(ConflictPlugin.vuduBrick, amount));

      } catch (Exception e) {
        sender.sendMessage(ChatColor.RED + "Invalid arguments");
      }
    }

    // show red arrows
    if (commandName.equals("showred")) {
      SpoutPlayer player = (SpoutPlayer) sender;

      if (args.length > 0) {
        if (args[0].equals("0")) {
          ConflictPlugin.showArrowRed.put(player, false);
        }
        if (args[0].equals("1")) {
          ConflictPlugin.showArrowRed.put(player, true);
        }

      } else {
        sender.sendMessage("/" + commandName + " needs one argument (0/1)");
      }
      return true;
    }

    // show blue arrows
    if (commandName.equals("showblue")) {
      SpoutPlayer player = (SpoutPlayer) sender;

      if (args.length > 0) {
        if (args[0].equals("0")) {
          ConflictPlugin.showArrowBlue.put(player, false);
        }
View Full Code Here

      * setzt den Timestamp (wird f�r Wachstum gebraucht) beim Platzieren
      * benachrichtigt ausserdem alle Spieler dar�ber dass ein ArtefaktBlock der Stufe X von Team Y gebaut wurde
      */
      public void onBlockPlace(World world, int x, int y, int z, LivingEntity living) {
       
        SpoutPlayer player = (SpoutPlayer) living;
        //Artefakt Lvl 5 d�rfen nicht wieder platziert werden
        if(this.is5()){
          this.dontPlace = new BlockLocation(world.getName(), x, y, z);
          return;
        }
       
        //Nachricht, dass Artefakt gebaut wurde
        Location l = world.getBlockAt(x, y, z).getLocation();
        Block below = world.getBlockAt(x, y-1, z);
        String team = ConflictPlugin.playerIsInTeam((SpoutPlayer) living);
        ArrayList<BlockLocation> base = team.equals("red") ? ConflictPlugin.baseBlocksRed : ConflictPlugin.baseBlocksBlue;
       
        if(ConflictPlugin.getDistanceToBase(world, l, team)<= 2){
            if(below instanceof SpoutBlock && below.getTypeId()==ConflictPlugin.BASEBLOCKID){
              for(BlockLocation l2 : base){
                if(ConflictPlugin.compareLocaction(l2, below.getLocation())){
                  Bukkit.getServer().broadcastMessage("Team "+team+" placed an artifact of stage "+Integer.toString(this.stage));
                  for(SpoutPlayer p : ConflictPlugin.players){
                    p.sendNotification("Artefakt gebaut", "Team "+team+": Stufe "+Integer.toString(this.stage), Material.RECORD_3, (short)0, 10000)
                  }
                 
                  if(this.stage==1){
                    ConflictPlugin.totalArt1.put(player.getName(),1+ ConflictPlugin.totalArt1.get(player.getName()))
                  }
                  if(this.stage==2){
                    ConflictPlugin.totalArt2.put(player.getName(), 1+ ConflictPlugin.totalArt2.get(player.getName()))
                  }
                 
                }
              }
            }
View Full Code Here

  @Override
  public void sendPacket(Packet packet) {
    if (packet != null) {
        queueOutputPacket(packet);
      if (packet instanceof Packet20NamedEntitySpawn) {
        SpoutPlayer player = SpoutManager
            .getPlayerFromId(((Packet20NamedEntitySpawn) packet).a);
        if (getPlayer() instanceof SpoutPlayer && player != null) {
          ((SpoutCraftPlayer)player).updateAppearance((SpoutPlayer)getPlayer());
        }
      } else if (packet instanceof Packet24MobSpawn) {
View Full Code Here

      return;
    }

    SpoutBlock block = (SpoutBlock) event.getBlock();

    SpoutPlayer player = (SpoutPlayer) event.getPlayer();

    if (block.getCustomBlock() != null) {
      CustomBlock material = block.getCustomBlock();
      material.onBlockDestroyed(block.getWorld(), block.getX(), block.getY(), block.getZ(), player);
      if (material.getItemDrop() != null) {
        if (player.getGameMode() == GameMode.SURVIVAL) {
          block.getWorld().dropItem(block.getLocation(), material.getItemDrop());
        }
        block.setTypeId(0);
        event.setCancelled(true);
      }
View Full Code Here

  @Override
  public void handle(Connection connection) {
    if (connection instanceof SpoutPlayerConnection) {
      SpoutPlayerConnection handler = (SpoutPlayerConnection) connection;
      SpoutPlayer player = SpoutManager.getPlayerFromId(handler.getPlayer().getEntityId());
      if (player != null) {
        if (success) {
          packet.run(player.getEntityId());
        } else if (packet != null) {
          packet.failure(player.getEntityId());
        }
      }
    }
  }
View Full Code Here

      }
    }
    if (c.equals("list")) {
      String message = "Players online with " + ChatColor.BLUE + "Spoutcraft" + ChatColor.RESET + ":\n";
      for (Player plr : Bukkit.getOnlinePlayers()) {
        SpoutPlayer splr = SpoutManager.getPlayer(plr);
        if (splr.isSpoutCraftEnabled()) {
          message += ChatColor.GREEN + splr.getName() + ChatColor.RESET + ", ";
        }
      }
      message = message.substring(0, message.length() - 2);
      sender.sendMessage(message);
      return true;
View Full Code Here

    } catch (Exception e) {
    }
    if (nm == null) {
      return false;
    }
    SpoutPlayer player = lookupPlayer(nm);
    if (player == null) {
      return false;
    }
    return player.isSpoutCraftEnabled();
  }
View Full Code Here

      int y = (Integer) args[3];
      int z = (Integer) args[4];
      org.getspout.spoutapi.material.CustomBlock block = getCustomBlock(world, x, y, z);
      if (block != null) {
        if (block instanceof org.getspout.spoutapi.material.CustomBlock) {
          SpoutPlayer player = (SpoutPlayer) human.getBukkitEntity();
          float def;
          SpoutItemStack inHand = player.getItemInHand() == null ? null : new SpoutItemStack(player.getItemInHand());
          org.getspout.spoutapi.material.Material item = inHand.getMaterial();

          float hardness = block.getHardness();
          if (hardness <= 0F) {
            return m.invoke(wrapped, args);
View Full Code Here

    }
  }

  @EventHandler(priority = EventPriority.LOWEST)
  public void onPlayerTeleport(PlayerTeleportEvent event) {
    SpoutPlayer splr = SpoutManager.getPlayer(event.getPlayer());
    if (event.getCause() == TeleportCause.UNKNOWN && splr.isSpoutCraftEnabled() && splr.isFlying() && splr.getFlySpeed() > 1.0f) {
      event.setCancelled(true);
    }
  }
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.