Package org.bukkit.entity

Examples of org.bukkit.entity.Player


   * @return
   */
  public static Boolean claim(CommandSender sender, String[] args, String command, String alias, Boolean... omitMessage) {
    if (!Utils.checkCommandSpam((Player) sender, "quiz-claim")) {
      // check if the player won anything
      Player p = (Player) sender;
      String pName = p.getName();
      if (quizWinners.containsKey(pName)) {
        // load all items for this player's reward
        FileConfiguration f = CommandsEX.getConf();
        ConfigurationSection configGroups = f.getConfigurationSection("quizDiff." + quizWinners.get(pName));
        Set<String> s = configGroups.getKeys(false);
       
        // first of all, count all rewards and see if they'd fit into player's inventory
        Integer allBlocks = 0;
        Inventory pi = p.getInventory();
        Integer maxStackSize = pi.getMaxStackSize();
        for (String reward : s) {
          Integer blockCount = f.getInt("quizDiff." + quizWinners.get(pName) + "." + reward);
          if (blockCount > maxStackSize) {
            allBlocks = (int) (allBlocks + Math.ceil(blockCount / maxStackSize));
          } else {
            allBlocks++;
          }
        }
       
        // calculate available slots
        Integer fullSlots = 0;
        for (ItemStack istack : p.getInventory().getContents()) {
          if ((istack != null) && istack.getAmount() > 0) {
            fullSlots++;
          }
        }
 
View Full Code Here


        Commands.showCommandHelpAndUsage(sender, "cex_spawn", alias);
        return true;
      }
    }

        Player player = (Player) sender;

        if (CombatTag.isInCombat(player)){
            LogHelper.showWarning("combatTagCannotDo", player);
            return true;
        }
View Full Code Here

        Commands.showCommandHelpAndUsage(sender, "cex_remrank", alias);
        return true;
      }
     
      // Command variables
      Player player = Bukkit.getServer().getPlayerExact(args[0]);
      if (player == null) {
        LogHelper.showWarning("invalidPlayer", sender);
        return true;
      }
 
      // Set group
      String group = args[1];
      Vault.perms.playerRemoveGroup(player, group);
     
      // Notify sender and player
      LogHelper.showInfo("[" + Nicknames.getNick(player.getName()) + " #####remrankToSender#####[" + group, sender);
      LogHelper.showInfo("remrankToPlayer#####[" + group, player);
    }
   
    return true;
  }
