當前位置: 首頁>>代碼示例>>Java>>正文


Java PlayerBucketEmptyEvent.setCancelled方法代碼示例

本文整理匯總了Java中org.bukkit.event.player.PlayerBucketEmptyEvent.setCancelled方法的典型用法代碼示例。如果您正苦於以下問題:Java PlayerBucketEmptyEvent.setCancelled方法的具體用法?Java PlayerBucketEmptyEvent.setCancelled怎麽用?Java PlayerBucketEmptyEvent.setCancelled使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.bukkit.event.player.PlayerBucketEmptyEvent的用法示例。


在下文中一共展示了PlayerBucketEmptyEvent.setCancelled方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: onBucketEmpty

import org.bukkit.event.player.PlayerBucketEmptyEvent; //導入方法依賴的package包/類
@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);
            }
        }
    }
}
 
開發者ID:tastybento,項目名稱:bskyblock,代碼行數:17,代碼來源:NetherEvents.java

示例2: onEvent

import org.bukkit.event.player.PlayerBucketEmptyEvent; //導入方法依賴的package包/類
@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()));
}
 
開發者ID:TheArchives,項目名稱:ArchBlock,代碼行數:27,代碼來源:PlayerBucketEmpty.java

示例3: onBucketEmpty

import org.bukkit.event.player.PlayerBucketEmptyEvent; //導入方法依賴的package包/類
/**
    * 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");
	}
}
 
開發者ID:stefvanschie,項目名稱:buildinggame,代碼行數:29,代碼來源:PlaceBucket.java

示例4: onBucketUse

import org.bukkit.event.player.PlayerBucketEmptyEvent; //導入方法依賴的package包/類
@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);
	}
   }
 
開發者ID:FabioZumbi12,項目名稱:RedProtect,代碼行數:22,代碼來源:RPGlobalListener.java

示例5: onPlayerBucketEmpty

import org.bukkit.event.player.PlayerBucketEmptyEvent; //導入方法依賴的package包/類
@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);
	}
}
 
開發者ID:NoChanceSD,項目名稱:AncientGates,代碼行數:20,代碼來源:PluginBlockListener.java

示例6: onBucketEmpty

import org.bukkit.event.player.PlayerBucketEmptyEvent; //導入方法依賴的package包/類
/**
 * 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);
    }
}
 
開發者ID:tastybento,項目名稱:beaconz,代碼行數:24,代碼來源:BeaconProtectionListener.java

示例7: onBucketEmpty

import org.bukkit.event.player.PlayerBucketEmptyEvent; //導入方法依賴的package包/類
@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);
            }
        }
    }
}
 
開發者ID:tastybento,項目名稱:askyblock,代碼行數:17,代碼來源:NetherPortals.java

示例8: onPlayerBucketEmpty

import org.bukkit.event.player.PlayerBucketEmptyEvent; //導入方法依賴的package包/類
/**
 *
 * @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);
        }
    }
}
 
開發者ID:Max9403,項目名稱:Blueprint-A-Bukkit-Plugin,代碼行數:28,代碼來源:PlayerListener.java

示例9: onBucketEmpty

import org.bukkit.event.player.PlayerBucketEmptyEvent; //導入方法依賴的package包/類
@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();
}
 
開發者ID:edasaki,項目名稱:ZentrelaRPG,代碼行數:12,代碼來源:EnvironmentManager.java

示例10: onBreak

import org.bukkit.event.player.PlayerBucketEmptyEvent; //導入方法依賴的package包/類
@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));
	} 
}
 
開發者ID:ThEWiZ76,項目名稱:KingdomFactions,代碼行數:9,代碼來源:PlayerBucketEmptyEventListener.java

示例11: onBucketEmpty

import org.bukkit.event.player.PlayerBucketEmptyEvent; //導入方法依賴的package包/類
/**
 * 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);
  }
}
 
開發者ID:twizmwazin,項目名稱:OpenUHC,代碼行數:12,代碼來源:LobbyModule.java

示例12: onPlayerBucketEmpty

import org.bukkit.event.player.PlayerBucketEmptyEvent; //導入方法依賴的package包/類
/**
 * 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);
    }
}
 
開發者ID:SamaGames,項目名稱:SurvivalAPI,代碼行數:18,代碼來源:GameListener.java

示例13: onBucketEmpty

import org.bukkit.event.player.PlayerBucketEmptyEvent; //導入方法依賴的package包/類
@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.");
    }
}
 
開發者ID:funkemunky,項目名稱:HCFCore,代碼行數:8,代碼來源:BorderListener.java

示例14: onEmptyBucket

import org.bukkit.event.player.PlayerBucketEmptyEvent; //導入方法依賴的package包/類
@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());
    }
}
 
開發者ID:Minehut,項目名稱:GamePlate,代碼行數:9,代碼來源:BuildHeightModule.java

示例15: onBucketEmpty

import org.bukkit.event.player.PlayerBucketEmptyEvent; //導入方法依賴的package包/類
/**
 * 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());
    }
}
 
開發者ID:redwallhp,項目名稱:AthenaGM,代碼行數:12,代碼來源:BlockPlaceListener.java


注:本文中的org.bukkit.event.player.PlayerBucketEmptyEvent.setCancelled方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。