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


Java PlayerDropItemEvent.setCancelled方法代码示例

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


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

示例1: on

import org.bukkit.event.player.PlayerDropItemEvent; //导入方法依赖的package包/类
@EventHandler
public void on(PlayerDropItemEvent event) {
    ItemStack item = event.getItemDrop().getItemStack();

    if (item == null) {
        return;
    }

    if (!item.hasItemMeta() || !item.getItemMeta().hasDisplayName()) {
        return;
    }

    String name = item.getItemMeta().getDisplayName();

    if (name.equals("§4§lBlocked Slot")) {
        event.setCancelled(true);
    }
}
 
开发者ID:LeonTG,项目名称:NineSlots,代码行数:19,代码来源:ClickListener.java

示例2: onDrop

import org.bukkit.event.player.PlayerDropItemEvent; //导入方法依赖的package包/类
@EventHandler
public void onDrop(PlayerDropItemEvent e) {
    Player p = e.getPlayer();

	if (ConfigGPlayerItems.getConfig().getBoolean("Server.Items.Drop.Disable")) {
		if (!ConfigGPlayerItems.getConfig().getBoolean("Server.Items.Drop.World.All_World")) {
			if (WorldUtils.getWItemDrop().contains(p.getWorld().getName())) {
 			if (ConfigGPlayerItems.getConfig().getBoolean("Server.Items.Drop.Bypass")) {
                 if (!p.hasPermission("ultimatespawn.event.playeritem.bypass.drop")) {
                     e.setCancelled(true);
                 }
             } else {
                 e.setCancelled(true);
             }
			}
		} else {
			if (ConfigGPlayerItems.getConfig().getBoolean("Server.Items.Drop.Bypass")) {
                if (!p.hasPermission("ultimatespawn.event.playeritem.bypass.drop")) {
                    e.setCancelled(true);
                }
            } else {
                e.setCancelled(true);
            }
		}
    }
}
 
开发者ID:DianoxDragon,项目名称:UltimateSpawn,代码行数:27,代码来源:BasicFeatures.java

示例3: onPlayerDropItem

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

示例4: onItemDrop

import org.bukkit.event.player.PlayerDropItemEvent; //导入方法依赖的package包/类
@EventHandler(ignoreCancelled = true)
public void onItemDrop(PlayerDropItemEvent event) {
    if (!cratesPlus.getConfigHandler().isDisableKeySwapping())
        return;
    String title;
    ItemStack item = event.getItemDrop().getItemStack();

    for (Map.Entry<String, Crate> crate : cratesPlus.getConfigHandler().getCrates().entrySet()) {
        if (!(crate.getValue() instanceof KeyCrate)) {
            continue;
        }
        KeyCrate keyCrate = (KeyCrate) crate.getValue();
        Key key = keyCrate.getKey();
        if (key == null)
            continue;
        title = key.getName();

        if (item.hasItemMeta() && item.getItemMeta().hasDisplayName() && item.getItemMeta().getDisplayName().contains(title)) {
            event.getPlayer().sendMessage(cratesPlus.getPluginPrefix() + cratesPlus.getMessageHandler().getMessage("Cant Drop", event.getPlayer(), crate.getValue(), null));
            event.setCancelled(true);
            return;
        }
    }

}
 
开发者ID:ConnorLinfoot,项目名称:CratesPlus,代码行数:26,代码来源:BlockListeners.java

示例5: onPlayerDropItem

import org.bukkit.event.player.PlayerDropItemEvent; //导入方法依赖的package包/类
@EventHandler
public void onPlayerDropItem(PlayerDropItemEvent e) {
	Player p = e.getPlayer();
	if (e.getItemDrop().getItemStack().getItemMeta().hasLore()) {
		if (e.getItemDrop().getItemStack().getItemMeta().getLore().get(0)
				.equals("Fury")
				|| e.getItemDrop().getItemStack().getItemMeta().getLore()
						.get(0).equals("Sheild")
				|| e.getItemDrop().getItemStack().getItemMeta().getLore()
						.get(0).equals("Sprint")
				|| e.getItemDrop().getItemStack().getItemMeta().getLore()
						.get(0).equals("Regen")) {
			e.setCancelled(true);
			p.sendMessage(ChatColor.DARK_RED + "You can't drop this item!");
		}
	}
}
 
