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


Java ChangeInventoryEvent.Pickup方法代码示例

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


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

示例1: pickupItem

import org.spongepowered.api.event.item.inventory.ChangeInventoryEvent; //导入方法依赖的package包/类
@Listener(order = Order.POST)
@Exclude({ChangeInventoryEvent.Pickup.Pre.class})
public void pickupItem(ChangeInventoryEvent.Pickup event, @Root Player player) {
    List<SlotTransaction> transactions = event.getTransactions();

    if (transactions.isEmpty()) {
        return;
    }

    int itemQuantity = transactions.get(0).getFinal().getQuantity() - transactions.get(0).getOriginal().getQuantity();
    // Sometimes it's 0 for some odd reason
    if (itemQuantity == 0) {
        return;
    }

    processEvent(event, player, itemQuantity);
}
 
开发者ID:BadgeUp,项目名称:badgeup-sponge-client,代码行数:18,代码来源:GeneralEventListener.java

示例2: onPickupItem

import org.spongepowered.api.event.item.inventory.ChangeInventoryEvent; //导入方法依赖的package包/类
@Listener
public void onPickupItem(ChangeInventoryEvent.Pickup event, @Root Player player)
{
	if (!player.hasPermission("essentialcmds.blacklist.bypass"))
	{
		for (SlotTransaction transaction : event.getTransactions())
		{
			if (Utils.getBlacklistItems().contains(transaction.getFinal().createStack().getItem().getId()))
			{
				if (Utils.areBlacklistMsgsEnabled())
					player.sendMessage(Text.of(TextColors.RED, "The item ", TextColors.GRAY, transaction.getFinal().createStack().getItem().getId(), TextColors.RED, " has been confiscated as it is blacklisted."));

				transaction.setCustom(Sponge.getRegistry().createBuilder(ItemStack.Builder.class).itemType(ItemTypes.DIRT).quantity(1).build());
			}
		}
	}
}
 
开发者ID:hsyyid,项目名称:EssentialCmds,代码行数:18,代码来源:BlacklistListener.java

示例3: onPlayerItemPickUp

import org.spongepowered.api.event.item.inventory.ChangeInventoryEvent; //导入方法依赖的package包/类
@Listener
public void onPlayerItemPickUp(ChangeInventoryEvent.Pickup event, @First Player player) {
	if (!Config.Values.Synchronize.getEnableInventory())
		return;

	synchronized (waitingPlayers) {
		if (waitingPlayers.containsKey(player.getUniqueId())) {
			event.setCancelled(true);
		}
	}
}
 
开发者ID:AuraDevelopmentTeam,项目名称:InvSync,代码行数:12,代码来源:PlayerEvents.java

示例4: onPickupItem

import org.spongepowered.api.event.item.inventory.ChangeInventoryEvent; //导入方法依赖的package包/类
@Listener
public void onPickupItem(ChangeInventoryEvent.Pickup event, @First Player player)
{
    if (module.isHidden(player) && !player.hasPermission(module.perms().PICKUP.getId()))
    {
        event.setCancelled(true);
    }
}
 
开发者ID:CubeEngine,项目名称:modules-extra,代码行数:9,代码来源:HideListener.java

示例5: onPickup

import org.spongepowered.api.event.item.inventory.ChangeInventoryEvent; //导入方法依赖的package包/类
@Listener
public void onPickup(ChangeInventoryEvent.Pickup event, @First Player p) {
    ModuleConfig config = Modules.BLACKLIST.get().getConfig().get();
    CommentedConfigurationNode hnode = config.get();
    Item item = event.getTargetEntity();
    CommentedConfigurationNode node = hnode.getNode("items", item.getItemType().getId());
    if (!node.isVirtual()) {
        if (node.getNode("deny-drop").getBoolean()) {
            event.setCancelled(true);
        }
    }
}
 
开发者ID:Bammerbom,项目名称:UltimateCore,代码行数:13,代码来源:ItemListener.java

示例6: onPickup

import org.spongepowered.api.event.item.inventory.ChangeInventoryEvent; //导入方法依赖的package包/类
@Listener
public void onPickup(ChangeInventoryEvent.Pickup event, @First Player p) {
    UltimateUser up = UltimateCore.get().getUserService().getUser(p);
    if (!up.get(VanishKeys.VANISH).get()) {
        return;
    }
    ModuleConfig config = Modules.VANISH.get().getConfig().get();
    if (!config.get().getNode("events", "pickup").getBoolean()) {
        event.setCancelled(true);
    }
}
 
开发者ID:Bammerbom,项目名称:UltimateCore,代码行数:12,代码来源:VanishListener.java

示例7: onChangeInventoryPickup

import org.spongepowered.api.event.item.inventory.ChangeInventoryEvent; //导入方法依赖的package包/类
@Listener
public void onChangeInventoryPickup(ChangeInventoryEvent.Pickup event, @Root @Has(ViewerData.class) Player player) {
    event.setCancelled(true);
}
 
开发者ID:Lergin,项目名称:Vigilate,代码行数:5,代码来源:PickUpListener.java

示例8: onPlayerItemPickup

import org.spongepowered.api.event.item.inventory.ChangeInventoryEvent; //导入方法依赖的package包/类
@Listener(order = Order.FIRST, beforeModifications = true)
public void onPlayerItemPickup(ChangeInventoryEvent.Pickup pickupItemEvent, @Root Player player) {
    checkLoginStatus(pickupItemEvent, player);
}
 
开发者ID:games647,项目名称:FlexibleLogin,代码行数:5,代码来源:PreventListener.java

示例9: onItemPickup

import org.spongepowered.api.event.item.inventory.ChangeInventoryEvent; //导入方法依赖的package包/类
/**
 * Saves event records when a player picks up an item.
 *
 * @param event Pickup event.
 */
@Listener(order = Order.POST)
public void onItemPickup(final ChangeInventoryEvent.Pickup event, @Root Player player) {
    PrismRecord.create().player(player).pickedUp(event.getTargetEntity()).save();
}
 
开发者ID:prism,项目名称:Prism,代码行数:10,代码来源:ChangeInventoryListener.java


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