Example #1
0
 @EventHandler
 public void onHit(EntityDamageByEntityEvent e) {
   if (e.getEntity() instanceof Player) {
     Player p = (Player) e.getEntity();
     if (e.getDamager() instanceof Snowball) {
       Snowball s = (Snowball) e.getDamager();
       Player shooter = (Player) s.getShooter();
       if (teamManager.getTeam(p) != teamManager.getTeam((Player) s.getShooter())) {
         if (s.getCustomName() != null) {
           if (s.getCustomName().equalsIgnoreCase("stun")) {
             if (!stunned.contains(p.getName())) {
               stunned.add(p.getName());
               p.playSound(p.getLocation(), Sound.FIREWORK_TWINKLE2, 3F, 1F);
               shooter.playSound(shooter.getLocation(), Sound.SUCCESSFUL_HIT, 3F, 1F);
               p.sendMessage(Color.np("&cYou got hit by a stun! You cannot move for 2 seconds!"));
               new BukkitRunnable() {
                 @Override
                 public void run() {
                   stunned.remove(p.getName());
                 }
               }.runTaskLater(Main.getInstance(), 40);
             } else {
               shooter.sendMessage(Color.np("&cThat player is already stunned!"));
             }
           }
         }
       } else {
         shooter.sendMessage(Color.np("&cYou cannot stun team members!"));
       }
     }
   }
 }
 public void sendAnvilLandSound(Player p) {
   if (EnderChest.is19Server == true) {
     p.playSound(p.getLocation(), Sound.BLOCK_ANVIL_LAND, 1F, 1F);
   } else {
     p.playSound(p.getLocation(), Sound.valueOf("ANVIL_LAND"), 1F, 1F);
   }
 }
 @Override
 public void click(Player player, ClickType clickType, int i, ItemStack itemStack) {
   if (i < itemList.size()) {
     RewardItem item = itemList.get(i);
     if (item.hasPermission(this.player)) {
       if (item.canUseReward(this.player)) {
         player.playSound(player.getLocation(), Sound.LEVEL_UP, 1f, 1f);
         item.use(this.player);
         item.giveReward(this.player, player);
         update();
       } else {
         player.playSound(player.getLocation(), Sound.BLAZE_HIT, 1f, 1f);
         player.sendMessage(
             ChatColor.BLUE
                 + "You need to wait "
                 + ChatColor.AQUA
                 + this.player.getWaitTime(item.getBlankname(), item.getTime())
                 + ChatColor.BLUE
                 + " till you can use this");
       }
     } else {
       player.playSound(player.getLocation(), Sound.BLAZE_DEATH, 1f, 1f);
       player.sendMessage(ChatColor.RED + item.getDenymsg());
     }
   }
 }
 public void sendFailedSound(Player p) {
   if (EnderChest.is19Server == true) {
     p.playSound(p.getLocation(), Sound.BLOCK_NOTE_PLING, 3F, 3F);
   } else {
     p.playSound(p.getLocation(), Sound.valueOf("NOTE_PLING"), 3F, 3F);
   }
 }
 public void sendEnderchestOpenSound(Player p) {
   if (EnderChest.is19Server == true) {
     p.playSound(p.getLocation(), Sound.BLOCK_ENDERCHEST_OPEN, 1F, 1F);
   } else {
     p.playSound(p.getLocation(), Sound.valueOf("CHEST_OPEN"), 1F, 1F);
   }
 }
 public void sendCompleteSound(Player p) {
   if (EnderChest.is19Server == true) {
     p.playSound(p.getLocation(), Sound.ENTITY_PLAYER_LEVELUP, 1F, 1F);
   } else {
     p.playSound(p.getLocation(), Sound.valueOf("LEVEL_UP"), 1F, 1F);
   }
 }
Example #7
0
 public static void playSound(Sound s, Location loc, float pitch, float level) {
   for (String s1 : Game.ingame) {
     Player p = Bukkit.getPlayer(s1);
     p.playSound(loc, s, level, pitch);
   }
   for (String s2 : Game.watching) {
     Player p = Bukkit.getPlayer(s2);
     p.playSound(loc, s, level, pitch);
   }
 }
  @EventHandler(priority = EventPriority.NORMAL)
  public void togglePlayerStacker(PlayerInteractEvent event) {
    // Do nothing if player is not right clicking.
    Action action = event.getAction();
    if (action != RIGHT_CLICK_AIR && action != RIGHT_CLICK_BLOCK) return;

    // Do nothing if player does not have permission.
    Player player = event.getPlayer();
    if (!Perm.PLAYERSTACKER.has(player)) return;

    // Do nothing if player is not clicking the player hider item.
    if (!player.getItemInHand().equals(plugin.getSettings().getPlayerStackerItemDisabled())
        && !player.getItemInHand().equals(plugin.getSettings().getPlayerStackerItemEnabled()))
      return;

    // Do nothing if user is null.
    User user = plugin.getUser(player.getUniqueId());
    if (user == null) return;

    // Toggle users stacking option.
    user.setStacking(!user.isStacking());

    // Update players inventory with the newer player hider item.
    if (plugin.getSettings().getPlayerStackerSlot() >= 0) {
      ItemStack reverse =
          player.getItemInHand().equals(plugin.getSettings().getPlayerStackerItemEnabled())
              ? plugin.getSettings().getPlayerStackerItemDisabled()
              : plugin.getSettings().getPlayerStackerItemEnabled();
      player.getInventory().setItem(plugin.getSettings().getPlayerStackerSlot(), reverse);
      player.updateInventory();
    }

    // Play a clicking sound.
    player.playSound(player.getLocation(), Sound.CLICK, 2.0F, 1.0F);
  }
Example #9
0
 @Override
 public void rightClick(Player player) {
   long cooldown;
   if (item.getHasPermission() == true && player.hasPermission(item.getPermission()) == false) {
   } else {
     RPGValue value = RPGValue.get(player, item, "tnt.cooldown");
     if (value == null) {
       cooldown = System.currentTimeMillis() / 50;
       value = new RPGValue(player, item, "tnt.cooldown", cooldown);
     } else {
       cooldown = value.asLong();
     }
     if (cooldown <= System.currentTimeMillis() / 50) {
       value.set(System.currentTimeMillis() / 50 + cooldownTime);
       player.playSound(player.getLocation(), Sound.SHOOT_ARROW, 1.0f, 1.0f);
       TNTPrimed tnt =
           player.getWorld().spawn(player.getLocation().add(0, 1.8, 0), TNTPrimed.class);
       tnt.setVelocity(player.getLocation().getDirection().multiply(2d));
     } else {
       player.sendMessage(
           ChatColor.AQUA
               + String.format(
                   Locale.get("message.cooldown", Locale.getPlayerLocale(player)),
                   ((double) (cooldown - System.currentTimeMillis() / 50)) / 20d));
     }
   }
 }
Example #10
0
 /**
  * Send the player an informative message to explain what he's doing wrong. Play an optional sound
  * aswell
  *
  * <p>
  *
  * @param player to send msg to
  * @param perm permission to silence the message
  * @param sound errorsound to play after the event got cancelled
  * @param soundPitch 20-35 is good
  */
 public void send(
     Player player, MessageNode node, PermissionNode perm, Sound sound, float soundPitch) {
   if (!player.hasPermission(perm.getNode())) {
     send(player, node, messages.getString(node));
     if (sound != null) player.playSound(player.getLocation(), sound, 1, soundPitch);
   }
 }
Example #11
0
  @EventHandler
  public void onMove(PlayerMoveEvent e) {
    Player p = e.getPlayer();
    double x = p.getLocation().getX();
    double y = p.getLocation().getY() - 1;
    double z = p.getLocation().getZ();
    Location loc = new Location(p.getWorld(), x, y, z);
    Block b1 = loc.getBlock();
    Block b2 = p.getLocation().getBlock();

    if (b1.getType().equals(Material.REDSTONE_BLOCK) && b2.getType().equals(Material.WOOD_PLATE)) {
      // p.sendMessage("ON " + b1.getType().toString() + " + " + b2.getType().toString());
      p.setVelocity(p.getLocation().getDirection().multiply(2).setY(p.getVelocity().getY() + 1));
      p.setFallDistance(0f);
      for (Player all : Bukkit.getOnlinePlayers()) {
        all.playSound(p.getLocation(), Sound.WITHER_SHOOT, 0.1f, 0.1f);
      }
    }

    p.setSaturation(100f);
    p.setFoodLevel(20);
    p.setHealth(20f);

    if (p.getLocation().getY() <= 80) {
      p.teleport(p.getWorld().getSpawnLocation());
      p.setGameMode(GameMode.ADVENTURE);
      p.setAllowFlight(true);
      p.setFlying(false);
    }
  }
