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


Java PlayerBucketFillEvent.setCancelled方法代碼示例

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


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

示例1: onBucketFill

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

示例2: onPlayerBucketFill

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

示例3: onPlayerBucketFill

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

示例4: onBucketFill

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

示例5: onBucketFill

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

示例6: onBucketFill

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

示例7: onBucketFill

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

示例8: onBucketEmpty

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

示例9: onFillBucket

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

示例10: onBucketFill

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

示例11: onFill

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

示例12: onFillBucket

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

示例13: onBucketFill

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

示例14: onBucketFill

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

示例15: onBucketTake

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


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