Java 类org.bukkit.event.player.PlayerBucketEmptyEvent 实例源码

项目:bskyblock    文件:NetherEvents.java   
@EventHandler(priority = EventPriority.LOW)
public void onBucketEmpty(final PlayerBucketEmptyEvent e) {
    if (DEBUG)
        plugin.getLogger().info("DEBUG: " + e.getEventName());
    if (!Settings.netherIslands) {
        if (e.getPlayer().getWorld().getName().equalsIgnoreCase(Settings.worldName + "_nether")
                || e.getPlayer().getWorld().getName().equalsIgnoreCase(Settings.worldName + "_the_end")) {
            if (VaultHelper.hasPerm(e.getPlayer(), Settings.PERMPREFIX + "mod.bypassprotect")) {
                return;
            }
            if (!awayFromSpawn(e.getPlayer()) && !e.getPlayer().isOp()) {
                e.setCancelled(true);
            }
        }
    }
}
项目:Cardinal    文件:AppliedModule.java   
/**
 * Filters PlayerBucketEmptyEvent (placing down a block of liquid).
 *
 * <p>Applies to: block, block place and block place against.<p/>
 */
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
public void onBucketEmpty(PlayerBucketEmptyEvent event) {
  Match match = Cardinal.getMatch(event.getPlayer());
  if (match == null || !match.hasPlayer(event.getPlayer())) {
    return;
  }
  for (AppliedRegion reg : get(match, ApplyType.BLOCK, ApplyType.BLOCK_PLACE, ApplyType.BLOCK_PLACE_AGAINST)) {
    Block evaluating = reg.isType(ApplyType.BLOCK_PLACE_AGAINST)
        ? event.getBlockClicked() : event.getBlockClicked().getRelative(event.getBlockFace());

    if (apply(reg, evaluating.getLocation(), event.getPlayer(), event,
        event, getBucketResult(event.getBucket()), event.getPlayer())) {
      break;
    }
  }
}
项目:Statz    文件:BucketsEmptiedListener.java   
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onBucketEmpty(final PlayerBucketEmptyEvent event) {

    final PlayerStat stat = PlayerStat.BUCKETS_EMPTIED;

    // Get player
    final Player player = event.getPlayer();

    // Do general check
    if (!plugin.doGeneralCheck(player, stat))
        return;

    // Update value to new stat.
    plugin.getDataManager().setPlayerInfo(player.getUniqueId(), stat, StatzUtil.makeQuery("uuid",
            player.getUniqueId().toString(), "value", 1, "world", player.getWorld().getName()));

}
项目:ArchBlock    文件:PlayerBucketEmpty.java   
@EventHandler(priority = EventPriority.NORMAL)
public void onEvent(PlayerBucketEmptyEvent event) {
    UUID owner = this.plugin.getApi().getOwnerUUID(new BukkitBlock(event.getBlockClicked()));
    UUID ourUuid = event.getPlayer().getUniqueId();

    if (this.plugin.getWorldGuardIntegration().isInIgnoredRegion(new BukkitBlock(event.getBlockClicked()))) {
        this.plugin.debug("Region has bypass-protection set to true");
        return;
    }


    if (owner != null && ! owner.equals(ourUuid)) {
        if (! event.getPlayer().hasPermission("archblock.bypass") && ! this.plugin.getApi().hasFriendship(owner, ourUuid)) {
            event.getPlayer().sendMessage(this.plugin.getPrefixedLocalisedString(
                    "event_bucket_denied", this.plugin.getApi().getUsernameForUuid(owner)
            ));

            event.setCancelled(true);
            return;
        }
        this.plugin.debug("Owner is different but player has a bypass or is friends with the owner");
    }

    this.plugin.debug("Everything's okay - empty ze bucket");
    this.plugin.getApi().removeOwner(new BukkitBlock(event.getBlockClicked()));
}
项目:buildinggame    文件:PlaceBucket.java   
/**
    * Handles placement of water and lava buckets
    *
    * @param e an event representing a player emptying a bucket
    * @see PlayerBucketEmptyEvent
    * @since 2.1.0
    */