Example #12
0
  public void run() {
    if (gm.isBomb()) {
      int timer = gm.getBombTimer();

      if (timer != 0) {
        timer--;
        gm.setLobbyTimer(timer);

        for (Player p : gm.getArenaPlayers()) {
          p.setLevel(timer);
        }
      } else {
        gm.removePlayer(gm.getPotatoCarrier());

        for (Player p : gm.getArenaPlayers()) {
          p.setLevel(0);
          p.setExp(0);
          p.playSound(p.getLocation(), Sound.LEVEL_UP, 1, 10);
        }

        plugin.getServer().getScheduler().cancelTask(gm.getBomb());
        gm.setBombTimer(-1);
      }
    }
  }
  @EventHandler(priority = EventPriority.NORMAL)
  public void grapple(ProjectileHitEvent event) {
    Entity proj = event.getEntity();
    Location hit = proj.getLocation();

    if (contains(hit, x1, x2, y1, y2, z1, z2) == true) {

      if (proj instanceof Snowball) {
        Snowball fish = (Snowball) proj;
        Entity shooter = fish.getShooter();

        if (shooter instanceof Player) {
          Player p = (Player) shooter;
          Location loc = p.getLocation();
          ItemStack is = p.getItemInHand();
          Material mat = is.getType();

          if (mat == Material.FISHING_ROD) {

            p.setFallDistance(0);
            p.playSound(loc, Sound.ARROW_HIT, 1, 1);

            int hitx = hit.getBlockX();
            int hity = hit.getBlockY();
            int hitz = hit.getBlockZ();
            int locx = loc.getBlockX();
            int locy = loc.getBlockY();
            int locz = loc.getBlockZ();
            double co[] = new double[3];

            if (hitx > locx) {
              co[0] = 1.2;
            } else if (hitx < locx) {
              co[0] = -1.2;
            } else if (hitx == locx) {
              co[0] = 0;
            }

            if (hity > locy) {
              co[1] = 1.4;
            } else if (hity < locy) {
              co[1] = -0.8;
            } else if (hity == locy) {
              co[1] = 0;
            }

            if (hitz > locz) {
              co[2] = 1.2;
            } else if (hitz < locz) {
              co[2] = -1.2;
            } else if (hitz == locz) {
              co[2] = 0;
            }

            p.setVelocity(new Vector(co[0], co[1], co[2]));
          }
        }
      }
    }
  }
Example #14
0
  @EventHandler(priority = EventPriority.MONITOR)
  public void onPlayerCommandPreprocess(PlayerCommandPreprocessEvent event) {
    Player p = event.getPlayer();
    boolean som = EssentialsLT.getInstance().getConfig().getBoolean("Som");
    if (som) {
      p.playSound(p.getLocation(), Sound.NOTE_BASS_GUITAR, 7.0F, 1.0F);
    }

    if (!event.isCancelled()) {
      Player player = event.getPlayer();
      String cmd = event.getMessage().split(" ")[0];
      HelpTopic topic = Bukkit.getServer().getHelpMap().getHelpTopic(cmd);
      String mensagem =
          EssentialsLT.getInstance()
              .getConfig()
              .getString("Mensagem")
              .replaceAll("&", "§")
              .replace("[cmd]", cmd);
      if (topic == null) {

        player.sendMessage(mensagem);
        event.setCancelled(true);
      }
    }
  }
  /** Check win * */
  private void checkWin() {
    for (Player p : Bukkit.getOnlinePlayers()) {
      if (points.containsKey(p.getName())) {
        if (points.get(p.getName()) == 15) {
          /** Clear inventories * */
          for (Player t : Bukkit.getOnlinePlayers()) {
            t.getInventory().clear();

            t.setLevel(0);
            p.setExp(0f);
          }

          /** Bukkit task * */
          runnable.cancel();

          /** Remove chickens * */
          for (Entity e : chickens) {
            if (!e.isDead()) e.remove();
          }

          /** Broadcast * */
          Bukkit.broadcastMessage(MTP.PREFIX + "" + p.getName() + " �at gewonnen!");

          /** Sounds * */
          for (Player tp : Bukkit.getOnlinePlayers()) {
            if (tp == p) {
              /** Points * */
              MTP.points.put(p.getName(), MTP.points.get(p.getName()) + 1);

              tp.playSound(tp.getLocation(), "win", 1, 1);
            } else tp.playSound(tp.getLocation(), "lose", 1, 1);
          }

          /** Runnable * */
          new BukkitRunnable() {
            public void run() {
              end();
            }
          }.runTaskLater(MTP.getPlugin(), 10 * 20L);

          /** Break * */
          break;
        }
      }
    }
  }
