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

项目:Statz    文件:BucketsFilledListener.java   
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onBucketFill(final PlayerBucketFillEvent event) {

    final PlayerStat stat = PlayerStat.BUCKETS_FILLED;

    // 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()));

}
项目:AdvancedAchievements    文件:AchieveMilkLavaWaterListener.java   
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onPlayerBucketFill(PlayerBucketFillEvent event) {
    Player player = event.getPlayer();

    Material resultBucket = event.getItemStack().getType();
    NormalAchievements category = getCategory(resultBucket);

    if (plugin.getDisabledCategorySet().contains(category.toString())) {
        return;
    }

    if (!shouldIncreaseBeTakenIntoAccount(player, category)
            || isInCooldownPeriod(player, category.toString(), false, category)) {
        return;
    }

    updateStatisticAndAwardAchievementsIfAvailable(player, category, 1);
}
项目:RedProtect    文件:RPGlobalListener.java   
@EventHandler
public void onBucketFill(PlayerBucketFillEvent 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 onPlayerBucketFill(final PlayerBucketFillEvent event) {
    if (event.isCancelled())
        return;

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

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

    if (nearestGate != null || nearestGateUp != null) {
        event.setCancelled(true);
    }
}
项目:acidisland    文件:AcidInventory.java   
/**
 * If the player filled up the bucket themselves
 * 
 * @param e
 */
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void onBucketFill(PlayerBucketFillEvent e) {
    if (DEBUG)
        plugin.getLogger().info("Player filled the bucket");
    if (e.getPlayer().getWorld().getName().equalsIgnoreCase(Settings.worldName)) {
        if (DEBUG)
            plugin.getLogger().info("Correct world");
        if (Settings.acidDamage > 0D && Settings.acidBottle) {
            ItemStack item = e.getItemStack();
            if (item.getType().equals(Material.WATER_BUCKET) || item.getType().equals(Material.POTION)) {
                ItemMeta meta = item.getItemMeta();
                meta.setDisplayName(plugin.myLocale(e.getPlayer().getUniqueId()).acidBucket);
                lore = Arrays.asList(plugin.myLocale(e.getPlayer().getUniqueId()).acidLore.split("\n"));
                meta.setLore(lore);
                item.setItemMeta(meta);
            }
        }
    }
}
项目:Factoid    文件:PlayerListener.java   
/**
 * On player bucket fill.
 * 
 * @param event
 *            the event
 */
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void onPlayerBucketFill(PlayerBucketFillEvent event) {

    if (!playerConf.get(event.getPlayer()).isAdminMod()) {

        IDummyLand land = Factoid.getThisPlugin().iLands().getLandOrOutsideArea(
                event.getBlockClicked().getLocation());
        Material mt = event.getBlockClicked().getType();

        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    文件:AcidInventory.java   
/**
 * If the player filled up the bucket themselves
 * 
 * @param e
 */
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void onBucketFill(PlayerBucketFillEvent e) {
    if (DEBUG)
        plugin.getLogger().info("Player filled the bucket");
    if (e.getPlayer().getWorld().getName().equalsIgnoreCase(Settings.worldName)) {
        if (DEBUG)
            plugin.getLogger().info("Correct world");
        if (Settings.acidDamage > 0D && Settings.acidBottle) {
            ItemStack item = e.getItemStack();
            if (item.getType().equals(Material.WATER_BUCKET) || item.getType().equals(Material.POTION)) {
                ItemMeta meta = item.getItemMeta();
                meta.setDisplayName(plugin.myLocale(e.getPlayer().getUniqueId()).acidBucket);
                lore = Arrays.asList(plugin.myLocale(e.getPlayer().getUniqueId()).acidLore.split("\n"));
                meta.setLore(lore);
                item.setItemMeta(meta);
            }
        }
    }
}
项目:modules-extra    文件:ListenerBucket.java   
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onPlayerBucketFill(final PlayerBucketFillEvent event)
{
    BlockState oldState = event.getBlockClicked().getRelative(event.getBlockFace()).getState();
    if (oldState.getType() == WATER || oldState.getType() == STATIONARY_WATER || oldState.getType() == LAVA
        || oldState.getType() == STATIONARY_LAVA)
    {
        this.setAndLog(BucketFill.class, event.getPlayer(), oldState, AIR);
    }
    else // TODO better check
    {
        // milk
        BucketMilk action = this.newAction(BucketMilk.class, event.getPlayer().getWorld());
        if (action != null)
        {
            action.setPlayer(event.getPlayer());
            action.setLocation(oldState.getLocation());
            this.logAction(action);
        }
    }
}
项目:TCMinigames    文件:PlayerListener.java   
@EventHandler
public void onBucketFill(PlayerBucketFillEvent 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;
        }
    }
}
项目:ZentrelaRPG    文件:EnvironmentManager.java   
@EventHandler
public void onBucketFill(PlayerBucketFillEvent 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();
}
项目:bskyblock    文件:IslandGuard.java   
@EventHandler(priority = EventPriority.LOW)
public void onBucketFill(final PlayerBucketFillEvent e) {
    if (DEBUG) {
        plugin.getLogger().info(e.getEventName());
    }
    if (Util.inWorld(e.getPlayer())) {
        // This permission bypasses protection
        if (VaultHelper.hasPerm(e.getPlayer(), Settings.PERMPREFIX + "mod.bypassprotect")) {
            return;
        }
        Island island = plugin.getIslands().getProtectedIslandAt(e.getBlockClicked().getLocation());
        if (island != null) {
            if (island.getMembers().contains(e.getPlayer().getUniqueId())) {
                return;
            }
            if (island.getFlag(SettingsFlag.COLLECT_LAVA) && e.getItemStack().getType().equals(Material.LAVA_BUCKET)) {
                return;
            }
            if (island.getFlag(SettingsFlag.COLLECT_WATER) && e.getItemStack().getType().equals(Material.WATER_BUCKET)) {
                return;
            }
            if (island.getFlag(SettingsFlag.MILKING) && e.getItemStack().getType().equals(Material.MILK_BUCKET)) {
                return;
            }
            if (island.getFlag(SettingsFlag.BUCKET)) {
                return;
            }
        } else {
            // Null
            if (Settings.defaultWorldSettings.get(SettingsFlag.BUCKET)) {
                return;
            }
        }
        // Not allowed
        Util.sendMessage(e.getPlayer(), plugin.getLocale(e.getPlayer().getUniqueId()).get("island.protected"));
        e.setCancelled(true);
    }
}
项目: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;
}
项目:OpenUHC    文件:LobbyModule.java   
/**
 * Prevents lobby players from interacting in the world.
 *
 * @param event The event
 */
