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


Java EventPriority.LOW属性代码示例

本文整理汇总了Java中org.bukkit.event.EventPriority.LOW属性的典型用法代码示例。如果您正苦于以下问题:Java EventPriority.LOW属性的具体用法?Java EventPriority.LOW怎么用?Java EventPriority.LOW使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在org.bukkit.event.EventPriority的用法示例。


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

示例1: onPlayerDeath

@EventHandler(ignoreCancelled = true, priority = EventPriority.LOW)
public void onPlayerDeath(PlayerDeathEvent event) {
    Player player = event.getEntity();
    Deathban deathban = plugin.getDeathbanManager().applyDeathBan(player, event.getDeathMessage());
    long remaining = deathban.getRemaining();
    if (remaining <= 0L || player.hasPermission(DeathbanListener.DEATH_BAN_BYPASS_PERMISSION)) {
        return;
    }

    if (DeathbanListener.RESPAWN_KICK_DELAY_MILLIS <= 0L || remaining < DeathbanListener.RESPAWN_KICK_DELAY_MILLIS) {
        this.handleKick(player, deathban);
        return;
    }

    // Let the player see the death screen for 10 seconds
    this.respawnTickTasks.put(player.getUniqueId(), new BukkitRunnable() {
        @Override
        public void run() {
            DeathbanListener.this.handleKick(player, deathban);
        }
    }.runTaskLater(plugin, DeathbanListener.RESPAWN_KICK_DELAY_TICKS).getTaskId());
}
 
开发者ID:funkemunky,项目名称:HCFCore,代码行数:22,代码来源:DeathbanListener.java

示例2: onTreeGrow

/**
 * Converts trees to gravel and glowstone
 *
 * @param e
 */
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
public void onTreeGrow(final StructureGrowEvent e) {
    if (DEBUG)
        plugin.getLogger().info("DEBUG: " + e.getEventName());

    if (!Settings.netherTrees) {
        return;
    }
    if (!Settings.netherGenerate || IslandWorld.getNetherWorld() == null) {
        return;
    }
    // Check world
    if (!e.getLocation().getWorld().equals(IslandWorld.getNetherWorld())) {
        return;
    }
    for (BlockState b : e.getBlocks()) {
        if (b.getType() == Material.LOG || b.getType() == Material.LOG_2) {
            b.setType(Material.GRAVEL);
        } else if (b.getType() == Material.LEAVES || b.getType() == Material.LEAVES_2) {
            b.setType(Material.GLOWSTONE);
        }
    }
}
 
开发者ID:tastybento,项目名称:bskyblock,代码行数:28,代码来源:NetherEvents.java

示例3: onBucketEmpty

@EventHandler(priority = EventPriority.LOW)
public void onBucketEmpty(final PlayerBucketEmptyEvent e) {
    if (DEBUG)
        plugin.getLogger().info("DEBUG: " + e.getEventName());
    if (!Settings.netherIslands) {
        if (e.getPlayer().getWorld().getName().equalsIgnoreCase(Settings.worldName + "_nether")
                || e.getPlayer().getWorld().getName().equalsIgnoreCase(Settings.worldName + "_the_end")) {
            if (VaultHelper.hasPerm(e.getPlayer(), Settings.PERMPREFIX + "mod.bypassprotect")) {
                return;
            }
            if (!awayFromSpawn(e.getPlayer()) && !e.getPlayer().isOp()) {
                e.setCancelled(true);
            }
        }
    }
}
 
开发者ID:tastybento,项目名称:bskyblock,代码行数:16,代码来源:NetherEvents.java

示例4: playerChatEvent4

@EventHandler(priority = EventPriority.LOW)
public void playerChatEvent4(final AsyncPlayerChatEvent event) {
    if (Config.getInstance().isChat_async() && !Config.getInstance().isChatHighestPriority()) {
        if (this.namingPlayers.contains(event.getPlayer()) || this.namingSkull.contains(event.getPlayer()))
            event.setCancelled(true);
        this.plugin.getServer().getScheduler().runTaskLater(this.plugin, () -> PetDataListener.this.handleChatMessage(new PlayerChatEvent(event.getPlayer(), event.getMessage())), 1L);
    }
}
 
开发者ID:Shynixn,项目名称:PetBlocks,代码行数:8,代码来源:PetDataListener.java

示例5: onShear

@EventHandler(priority = EventPriority.LOW)
public void onShear(final PlayerShearEntityEvent e) {
    if (DEBUG) {
        plugin.getLogger().info(e.getEventName());
    }
    if (Util.inWorld(e.getPlayer())) {
        if (actionAllowed(e.getPlayer(), e.getEntity().getLocation(), SettingsFlag.SHEARING)) {
            return;
        }
        // Not allowed
        Util.sendMessage(e.getPlayer(), plugin.getLocale(e.getPlayer().getUniqueId()).get("island.protected"));
        e.setCancelled(true);
    }
}
 