Example #16
0
  @EventHandler(priority = EventPriority.NORMAL)
  public void grapple(ProjectileHitEvent event) {
    Entity proj = event.getEntity();
    Location hit = proj.getLocation();

    if (!event.getEntity().getWorld().getName().equals(getName())) return;

    if (proj instanceof Snowball) {
      Snowball fish = (Snowball) proj;
      ProjectileSource shooter = (ProjectileSource) fish.getShooter();
      if (shooter instanceof Player) {
        Player player = (Player) shooter;
        Location location = player.getLocation();
        ItemStack itemStack = player.getItemInHand();
        Material material = itemStack.getType();

        if (material == Material.FISHING_ROD) {

          player.setFallDistance(0);
          player.playSound(location, Sound.ARROW_HIT, 1, 1);

          int hitx = hit.getBlockX();
          int hity = hit.getBlockY();
          int hitz = hit.getBlockZ();
          int locx = location.getBlockX();
          int locy = location.getBlockY();
          int locz = location.getBlockZ();
          double co[] = new double[3];

          if (hitx > locx) {
            co[0] = 1.2;
          } else if (hitx < locx) {
            co[0] = -1.2;
          } else if (hitx == locx) {
            co[0] = 0;
          }

          if (hity > locy) {
            co[1] = 1.4;
          } else if (hity < locy) {
            co[1] = -0.8;
          } else if (hity == locy) {
            co[1] = 0;
          }

          if (hitz > locz) {
            co[2] = 1.2;
          } else if (hitz < locz) {
            co[2] = -1.2;
          } else if (hitz == locz) {
            co[2] = 0;
          }

          player.setVelocity(new Vector(co[0], co[1] / 1.25, co[2]));
        }
      }
    }
  }
Example #17
0
 public static void soundToAllInQueue(Sound sound) {
   for (int i = 1; i <= 8; i++) {
     if (i > inqueue.size()) {
       break;
     }
     Player p = Bukkit.getPlayer(inqueue.get(i - 1));
     p.playSound(p.getLocation(), sound, 1f, 1f);
   }
 }
 public static void setCoins(Player p, int amount, String reason) {
   Vars.coins.remove(p.getName());
   Vars.coins.put(p.getName(), amount);
   p.playSound(p.getLocation(), Sound.LEVEL_UP, 100, 1);
   ScoreboardUtils.updateScoreboard(p, false);
   ChatUtils.sendMsg(p, "&6=" + amount + " coins! (" + reason + ")");
   WorldUtils.updateSpawnSigns(p);
   TitleUtils.updateTab(p, false);
 }
 public static void addCoins(Player p, int coinsGained, String reason) {
   int curCoins = getCoins(p);
   Vars.coins.remove(p.getName());
   Vars.coins.put(p.getName(), coinsGained + curCoins);
   ChatUtils.sendMsg(p, "&6+" + coinsGained + " coins! (" + reason + ")");
   p.playSound(p.getLocation(), Sound.LEVEL_UP, 100, 1);
   ScoreboardUtils.updateScoreboard(p, false);
   TitleUtils.updateTab(p, false);
 }
