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


Java PlayerBucketEmptyEvent.isCancelled方法代碼示例

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


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

示例1: 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

示例2: 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

示例3: 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

示例4: 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

示例5: 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

示例6: onEmptyBucket

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

示例7: onBucketEmpty

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

示例8: onBucketEmpty

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

示例9: onBucketEmpty

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

示例10: onBucketUse

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

示例11: onPlayerBucketEmpty

import org.bukkit.event.player.PlayerBucketEmptyEvent; //導入方法依賴的package包/類
@EventHandler (priority=EventPriority.HIGHEST)
	public void onPlayerBucketEmpty(PlayerBucketEmptyEvent e) {
		if (e.isCancelled()) {
			Location loc = e.getBlockClicked().getLocation();
			if (loc.getWorld().getName().equals("Build")) {
//				String id = PlotManager.getPlotId(loc);
//				if (getPlot(id) != null)
//					return;
				String x1 = PlotManager.getPlotId(loc.clone().add(5, 0, 0));
				String x2 = PlotManager.getPlotId(loc.clone().add(-5, 0, 0));
				String y1 = PlotManager.getPlotId(loc.clone().add(0, 0, 5));
				String y2 = PlotManager.getPlotId(loc.clone().add(0, 0, -5));
				boolean allowed = false;
				if (getPlot(x1) != null && getPlot(x2) != null)
					allowed = getPlot(x1).getOwner().equals(getPlot(x2).getOwner()) && getPlot(x1).isAllowed(e.getPlayer().getName());
				if (!allowed && getPlot(y1) != null && getPlot(y2) != null)
					allowed = getPlot(y1).getOwner().equals(getPlot(y2).getOwner()) && getPlot(y1).isAllowed(e.getPlayer().getName());
				if (allowed) {
					e.setCancelled(false);
					return;
				}
				String cor1 = PlotManager.getPlotId(loc.clone().add(5, 0, 5));
				String cor2 = PlotManager.getPlotId(loc.clone().add(-5, 0, 5));
				String cor3 = PlotManager.getPlotId(loc.clone().add(5, 0, 5));
				String cor4 = PlotManager.getPlotId(loc.clone().add(-5, 0, -5));
				if (getPlot(cor1) != null && getPlot(cor2) != null && getPlot(cor3) != null && getPlot(cor4) != null)
					if (getPlot(cor1).getOwner().equals(getPlot(cor2).getOwner()) && getPlot(cor1).getOwner().equals(getPlot(cor3).getOwner()) && getPlot(cor1).getOwner().equals(getPlot(cor4).getOwner())) {
						e.setCancelled(false);
					}
			}
		}
	}
 
開發者ID:Esaych,項目名稱:DDCustomPlugin,代碼行數:33,代碼來源:PlotMeOverride.java

示例12: 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(), "You have reached the maximum build height (" + ChatColor.AQUA + height + ChatColor.RED + " blocks)");
    }
}
 
開發者ID:twizmwazin,項目名稱:CardinalPGM,代碼行數:9,代碼來源:BuildHeight.java

示例13: onBucketEmpty

import org.bukkit.event.player.PlayerBucketEmptyEvent; //導入方法依賴的package包/類
@EventHandler
public void onBucketEmpty(PlayerBucketEmptyEvent event) {
    Material material = (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(), material, event).equals(FilterState.DENY)) {
        event.setCancelled(true);
        ChatUtil.sendWarningMessage(event.getPlayer(), message);
    }
}
 
開發者ID:twizmwazin,項目名稱:CardinalPGM,代碼行數:9,代碼來源:BlockPlaceRegion.java

示例14: onBucketEmpty

import org.bukkit.event.player.PlayerBucketEmptyEvent; //導入方法依賴的package包/類
@EventHandler
public void onBucketEmpty(PlayerBucketEmptyEvent event) {
    Material material = (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(), material, event).equals(FilterState.DENY)
            && region.contains(new BlockRegion(null, event.getBlockClicked().getRelative(event.getBlockFace()).getLocation().toVector()))) {
        event.setCancelled(true);
        ChatUtil.sendWarningMessage(event.getPlayer(), message);
    }
}
 
開發者ID:twizmwazin,項目名稱:CardinalPGM,代碼行數:10,代碼來源:BlockEventRegion.java

示例15: onBucketEmpty

import org.bukkit.event.player.PlayerBucketEmptyEvent; //導入方法依賴的package包/類
@EventHandler
public void onBucketEmpty(PlayerBucketEmptyEvent event) {
    Material material = (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(), material, event).equals(FilterState.DENY)) {
        event.setCancelled(true);
        ChatUtil.sendWarningMessage(event.getPlayer(), message);
    }
}
 
開發者ID:twizmwazin,項目名稱:CardinalPGM,代碼行數:10,代碼來源:BlockPlaceAgainstRegion.java


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