开发者ID:tastybento,项目名称:bskyblock,代码行数:14,代码来源:IslandGuard.java

示例6: onPlayerQuit

@EventHandler(priority = EventPriority.LOW)
public void onPlayerQuit(PlayerQuitEvent e) {
    PAUser u = PAServer.getUser(e.getPlayer());

    e.setQuitMessage(Messages.getMessage(Messages.LEFT, PAData.CORE, "%player%", e.getPlayer().getName()));
    u.save();
    if (PAServer.users.contains(u)) PAServer.users.remove(u);
}
 
开发者ID:cadox8,项目名称:PA,代码行数:8,代码来源:PlayerListener.java

示例7: playerJoin

@EventHandler(priority = EventPriority.LOW)
public void playerJoin(final PlayerJoinEvent event) {
    // Add the player to the match if they spawn in this world
    if(match.getWorld().equals(event.getPlayer().getLocation().getWorld())) {
        event.getPlayer().setGliding(true); // Fixes client desync if player joins server while gliding
        match.addPlayer(event.getPlayer());
    }
}
 
开发者ID:OvercastNetwork,项目名称:ProjectAres,代码行数:8,代码来源:SpawnMatchModule.java

示例8: ArmorStandDestroy

@EventHandler(priority = EventPriority.LOW, ignoreCancelled=true)
public void ArmorStandDestroy(EntityDamageByEntityEvent e) {
    if (DEBUG) {
        plugin.getLogger().info("1.8 " + "IslandGuard New " + e.getEventName());
    }
    if (!(e.getEntity() instanceof LivingEntity)) {
        return;
    }
    if (!Util.inWorld(e.getEntity())) {
        return;
    }
    final LivingEntity livingEntity = (LivingEntity) e.getEntity();
    if (!livingEntity.getType().equals(EntityType.ARMOR_STAND)) {
        return;
    }
    if (e.getDamager() instanceof Player) {
        Player p = (Player) e.getDamager();
        if (p.isOp() || VaultHelper.hasPerm(p, Settings.PERMPREFIX + "mod.bypassprotect")) {
            return;
        }
        // Check if on island
        if (plugin.getIslands().playerIsOnIsland(p)) {
            return;
        }
        // Check island
        Island island = plugin.getIslands().getIslandAt(e.getEntity().getLocation());
        if (island == null && Settings.defaultWorldSettings.get(SettingsFlag.BREAK_BLOCKS)) {
            return;
        }
        if (island != null && island.getFlag(SettingsFlag.BREAK_BLOCKS)) {
            return;
        }
        Util.sendMessage(p, plugin.getLocale(p.getUniqueId()).get("island.protected"));
        e.setCancelled(true);
    }
}
 
开发者ID:tastybento,项目名称:bskyblock,代码行数:36,代码来源:IslandGuard1_8.java

示例9: applyNicknameOnLogin

/**
 * If a player has a nickname set in their user document on login, apply it.
 * This needs to run before {@link PlayerAppearanceListener#refreshNamesOnLogin}
 */
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
public void applyNicknameOnLogin(UserLoginEvent event) {
    if(event.getUser().nickname() != null) {
        applyNickname(event.getPlayer(), null, event.getUser().nickname());
    }
}
 
开发者ID:OvercastNetwork,项目名称:ProjectAres,代码行数:10,代码来源:IdentityProviderImpl.java

示例10: onInventoryOpen

@EventHandler(priority = EventPriority.LOW)
public void onInventoryOpen(InventoryOpenEvent e) {
    Player p = (Player) e.getPlayer();

    if(!inventories.containsKey(p))
        return;

    SmartInventory inv = inventories.get(p);

    inv.getListeners().stream()
            .filter(listener -> listener.getType() == InventoryOpenEvent.class)
            .forEach(listener -> ((InventoryListener<InventoryOpenEvent>) listener).accept(e));
}
 
开发者ID:MinusKube,项目名称:SmartInvs,代码行数:13,代码来源:InventoryManager.java

示例11: onPlayerBedEnter

@EventHandler(priority = EventPriority.LOW)
public void onPlayerBedEnter(final PlayerBedEnterEvent e) {
    if (DEBUG) {
        plugin.getLogger().info(e.getEventName());
    }
    // Check world
    if (Util.inWorld(e.getPlayer())) {
        if (actionAllowed(e.getPlayer(),e.getBed().getLocation(), SettingsFlag.BED)) {
            return;
        }
        // Not allowed
        Util.sendMessage(e.getPlayer(), plugin.getLocale(e.getPlayer().getUniqueId()).get("island.protected"));
        e.setCancelled(true);
    }
}
 
