类org.bukkit.event.player.PlayerEggThrowEvent源码实例Demo

下面列出了怎么用org.bukkit.event.player.PlayerEggThrowEvent的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: askyblock   文件: IslandGuard.java
/**
 * Handle visitor chicken egg throwing
 * @param e - event
 */
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
public void onEggThrow(PlayerEggThrowEvent e) {
    if (DEBUG) {
        plugin.getLogger().info("egg throwing = " + e.getEventName());
    }
    if (!inWorld(e.getPlayer()) || e.getPlayer().isOp() || VaultHelper.checkPerm(e.getPlayer(), Settings.PERMPREFIX + "mod.bypassprotect")
            || plugin.getGrid().playerIsOnIsland(e.getPlayer()) || plugin.getGrid().isAtSpawn(e.getPlayer().getLocation())) {
        return;
    }
    // Check island
    Island island = plugin.getGrid().getProtectedIslandAt(e.getPlayer().getLocation());
    if (island == null) {
        return;
    }
    if (!island.getIgsFlag(SettingsFlag.EGGS)) {
        e.setHatching(false);
        Util.sendMessage(e.getPlayer(), ChatColor.RED + plugin.myLocale(e.getPlayer().getUniqueId()).islandProtected);
        //e.getPlayer().updateInventory();
    }

    return;
}
 
源代码2 项目: uSkyBlock   文件: GriefEvents.java
@EventHandler
public void onEgg(PlayerEggThrowEvent e) {
    if (!hatchingEnabled || !plugin.getWorldManager().isSkyAssociatedWorld(e.getPlayer().getWorld())) {
        return;
    }
    if (!plugin.playerIsOnIsland(e.getPlayer())) {
        e.setHatching(false);
    }
}
 
源代码3 项目: HeavySpleef   文件: FlagSplegg.java
@EventHandler
public void onPlayerEggThrow(PlayerEggThrowEvent event) {
	SpleefPlayer player = heavySpleef.getSpleefPlayer(event.getPlayer());
	GameManager manager = heavySpleef.getGameManager();
	
	Game game = manager.getGame(player);
	if (game == null || !game.isFlagPresent(FlagSplegg.class)) {
		return;
	}
	
	event.setHatching(false);
}
 
源代码4 项目: Statz   文件: EggsThrownListener.java
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onEggThrow(final PlayerEggThrowEvent event) {

	final PlayerStat stat = PlayerStat.EGGS_THROWN;

	// Get player
	final Player player = event.getPlayer();

	// Do general check
	if (!plugin.doGeneralCheck(player, stat))
		return;

	PlayerStatSpecification specification = new EggsThrownSpecification(player.getUniqueId(), 1,
			player.getWorld().getName());

	// Update value to new stat.
	plugin.getDataManager().setPlayerInfo(player.getUniqueId(), stat, specification.constructQuery());

}
 
 类所在包
 类方法
 同包方法