當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。