Example #20
0
  /**
   * Removes a friend from an owned chunk Called when landlord remfriend is executed
   *
   * @param sender who executed the command
   * @param args given with command
   * @return boolean
   */
  @Override
  public boolean execute(CommandSender sender, String[] args, String label) {
    if (!(sender instanceof Player)) {
      sender.sendMessage(
          Fonctions.replaceColor(Landlord.getMessages().getString("noConsole"))); // mess
    } else {
      if (args.length < 2) {
        sender.sendMessage(
            Fonctions.replaceColor(Landlord.getMessages().getString("usageLandUnfriend"))); // mess
        return true;
      }
      Player player = (Player) sender;
      if (!player.hasPermission("landlord.player.own")) {
        player.sendMessage(
            Fonctions.replaceColor(Landlord.getMessages().getString("noPermission"))); // mess
        return true;
      }

      Chunk currChunk = player.getLocation().getChunk();
      /*
       * *************************************
       * mark for possible change    !!!!!!!!!
       * *************************************
       */
      Friend frd = Friend.friendFromOfflinePlayer(getOfflinePlayer(args[1]));
      OwnedLand land =
          OwnedLand.getLandFromDatabase(
              currChunk.getX(), currChunk.getZ(), currChunk.getWorld().getName());
      if (land == null
          || (!land.ownerUUID().equals(player.getUniqueId())
              && !player.hasPermission("landlord.admin.modifyfriends"))) {
        player.sendMessage(
            Fonctions.replaceColor(Landlord.getMessages().getString("noOwner"))); // mess
        return true;
      }
      if (!land.removeFriend(frd)) {
        player.sendMessage(
            Fonctions.replaceColor(Landlord.getMessages().getString("playerNotFriendLand"))
                .replaceAll("%pseudo%", args[1])); // mess
        return true;
      }
      if (plugin.getConfig().getBoolean("options.particleEffects", true)) { // conf
        land.highlightLand(player, Effect.VILLAGER_THUNDERCLOUD, 2);
      }
      plugin.getDatabase().save(land);
      if (plugin.getConfig().getBoolean("options.soundEffects", true)) { // conf
        player.playSound(player.getLocation(), Sound.ZOMBIE_INFECT, 10, .5f);
      }
      player.sendMessage(
          Fonctions.replaceColor(Landlord.getMessages().getString("playerIsNoLongerFriendLand"))
              .replaceAll("%pseudo%", args[1])); // mess
    }
    return true;
  }
Example #21
0
 @SuppressWarnings("deprecation")
 public void giveGold(Player player, int amount) {
   List<String> lore = new ArrayList<String>();
   lore.add(ChatColor.GRAY + "Worth: " + ChatColor.WHITE + "100 Silver");
   lore.add(ChatColor.GRAY + "The currency of Mists of Dawn");
   setItemText(
       gold, ChatColor.GOLD + "" + ChatColor.BOLD + "GOLD COIN(s)" + ChatColor.RESET, lore);
   gold.setAmount(amount);
   player.getInventory().addItem(gold);
   player.updateInventory();
   player.playSound(player.getLocation(), Sound.ORB_PICKUP, 1, 1);
 }
Example #22
0
  @SuppressWarnings("deprecation")
  public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
    if (cmd.getName().equalsIgnoreCase("check-server")) {

      Player _user = (Player) sender;

      if (_user.hasPermission(PERM.ADMINKA_DATA_CMD)) {

        Runtime runtime = Runtime.getRuntime();

        System.gc();

        String nameOS = System.getProperty("os.name");

        sender.sendMessage("§a§l§m=============================================");
        sender.sendMessage("");
        sender.sendMessage(
            "§8▍  §3RAM §8▏ ➲ §7USED §8/ §7TOTAL §8/ §7FREE "
                + ChatColor.AQUA
                + (runtime.totalMemory() - runtime.freeMemory()) / 1048576L
                + " MB / "
                + runtime.totalMemory() / 1048576L
                + " MB / "
                + runtime.freeMemory() / 1048576L
                + " MB");

        sender.sendMessage(
            "§8▍  §3CPU §8▏ ➲ §7Available (cores) "
                + ChatColor.AQUA
                + Runtime.getRuntime().availableProcessors());

        sender.sendMessage(
            "§8▍  §3CPU §8▏ ➲ §7Architecture "
                + ChatColor.BLUE
                + System.getenv("PROCESSOR_ARCHITECTURE"));

        sender.sendMessage("§8▍  §3OS §8▏ ➲   " + ChatColor.LIGHT_PURPLE + nameOS);

        sender.sendMessage("");
        sender.sendMessage("§a§l§m=============================================");

        sender.sendMessage(
            plugin.getConfig().getString("Config.Spravy.Prefix").replace('&', '§')
                + "Tento plugin napísal » §9 Shiro");

        _user.playSound(_user.getLocation(), Sound.CHICKEN_EGG_POP, 1.0F, 2.0F);
        _user.playEffect(_user.getLocation(), Effect.FIREWORKS_SPARK, 1);
      }
    }
    return false;
  }
