Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package net.ikillforfun.dghc.listeners;
- import org.bukkit.event.block.*;
- import net.ikillforfun.dghc.utils.*;
- import org.bukkit.entity.*;
- import org.bukkit.block.*;
- import org.bukkit.*;
- import org.bukkit.event.*;
- public class BoyListener implements Listener {
- @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
- public void BlockPlace(final BlockPlaceEvent e) {
- if (e.isCancelled()) {
- return;
- }
- final Player p = e.getPlayer();
- final Block u = e.getBlock().getLocation().add(0.0, 1.0, 0.0)
- .getBlock();
- if (p.getItemInHand() == null || !p.getItemInHand().hasItemMeta()) {
- return;
- }
- final Block b = e.getBlock();
- if (p.getItemInHand().getItemMeta().getDisplayName()
- .equalsIgnoreCase(ChatUtil.fixColor("&5&lBOYFARMER"))) {
- final Location loc = e.getBlockPlaced().getLocation();
- for (int i = 0; i < 100
- && !loc.getBlock().getType()
- .equals((Object) Material.BEDROCK); ++i) {
- if (loc.getBlock().getType()
- .equals((Object) Material.DRAGON_EGG)) {
- break;
- }
- loc.getBlock().setType(Material.OBSIDIAN);
- loc.subtract(0.0, 1.0, 0.0);
- }
- }
- if (p.getItemInHand().getItemMeta().getDisplayName()
- .equalsIgnoreCase(ChatUtil.fixColor("&6&lSANDFARMER"))) {
- final Location loc = e.getBlockPlaced().getLocation();
- for (int i = 0; i < 100
- && !loc.getBlock().getType()
- .equals((Object) Material.BEDROCK); ++i) {
- if (loc.getBlock().getType()
- .equals((Object) Material.DRAGON_EGG)) {
- break;
- }
- loc.getBlock().setType(Material.SAND);
- loc.subtract(0.0, 1.0, 0.0);
- }
- }
- if (p.getItemInHand().getItemMeta().getDisplayName()
- .equalsIgnoreCase(ChatUtil.fixColor("&7&lKOPACZ FOSY"))) {
- final Location loc = e.getBlockPlaced().getLocation();
- for (int i = 0; i < 100
- && !loc.getBlock().getType()
- .equals((Object) Material.BEDROCK); ++i) {
- if (loc.getBlock().getType()
- .equals((Object) Material.DRAGON_EGG)) {
- break;
- }
- loc.getBlock().setType(Material.AIR);
- loc.subtract(0.0, 1.0, 0.0);
- }
- }
- e.getPlayer().playEffect(b.getLocation(), Effect.MOBSPAWNER_FLAMES, 20);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement