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


Java PlayerBucketFillEvent.getPlayer方法代碼示例

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


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

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

示例5: onBucketFill

import org.bukkit.event.player.PlayerBucketFillEvent; //導入方法依賴的package包/類
@EventHandler
public void onBucketFill(PlayerBucketFillEvent 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

示例6: NoBucketFill

import org.bukkit.event.player.PlayerBucketFillEvent; //導入方法依賴的package包/類
/**
     * Checks if a player has permission to fill a bucket.
     *
     * @param event that triggered the listener.
     */
    @EventHandler(priority = EventPriority.LOW)
    public void NoBucketFill(PlayerBucketFillEvent event) {

        Player player = event.getPlayer();

        // Bucket check
        if (!player.hasPermission("antibuild.bypass")) {
            if (!player.hasPermission("antibuild.bucket")) {
                int source = event.getBlockClicked().getTypeId();
                if ((source == 8 || source == 9)
                        && !player.hasPermission("antibuild.bucket.water")) {
                    event.setCancelled(true);
                    PlayerMessenger.messageHandler(plugin.getConfigHandler().getNoBucketMessage(), player);
                } else if ((source == 10 || source == 11)
                        && !player.hasPermission("antibuild.bucket.lava")) {
                    event.setCancelled(true);
                    PlayerMessenger.messageHandler(plugin.getConfigHandler().getNoBucketMessage(), player);
                }
            }
        }

//        // World lock check
//        if (!event.isCancelled() && plugin.isUsingLock()) {
//            if (plugin.isLockedWorld(player.getWorld().getName())
//                    && !player.hasPermission("antibuild.lock.bypass") && !player.hasPermission("antibuild.lock
// .bypass" +
//                    "." + player.getWorld().getName())) {
//                event.setCancelled(true);
//                messageHandler(plugin.getLockedWorldMessage(), player);
//            }
//        }
    }
 
開發者ID:MutinyCraft,項目名稱:AntiBuild,代碼行數:38,代碼來源:BucketFill.java

示例7: onBucketFill

import org.bukkit.event.player.PlayerBucketFillEvent; //導入方法依賴的package包/類
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void onBucketFill(PlayerBucketFillEvent event) {
    Block b = event.getBlockClicked();
    Location location = BukkitUtil.getLocation(b.getLocation());
    PlotArea area = location.getPlotArea();
    if (area == null) {
        return;
    }
    Player player = event.getPlayer();
    PlotPlayer plotPlayer = BukkitUtil.getPlayer(player);
    Plot plot = area.getPlot(location);
    if (plot == null) {
        if (Permissions.hasPermission(plotPlayer, C.PERMISSION_ADMIN_BUILD_ROAD)) {
            return;
        }
        MainUtil.sendMessage(plotPlayer, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_BUILD_ROAD);
        event.setCancelled(true);
    } else if (!plot.hasOwner()) {
        if (Permissions.hasPermission(plotPlayer, C.PERMISSION_ADMIN_BUILD_UNOWNED)) {
            return;
        }
        MainUtil.sendMessage(plotPlayer, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_BUILD_UNOWNED);
        event.setCancelled(true);
    } else if (!plot.isAdded(plotPlayer.getUUID())) {
        Optional<HashSet<PlotBlock>> use = plot.getFlag(Flags.USE);
        Block block = event.getBlockClicked();
        if (use.isPresent() && use.get().contains(PlotBlock.get(block.getTypeId(), block.getData()))) {
            return;
        }
        if (Permissions.hasPermission(plotPlayer, C.PERMISSION_ADMIN_BUILD_OTHER)) {
            return;
        }
        MainUtil.sendMessage(plotPlayer, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_BUILD_OTHER);
        event.setCancelled(true);
    }
}
 
開發者ID:IntellectualSites,項目名稱:PlotSquared,代碼行數:37,代碼來源:PlayerEvents.java

示例8: onPlayerBucketFillEvent

import org.bukkit.event.player.PlayerBucketFillEvent; //導入方法依賴的package包/類
@EventHandler
public void onPlayerBucketFillEvent(PlayerBucketFillEvent event) {
	Player p = event.getPlayer();
	ArenaManager am = SimpleSurvivalGames.instance.getArenaManager();
	
	// TODO: Is the player allowed to get water
	
	// Is the current player playing
	if(am.isInArena(p)) {
		ArenaPlayer ap = am.getPlayer(p);
		
		// Is the player in the lobby of the arena
		if(ap.isInLobby()) {
			
			// Has the player a arena spawn assigned
			if(ap.hasAssignedAreanSpawn()) {
				
				// Cancel the event and send a status message
				event.setCancelled(true);
				p.sendMessage(ChatColor.DARK_RED + "You may not dehumidify the lobby in the lobby of an arena!");
			}
		}

		// Is the player an spectators
		if(ap.isSpectator()) {
			event.setCancelled(true);
			ap.sendMessage(ChatColor.DARK_RED + "You can't use buckets while spectating!");
		}
	}
}
 
開發者ID:timvisee,項目名稱:simple-survival-games,代碼行數:31,代碼來源:SSGPlayerListener.java

示例9: onPlayerBucketFillEvent

import org.bukkit.event.player.PlayerBucketFillEvent; //導入方法依賴的package包/類
/**
 * Checks the player is allowed to fill the bucket.
 *
 * @param event     event being handled
 */
@EventHandler (priority = EventPriority.HIGH, ignoreCancelled = true)
public void onPlayerBucketFillEvent(PlayerBucketFillEvent event) {
    final Player player = event.getPlayer();
    final Block block = event.getBlockClicked();
    if (!canBuild(player, block)) {
        final Town town = plugin.getTown(block.getChunk());
        if (town == null) {
            player.sendMessage(plugin.getLocalisation().get(LocalisationEntry.MSG_CANNOT_BUILD_HERE));
        } else {
            player.sendMessage(plugin.getLocalisation().get(LocalisationEntry.MSG_ONLY_TOWN_MEMBERS_CAN_BREAK_BLOCKS, town.getName()));
        }
        event.setCancelled(true);
    }
}
 
開發者ID:JamesHealey94,項目名稱:SimpleTowns,代碼行數:20,代碼來源:STListener.java

示例10: onBucketFill

import org.bukkit.event.player.PlayerBucketFillEvent; //導入方法依賴的package包/類
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
public void onBucketFill(final PlayerBucketFillEvent e) {
    final Block b = e.getBlockClicked();
    final Location loc = BukkitUtil.getLocation(b.getLocation());
    if (PlotSquared.isPlotWorld(loc.getWorld())) {
        final Player p = e.getPlayer();
        final PlotPlayer pp = BukkitUtil.getPlayer(p);
        Plot plot = MainUtil.getPlot(loc);
        if (plot == null) {
            if (MainUtil.isPlotAreaAbs(loc)) {
                if (Permissions.hasPermission(pp, "plots.admin.build.road")) {
                    return;
                }
                MainUtil.sendMessage(pp, C.NO_PERMISSION, "plots.admin.build.road");
                e.setCancelled(true);
                return;
            }
        } else {
            if (!plot.hasOwner()) {
                if (Permissions.hasPermission(pp, "plots.admin.build.unowned")) {
                    return;
                }
                MainUtil.sendMessage(pp, C.NO_PERMISSION, "plots.admin.build.unowned");
                e.setCancelled(true);
                return;
            } else if (!plot.isAdded(pp.getUUID())) {
                final Flag use = FlagManager.getPlotFlag(plot, "use");
                final Block block = e.getBlockClicked();
                if ((use != null) && ((HashSet<PlotBlock>) use.getValue()).contains(new PlotBlock((short) block.getTypeId(), block.getData()))) {
                    return;
                }
                if (Permissions.hasPermission(pp, "plots.admin.build.other")) {
                    return;
                }
                if (MainUtil.isPlotArea(loc)) {
                    MainUtil.sendMessage(pp, C.NO_PERMISSION, "plots.admin.build.other");
                    e.setCancelled(true);
                    return;
                }
            }
        }
    }
}
 
開發者ID:Mayomi,項目名稱:PlotSquared-Chinese,代碼行數:44,代碼來源:PlayerEvents.java


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