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


Java PlayerPickupItemEvent.setCancelled方法代码示例

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


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

示例1: onPlayerPickupItem

import org.bukkit.event.player.PlayerPickupItemEvent; //导入方法依赖的package包/类
@EventHandler
private void onPlayerPickupItem(PlayerPickupItemEvent event)
{
    if (event.getItem().getItemStack() != null && event.getItem().getItemStack().getItemMeta() != null && event.getItem().getItemStack().getItemMeta().getDisplayName() != null)
    {
        if (this.alive && event.getItem().getItemStack().getItemMeta().getDisplayName().equals(this.uuid.toString()))
        {
            event.setCancelled(true);

            HandlerList.unregisterAll(this);

            this.remove(true);
            this.parent.onPickup(event.getPlayer());
        }
    }
}
 
开发者ID:SamaGames,项目名称:SamaGamesAPI,代码行数:17,代码来源:ActivePowerup.java

示例2: onPickUp

import org.bukkit.event.player.PlayerPickupItemEvent; //导入方法依赖的package包/类
@EventHandler
public void onPickUp(PlayerPickupItemEvent e) {
    Player p = e.getPlayer();
    
    if (ConfigGPlayerItems.getConfig().getBoolean("Server.Items.PickUp.Disable")) {
		if (!ConfigGPlayerItems.getConfig().getBoolean("Server.Items.PickUp.World.All_World")) {
			if (WorldUtils.getWItemPickUp().contains(p.getWorld().getName())) {
 			if (ConfigGPlayerItems.getConfig().getBoolean("Server.Items.PickUp.Bypass")) {
                 if (!p.hasPermission("ultimatespawn.event.playeritem.bypass.pickup")) {
                     e.setCancelled(true);
                 }
             } else {
                 e.setCancelled(true);
             }
			}
		} else {
			if (ConfigGPlayerItems.getConfig().getBoolean("Server.Items.PickUp.Bypass")) {
                if (!p.hasPermission("ultimatespawn.event.playeritem.bypass.pickup")) {
                    e.setCancelled(true);
                }
            } else {
                e.setCancelled(true);
            }
		}
    }
}
 
开发者ID:DianoxDragon,项目名称:UltimateSpawn,代码行数:27,代码来源:BasicFeatures.java

示例3: onPlayerPickupItem

import org.bukkit.event.player.PlayerPickupItemEvent; //导入方法依赖的package包/类
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
void onPlayerPickupItem(PlayerPickupItemEvent event)
{
 Player player = event.getPlayer();
 if(!player.isSneaking() && PhantomAdmin.instance.isInvisible(player))
 {
     event.setCancelled(true);
     PlayerData data = PlayerData.FromPlayer(player);
        if(!data.gotItemPickupInfo)
        {
            PhantomAdmin.sendMessage(player, TextMode.Warn, Messages.NoItemPickupWhileInvisible);
            data.gotItemPickupInfo = true;
        }
        
     return;
 }
}
 
开发者ID:BigScary,项目名称:PhantomAdmin,代码行数:18,代码来源:PAEventHandler.java

示例4: onItemPickup

import org.bukkit.event.player.PlayerPickupItemEvent; //导入方法依赖的package包/类
@EventHandler
public void onItemPickup(PlayerPickupItemEvent e) {
	
	if (e.isCancelled()) {
		return;
	}
	
	ItemStack item = e.getItem().getItemStack();
	
	if (item.getType().equals(Material.WRITTEN_BOOK)) {
		BookMeta meta = (BookMeta) item.getItemMeta();
		
		if (meta.getTitle().equals("Quest Log")) {
			e.getItem().remove();
			e.setCancelled(true);
			
			QuestManagerPlugin.questManagerPlugin.getPlayerManager().getPlayer(
					e.getPlayer().getUniqueId()).addQuestBook();
			
		}
	}
	
}
 
开发者ID:Dove-Bren,项目名称:QuestManager,代码行数:24,代码来源:QuestManager.java

示例5: onPickup

import org.bukkit.event.player.PlayerPickupItemEvent; //导入方法依赖的package包/类
@EventHandler
public void onPickup(PlayerPickupItemEvent ppie) {
  Player player = ppie.getPlayer();
  Game game = BedwarsRel.getInstance().getGameManager().getGameOfPlayer(player);

  if (game == null) {
    game = BedwarsRel.getInstance().getGameManager().getGameByLocation(player.getLocation());
    if (game == null) {
      return;
    }
  }

  if (game.getState() != GameState.WAITING && game.isInGame(player)) {
    return;
  }

  ppie.setCancelled(true);
}
 
