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


Java PlayerEvent.getPlayer方法代码示例

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


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

示例1: onItemDisappeared

import org.bukkit.event.player.PlayerEvent; //导入方法依赖的package包/类
private void onItemDisappeared(PlayerEvent event, ItemStack item) {
    final Player player = event.getPlayer();
    final PlayerInventory inventory = player.getInventory();
    final int slotId = inventory.getHeldItemSlot();

    if (!InventoryManager.playerIsLoaded(player)) {
        return;
    }

    if (ItemUtils.isEmpty(inventory.getItemInMainHand()) || item.equals(inventory.getItemInMainHand())) {
        final Slot slot = InventoryManager.getQuickSlot(slotId);
        if (slot != null) {
            new BukkitRunnable() {
                @Override
                public void run() {
                    InventoryUtils.heldFreeSlot(player, slotId, InventoryUtils.SearchType.NEXT);
                    inventory.setItem(slotId, slot.getCup());
                }
            }.runTaskLater(RPGInventory.getInstance(), 1);
        }
    }
}
 
开发者ID:EndlessCodeGroup,项目名称:RPGInventory,代码行数:23,代码来源:InventoryListener.java

示例2: removeProfile

import org.bukkit.event.player.PlayerEvent; //导入方法依赖的package包/类
private void removeProfile(PlayerEvent event) {
	Player player = event.getPlayer();
	Game game = plugin.getGameManager().getGame();
	Profile profile = plugin.getProfileManager().getProfileByUuid(player.getUniqueId());
	if (profile != null && profile.getTeam() != null) {
		if (game.hasStarted()) {
			plugin.getGameManager().getGame().getOffline().add(player.getName());
			profile.getTeam().getOffline().add(player.getName());
		}
		profile.getTeam().removeMember(profile);
	}
	plugin.getProfileManager().removeProfile(profile);
}
 
开发者ID:HuliPvP,项目名称:Chambers,代码行数:14,代码来源:ProfileListener.java

示例3: anyPlayerEvent

import org.bukkit.event.player.PlayerEvent; //导入方法依赖的package包/类
@EventHandler(priority = EventPriority.LOWEST)
public void anyPlayerEvent(PlayerEvent event){
	if(!(event instanceof Cancellable))
		return;
	if (!usingBeeLoginMod)
		return;
	Player player = event.getPlayer();
	if (!loginStatus.get(player.getName().toLowerCase())) {
		((Cancellable) event).setCancelled(true);
	}
}
 
开发者ID:lj2000lj,项目名称:BeeLogin,代码行数:12,代码来源:EventCanceler.java

示例4: getLoggablePlayerEvent

import org.bukkit.event.player.PlayerEvent; //导入方法依赖的package包/类
private LoggablePlayerEvent getLoggablePlayerEvent(PlayerEventAction action, PlayerEvent event) {

        final Player player = event.getPlayer();
        final Location location = player.getLocation();
        final World world = player.getWorld();

        Point3d coordinates = new Point3d(location.getX(), location.getY(), location.getZ());

        LoggablePlayerEvent playerEvent = new LoggablePlayerEvent(world.getFullTime(), minecraft_server, world.getName(), action);

        LivingEntity eventPlayer = new LivingEntity("player", player.getDisplayName());

        eventPlayer.setMaxHealth(player.getMaxHealth());
        eventPlayer.setCurrentHealth(player.getHealth());


        for (PotionEffect potion : player.getActivePotionEffects()) {
            eventPlayer.addPotions(potion.getType().getName() + ":" + potion.getAmplifier());
        }
        playerEvent.setPlayer(eventPlayer);

        if (event instanceof PlayerMoveEvent) {

            // Teleport is a child class so this is to allow us to identify the child class
            if (event instanceof PlayerTeleportEvent)
                playerEvent.setAction("Teleport"); // Should use the action enum instead of the string.

            // The coordinates from the event and the destination of the move event are slightly different so this corrects that.
            Point3d destination = new Point3d(((PlayerMoveEvent) event).getTo().getX(), ((PlayerMoveEvent) event).getTo().getY(), ((PlayerMoveEvent) event).getTo().getZ());
            playerEvent.setDest(destination);

            Point3d source = new Point3d(((PlayerMoveEvent) event).getFrom().getX(), ((PlayerMoveEvent) event).getFrom().getY(), ((PlayerMoveEvent) event).getFrom().getZ());
            playerEvent.setSrc(source);


        }
        return playerEvent;

    }
 
开发者ID:PowerSchill,项目名称:LogToSplunk,代码行数:40,代码来源:PlayerEventLogger.java

示例5: shouldCancelEvent

import org.bukkit.event.player.PlayerEvent; //导入方法依赖的package包/类
/**
 * Returns whether an event should be canceled (for unauthenticated, non-NPC players).
 *
 * @param event the event to process
 * @return true if the event should be canceled, false otherwise
 */
public boolean shouldCancelEvent(PlayerEvent event) {
    Player player = event.getPlayer();
    return shouldCancelEvent(player);
}
 
开发者ID:AuthMe,项目名称:AuthMeReloaded,代码行数:11,代码来源:ListenerService.java


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