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


Java PluginManager.callEvent方法代码示例

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


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

示例1: simulateBlockBreak

import org.bukkit.plugin.PluginManager; //导入方法依赖的package包/类
/**
 * Simulate a block break event.
 *
 * @param block The block to break
 * @param player The player breaking the block
 * @param shouldArmSwing true if an armswing event should be fired, false otherwise
 * @return true if the event wasn't cancelled, false otherwise
 */
public static boolean simulateBlockBreak(Block block, Player player, boolean shouldArmSwing) {
    PluginManager pluginManager = mcMMO.p.getServer().getPluginManager();

    // Support for NoCheat
    if (shouldArmSwing) {
        callFakeArmSwingEvent(player);
    }

    FakeBlockDamageEvent damageEvent = new FakeBlockDamageEvent(player, block, player.getItemInHand(), true);
    pluginManager.callEvent(damageEvent);

    FakeBlockBreakEvent breakEvent = new FakeBlockBreakEvent(block, player);
    pluginManager.callEvent(breakEvent);

    return !damageEvent.isCancelled() && !breakEvent.isCancelled();
}
 
开发者ID:Pershonkey,项目名称:McMMOPlus,代码行数:25,代码来源:EventUtils.java

示例2: onExecute

import org.bukkit.plugin.PluginManager; //导入方法依赖的package包/类
@Override
public void onExecute(String[] args, CommandSender sender) {
    PluginManager plugins = Bukkit.getPluginManager();

    DataReloadEvent event = new DataReloadEvent();
    plugins.callEvent(event);
    if (event.isCancelled()) {
        return;
    }

    plugin.onDisable();
    plugin.loadCore();

    MessageUtil.sendPluginTag(sender, plugin);
    MessageUtil.sendCenteredMessage(sender, FMessage.CMD_RELOAD_DONE.getMessage());
}
 
开发者ID:DRE2N,项目名称:FactionsXL,代码行数:17,代码来源:ReloadCommand.java

示例3: process

import org.bukkit.plugin.PluginManager; //导入方法依赖的package包/类
public static void process(Player player, String message) {
    KMPlayer kmp = KMPlayerManager.getKMPlayer(player);
    PluginManager pm = Bukkit.getPluginManager();

    if (!kmp.isEnableMessages()) {
        return;
    }

    switch (DefaultConfig.getMessageMethod()) {
        case DISABLED:              return;

        case ACTION_BAR:            pm.callEvent(new KMSendActionBarMessageEvent(player, message, 3));
                                    break;

        case CHAT:                  pm.callEvent(new KMSendMessageEvent(player, message));
                                    break;
    }
}
 
开发者ID:diecode,项目名称:KillerMoney,代码行数:19,代码来源:MessageHandler.java

示例4: trigger

import org.bukkit.plugin.PluginManager; //导入方法依赖的package包/类
@Override
public void trigger(AlmightyNotchPlugin plugin, World world) {
    PluginManager pluginManager = Bukkit.getPluginManager();
    for (LivingEntity entity : world.getLivingEntities()) {
        if (entity.getType() == EntityType.CREEPER) {
            Creeper creeper = (Creeper) entity;

            float power = creeper.isPowered() ? 6.0F : 3.0F;
            ExplosionPrimeEvent event = new ExplosionPrimeEvent(creeper, power, false);
            pluginManager.callEvent(event);
            if (!event.isCancelled()) {
                creeper.damage(creeper.getHealth());
                world.createExplosion(creeper.getLocation(), power);
            }
        }
    }
    plugin.getMessenger().sendMessage(Bukkit.getServer(), getOccurMessage());
}
 
开发者ID:Amperial,项目名称:AlmightyNotch,代码行数:19,代码来源:CreeperExplodeEvent.java


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