开发者ID:BedwarsRel,项目名称:BedwarsRel,代码行数:19,代码来源:PlayerListener.java

示例6: PickupItem

import org.bukkit.event.player.PlayerPickupItemEvent; //导入方法依赖的package包/类
/**
     * Checks if player has proper permission to pickup items.
     *
     * @param event that triggers listener.
     */
    @EventHandler(priority = EventPriority.LOW)
    private void PickupItem(PlayerPickupItemEvent event) {
        Player player = event.getPlayer();

        // Pickup item check.
        if (player != null && !player.hasPermission("antibuild.bypass")) {
            if (!player.hasPermission("antibuild.pickupitems")) {
                event.setCancelled(true);
                // We can't message the player here or it spams.
            }
        }

//        // World Check
//        if (!event.isCancelled() && plugin.isUsingLock()) {
//            if (plugin.isLockedWorld(player.getWorld().getName())
//                    && !player.hasPermission("antibuild.lock.bypass") && !player.hasPermission("antibuild.lock
// .bypass" +
//                    "." + player.getWorld().getName())) {
//                event.setCancelled(true);
//                // We can't message the player here or it spams.
//            }
//        }
    }
 
开发者ID:MutinyCraft,项目名称:AntiBuild,代码行数:29,代码来源:ItemPickup.java

示例7: onVisitorPickup

import org.bukkit.event.player.PlayerPickupItemEvent; //导入方法依赖的package包/类
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
public void onVisitorPickup(final PlayerPickupItemEvent e) {
    if (DEBUG) {
        plugin.getLogger().info(e.getEventName());
    }
    if (!IslandGuard.inWorld(e.getPlayer())) {
        return;
    }
    Island island = plugin.getGrid().getIslandAt(e.getItem().getLocation());
    if ((island != null && island.getIgsFlag(SettingsFlag.VISITOR_ITEM_PICKUP)) 
            || e.getPlayer().isOp() || VaultHelper.checkPerm(e.getPlayer(), Settings.PERMPREFIX + "mod.bypassprotect")
            || plugin.getGrid().locationIsOnIsland(e.getPlayer(), e.getItem().getLocation())) {
        return;
    }
    e.setCancelled(true);
}
 
开发者ID:tastybento,项目名称:acidisland,代码行数:17,代码来源:PlayerEvents2.java

示例8: onPlayerPickupItem

import org.bukkit.event.player.PlayerPickupItemEvent; //导入方法依赖的package包/类
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
public void onPlayerPickupItem(PlayerPickupItemEvent event)
{

	final Player user = event.getPlayer();
	final ItemStack item = event.getItem().getItemStack();

	if (antib.getSettings().getData().isDisableUse() && !Permissions.BUILD.isAuthorized(user))
	{
		if (!Permissions.PICKUP.isAuthorized(user, item.getType(), item.getData()))
		{
			event.setCancelled(true);
			event.getItem().setPickupDelay(50);
		}
	}
}
 
开发者ID:Curtis3321,项目名称:Essentials,代码行数:17,代码来源:EssentialsAntiBuildListener.java

示例9: onPlayerPickupItem

import org.bukkit.event.player.PlayerPickupItemEvent; //导入方法依赖的package包/类
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void onPlayerPickupItem(final PlayerPickupItemEvent event) {
    this.plugin.entering(this.getClass(), "onPlayerPickupItem");
    final Item i = event.getItem();
    if (this.itemMap.containsKey(i)) {
        this.plugin.debug("Item is handled by an Altar");
        final String playerName = event.getPlayer().getName();
        final String awaitedPlayerName = this.itemMap.get(i);
        if (!playerName.equals(awaitedPlayerName)) {
            if (this.plugin.isDebugEnabled()) {
                this.plugin.debug("Not the right player (" + playerName + "), cancel pickup. Awaited '" + awaitedPlayerName + '\'');
            }
            event.setCancelled(true);
        } else {
            this.plugin.debug("Right player, allow pickup");
            this.itemMap.remove(i);
            final Altar altar = this.plugin.getAltars().get(new ChunkCoord(i.getLocation().getChunk()));
            if (altar != null) {
                this.plugin.getItemProvidedToLockedTransition().doTransition(altar);
            }
        }
    }
    this.plugin.exiting(this.getClass(), "onPlayerPickupItem");
}
 