@EventHandler
public static void onBucketEmpty(PlayerBucketEmptyEvent e) {
    Player player = e.getPlayer();
       Arena arena = ArenaManager.getInstance().getArena(player);

       if (arena == null)
        return;

    Plot plot = arena.getPlot(player);

    if (plot.getGamePlayer(player).getGamePlayerType() == GamePlayerType.SPECTATOR) {
        MessageManager.getInstance().send(player, ChatColor.RED + "Spectators can't build");
        e.setCancelled(true);
        return;
    }

    if (!plot.getBoundary().isInside(e.getBlockClicked().getRelative(e.getBlockFace()).getLocation())) {
        e.setCancelled(true);
        MessageManager.getInstance().send(player, ChatColor.RED + "You can't place blocks outside your plot");
    }
}
项目:RedProtect    文件:RPGlobalListener.java   
@EventHandler
public void onBucketUse(PlayerBucketEmptyEvent e){
    if (e.isCancelled()) {
           return;
       }

    Location l = e.getBlockClicked().getLocation();
    Region r = RedProtect.get().rm.getTopRegion(l); 
    if (r != null){
        return;
    }

    if (!RPUtil.canBuildNear(e.getPlayer(), l)){            
           e.setCancelled(true);
        return;     
       }

    if (!bypassBuild(e.getPlayer(), null, 0)) {
        e.setCancelled(true);
    }
   }
项目:AncientGates    文件:PluginBlockListener.java   
@EventHandler(priority = EventPriority.HIGH)
public void onPlayerBucketEmpty(final PlayerBucketEmptyEvent event) {
    if (event.isCancelled())
        return;

    final Block block = event.getBlockClicked();
    final Block blockUp = block.getRelative(BlockFace.UP);

    // Ok so a player empties a bucket near on portal/frame block
    // Find the nearest gate!
    final WorldCoord blockCoord = new WorldCoord(block);
    final WorldCoord blockCoordUp = new WorldCoord(blockUp);
    final Gate nearestGate = Gates.gateFromAll(blockCoord);
    final Gate nearestGateUp = Gates.gateFromAll(blockCoordUp);

    if (nearestGate != null || nearestGateUp != null) {
        event.setCancelled(true);
    }
}
项目:beaconz    文件:BeaconProtectionListener.java   
/**
 * Prevents the tipping of liquids over the beacon using a bucket
 * @param event
 */