@EventHandler
public void onBucketFill(final PlayerBucketFillEvent event) {
  if (event.getBlockClicked().getWorld().equals(world)) {
    event.setCancelled(true);
  }
}
项目:HCFCore    文件:BorderListener.java   
@EventHandler(ignoreCancelled = true, priority = EventPriority.HIGH)
public void onBucketEmpty(final PlayerBucketFillEvent event) {
    if (!isWithinBorder(event.getBlockClicked().getLocation())) {
        event.setCancelled(true);
        event.getPlayer().sendMessage(ChatColor.RED + "You cannot fill buckets past the border.");
    }
}
项目:HCFCore    文件:BorderListener.java   
@EventHandler(ignoreCancelled = true, priority = EventPriority.HIGH)
public void onBucketEmpty(final PlayerBucketFillEvent event) {
    if (!isWithinBorder(event.getBlockClicked().getLocation())) {
        event.setCancelled(true);
        event.getPlayer().sendMessage(ChatColor.RED + "You cannot fill buckets past the border.");
    }
}
项目:GamePlate    文件:BuildHeightModule.java   
@EventHandler
public void onFillBucket(PlayerBucketFillEvent event) {
    Block toEmpty = event.getBlockClicked().getRelative(event.getBlockFace());
    if (toEmpty.getY() >= height && !event.isCancelled()) {
        event.setCancelled(true);
        ChatUtil.sendWarningMessage(event.getPlayer(), ChatConstant.ERROR_BUILD_HEIGHT, ChatUtil.HIGHLIGHT.toString() + height + ChatColor.GRAY.toString());
    }
}
项目:AthenaGM    文件:BlockBreakListener.java   
/**
 * Prevents buckets from being filled
 */