开发者ID:Ribesg,项目名称:NPlugins,代码行数:25,代码来源:ItemListener.java

示例10: onItemPickup

import org.bukkit.event.player.PlayerPickupItemEvent; //导入方法依赖的package包/类
@EventHandler
public void onItemPickup(PlayerPickupItemEvent e) {
	Game bw = io.github.bedwarsrel.BedwarsRel.Main.getInstance()
			.getGameManager().getGameOfPlayer(e.getPlayer());
	if (bw == null) {
		return;
	}
	if (!Config.isGameEnabledXP(bw.getName())) {
		return;
	}
	Player p = e.getPlayer();
	Item entity = e.getItem();
	ItemStack stack = entity.getItemStack();
	int count = Res.convertResToXP(stack);
	if (count == 0) {
		return;
	}
	e.setCancelled(true);
	XPManager.addXP(bw.getName(), p, count);
	p.playSound(p.getLocation(),
			SoundMachine.get("ORB_PICKUP", "ENTITY_EXPERIENCE_ORB_PICKUP"),
			10.0F, 1.0F);
	if (!Config.Message.equals("")) {
		ActionBarUtils.sendActionBar(p,
				Config.Message.replaceAll("%xp%", Integer.toString(count)));
		/*
		 * if (!ActionBarUtils.works) {
		 * p.sendMessage(Config.Message.replaceAll("%xp%",
		 * Integer.toString(count))); }
		 */
	}
	entity.remove();
}
 
开发者ID:Ldcr993519867,项目名称:BedwarsXP,代码行数:34,代码来源:NewEventListeners.java

示例11: onPickup

import org.bukkit.event.player.PlayerPickupItemEvent; //导入方法依赖的package包/类
@EventHandler
public void onPickup(PlayerPickupItemEvent e)
{
  Player staff = e.getPlayer();
  if (modMode.contains(staff.getName())) {
    e.setCancelled(true);
  }
}
 
开发者ID:funkemunky,项目名称:HCFCore,代码行数:9,代码来源:ModeratorMode.java

示例12: onPickup

import org.bukkit.event.player.PlayerPickupItemEvent; //导入方法依赖的package包/类
@EventHandler
public void onPickup(PlayerPickupItemEvent event) {
	Profile profile = Chambers.getInstance().getProfileManager().getProfileByUuid(event.getPlayer().getUniqueId());
	if (profile.getProfileStatus() != ProfileStatus.PLAYING) {
		event.setCancelled(true);
	}
}
 
开发者ID:HuliPvP,项目名称:Chambers,代码行数:8,代码来源:ProfileStatusListener.java

示例13: onPlayerPickup

import org.bukkit.event.player.PlayerPickupItemEvent; //导入方法依赖的package包/类
@EventHandler
public void onPlayerPickup(PlayerPickupItemEvent event){
    Material type = event.getItem().getItemStack().getType();
    if(type == Material.STONE || type == Material.COBBLESTONE){
        if(disabled.contains(event.getPlayer())){
            event.setCancelled(true);
        }
    }
}
 
开发者ID:funkemunky,项目名称:HCFCore,代码行数:10,代码来源:CobbleCommand.java

示例14: onPlayerDropItem

import org.bukkit.event.player.PlayerPickupItemEvent; //导入方法依赖的package包/类
@EventHandler
public void onPlayerDropItem(PlayerPickupItemEvent event) {
	Gamer g = Gamer.get(event.getPlayer());
	event.setCancelled(true);
	if (g.getVariable("edit") != null) {
		if ((boolean) g.getVariable("edit"))
			event.setCancelled(false);
	}
}
 
开发者ID:thekeenant,项目名称:mczone,代码行数:10,代码来源:GeneralEvents.java

示例15: onPickup

import org.bukkit.event.player.PlayerPickupItemEvent; //导入方法依赖的package包/类
@EventHandler
public void onPickup(PlayerPickupItemEvent e) {
    if (e.getItem().hasMetadata("no_pickup")) e.setCancelled(true);
    else if (!e.getItem().hasMetadata("no_pickup") && e.getItem().getItemStack().hasItemMeta() && e.getItem().getItemStack().getItemMeta().hasDisplayName() && e.getItem().getItemStack().getItemMeta().getDisplayName().startsWith("&5&dALTAR &3Probe - &e")) {
        e.setCancelled(true);
        e.getItem().remove();
    }
}
 
开发者ID:StarWishsama,项目名称:Slimefun4-Chinese-Version,代码行数:9,代码来源:ItemPickupListener.java


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