@EventHandler(priority = EventPriority.LOW, ignoreCancelled=true)
public void onBucketEmpty(final PlayerBucketEmptyEvent event) {
    if (DEBUG)
        getLogger().info("DEBUG: " + event.getEventName());
    World world = event.getBlockClicked().getWorld();
    if (!world.equals(getBeaconzWorld())) {
        return;
    }
    Block b = event.getBlockClicked().getRelative(event.getBlockFace());
    BeaconObj beacon = getRegister().getBeaconAt(b.getX(),b.getZ());
    if (beacon != null && beacon.getY() <= event.getBlockClicked().getY()) {
        event.setCancelled(true);
        event.getPlayer().sendMessage(ChatColor.RED + Lang.beaconCannotPlaceLiquids);
    }
    if (getRegister().isAboveBeacon(b.getLocation())) {
        event.setCancelled(true);
        event.getPlayer().sendMessage(ChatColor.RED + Lang.beaconCannotPlaceLiquids);
    }
}
项目:civcraft    文件:PlayerListener.java   
@EventHandler(priority = EventPriority.HIGHEST)
public void OnPlayerBucketEmptyEvent(PlayerBucketEmptyEvent event) {
    Resident resident = CivGlobal.getResident(event.getPlayer());

    if (resident == null) {
        event.setCancelled(true);
        return;
    }

    ChunkCoord coord = new ChunkCoord(event.getBlockClicked().getLocation());
    CultureChunk cc = CivGlobal.getCultureChunk(coord);
    if (cc != null) {
        if (event.getBucket().equals(Material.LAVA_BUCKET) || 
                event.getBucket().equals(Material.LAVA)) {

            if (!resident.hasTown() || (resident.getTown().getCiv() != cc.getCiv())) {
                CivMessage.sendError(event.getPlayer(), "You cannot place lava inside another civ's culture.");
                event.setCancelled(true);
                return;
            }

        }
    }
}
项目:acidisland    文件:NetherPortals.java   
@EventHandler(priority = EventPriority.LOW)
public void onBucketEmpty(final PlayerBucketEmptyEvent e) {
    if (DEBUG)
        plugin.getLogger().info("DEBUG: " + e.getEventName());
    if (!Settings.newNether) {
        if (e.getPlayer().getWorld().getName().equalsIgnoreCase(Settings.worldName + "_nether")
                || e.getPlayer().getWorld().getName().equalsIgnoreCase(Settings.worldName + "_the_end")) {
            if (VaultHelper.checkPerm(e.getPlayer(), Settings.PERMPREFIX + "mod.bypassprotect")) {
                return;
            }
            if (!awayFromSpawn(e.getPlayer()) && !e.getPlayer().isOp()) {
                e.setCancelled(true);
            }
        }
    }
}
项目:Factoid    文件:PlayerListener.java   
/**
 * On player bucket empty.
 * 
 * @param event
 *            the event
 */
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void onPlayerBucketEmpty(PlayerBucketEmptyEvent event) {

    if (!playerConf.get(event.getPlayer()).isAdminMod()) {
        Block block = event.getBlockClicked().getRelative(event.getBlockFace());
        IDummyLand land = Factoid.getThisPlugin().iLands().getLandOrOutsideArea(
                block.getLocation());
        Material mt = event.getBucket();

        if ((land instanceof ILand && ((ILand) land).isBanned(event
                .getPlayer()))
                || (mt == Material.LAVA_BUCKET && !checkPermission(land,
                        event.getPlayer(),
                        PermissionList.BUCKET_LAVA.getPermissionType()))
                || (mt == Material.WATER_BUCKET && !checkPermission(land,
                        event.getPlayer(),
                        PermissionList.BUCKET_WATER.getPermissionType()))) {
            messagePermission(event.getPlayer());
            event.setCancelled(true);
        }
    }
}
项目:askyblock    文件:NetherPortals.java   
@EventHandler(priority = EventPriority.LOW)
public void onBucketEmpty(final PlayerBucketEmptyEvent e) {
    if (DEBUG)
        plugin.getLogger().info("DEBUG: " + e.getEventName());
    if (!Settings.newNether) {
        if (e.getPlayer().getWorld().getName().equalsIgnoreCase(Settings.worldName + "_nether")
                || e.getPlayer().getWorld().getName().equalsIgnoreCase(Settings.worldName + "_the_end")) {
            if (VaultHelper.checkPerm(e.getPlayer(), Settings.PERMPREFIX + "mod.bypassprotect")) {
                return;
            }
            if (!awayFromSpawn(e.getPlayer()) && !e.getPlayer().isOp()) {
                e.setCancelled(true);
            }
        }
    }
}
项目:TCMinigames    文件:PlayerListener.java   
@EventHandler
public void onBucketEmpty(PlayerBucketEmptyEvent event){
    if(Minigame.getCurrentMinigame()!=null){
        switch(Minigame.getCurrentMinigame().getMap().getType()){
        case CIRCLE_OF_BOOM:
            event.setCancelled(true);
            break;
        case KEY_QUEST:
            break;
        case WATER_THE_MONUMENT:
            break;
        default:
            break;
        }
    }
}
项目:Rixor    文件:FilterEvents.java   
@SuppressWarnings("deprecation")
@EventHandler(priority = EventPriority.LOW)
public void onBucketEmpty(PlayerBucketEmptyEvent event) {
    Player player = event.getPlayer();
    Client client = Client.getClient(player);
    Block block = event.getBlockClicked().getRelative(event.getBlockFace());
    Map map = Rixor.getRotation().getSlot().getMap();

    BlockState newState = block.getState();
    Material update = Material.LAVA;
    if(event.getBucket() == Material.WATER_BUCKET) update = Material.WATER;
    newState.setData(new MaterialData(update, (byte) 0));

    BlockState oldState = block.getState();
    BlockChangeEvent change = new BlockChangeEvent(event, map, client, oldState, newState);
    Rixor.callEvent(change);
}
项目:Blueprint-A-Bukkit-Plugin    文件:PlayerListener.java   
/**
 *
 * @param pbee
 */