开发者ID:ckm499,项目名称:MythsOfCreation,代码行数:18,代码来源:ItemDropListener.java

示例6: onDropItem

import org.bukkit.event.player.PlayerDropItemEvent; //导入方法依赖的package包/类
@EventHandler
public void onDropItem(PlayerDropItemEvent e) {
	if (Main.WaitingPlayers.contains(e.getPlayer()) || Main.PlayingPlayers.contains(e.getPlayer())) {
		if (!(e.getPlayer().hasPermission("cod.dropitem"))) {
			e.setCancelled(true);
		}
	}

	if (CreateArenaCommand.creatingArena.get(e.getPlayer()) == true) {
		e.setCancelled(true);
	}

	if (CreateGunCommand.gunBuilder.get(e.getPlayer()) == true) {
		if (CreateGunCommand.gunBuilderStep.get(e.getPlayer()) >= 7) {
			e.setCancelled(true);
			return;
		}
	}
}
 
开发者ID:frostythedev,项目名称:COD-Warfare,代码行数:20,代码来源:Listeners.java

示例7: onItemDrop

import org.bukkit.event.player.PlayerDropItemEvent; //导入方法依赖的package包/类
@EventHandler
public void onItemDrop(PlayerDropItemEvent event)
{
    RacerHandler racerHandler = plugin.getRacerHandler();
    Racer racer = racerHandler.getRacer(event.getPlayer());
    for (Powerup powerup : plugin.getPowerupsRegistry().getPowerups())
    {
        if (powerup.getItem().getType() == event.getItemDrop().getItemStack().getType() && powerup.getItem().getDurability() == event.getItemDrop().getItemStack().getDurability() && !racer.inventoryIsSpinning())
        {
            powerup.doOnDrop(racerHandler.getRacer(event.getPlayer()), event.getItemDrop());
            if (powerup.cancelledEvents().contains(Powerup.ActionType.DROP) || powerup.cancelledEvents().contains(Powerup.ActionType.ALL))
            {
                event.setCancelled(true);
            }
            else
            {
                event.getItemDrop().setMetadata("whoDropped", new FixedMetadataValue(plugin, event.getPlayer().getUniqueId().toString()));
            }
            return;
        }
        else if (racer.inventoryIsSpinning())
        {
            event.setCancelled(true);
        }
    }
}
 
开发者ID:ColonelHedgehog,项目名称:Equestrian-Dash,代码行数:27,代码来源:PlayerDropItemListener.java

示例8: onDrop

import org.bukkit.event.player.PlayerDropItemEvent; //导入方法依赖的package包/类
@EventHandler
public void onDrop(PlayerDropItemEvent event)
{
    BytecraftPlayer player = plugin.getPlayer(event.getPlayer());
    Location loc = player.getLocation();
    
    ZoneWorld world = plugin.getWorld(loc.getWorld());
    
    Zone zone = world.findZone(loc);
    if(zone == null)return;
    
    if(zone.hasFlag(Flag.CREATIVE)){
        event.setCancelled(true);
        player.sendMessage(ChatColor.RED + "You can't drop items in a creative zone.");
    }
}
 
开发者ID:sabersamus,项目名称:Bytecraft,代码行数:17,代码来源:ZoneListener.java

示例9: onVisitorDrop

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

示例10: DropItem

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

        // Drop item check.
        if (player != null && !player.hasPermission("antibuild.bypass")) {
            if (!player.hasPermission("antibuild.dropitems")) {
                event.setCancelled(true);
                PlayerMessenger.messageHandler(plugin.getConfigHandler().getNoDropItemsMessage(), player);
            }
        }

