本文整理汇总了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();
}
示例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());
}
示例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;
}
}
示例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());
}