@EventHandler
public void onBucketFill(PlayerBucketFillEvent event) {
    CuboidRegion region = regionHandler.getApplicableRegion(event.getBlockClicked().getLocation());
    if (!event.isCancelled() && region != null && !region.allows("destroy")) {
        event.setCancelled(true);
        warnPlayer(event.getPlayer());
    }
}
项目:CommunityDrivenPlugin    文件:PlaceBreakListener.java   
public void onFill(PlayerBucketFillEvent 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 onPlayerBucketFill(PlayerBucketFillEvent event) {
    Block block = event.getBlockClicked().getRelative(event.getBlockFace());
    this.post(event,
              block.getState(),
              this.applyAir(block),
              event.getPlayer());
}
项目:Cardinal    文件:AppliedModule.java   
/**
 * Filters PlayerBucketFillEvent (removing a block of liquid).
 *
 * <p>Applies to: block and block break.<p/>
 */
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
public void onBucketFill(PlayerBucketFillEvent event) {
  Match match = Cardinal.getMatch(event.getPlayer());
  if (match == null || !match.hasPlayer(event.getPlayer())) {
    return;
  }
  for (AppliedRegion reg : get(match, ApplyType.BLOCK, ApplyType.BLOCK_BREAK)) {
    Block evaluating = event.getBlockClicked();

    if (apply(reg, evaluating.getLocation(), event.getPlayer(), event, event, evaluating, event.getPlayer())) {
      break;
    }
  }
}
项目:ExilePearl    文件:ExileListener.java   
/**
 * Prevent exiled players from using buckets
 * @param e The event
 */
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
public void onPlayerFillBucket(PlayerBucketFillEvent e) {
    if (e.getItemStack() != null && Material.MILK_BUCKET.equals(e.getItemStack().getType())) {
        checkAndCancelRule(ExileRule.MILK_COWS, e, e.getPlayer());
    } else {
        checkAndCancelRule(ExileRule.FILL_BUCKET, e, e.getPlayer());
    }
}
项目:Cardinal-Plus    文件:BuildHeight.java   
@EventHandler
public void onFillBucket(PlayerBucketFillEvent event) {
    if (TeamUtils.getTeamByPlayer(event.getPlayer()).isObserver() || match.getState() != MatchState.PLAYING)
        return;
    Block toEmpty = event.getBlockClicked().getRelative(event.getBlockFace());
    if (toEmpty.getY() >= height && !event.isCancelled()) {
        event.setCancelled(true);
        ChatUtils.sendWarningMessage(event.getPlayer(), "You have reached the maximum build height! " + ChatColor.GRAY + "(" + height + " blocks)");
    }
}
项目:Cardinal-Plus    文件:BlockBreakRegion.java   
@EventHandler
public void onBucketFill(PlayerBucketFillEvent event) {
    if (!event.isCancelled() && region.contains(new BlockRegion(null, event.getBlockClicked().getRelative(event.getBlockFace()).getLocation().toVector())) && filter.evaluate(event.getPlayer(), event.getBlockClicked().getRelative(event.getBlockFace()), event).equals(FilterState.DENY)) {
        event.setCancelled(true);
        ChatUtils.sendWarningMessage(event.getPlayer(), message);
    }
}
项目:Cardinal-Plus    文件:BlockEventRegion.java   
public void onBucketFill(PlayerBucketFillEvent event) {
    if (!event.isCancelled() && filter.evaluate(event.getPlayer(), event.getBlockClicked().getRelative(event.getBlockFace()), event).equals(FilterState.DENY)
            && region.contains(new BlockRegion(null, event.getBlockClicked().getRelative(event.getBlockFace()).getLocation().toVector()))) {
        event.setCancelled(true);
        ChatUtils.sendWarningMessage(event.getPlayer(), message);
    }
}
项目:SurvivalCG    文件:PlayerBucketListeners.java   
@EventHandler
public void onBucketTake(PlayerBucketFillEvent e) {
    if(e.getPlayer().hasPermission("scg.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 onBucketFill(PlayerBucketFillEvent 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);
       }
   }
项目:Peacecraft    文件:LotsListener.java   
@EventHandler
public void onPlayerBucketFill(PlayerBucketFillEvent event) {
    Block block = event.getBlockClicked();
    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);
    }
}
项目:acidisland    文件:IslandGuard.java   
@EventHandler(priority = EventPriority.LOW)
public void onBucketFill(final PlayerBucketFillEvent e) {
    if (DEBUG) {
        plugin.getLogger().info(e.getEventName());
    }
    if (inWorld(e.getPlayer())) {
        // This permission bypasses protection
        if (VaultHelper.checkPerm(e.getPlayer(), Settings.PERMPREFIX + "mod.bypassprotect")) {
            return;
        }
        Island island = plugin.getGrid().getProtectedIslandAt(e.getBlockClicked().getLocation());
        if (island != null) {
            if (island.getMembers().contains(e.getPlayer().getUniqueId())) {
                return;
            }
            if (island.getIgsFlag(SettingsFlag.COLLECT_LAVA) && e.getItemStack().getType().equals(Material.LAVA_BUCKET)) {
                return;
            }
            if (island.getIgsFlag(SettingsFlag.COLLECT_WATER) && e.getItemStack().getType().equals(Material.WATER_BUCKET)) {
                return;
            }
            if (island.getIgsFlag(SettingsFlag.MILKING) && e.getItemStack().getType().equals(Material.MILK_BUCKET)) {
                return;
            }
            if (island.getIgsFlag(SettingsFlag.BUCKET)) {
                return;
            }
        } else {
            // Null
            if (Settings.defaultWorldSettings.get(SettingsFlag.BUCKET)) {
                return;
            }
        }
        // Not allowed
        Util.sendMessage(e.getPlayer(), ChatColor.RED + plugin.myLocale(e.getPlayer().getUniqueId()).islandProtected);
        e.setCancelled(true);
    }
}
项目:UltimateSurvivalGames    文件:PlayerListener.java   
@EventHandler
public void onPlayerWaterPlace(PlayerBucketFillEvent event) {
    for(Game game : SurvivalGames.gameManager.getGames()) {
        for(Arena arena : game.getArenas()) {
            if(arena.containsBlock(event.getBlockClicked().getLocation()))
                event.setCancelled(true);
        }
    }
}
项目:askyblock    文件:IslandGuard.java   
@EventHandler(priority = EventPriority.LOW)
public void onBucketFill(final PlayerBucketFillEvent e) {
    if (DEBUG) {
        plugin.getLogger().info(e.getEventName());
    }
    if (inWorld(e.getPlayer())) {
        // This permission bypasses protection
        if (VaultHelper.checkPerm(e.getPlayer(), Settings.PERMPREFIX + "mod.bypassprotect")) {
            return;
        }
        Island island = plugin.getGrid().getProtectedIslandAt(e.getBlockClicked().getLocation());
        if (island != null) {
            if (island.getMembers().contains(e.getPlayer().getUniqueId())) {
                return;
            }
            if (island.getIgsFlag(SettingsFlag.COLLECT_LAVA) && e.getItemStack().getType().equals(Material.LAVA_BUCKET)) {
                return;
            }
            if (island.getIgsFlag(SettingsFlag.COLLECT_WATER) && e.getItemStack().getType().equals(Material.WATER_BUCKET)) {
                return;
            }
            if (island.getIgsFlag(SettingsFlag.MILKING) && e.getItemStack().getType().equals(Material.MILK_BUCKET)) {
                return;
            }
            if (island.getIgsFlag(SettingsFlag.BUCKET)) {
                return;
            }
        } else {
            // Null
            if (Settings.defaultWorldSettings.get(SettingsFlag.BUCKET)) {
                return;
            }
        }
        // Not allowed
        Util.sendMessage(e.getPlayer(), ChatColor.RED + plugin.myLocale(e.getPlayer().getUniqueId()).islandProtected);
        e.setCancelled(true);
    }
}
项目:The-Plague    文件:ArenaListener.java   
@EventHandler
public void bucketFill(PlayerBucketFillEvent event) {
    if (ArenaUtils.isProtectedLobby(event.getBlockClicked().getLocation())) {
        event.setCancelled(Arenas.findCreatorByName(event.getPlayer().getName()) == null);
    }
    if (ArenaUtils.isProtected(event.getBlockClicked().getLocation()) && Arenas.getCurrentArena(event.getPlayer()) == null)
        event.setCancelled(Arenas.findCreatorByName(event.getPlayer().getName()) == null);
}
项目:PlotMe-Core    文件:BukkitPlotListener.java   
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
public void onBucketFillEvent(PlayerBucketFillEvent event) {
    IPlayer player = plugin.wrapPlayer(event.getPlayer());
    Location location = BukkitUtil.adapt(event.getBlockClicked().getLocation());

    if (player.hasPermission(PermissionNames.ADMIN_BUILDANYWHERE)) {
        return;
    }
    if (manager.isPlotWorld(location)) {
        Plot plot = manager.getPlot(location);

        if (plot == null) {
            player.sendMessage(api.C("CannotBuild"));
            event.setCancelled(true);
        } else {
            if (plot.getOwnerId().equals(event.getPlayer().getUniqueId())) {
                return;
            }
            Optional<Plot.AccessLevel> member = plot.isMember(player.getUniqueId());
            if (member.isPresent()) {
                if (member.get().equals(Plot.AccessLevel.TRUSTED) && !api.getServerBridge().getOfflinePlayer(plot.getOwnerId()).isOnline()) {
                    player.sendMessage(api.C("CannotBuild"));
                    event.setCancelled(true);
                } else if (api.isPlotLocked(plot.getId())) {
                    player.sendMessage(api.C("PlotLocked"));
                    event.setCancelled(true);
                }
            } else {
                player.sendMessage(api.C("CannotBuild"));
                event.setCancelled(true);
            }
        }
    }
}
项目:AntiBuild    文件:BucketFill.java   
/**
     * Checks if a player has permission to fill a bucket.
     *
     * @param event that triggered the listener.
     */
    @EventHandler(priority = EventPriority.LOW)
    public void NoBucketFill(PlayerBucketFillEvent event) {

        Player player = event.getPlayer();

        // Bucket check
        if (!player.hasPermission("antibuild.bypass")) {
            if (!player.hasPermission("antibuild.bucket")) {
                int source = event.getBlockClicked().getTypeId();
                if ((source == 8 || source == 9)
                        && !player.hasPermission("antibuild.bucket.water")) {
                    event.setCancelled(true);
                    PlayerMessenger.messageHandler(plugin.getConfigHandler().getNoBucketMessage(), player);
                } else if ((source == 10 || source == 11)
                        && !player.hasPermission("antibuild.bucket.lava")) {
                    event.setCancelled(true);
                    PlayerMessenger.messageHandler(plugin.getConfigHandler().getNoBucketMessage(), player);
                }
            }
        }

//        // World lock check
//        if (!event.isCancelled() && plugin.isUsingLock()) {
//            if (plugin.isLockedWorld(player.getWorld().getName())
//                    && !player.hasPermission("antibuild.lock.bypass") && !player.hasPermission("antibuild.lock
// .bypass" +
//                    "." + player.getWorld().getName())) {
//                event.setCancelled(true);
//                messageHandler(plugin.getLockedWorldMessage(), player);
//            }
//        }
    }