Example #23
0
  @EventHandler
  public static void onFly(PlayerToggleFlightEvent event) {
    Player p = event.getPlayer();
    if (p.getGameMode() != GameMode.CREATIVE && event.isFlying()) {
      event.setCancelled(true);

      Vector jump = p.getLocation().getDirection().multiply(0.4).setY(1.1);
      p.setVelocity(p.getVelocity().add(jump));
      p.setAllowFlight(false);
      p.setFallDistance(1);
      p.playSound(p.getLocation(), Sound.ENDERDRAGON_WINGS, 100, 1);
      ParticleEffect.CLOUD.display(1, 1, 1, 1, 20, p.getLocation(), 20);
    }
  }
Example #24
0
 /**
  * @param player Set the player
  * @param itemstack The bank note itemstack
  * @param newvalue Set the new value of the Banknote
  */
 @SuppressWarnings("deprecation")
 public void changeBanknoteAmount(Player player, ItemStack itemstack, int newvalue) {
   ArrayList<String> lore = new ArrayList<String>();
   String one = itemstack.getItemMeta().getLore().get(0);
   String[] split = one.split(" ");
   String s1 = split[0];
   String s2 = split[1];
   String part1 = s1.replaceAll("[\\d]+", String.valueOf(newvalue));
   lore.add(part1 + " " + s2);
   lore.add(itemstack.getItemMeta().getLore().get(1));
   setItemText(itemstack, itemstack.getItemMeta().getDisplayName(), lore);
   player.playSound(player.getLocation(), Sound.ENDERDRAGON_WINGS, (float) 0.3, 1);
   player.updateInventory();
 }
Example #25
0
 private void allocatePoints(int points, Player plr) {
   if ((points > 0 && pLevel.getTempFreePoints() >= points
           || (points < 0 && (this.points - pLevel.getIntPoints()) >= Math.abs(points)))
       && this.points + points <= 600) {
     this.points += points;
     pLevel.setTempFreePoints(pLevel.getTempFreePoints() - points);
     plr.playSound(plr.getLocation(), Sound.SHEEP_SHEAR, 1.0F, 1.3F);
     for (Entry<Integer, MenuItem> entry :
         DynamicMenuModel.getMenu(plr).getDynamicItems().entrySet()) {
       DynamicMenuModel.getMenu(plr)
           .getInventory()
           .setItem(entry.getKey(), entry.getValue().getItem());
     }
   }
 }
  @Override
  public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args) {
    if (sender instanceof Player) {
      Player p = (Player) sender;
      if (!plugin.hasPerm(p, "petcreeper.saddle")) {
        plugin.message(p, ChatColor.RED + "You do not have permission to use this command.");
        return true;
      }
      if (plugin.isPetOwner(p)) {
        if (args.length == 1 && args[0].matches("\\d+")) {
          int idx = Integer.parseInt(args[0]) - 1;
          if (idx >= 0 && idx < plugin.getPetsOf(p).size()) {
            Pet pet = plugin.getPetsOf(p).get(idx);
            if (pet.type.equals(EntityType.PIG)) {
              Entity e = plugin.getEntityOfPet(pet);
              if (e != null) {
                if (((Pig) e).hasSaddle()) {
                  ((Pig) e).setSaddle(false);
                  plugin.message(p, ChatColor.GREEN + "Your pet dropped the saddle!");
                  e.getWorld()
                      .dropItemNaturally(e.getLocation(), new ItemStack(Material.SADDLE, 1));
                  p.playSound(e.getLocation(), Sound.PIG_DEATH, 10, 1);

                } else {
                  plugin.message(p, ChatColor.GREEN + "Your pet looks at you strangely.");
                }
              }
            } else {
              plugin.message(p, ChatColor.RED + "Invalid pet ID.");
            }
          } else {
            plugin.message(
                p,
                ChatColor.YELLOW
                    + "Usage: "
                    + ChatColor.WHITE
                    + "/"
                    + plugin.config.commandPrefix
                    + "saddle [id]");
          }
        } else {
          plugin.message(p, ChatColor.RED + "You have no pets. :(");
        }
      }
    }
    return true;
  }
Example #27
0
 @SuppressWarnings("deprecation")
 public void giveSilver(Player player, int amount) {
   List<String> lore = new ArrayList<String>();
   lore.add(ChatColor.GRAY + "Worth: " + ChatColor.WHITE + "1/100" + ChatColor.GOLD + " Gold");
   lore.add(ChatColor.GRAY + "The currency of Mists of Dawn");
   setItemText(
       silver, ChatColor.WHITE + "" + ChatColor.BOLD + "SILVER COIN(s)" + ChatColor.RESET, lore);
   silver.setAmount(amount);
   player.getInventory().addItem(silver);
   int b = totalSilver(player);
   if (b >= 100) {
     giveGold(player, 1);
     removeSilver(player, 100);
   }
   player.updateInventory();
   player.playSound(player.getLocation(), Sound.ORB_PICKUP, 1, (float) 0.8);
 }
Example #28
0
  public void depositSilver(Player player, int amount) {
    Bank bank = banks.get(player.getName());
    int a = amount;
    int b = getSilverBalance(player);
    int c = a + b;
    int d = (c - b) - 1;
    double e = c / 100;

    if (c < 100) {
      bank.setSilver(bank.getSilver() + amount);
    } else {
      depositGold(player, (int) e);
      bank.setSilver(d);
    }
    refreshBank(player);
    player.playSound(player.getLocation(), Sound.ORB_PICKUP, 1, (float) 0.8);
  }
Example #29
0
  public static void seekersWin(Arena arena) {
    ArenaHandler.sendFMessage(arena, ConfigC.normal_winSeekers, true);
    for (Player player : arena.playersInArena) {
      playerLeaveArena(player, false, false);
      player.playSound(player.getLocation(), Sound.LEVEL_UP, 1, 1);
      if (arena.seekersWinCommands != null) {
        for (String command : arena.seekersWinCommands) {
          Bukkit.dispatchCommand(
              Bukkit.getConsoleSender(), command.replaceAll("%player%", player.getName()));
        }
      }
    }

    arena.playersInArena.clear();
    arena.seekers.clear();
    arena.gameState = ArenaState.WAITING;
  }
Example #30
0
  @EventHandler
  public void onFly(PlayerToggleFlightEvent e) {
    final Player p = e.getPlayer();

    Runnable jump2 =
        new Runnable() {
          public void run() {
            p.setLevel(2);
            p.setFallDistance(-100);
          }
        };
    Runnable jump1 =
        new Runnable() {
          public void run() {
            p.setLevel(1);
            p.setFallDistance(-100);
          }
        };
    Runnable jump =
        new Runnable() {
          public void run() {
            p.setAllowFlight(true);
            p.setFlying(false);
            p.setLevel(0);
            p.setFallDistance(-100);
          }
        };

    if (p.getGameMode().equals(GameMode.ADVENTURE) && e.isFlying() == true) {
      p.setFlying(false);
      p.setAllowFlight(false);
      p.setLevel(3);

      for (Player all : Bukkit.getOnlinePlayers()) {
        all.playSound(p.getLocation(), Sound.WITHER_SHOOT, 0.1f, 0.1f);
      }

      p.setVelocity(p.getLocation().getDirection().multiply(3).setY(p.getVelocity().getY() + 1.5));
      Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, jump2, 20L);
      Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, jump1, 40L);
      Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, jump, 60L);
    }
  }