@EventHandler
public void onPlayerBucketEmpty(final PlayerBucketEmptyEvent pbee) {
    ScoreBoardSystem.updatePlayer(pbee.getPlayer());
    if (!pbee.isCancelled() && DataHandler.isPlayerActive(ConfigHandler.getDefaultBukkitConfig().getBoolean("use.UUIDs", true) ? pbee.getPlayer().getUniqueId().toString() : pbee.getPlayer().getName())) {
        if (ConfigHandler.getDefaultBukkitConfig().getBoolean("limits.blacklist")) {
            if (ConfigHandler.getBlockBlacklistConfig().getIntegerList("List Items").contains(pbee.getBucket().getId())) {
                pbee.setCancelled(true);
                return;
            }
        } else {
            if (ConfigHandler.getBlockBlacklistConfig().getIntegerList("List Items").contains(pbee.getBucket().getId())) {
                pbee.setCancelled(true);
                return;
            }
        }
        final BlockData block = new BlockData(pbee.getBlockClicked().getRelative(pbee.getBlockFace()));
        if (DataHandler.isBlueprintBlockAtLocation(pbee.getBlockClicked().getRelative(pbee.getBlockFace()).getLocation())) {
            DataHandler.updatePlayerBlock(ConfigHandler.getDefaultBukkitConfig().getBoolean("use.UUIDs", true) ? pbee.getPlayer().getUniqueId().toString() : pbee.getPlayer().getName(), block);
        } else {
            DataHandler.addPlayerBlock(ConfigHandler.getDefaultBukkitConfig().getBoolean("use.UUIDs", true) ? pbee.getPlayer().getUniqueId().toString() : pbee.getPlayer().getName(), new ItemStack(pbee.getBucket()), block);
        }
    }
}
项目:ZentrelaRPG    文件:EnvironmentManager.java   
@EventHandler
public void onBucketEmpty(PlayerBucketEmptyEvent event) {
    PlayerDataRPG pd = plugin.getPD(event.getPlayer());
    if (pd == null)
        event.setCancelled(true);
    if (event.getPlayer().getGameMode() != GameMode.CREATIVE)
        event.setCancelled(true);
    if (!canBuild(pd))
        event.setCancelled(true);
    event.getPlayer().updateInventory();
}
项目:ProjectAres    文件:BlockTransformEvent.java   
/**
 * Return true if the block transformation was performed "by hand".
 *
 * Handled:
 *  - place
 *  - mine
 *  - bucket fill/empty
 *  - flint & steel fire/tnt
 *
 * Not handled:
 *  - bonemeal
 *  - probably lots of other things
 */
public boolean isManual() {
    final Event event = getCause();

    if(Types.instanceOfAny(
        event,
        BlockPlaceEvent.class,
        BlockBreakEvent.class,
        PlayerBucketEmptyEvent.class,
        PlayerBucketFillEvent.class
    )) return true;

    if(event instanceof BlockIgniteEvent) {
        BlockIgniteEvent igniteEvent = (BlockIgniteEvent) event;
        if(igniteEvent.getCause() == BlockIgniteEvent.IgniteCause.FLINT_AND_STEEL && igniteEvent.getIgnitingEntity() != null) {
            return true;
        }
    }

    if(event instanceof ExplosionPrimeByEntityEvent && ((ExplosionPrimeByEntityEvent) event).getPrimer() instanceof Player) {
        return true;
    }

    return false;
}
项目:ProjectAres    文件:BlockTransformListener.java   
@SuppressWarnings("deprecation")
@EventWrapper
public void onPlayerBucketEmpty(final PlayerBucketEmptyEvent event) {
    Block block = event.getBlockClicked().getRelative(event.getBlockFace());
    Material contents = Materials.materialInBucket(event.getBucket());
    if(contents == null) {
        return;
    }
    BlockState newBlock = BlockStateUtils.cloneWithMaterial(block, contents);

    this.callEvent(event, block.getState(), newBlock, event.getPlayer());
}
项目:KingdomFactions    文件:PlayerBucketEmptyEventListener.java   
@EventHandler
public void onBreak(PlayerBucketEmptyEvent e) {
    KingdomFactionsPlayer p =PlayerModule.getInstance().getPlayer(e.getPlayer());
    if(p.getSettingsProfile().hasAdminMode()) return;
    if(!p.canBuild(e.getBlockClicked().getLocation())) {
        e.setCancelled(!ProtectionModule.getInstance().tryInfluence(p, 50));
    } 
}
项目:OpenUHC    文件:LobbyModule.java   
/**
 * Prevents lobby players from interacting in the world.
 *
 * @param event The event
 */
