java类org.bukkit.event.player.PlayerEggThrowEvent的实例源码

IslandGuard.java 文件源码 项目:bskyblock 阅读 22 收藏 0 点赞 0 评论 0
/**
 * 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();
    }
}
l.java 文件源码 项目:AmazingEgss 阅读 35 收藏 0 点赞 0 评论 0
/** @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);
        }
    }
EggsThrownListener.java 文件源码 项目:Statz 阅读 23 收藏 0 点赞 0 评论 0
@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()));

}
IslandGuard.java 文件源码 项目:acidisland 阅读 21 收藏 0 点赞 0 评论 0
/**
 * 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;
}
IslandGuard.java 文件源码 项目:askyblock 阅读 19 收藏 0 点赞 0 评论 0
/**
 * 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;
}
CatchMob.java 文件源码 项目:WC 阅读 22 收藏 0 点赞 0 评论 0
@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);
    }
}
CatchMob.java 文件源码 项目:PA 阅读 23 收藏 0 点赞 0 评论 0
@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);
    }
}
ChickenSpawnByEgg.java 文件源码 项目:buildinggame 阅读 19 收藏 0 点赞 0 评论 0
/**
    * 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);
}
RPPlayerListener.java 文件源码 项目:RedProtect 阅读 31 收藏 0 点赞 0 评论 0
@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");
    }
}
ListenerEggEvents.java 文件源码 项目:SimpleEgg 阅读 23 收藏 0 点赞 0 评论 0
/**
 * 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);
}
PlayerEvents.java 文件源码 项目:PlotSquared-Chinese 阅读 26 收藏 0 点赞 0 评论 0
@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;
                    }
                }
            }
        }
    }
}
GriefEvents.java 文件源码 项目:uSkyBlock 阅读 30 收藏 0 点赞 0 评论 0
@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);
    }
}
PlayerEvents.java 文件源码 项目:PlotSquared 阅读 28 收藏 0 点赞 0 评论 0
@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);
        }
    }
}
ThrowableSpawnEggs.java 文件源码 项目:TheSurvivalGames 阅读 25 收藏 0 点赞 0 评论 0
@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);
        }
    }
}
EggListener.java 文件源码 项目:tregmine 阅读 25 收藏 0 点赞 0 评论 0
@EventHandler
public void onEggThrown(PlayerEggThrowEvent event)
{
    TregminePlayer player = plugin.getPlayer(event.getPlayer());

    if (!player.hasBlockPermission(player.getLocation(), true)) {
        event.setHatching(false);
    }
}
FlagSplegg.java 文件源码 项目:HeavySpleef 阅读 25 收藏 0 点赞 0 评论 0
@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);
}
PlayerListener.java 文件源码 项目:Blueprint-A-Bukkit-Plugin 阅读 20 收藏 0 点赞 0 评论 0
@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);
    }
}
ChickenSpawn.java 文件源码 项目:SurvivalPlus 阅读 21 收藏 0 点赞 0 评论 0
@EventHandler
public void onEggThrown(PlayerEggThrowEvent e)
{
    e.setHatching(true);
    e.setNumHatches((byte)1);
}
TreeListener.java 文件源码 项目:StarQuestCode 阅读 21 收藏 0 点赞 0 评论 0
/**
 * @param event  
 * Don't think this event should be here, but left it in as I'm just tidying up the code and it runs OK
 */
@EventHandler
  public void onPlayerTalk(PlayerEggThrowEvent event) {}


问题


面经


文章

微信
公众号

扫码关注公众号