//        // 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);
//                messageHandler(plugin.getLockedWorldMessage(), player);
//            }
//        }

    }
 
开发者ID:MutinyCraft,项目名称:AntiBuild,代码行数:30,代码来源:ItemDrop.java

示例11: onPlayerDropItem

import org.bukkit.event.player.PlayerDropItemEvent; //导入方法依赖的package包/类
@EventHandler
public void onPlayerDropItem(final PlayerDropItemEvent ev) {
    if (ev.getPlayer().hasMetadata("itemtrader-exit-timestamp")) {
        List<MetadataValue> timestamps = ev.getPlayer().getMetadata("itemtrader-exit-timestamp");

        long timestamp = Long.MIN_VALUE;
        for (MetadataValue value : timestamps) {
            if (value.getOwningPlugin().equals(plugin))
                timestamp = value.asLong();
        }
        ev.getPlayer().removeMetadata("itemtrader-exit-timestamp", plugin);

        if (System.currentTimeMillis() <= timestamp + 1000L) {
            ev.setCancelled(true);
            plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() {

                @SuppressWarnings("deprecation")
                @Override
                public void run() {
                    ev.getPlayer().updateInventory();
                }

            }, 1);
        }
    }
}
 
开发者ID:ase34,项目名称:itemtrader,代码行数:27,代码来源:PlayerListener.java

示例12: onPlayerDropItem

import org.bukkit.event.player.PlayerDropItemEvent; //导入方法依赖的package包/类
@EventHandler(priority = EventPriority.HIGHEST)
public void onPlayerDropItem(PlayerDropItemEvent event)
{
	Item dropped = event.getItemDrop();
	GunPlayer gp = plugin.getGunPlayer(event.getPlayer());
	ItemStack lastHold = gp.getLastHeldItem();
	if (lastHold != null)
	{
		Gun gun = gp.getGun(dropped.getItemStack());
		if (gun != null)
		{
			if (lastHold.getType() == dropped.getItemStack().getType())
			{
				if (gun.isHasClip() && gun.isChanged() && gun.isReloadGunOnDrop())
				{
					gun.reloadGun();
					event.setCancelled(true);
				}
			}
		}
	}
}
 
开发者ID:dmulloy2,项目名称:SwornGuns,代码行数:23,代码来源:PlayerListener.java

示例13: onDropWithItemVisibility

import org.bukkit.event.player.PlayerDropItemEvent; //导入方法依赖的package包/类
@EventHandler(priority=EventPriority.HIGHEST)
public void onDropWithItemVisibility(PlayerDropItemEvent e) {
	Player p = e.getPlayer();
	
	if (ConfigGPlayerVisibility.getConfig().getBoolean("PV.Enable")) {
		if (ConfigGPlayerVisibility.getConfig().getBoolean("PV.Option.Ultimate-Protection-Of-The-Items")) {
			if ((p.getItemInHand().getItemMeta().getDisplayName() == Check) || (p.getItemInHand().getItemMeta().getDisplayName() == CheckTwo)) {
				e.setCancelled(true);
			}
		}
	}
}
 
开发者ID:DianoxDragon,项目名称:UltimateSpawn,代码行数:13,代码来源:CustomJoinItem.java

示例14: onPlayerDropItem

import org.bukkit.event.player.PlayerDropItemEvent; //导入方法依赖的package包/类
@EventHandler
public void onPlayerDropItem(PlayerDropItemEvent 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: onDrop

import org.bukkit.event.player.PlayerDropItemEvent; //导入方法依赖的package包/类
@EventHandler
public void onDrop(PlayerDropItemEvent event) {
    if (isSoulbound(event.getItemDrop().getItemStack())) {
        event.getPlayer().sendMessage(ChatColor.RED + "You cannot drop Soulbound items!");
        event.setCancelled(true);
    }
}
 
开发者ID:edasaki,项目名称:ZentrelaRPG,代码行数:8,代码来源:ItemManager.java


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