@EventHandler
public void onBucketEmpty(final PlayerBucketEmptyEvent event) {
  if (event.getBlockClicked().getWorld().equals(world)) {
    event.setCancelled(true);
  }
}
项目:SurvivalAPI    文件:GameListener.java   
/**
 * Disable lava buckets if the PvP isn't activated
 *
 * @param event Event
 */
@EventHandler
public void onPlayerBucketEmpty(PlayerBucketEmptyEvent event)
{
    if (event.getBucket().equals(Material.LAVA_BUCKET) && !this.game.isPvPActivated())
    {
        event.getPlayer().sendMessage(ChatColor.RED + "Le PvP est désactivé, l'utilisation de sources de lave est interdite.");
        event.getPlayer().getWorld().getBlockAt(event.getBlockClicked().getLocation().add(event.getBlockFace().getModX(), event.getBlockFace().getModY(), event.getBlockFace().getModZ())).setType(Material.AIR);
        event.getPlayer().getInventory().getItemInHand().setType(Material.LAVA_BUCKET);

        event.setCancelled(true);
    }
}
项目:HCFCore    文件:BorderListener.java   
@EventHandler(ignoreCancelled = true, priority = EventPriority.HIGH)
public void onBucketEmpty(final PlayerBucketEmptyEvent event) {
    if (!isWithinBorder(event.getBlockClicked().getLocation())) {
        event.setCancelled(true);
        event.getPlayer().sendMessage(ChatColor.RED + "You cannot empty buckets past the border.");
    }
}
项目:HCFCore    文件:BorderListener.java   
@EventHandler(ignoreCancelled = true, priority = EventPriority.HIGH)
public void onBucketEmpty(final PlayerBucketEmptyEvent event) {
    if (!isWithinBorder(event.getBlockClicked().getLocation())) {
        event.setCancelled(true);
        event.getPlayer().sendMessage(ChatColor.RED + "You cannot empty buckets past the border.");
    }
}
项目:GamePlate    文件:BuildHeightModule.java   
@EventHandler
public void onEmptyBucket(PlayerBucketEmptyEvent event) {
    Block toFill = event.getBlockClicked().getRelative(event.getBlockFace());
    if (toFill.getY() >= height && !event.isCancelled()) {
        event.setCancelled(true);
        ChatUtil.sendWarningMessage(event.getPlayer(), ChatConstant.ERROR_BUILD_HEIGHT, ChatUtil.HIGHLIGHT.toString() + height + ChatColor.GRAY.toString());
    }
}
项目:AthenaGM    文件:BlockPlaceListener.java   
/**
 * Prevent bucket usage
 */
