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


Java PlayerBucketFillEvent類代碼示例

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


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

示例1: onBucketFill

import org.bukkit.event.player.PlayerBucketFillEvent; //導入依賴的package包/類
@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()));

}
 
開發者ID:Staartvin,項目名稱:Statz,代碼行數:18,代碼來源:BucketsFilledListener.java

示例2: onPlayerBucketFill

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

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

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

示例5: onBucketFill

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

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

示例7: onPlayerBucketFill

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

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

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

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

示例11: isManual

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

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

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

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

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


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