项目:PlotSquared    文件:PlayerEvents.java   
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void onBucketFill(PlayerBucketFillEvent event) {
    Block b = event.getBlockClicked();
    Location location = BukkitUtil.getLocation(b.getLocation());
    PlotArea area = location.getPlotArea();
    if (area == null) {
        return;
    }
    Player player = event.getPlayer();
    PlotPlayer plotPlayer = BukkitUtil.getPlayer(player);
    Plot plot = area.getPlot(location);
    if (plot == null) {
        if (Permissions.hasPermission(plotPlayer, C.PERMISSION_ADMIN_BUILD_ROAD)) {
            return;
        }
        MainUtil.sendMessage(plotPlayer, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_BUILD_ROAD);
        event.setCancelled(true);
    } else if (!plot.hasOwner()) {
        if (Permissions.hasPermission(plotPlayer, C.PERMISSION_ADMIN_BUILD_UNOWNED)) {
            return;
        }
        MainUtil.sendMessage(plotPlayer, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_BUILD_UNOWNED);
        event.setCancelled(true);
    } else if (!plot.isAdded(plotPlayer.getUUID())) {
        Optional<HashSet<PlotBlock>> use = plot.getFlag(Flags.USE);
        Block block = event.getBlockClicked();
        if (use.isPresent() && use.get().contains(PlotBlock.get(block.getTypeId(), block.getData()))) {
            return;
        }
        if (Permissions.hasPermission(plotPlayer, C.PERMISSION_ADMIN_BUILD_OTHER)) {
            return;
        }
        MainUtil.sendMessage(plotPlayer, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_BUILD_OTHER);
        event.setCancelled(true);
    }
}
项目:Bytecraft    文件:ZoneListener.java   
@EventHandler
public void onFill(PlayerBucketFillEvent event)
{
    BytecraftPlayer player = plugin.getPlayer(event.getPlayer());
    Block block = event.getBlockClicked();

    boolean bool = player.hasBlockPermission(block.getLocation(), true);
    if(!bool){
        player.setFireTicks(20 * 2);
        event.setCancelled(true);
    }
}
项目:CardinalPGM    文件:BuildHeight.java   
@EventHandler
public void onFillBucket(PlayerBucketFillEvent event) {
    Block toEmpty = event.getBlockClicked().getRelative(event.getBlockFace());
    if (toEmpty.getY() >= height && !event.isCancelled()) {
        event.setCancelled(true);
        ChatUtil.sendWarningMessage(event.getPlayer(), "You have reached the maximum build height (" + ChatColor.AQUA + height + ChatColor.RED + " blocks)");
    }
}
项目:CardinalPGM    文件:BlockBreakRegion.java   
@EventHandler
public void onBucketFill(PlayerBucketFillEvent event) {
    if (!event.isCancelled() && region.contains(new BlockRegion(null, event.getBlockClicked().getRelative(event.getBlockFace()).getLocation().toVector())) && filter.evaluate(event.getPlayer(), event.getBlockClicked().getRelative(event.getBlockFace()), event).equals(FilterState.DENY)) {
        event.setCancelled(true);
        ChatUtil.sendWarningMessage(event.getPlayer(), message);
    }
}
项目:CardinalPGM    文件:BlockEventRegion.java   
@EventHandler
public void onBucketFill(PlayerBucketFillEvent event) {
    if (!event.isCancelled() && filter.evaluate(event.getPlayer(), event.getBlockClicked().getRelative(event.getBlockFace()), event).equals(FilterState.DENY)
            && region.contains(new BlockRegion(null, event.getBlockClicked().getRelative(event.getBlockFace()).getLocation().toVector()))) {
        event.setCancelled(true);
        ChatUtil.sendWarningMessage(event.getPlayer(), message);
    }
}
项目:NPlugins    文件:BuildFlagListener.java   
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void onPlayerBucketFill(final PlayerBucketFillEvent event) {
    final GeneralRegion region = this.getPlugin().getDb().getPriorByLocation(event.getBlockClicked().getLocation());
    if (region != null && region.getFlag(Flag.BUILD) && !region.isUser(event.getPlayer())) {
        event.setCancelled(true);
    }
}
项目:simple-survival-games    文件:SSGPlayerListener.java   
@EventHandler
public void onPlayerBucketFillEvent(PlayerBucketFillEvent event) {
    Player p = event.getPlayer();
    ArenaManager am = SimpleSurvivalGames.instance.getArenaManager();

    // TODO: Is the player allowed to get water

    // Is the current player playing
    if(am.isInArena(p)) {
        ArenaPlayer ap = am.getPlayer(p);

        // Is the player in the lobby of the arena
        if(ap.isInLobby()) {

            // Has the player a arena spawn assigned
            if(ap.hasAssignedAreanSpawn()) {

                // Cancel the event and send a status message
                event.setCancelled(true);
                p.sendMessage(ChatColor.DARK_RED + "You may not dehumidify the lobby in the lobby of an arena!");
            }
        }

        // Is the player an spectators
        if(ap.isSpectator()) {
            event.setCancelled(true);
            ap.sendMessage(ChatColor.DARK_RED + "You can't use buckets while spectating!");
        }
    }
}