@EventHandler
public void onBucketEmpty(PlayerBucketEmptyEvent event) {
    CuboidRegion region = regionHandler.getApplicableRegion(event.getBlockClicked().getLocation());
    if (!event.isCancelled() && region != null && !region.allows("build")) {
        event.setCancelled(true);
        warnPlayer(event.getPlayer());
    }
}
项目:CommunityDrivenPlugin    文件:PlaceBreakListener.java   
public void onEmpty(PlayerBucketEmptyEvent e) {
    Player p = e.getPlayer();
    int prot = plugin.getSettings().getProtectedSpawnRadius();
    if (p.getWorld().getSpawnLocation().distance(p.getLocation()) < prot) {
        e.setCancelled(true);
        p.sendMessage(ColoringUtil.colorText("&cNie mozesz ingerowac w bloki na spawnie!"));
    }
}
项目:Arcade2    文件:BlockTransformListeners.java   
@EventHandler(ignoreCancelled = true)
public void onPlayerBucketEmpty(PlayerBucketEmptyEvent event) {
    Block block = event.getBlockClicked().getRelative(event.getBlockFace());
    Material inside = this.getBucketContent(block.getType());

    if (inside != null) {
        this.post(event,
                  block.getState(),
                  this.applyState(block, inside),
                  event.getPlayer());
    }
}
项目:AnnihilationPro    文件:Areas.java   
@EventHandler(priority = EventPriority.LOWEST,ignoreCancelled = true)
public void checkBreaks(PlayerBucketEmptyEvent event)
{
    if(event.getPlayer().getGameMode() != GameMode.CREATIVE)
    {
        Area a = this.getArea(new Loc(event.getBlockClicked().getRelative(event.getBlockFace()).getLocation(),false));
        if(a != null)
        {
            event.setCancelled(true);
        }
    }
}
项目:ExilePearl    文件:ExileListener.java   
/**
 * Prevent exiled players from using buckets
 * @param e The event
 */
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
public void onPlayerEmptyBucket(PlayerBucketEmptyEvent e) {
    if (e.getBlockClicked() != null && Material.CAULDRON.equals(e.getBlockClicked().getType())) {
        checkAndCancelRule(ExileRule.FILL_CAULDRON, e, e.getPlayer());
    } else {
        checkAndCancelRule(ExileRule.USE_BUCKET, e, e.getPlayer());
    }
}
项目:Cardinal-Plus    文件:BuildHeight.java   
@EventHandler
public void onEmptyBucket(PlayerBucketEmptyEvent event) {
    if (TeamUtils.getTeamByPlayer(event.getPlayer()).isObserver() || match.getState() != MatchState.PLAYING)
        return;
    Block toFill = event.getBlockClicked().getRelative(event.getBlockFace());
    if (toFill.getY() >= height && !event.isCancelled()) {
        event.setCancelled(true);
        ChatUtils.sendWarningMessage(event.getPlayer(), "You have reached the maximum build height! " + ChatColor.GRAY + "(" + height + " blocks)");
    }
}
项目:Cardinal-Plus    文件:BlockPlaceRegion.java   
@EventHandler
public void onBucketEmpty(PlayerBucketEmptyEvent event) {
    Material newMaterial = (event.getBucket().equals(Material.WATER_BUCKET) ? Material.WATER : (event.getBucket().equals(Material.LAVA_BUCKET) ? Material.LAVA : Material.AIR));
    if (!event.isCancelled() && region.contains(new BlockRegion(null, event.getBlockClicked().getRelative(event.getBlockFace()).getLocation().toVector())) && filter.evaluate(event.getPlayer(), newMaterial, event).equals(FilterState.DENY)) {
        event.setCancelled(true);
        ChatUtils.sendWarningMessage(event.getPlayer(), message);
    }
}
项目:Cardinal-Plus    文件:BlockEventRegion.java   
@EventHandler
public void onBucketEmpty(PlayerBucketEmptyEvent event) {
    Material newMaterial = (event.getBucket().equals(Material.WATER_BUCKET) ? Material.WATER : (event.getBucket().equals(Material.LAVA_BUCKET) ? Material.LAVA : Material.AIR));
    if (!event.isCancelled() && filter.evaluate(event.getPlayer(), newMaterial, event).equals(FilterState.DENY)
            && region.contains(new BlockRegion(null, event.getBlockClicked().getRelative(event.getBlockFace()).getLocation().toVector()))) {
        event.setCancelled(true);
        ChatUtils.sendWarningMessage(event.getPlayer(), message);
    }
}
项目:Cardinal-Plus    文件:BlockPlaceAgainstRegion.java   
@EventHandler
public void onBucketEmpty(PlayerBucketEmptyEvent event) {
    Material newMaterial = (event.getBucket().equals(Material.WATER_BUCKET) ? Material.WATER : (event.getBucket().equals(Material.LAVA_BUCKET) ? Material.LAVA : Material.AIR));
    if (!event.isCancelled() && region.contains(new BlockRegion(null, event.getBlockClicked().getRelative(event.getBlockFace()).getLocation().toVector()))
            && filter.evaluate(event.getPlayer(), newMaterial, event).equals(FilterState.DENY)) {
        event.setCancelled(true);
        ChatUtils.sendWarningMessage(event.getPlayer(), message);
    }
}
项目:SurvivalCG    文件:PlayerBucketListeners.java   
@EventHandler
public void onBucketFlow(PlayerBucketEmptyEvent e) {
    if(e.getPlayer().hasPermission("openguild.cuboid.bypassplace")) {
        return;
    }
    Player p = e.getPlayer();
    User user = plugin.getManager().getUserManager().getUsers().get(p.getName());
    Guild guild = user.getGuild();
    Cuboid cuboid = user.getCurrentCuboid();
    if (cuboid != null) {
        if (guild != null) {
            if (!user.getGuild().equals(cuboid.getGuild())) {
                p.sendMessage(plugin.getManager().getMsgManager().getMsg("enemyguildblockplace"));
                e.setCancelled(true);
            }
        } else {
            p.sendMessage(plugin.getManager().getMsgManager().getMsg("enemyguildblockplace"));
            e.setCancelled(true);
        }
        //Bukkit.broadcastMessage("Gracz "+p.getName()+" robi cos na cuboidzie "+cuboid.getGuild().getGuildTag());

    } else {
        if (p.getLocation().distance(p.getWorld().getSpawnLocation()) <= plugin.getManager().getSettingsManager().getProtectedSpawnRadius()) {
            p.sendMessage(plugin.getManager().getMsgManager().getMsg("spawnplacecantbreak"));
        }
    }
}
项目:RedProtect    文件:RPPlayerListener.java   
@EventHandler
public void onBucketUse(PlayerBucketEmptyEvent e){
    if (e.isCancelled()) {
           return;
       }
    Player p = e.getPlayer();
    Location l = e.getBlockClicked().getLocation();
    Region r = RedProtect.get().rm.getTopRegion(l); 

    if (r != null && !r.canBuild(p) && (p.getItemInHand().getType().name().contains("BUCKET"))) {
        e.setCancelled(true);
       }
   }