View Full Code Here

   */
 
  public static Boolean run(CommandSender sender, String alias, String[] args){
 
    if (sender instanceof Player){
      Player player = (Player) sender;
      if (Utils.checkCommandSpam(player, "cex_feed")){
        return true;
      }
    }
   
    if (args.length == 0){
      if (!(sender instanceof Player)){
        Commands.showCommandHelpAndUsage(sender, "cex_feed", alias);
        return true;
      }
     
      Player player = (Player) sender;
      player.setFoodLevel(20);
      LogHelper.showInfo("feedFed", sender, ChatColor.AQUA);
    } else if (args.length == 1){
      Player beingFed = Bukkit.getPlayer(args[0]);
     
      if (beingFed == null){
        LogHelper.showInfo("invalidPlayer", sender, ChatColor.RED);
        return true;
      }

      beingFed.setFoodLevel(20);
     
      if (sender.getName().equalsIgnoreCase(beingFed.getName())){
        LogHelper.showInfo("feedFed", sender, ChatColor.AQUA);
      } else if ((!(sender instanceof Player)) || (((Player) sender).hasPermission("cex.feed.others"))){
        LogHelper.showInfo("feedFedBySomeoneElse#####[" + Nicknames.getNick(sender.getName()), beingFed, ChatColor.AQUA);
        LogHelper.showInfo("feedFedSomeoneElse#####[" + Nicknames.getNick(beingFed.getName()), sender, ChatColor.AQUA);
      } else {
        LogHelper.showInfo("feedOthersNoPerm", sender, ChatColor.RED);
        return true;
      }
    } else {
View Full Code Here

 
  public static Boolean run(CommandSender sender, String alias, String[] args) {
   
    // Player check
    if (sender instanceof Player){
      Player player = (Player) sender;
      if(Utils.checkCommandSpam(player, "cex_clock")) {
        return true;
      }
    }
   
View Full Code Here

    if (args.length < 1 || args.length > 2){
      Commands.showCommandHelpAndUsage(sender, "cex_tpworld", alias);
      return true;
    }
   
    Player target;
   
    if (args.length == 2){
      target = Bukkit.getPlayer(args[1]);
     
      if (target != sender && !sender.hasPermission("cex.tpworld.others")){
        LogHelper.showWarning("tpWorldOthersNoPerm", sender);
        return true;
      }
     
      if (target == null){
        LogHelper.showWarning("invalidPlayer", sender);
      }
    } else {
      if (sender instanceof Player){
        target = (Player) sender;

                if (CombatTag.isInCombat(target)){
                    LogHelper.showWarning("combatTagCannotDo", target);
                    return true;
                }
      } else {
        Commands.showCommandHelpAndUsage(sender, "cex_tpworld", alias);
        return true;
      }
    }

    List<World> matches = ClosestMatches.intellWorld(args[0], target.getWorld());
   
    if (matches.size() < 1){
      LogHelper.showWarning("invalidWorld", sender);
      return true;
    }
   
    World world = matches.get(0);
   
    // teleport
    Teleportation.delayedTeleport(target, Spawning.getWorldSpawn(world));
   
    if (sender == target){
      LogHelper.showInfo("tpWorldSelf#####[" + world.getName(), sender);
    } else {
      LogHelper.showInfo("tpLocSuccess#####[" + Nicknames.getNick(target.getName()) + " #####to#####[" + world.getName(), sender);
      LogHelper.showInfo("[" + Nicknames.getNick(sender.getName()) + " #####tpWorldOtherNotify#####[" + world.getName(), target);
    }
   
    return true;
  }
View Full Code Here

   * @param args
   * @return
   */
 
  public static Boolean run(CommandSender sender, String alias, String[] args) {
    Player target;
   
    if (args.length == 0){
      if (sender instanceof Player){
        target = (Player) sender;
      } else {
        Commands.showCommandHelpAndUsage(sender, "cex_workbench", alias);
        return true;
      }
    } else if (args.length == 1){
      if (sender.hasPermission("cex.workbench.others")){
        target = Bukkit.getPlayer(args[0]);
       
        if (target == null){
          LogHelper.showWarning("invalidPlayer", sender);
          return true;
        }
      } else {
        LogHelper.showWarning("othersNoPerm", sender);
        return true;
      }
    } else {
      Commands.showCommandHelpAndUsage(sender, "cex_workbench", alias);
      return true;
    }
   
    target.openWorkbench(null, true);
   
    if (!sender.equals(target)){
      LogHelper.showInfo("[" + sender.getName() + "#####workbenchOther", target);
    }
   
View Full Code Here

    if (args.length > 3){
      Commands.showCommandHelpAndUsage(sender, "cex_butcher", alias);
      return true;
    }
   
    Player player = (Player) sender;
    int radius = CommandsEX.getConf().getInt("butcherDefaultRadius");
    String typeToKill = "all";
    boolean lightning = false;
   
    if (args.length > 0){
      if (args[0].matches(CommandsEX.intRegex)){
        radius = Integer.valueOf(args[0]);
      } else if (args.length == 3){
        Commands.showCommandHelpAndUsage(sender, "cex_butcher", alias);
        return true;
      } else if (args[0].equalsIgnoreCase("lightning") || args[0].equalsIgnoreCase("-l")){
        lightning = true;
      }
     
      if (args.length > 1){
        if (!args[1].equalsIgnoreCase("lightning") && !args[1].equalsIgnoreCase("-l")){
          typeToKill = args[1];
         
          if (args.length > 2){
            if (args[2].equalsIgnoreCase("lightning") || args[2].equalsIgnoreCase("-l")){
              lightning = true;
            } else {
              Commands.showCommandHelpAndUsage(sender, "cex_butcher", alias);
              return true;
            }
          }
        } else {
          lightning = true;
        }
      } else {
        if (args[0].equalsIgnoreCase("lightning") || args[0].equalsIgnoreCase("-l")){
          lightning = true;
        }
      }
    }
   
    List<Entity> entities = player.getNearbyEntities(radius, radius, radius);
    int killCount = 0;
   
    for (Entity entity : entities){
      EntityType eType = entity.getType();
      if (eType.isAlive() && eType.isSpawnable()){
View Full Code Here

   */
 
  public static Boolean run(CommandSender sender, String alias, String[] args){

    if (PlayerHelper.checkIsPlayer(sender)){
      Player player = (Player) sender;

      if (Utils.checkCommandSpam(player, "cex_tpall")){
        return true;
      }

      Player tpTo = null;

      if (args.length == 0){
        tpTo = player;
      } else if (args.length == 1){
        tpTo = Bukkit.getPlayer(args[0]);
      }

      if (args.length <= 1){
        if (tpTo != null){
          for (Player player2 : Bukkit.getOnlinePlayers()){
            if (player2 != tpTo){
              String[] newargs = {tpTo.getName(), player2.getName()};
              tp_common(sender, newargs, "tpto", alias);
              LogHelper.showInfo("tpTeleport#####[ " + Nicknames.getNick(player.getName()), player2, ChatColor.GREEN);
            }
          }
          LogHelper.showInfo("tpAllSuccess", player, ChatColor.GREEN);
View Full Code Here

   * @param args
   * @return
   */
  public static Boolean run(CommandSender sender, String alias, String[] args) {
    if (PlayerHelper.checkIsPlayer(sender)) {
      Player player = (Player)sender;

      // check permissions and call to action
      if (Permissions.checkPerms(player, "cex.setjail")) {
        setjail(sender, args, "setjail", alias);
      }
View Full Code Here

TOP

Related Classes of org.bukkit.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.