当前位置: 首页>>代码示例>>Java>>正文


Java PlayerEggThrowEvent类代码示例

本文整理汇总了Java中org.bukkit.event.player.PlayerEggThrowEvent的典型用法代码示例。如果您正苦于以下问题:Java PlayerEggThrowEvent类的具体用法?Java PlayerEggThrowEvent怎么用?Java PlayerEggThrowEvent使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


PlayerEggThrowEvent类属于org.bukkit.event.player包,在下文中一共展示了PlayerEggThrowEvent类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onEggThrow

import org.bukkit.event.player.PlayerEggThrowEvent; //导入依赖的package包/类
/**
 * Handle visitor chicken egg throwing
 * @param e
 */
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
public void onEggThrow(PlayerEggThrowEvent e) {
    if (DEBUG) {
        plugin.getLogger().info("egg throwing = " + e.getEventName());
    }
    if (!Util.inWorld(e.getPlayer()) || e.getPlayer().isOp() || VaultHelper.hasPerm(e.getPlayer(), Settings.PERMPREFIX + "mod.bypassprotect")
            || plugin.getIslands().playerIsOnIsland(e.getPlayer()) || plugin.getIslands().isAtSpawn(e.getPlayer().getLocation())) {
        return;
    }
    // Check island
    Island island = plugin.getIslands().getProtectedIslandAt(e.getPlayer().getLocation());
    if (island == null) {
        return;
    }
    if (!island.getFlag(SettingsFlag.THROW_EGGS)) {
        e.setHatching(false);
        Util.sendMessage(e.getPlayer(), plugin.getLocale(e.getPlayer().getUniqueId()).get("island.protected"));
        //e.getPlayer().updateInventory();
    }
}
 
开发者ID:tastybento,项目名称:bskyblock,代码行数:25,代码来源:IslandGuard.java

示例2: tirarhuevo

import org.bukkit.event.player.PlayerEggThrowEvent; //导入依赖的package包/类
/** @EVENTS **/

    @EventHandler

    public void tirarhuevo(PlayerEggThrowEvent e){

        if (e.isHatching()){
            Location loc = e.getPlayer().getLocation();

            for(int i = 0; i <360; i+=5) {
                Location particleloc = loc;
                particleloc.setZ(particleloc.getZ() + Math.cos(i) * 0.6);
                particleloc.setX(particleloc.getX() + Math.sin(i) * 0.5);
                particleloc.setY(particleloc.getY() + 0.05);
                loc.getWorld().playEffect(particleloc, Effect.valueOf(plugin.particle), 51);
            }

            Location location = e.getPlayer().getLocation();
            e.getPlayer().playSound(location, Sound.valueOf(plugin.sound), 1, 1);
        }
    }
 
开发者ID:clonalejandro,项目名称:AmazingEgss,代码行数:22,代码来源:l.java

示例3: onEggThrow

import org.bukkit.event.player.PlayerEggThrowEvent; //导入依赖的package包/类
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onEggThrow(final PlayerEggThrowEvent event) {

	final PlayerStat stat = PlayerStat.EGGS_THROWN;

	// Get player
	final Player 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,代码来源:EggsThrownListener.java

示例4: onEggThrow

import org.bukkit.event.player.PlayerEggThrowEvent; //导入依赖的package包/类
/**
 * Handle visitor chicken egg throwing
 * @param e
 */
@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;
}
 
开发者ID:tastybento,项目名称:acidisland,代码行数:27,代码来源:IslandGuard.java

示例5: onEgg

import org.bukkit.event.player.PlayerEggThrowEvent; //导入依赖的package包/类
@EventHandler
public void onEgg(PlayerEggThrowEvent e){
    Player p = e.getPlayer();

    if (p.getInventory().getItemInMainHand() == null) return;
    if (!p.getInventory().getItemInMainHand().hasItemMeta() || !p.getInventory().getItemInMainHand().getItemMeta().hasDisplayName()) return;
    if (p.getInventory().getItemInMainHand().getItemMeta().getDisplayName().equalsIgnoreCase(pe.getPokeEgg().getItemMeta().getDisplayName())) {
        e.setHatching(false);
    }
}
 
开发者ID:cadox8,项目名称:WC,代码行数:11,代码来源:CatchMob.java

示例6: onPlayerEggThrowEvent

import org.bukkit.event.player.PlayerEggThrowEvent; //导入依赖的package包/类
/**
    * Handles players breaking join signs
    *
    * @param e an event indicating that an egg is thrown
    * @see PlayerEggThrowEvent
    * @since 3.1.2
    */