项目:beaconz    文件:SkyListeners.java   
/**
 * Prevents the tipping of liquids at this height
 * @param event
 */
@EventHandler(priority = EventPriority.LOW, ignoreCancelled=true)
public void onBucketEmpty(final PlayerBucketEmptyEvent event) {
    //getLogger().info("DEBUG: " + event.getEventName());
    World world = event.getBlockClicked().getWorld();
    if (!world.equals(getBeaconzWorld())) {
        //getLogger().info("DEBUG: not right world");
        return;
    }
    if (event.getBlockClicked().getY() == BLOCK_HEIGHT) {
        event.setCancelled(true);
        event.getPlayer().sendMessage(ChatColor.RED + Lang.errorYouCannotDoThat);
    }
}
项目:libelula    文件:EventManager.java   
@EventHandler(ignoreCancelled = true, priority = EventPriority.HIGHEST)
public void onPlayerQuit(PlayerBucketEmptyEvent e) {
    if (e.getBucket().equals(Material.LAVA_BUCKET)
            && !e.getPlayer().hasPermission("lnm.survival.allow-lava")) {
        e.getPlayer().sendMessage(plugin.getPrefix() + ChatColor.RED
                + "Debido a tu rango no tienes permitido poner lava.");
        e.setCancelled(true);
    }
}
项目:libelula    文件:GameManager.java   
public void cancelUseBukketOnProtectedAreas(PlayerBucketEmptyEvent e) {
    Game game = worldGame.get(e.getBlockClicked().getWorld());
    if (game != null) {
        if (isProtected(e.getBlockClicked(), game)) {
            e.setCancelled(true);
        } else {
            TeamManager.TeamId ti = plugin.pm.getTeamId(e.getPlayer());
            if (isProhibitedLocation(e.getBlockClicked().getLocation(), ti, game)) {
                e.setCancelled(true);
            }
        }
    }
}
项目:libelula    文件:GameManager.java   
public void cancelUseBukketOnProtectedAreas(PlayerBucketEmptyEvent e) {
    Game game = worldGame.get(e.getBlockClicked().getWorld());
    if (game != null) {
        if (isProtected(e.getBlockClicked(), game)) {
            e.setCancelled(true);
        } else {
            TeamManager.TeamId ti = plugin.pm.getTeamId(e.getPlayer());
            if (isProhibitedLocation(e.getBlockClicked().getLocation(), ti, game)) {
                e.setCancelled(true);
            }
        }
    }
}
项目:Peacecraft    文件:LotsListener.java   
@EventHandler
public void onPlayerBucketEmpty(PlayerBucketEmptyEvent event) {
    Block block = event.getBlockClicked().getRelative(event.getBlockFace());
    Lot lot = this.module.getLotManager().getLot(block.getLocation());
    Town town = this.module.getLotManager().getTown(block.getLocation());
    if(((lot != null && !lot.canBuild(event.getPlayer())) || (lot == null && town != null)) && !event.getPlayer().hasPermission(LotPermissions.BUILD_ANYWHERE)) {
        sendMessage(event.getPlayer(), "lots.cannot-do");
        event.setCancelled(true);
    }
}