3 Blocks Up

Discussion in 'Plugin Development' started by icedmoca, Mar 15, 2016.

Thread Status:
Not open for further replies.
  1. Offline


    Im trying to have it give you poison 3 blocks above the Monster egg. How would I do so?

    public void onMove2(PlayerMoveEvent e) {
        Player p = e.getPlayer();
        if (e.getTo().getX() == e.getFrom().getX() || e.getTo().getZ() == e.getFrom().getZ()) return;
        Block b = p.getLocation().getBlock().getRelative(BlockFace.DOWN);
        if(b.getType().equals(Material.MONSTER_EGGS)) {
            if (b.getData() != (byte) 2) return;
            if (p.getInventory().getHelmet() != null && p.getInventory().getHelmet().getType().equals(Material.CHAINMAIL_HELMET))
            p.addPotionEffect(new PotionEffect(PotionEffectType.POISON, 24000, 0), true);
            p.sendMessage(ChatColor.LIGHT_PURPLE + ">> " + ChatColor.WHITE + "Get you Gas Mask on!");
  2. Offline


    //Remember: clone is there so you don't mess up the actual eggs location. The "add" method adds those values to the X/Y/Z.
    //Also remember that it does not take in negative numbers. If you want to add negative, use ".subtract"
    MonsterEgg.getLocation().clone().add(X, Y , Z);
Thread Status:
Not open for further replies.

Share This Page