@EventHandler
public void onPlayerEggThrowEvent(PlayerEggThrowEvent e) {
	if (ArenaManager.getInstance().getArena(e.getPlayer()) == null)
		return;
	
	if (e.isHatching())
		e.setHatching(false);
}
 
开发者ID:stefvanschie,项目名称:buildinggame,代码行数:16,代码来源:ChickenSpawnByEgg.java

示例7: PlayerTrownEgg

import org.bukkit.event.player.PlayerEggThrowEvent; //导入依赖的package包/类
@EventHandler
public void PlayerTrownEgg(PlayerEggThrowEvent e){
	Location l = e.getEgg().getLocation();
	Player p = e.getPlayer();
	Region r = RedProtect.get().rm.getTopRegion(l);
	
	if (r != null && !r.canBuild(p)){
		e.setHatching(false);
		RPLang.sendMessage(p, "playerlistener.region.canthatch");
	}
}
 
开发者ID:FabioZumbi12,项目名称:RedProtect,代码行数:12,代码来源:RPPlayerListener.java

示例8: eggCollide

import org.bukkit.event.player.PlayerEggThrowEvent; //导入依赖的package包/类
/**
 * This fires after the damage event does, so this, somehow, works.
 */
@EventHandler
public void eggCollide(PlayerEggThrowEvent event) {
    if (eggTracker.getEntry(event.getEgg()) != null) {
        eggTracker.getEntry(event.getEgg()).setPlayer(event.getPlayer());
        event.setHatching(false);
    } else {
        return;
    }
    
    // The player is undefined before we set it above. So to make sure the
    // local var is in fact a true copy, we will define it post assignment.
    EggTrackerEntry entry = eggTracker.getEntry(event.getEgg());
    
    if (entry.getPlayer().hasPermission("SimpleEgg." + entry.getEntity().getType().toString().replaceAll("_", "").toLowerCase())) {
        if (!captureManager.ownerConfliction(entry)) {
            if (expenseHandler.hasMaterials(entry.getPlayer())) {
                captureManager.makeSpawnEgg(entry);
            } else {
                entry.getPlayer().sendMessage(Text.tag + "You need " + Text.a + expenseHandler.requiredMaterials() + Text.b + " to capture a mob.");
                refundEgg(entry.getPlayer());
            }
        } else {
            entry.getPlayer().sendMessage(Text.tag + "You do not own this mob.");
            refundEgg(entry.getPlayer());
        }
    } else {
        entry.getPlayer().sendMessage(Text.tag + "You do not have permission to capture this mob type.");
        refundEgg(entry.getPlayer());
    }
    
    eggTracker.removeEntry(entry);
}
 
开发者ID:RedPanda4552,项目名称:SimpleEgg,代码行数:36,代码来源:ListenerEggEvents.java

示例9: onPlayerEggThrow

import org.bukkit.event.player.PlayerEggThrowEvent; //导入依赖的package包/类
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
public void onPlayerEggThrow(final PlayerEggThrowEvent e) {
    final Location l = BukkitUtil.getLocation(e.getEgg().getLocation());
    if (PlotSquared.isPlotWorld(l.getWorld())) {
        final Player p = e.getPlayer();
        final PlotPlayer pp = BukkitUtil.getPlayer(p);
        Plot plot = MainUtil.getPlot(l);
        if (plot == null) {
            if (!MainUtil.isPlotAreaAbs(l)) {
                return;
            }
            if (!Permissions.hasPermission(pp, "plots.admin.projectile.road")) {
                MainUtil.sendMessage(pp, C.NO_PERMISSION, "plots.admin.projectile.road");
                e.setHatching(false);
                return;
            }
        } else {
            if (!plot.hasOwner()) {
                if (!Permissions.hasPermission(pp, "plots.admin.projectile.unowned")) {
                    MainUtil.sendMessage(pp, C.NO_PERMISSION, "plots.admin.projectile.unowned");
                    e.setHatching(false);
                    return;
                }
            } else if (!plot.isAdded(pp.getUUID())) {
                if (!Permissions.hasPermission(pp, "plots.admin.projectile.other")) {
                    if (MainUtil.isPlotArea(l)) {
                        MainUtil.sendMessage(pp, C.NO_PERMISSION, "plots.admin.projectile.other");
                        e.setHatching(false);
                        return;
                    }
                }
            }
        }
    }
}
 
开发者ID:Mayomi,项目名称:PlotSquared-Chinese,代码行数:36,代码来源:PlayerEvents.java

示例10: onEgg

