java类org.bukkit.event.player.PlayerBucketEmptyEvent的实例源码

NetherEvents.java 文件源码 项目:bskyblock 阅读 24 收藏 0 点赞 0 评论 0
@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);
            }
        }
    }
}
AppliedModule.java 文件源码 项目:Cardinal 阅读 24 收藏 0 点赞 0 评论 0
/**
 * 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;
    }
  }
}
BucketsEmptiedListener.java 文件源码 项目:Statz 阅读 25 收藏 0 点赞 0 评论 0
@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()));

}
PlayerBucketEmpty.java 文件源码 项目:ArchBlock 阅读 19 收藏 0 点赞 0 评论 0
@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()));
}
PlaceBucket.java 文件源码 项目:buildinggame 阅读 23 收藏 0 点赞 0 评论 0
/**
    * 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");
    }
}
RPGlobalListener.java 文件源码 项目:RedProtect 阅读 32 收藏 0 点赞 0 评论 0
@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);
    }
   }
PluginBlockListener.java 文件源码 项目:AncientGates 阅读 24 收藏 0 点赞 0 评论 0
@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);
    }
}
BeaconProtectionListener.java 文件源码 项目:beaconz 阅读 23 收藏 0 点赞 0 评论 0
/**
 * 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);
    }
}
PlayerListener.java 文件源码 项目:civcraft 阅读 26 收藏 0 点赞 0 评论 0
@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;
            }

        }
    }
}
NetherPortals.java 文件源码 项目:acidisland 阅读 25 收藏 0 点赞 0 评论 0
@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);
            }
        }
    }
}
PlayerListener.java 文件源码 项目:Factoid 阅读 21 收藏 0 点赞 0 评论 0
/**
 * 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);
        }
    }
}
NetherPortals.java 文件源码 项目:askyblock 阅读 22 收藏 0 点赞 0 评论 0
@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);
            }
        }
    }
}
PlayerListener.java 文件源码 项目:TCMinigames 阅读 22 收藏 0 点赞 0 评论 0
@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;
        }
    }
}
FilterEvents.java 文件源码 项目:Rixor 阅读 23 收藏 0 点赞 0 评论 0
@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);
}
PlayerListener.java 文件源码 项目:Blueprint-A-Bukkit-Plugin 阅读 89 收藏 0 点赞 0 评论 0
/**
 *
 * @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);
        }
    }
}
EnvironmentManager.java 文件源码 项目:ZentrelaRPG 阅读 24 收藏 0 点赞 0 评论 0
@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();
}
BlockTransformEvent.java 文件源码 项目:ProjectAres 阅读 22 收藏 0 点赞 0 评论 0
/**
 * 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;
}
BlockTransformListener.java 文件源码 项目:ProjectAres 阅读 24 收藏 0 点赞 0 评论 0
@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());
}
PlayerBucketEmptyEventListener.java 文件源码 项目:KingdomFactions 阅读 24 收藏 0 点赞 0 评论 0
@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));
    } 
}
LobbyModule.java 文件源码 项目:OpenUHC 阅读 32 收藏 0 点赞 0 评论 0
/**
 * 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);
  }
}
GameListener.java 文件源码 项目:SurvivalAPI 阅读 30 收藏 0 点赞 0 评论 0
/**
 * 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);
    }
}
BorderListener.java 文件源码 项目:HCFCore 阅读 18 收藏 0 点赞 0 评论 0
@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.");
    }
}
BorderListener.java 文件源码 项目:HCFCore 阅读 31 收藏 0 点赞 0 评论 0
@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.");
    }
}
BuildHeightModule.java 文件源码 项目:GamePlate 阅读 26 收藏 0 点赞 0 评论 0
@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());
    }
}
BlockPlaceListener.java 文件源码 项目:AthenaGM 阅读 23 收藏 0 点赞 0 评论 0
/**
 * 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());
    }
}
PlaceBreakListener.java 文件源码 项目:CommunityDrivenPlugin 阅读 32 收藏 0 点赞 0 评论 0
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!"));
    }
}
BlockTransformListeners.java 文件源码 项目:Arcade2 阅读 27 收藏 0 点赞 0 评论 0
@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());
    }
}
Areas.java 文件源码 项目:AnnihilationPro 阅读 27 收藏 0 点赞 0 评论 0
@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);
        }
    }
}
ExileListener.java 文件源码 项目:ExilePearl 阅读 51 收藏 0 点赞 0 评论 0
/**
 * 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());
    }
}
BuildHeight.java 文件源码 项目:Cardinal-Plus 阅读 26 收藏 0 点赞 0 评论 0
@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)");
    }
}


问题


面经


文章

微信
公众号

扫码关注公众号