开发者ID:tastybento,项目名称:bskyblock,代码行数:15,代码来源:IslandGuard.java

示例12: onInventoryOpen

@EventHandler(priority = EventPriority.LOW)
public void onInventoryOpen(InventoryOpenEvent event) {
    final Player player = (Player) event.getPlayer();
    if (!InventoryManager.playerIsLoaded(player)
            || event.getInventory().getType() != InventoryType.WORKBENCH
            || isNotNeededHere(player)) {
        return;
    }

    //noinspection deprecation
    player.updateInventory();
}
 
开发者ID:EndlessCodeGroup,项目名称:RPGInventory,代码行数:12,代码来源:CraftListener.java

示例13: onInventoryClick

@EventHandler(priority = EventPriority.LOW)
public void onInventoryClick(InventoryClickEvent e) {
    Player p = (Player) e.getWhoClicked();

    if(!inventories.containsKey(p))
        return;

    if(e.getAction() == InventoryAction.COLLECT_TO_CURSOR ||
            e.getAction() == InventoryAction.MOVE_TO_OTHER_INVENTORY) {
        e.setCancelled(true);
        return;
    }

    if(e.getClickedInventory() == p.getOpenInventory().getTopInventory()) {
        e.setCancelled(true);

        int row = e.getSlot() / 9;
        int column = e.getSlot() % 9;

        if(row < 0 || column < 0)
            return;

        SmartInventory inv = inventories.get(p);

        if(row >= inv.getRows() || column >= inv.getColumns())
            return;

        inv.getListeners().stream()
                .filter(listener -> listener.getType() == InventoryClickEvent.class)
                .forEach(listener -> ((InventoryListener<InventoryClickEvent>) listener).accept(e));

        contents.get(p).get(row, column).ifPresent(item -> item.run(e));
    }
}
 
开发者ID:MinusKube,项目名称:SmartInvs,代码行数:34,代码来源:InventoryManager.java

示例14: initializeDrops

@EventHandler(priority = EventPriority.LOW)
public void initializeDrops(BlockTransformEvent event) {
    if(!causesDrops(event.getCause())) {
        return;
    }

    BlockDrops drops = this.ruleSet.getDrops(event, event.getOldState(), ParticipantBlockTransformEvent.getPlayerState(event));
    if(drops != null) {
        event.setDrops(drops);
    }
}
 
开发者ID:OvercastNetwork,项目名称:ProjectAres,代码行数:11,代码来源:BlockDropsMatchModule.java

示例15: WitherExplode

/**
 * Deal with pre-explosions
 */
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
public void WitherExplode(ExplosionPrimeEvent e) {
    if (DEBUG) {
        plugin.getLogger().info(e.getEventName());
    }
    // Only cover withers in the island world
    if (!Util.inWorld(e.getEntity()) || e.getEntity() == null) {
        return;
    }
    // The wither or wither skulls can both blow up
    if (e.getEntityType() == EntityType.WITHER) {
        //plugin.getLogger().info("DEBUG: Wither");
        // Check the location
        if (mobSpawnInfo.containsKey(e.getEntity())) {
            // We know about this wither
            if (DEBUG) {
                plugin.getLogger().info("DEBUG: We know about this wither");
            }
            if (!mobSpawnInfo.get(e.getEntity()).inIslandSpace(e.getEntity().getLocation())) {
                // Cancel the explosion
                if (DEBUG) {
                    plugin.getLogger().info("DEBUG: cancelling wither pre-explosion");
                }
                e.setCancelled(true);
            }
        }
        // Testing only e.setCancelled(true);
    }
    if (e.getEntityType() == EntityType.WITHER_SKULL) {
        //plugin.getLogger().info("DEBUG: Wither skull");
        // Get shooter
        Projectile projectile = (Projectile)e.getEntity();
        if (projectile.getShooter() instanceof Wither) {
            //plugin.getLogger().info("DEBUG: shooter is wither");
            Wither wither = (Wither)projectile.getShooter();
            // Check the location
            if (mobSpawnInfo.containsKey(wither)) {
                // We know about this wither
                if (DEBUG) {
                    plugin.getLogger().info("DEBUG: We know about this wither");
                }
                if (!mobSpawnInfo.get(wither).inIslandSpace(e.getEntity().getLocation())) {
                    // Cancel the explosion
                    if (DEBUG) {
                        plugin.getLogger().info("DEBUG: cancel wither skull explosion");
                    }
                    e.setCancelled(true);
                }
            }
        }
    }
}
 
开发者ID:tastybento,项目名称:bskyblock,代码行数:55,代码来源:FlyingMobEvents.java


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