import org.bukkit.event.player.PlayerEggThrowEvent; //导入依赖的package包/类
@EventHandler
public void onEgg(PlayerEggThrowEvent e) {
    if (!hatchingEnabled || e.getPlayer() == null || !plugin.isSkyAssociatedWorld(e.getPlayer().getWorld())) {
        return;
    }
    if (!plugin.playerIsOnIsland(e.getPlayer())) {
        e.setHatching(false);
    }
}
 
开发者ID:rlf,项目名称:uSkyBlock,代码行数:10,代码来源:GriefEvents.java

示例11: onPlayerEggThrow

import org.bukkit.event.player.PlayerEggThrowEvent; //导入依赖的package包/类
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void onPlayerEggThrow(PlayerEggThrowEvent event) {
    Location l = BukkitUtil.getLocation(event.getEgg().getLocation());
    PlotArea area = l.getPlotArea();
    if (area == null) {
        return;
    }
    Player player = event.getPlayer();
    PlotPlayer plotPlayer = BukkitUtil.getPlayer(player);
    Plot plot = area.getPlot(l);
    if (plot == null) {
        if (!Permissions.hasPermission(plotPlayer, "plots.admin.projectile.road")) {
            MainUtil.sendMessage(plotPlayer, C.NO_PERMISSION_EVENT, "plots.admin.projectile.road");
            event.setHatching(false);
        }
    } else if (!plot.hasOwner()) {
        if (!Permissions.hasPermission(plotPlayer, "plots.admin.projectile.unowned")) {
            MainUtil.sendMessage(plotPlayer, C.NO_PERMISSION_EVENT, "plots.admin.projectile.unowned");
            event.setHatching(false);
        }
    } else if (!plot.isAdded(plotPlayer.getUUID())) {
        if (!Permissions.hasPermission(plotPlayer, "plots.admin.projectile.other")) {
            MainUtil.sendMessage(plotPlayer, C.NO_PERMISSION_EVENT, "plots.admin.projectile.other");
            event.setHatching(false);
        }
    }
}
 
开发者ID:IntellectualSites,项目名称:PlotSquared,代码行数:28,代码来源:PlayerEvents.java

示例12: throwEgg

import org.bukkit.event.player.PlayerEggThrowEvent; //导入依赖的package包/类
@EventHandler
public void throwEgg(PlayerEggThrowEvent event) {
	Egg egg = event.getEgg();
	if (this.eggs.containsKey(egg)) {
		EntityType entityType = (EntityType) this.eggs.get(egg);
		Entity entity = egg.getWorld().spawnEntity(egg.getLocation(), entityType);
		if (entityType == EntityType.SHEEP) {
			((Sheep) entity).setColor(org.bukkit.DyeColor.values()[((int) (java.lang.Math.random() * org.bukkit.DyeColor.values().length))]);
			event.setHatching(false);
		}
	}
}
 
开发者ID:SurvivalGamesDevTeam,项目名称:TheSurvivalGames,代码行数:13,代码来源:ThrowableSpawnEggs.java

示例13: onEggThrown

import org.bukkit.event.player.PlayerEggThrowEvent; //导入依赖的package包/类
@EventHandler
public void onEggThrown(PlayerEggThrowEvent event)
{
    TregminePlayer player = plugin.getPlayer(event.getPlayer());
    
    if (!player.hasBlockPermission(player.getLocation(), true)) {
        event.setHatching(false);
    }
}
 
开发者ID:EmilHernvall,项目名称:tregmine,代码行数:10,代码来源:EggListener.java

示例14: onPlayerEggThrow

import org.bukkit.event.player.PlayerEggThrowEvent; //导入依赖的package包/类
@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);
}
 
开发者ID:xaniox,项目名称:HeavySpleef,代码行数:13,代码来源:FlagSplegg.java

示例15: onPlayerEggThrowEvent

import org.bukkit.event.player.PlayerEggThrowEvent; //导入依赖的package包/类
@EventHandler
public void onPlayerEggThrowEvent(final PlayerEggThrowEvent pete) {
    final String playerId = ConfigHandler.getDefaultBukkitConfig().getBoolean("use.UUIDs", true) ? pete.getPlayer().getUniqueId().toString() : pete.getPlayer().getPlayer().getName();
    if (DataHandler.isPlayerActive(playerId)) {
        pete.setHatching(false);
    }
}
 
开发者ID:Max9403,项目名称:Blueprint-A-Bukkit-Plugin,代码行数:8,代码来源:PlayerListener.java


注:本文中的org.bukkit.event.player.PlayerEggThrowEvent类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。