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


Java InventoryDragEvent.setResult方法代码示例

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


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

示例1: equipWeaponEvent

import org.bukkit.event.inventory.InventoryDragEvent; //导入方法依赖的package包/类
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
public void equipWeaponEvent(InventoryDragEvent event) {
	if (Result.DENY.equals(event.getResult())) return;
	HumanEntity human = event.getWhoClicked();
	
	Inventory inv = event.getInventory();
	ItemStack prior = event.getOldCursor();
	StandardGun priorGun = findGun(prior); 
	
	// Don't really care what sort of drag, if we have a gun in inv and this was a gun, deny.
	if (priorGun != null && inv != null && !InventoryType.PLAYER.equals(inv.getType()) && priorGun.isLimitToOne() && priorGun.hasGun(human)) {
		event.setResult(Result.DENY);
		// yes this will prevent drag style of weapon in chest invs. Oh well.
	}
	
}
 
开发者ID:ProgrammerDan,项目名称:AddGun,代码行数:17,代码来源:Guns.java

示例2: equipWeaponEvent

import org.bukkit.event.inventory.InventoryDragEvent; //导入方法依赖的package包/类
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
public void equipWeaponEvent(InventoryDragEvent event) {
	if (!enabled) return;
	HumanEntity human = event.getWhoClicked();
	boolean alreadyHasGun = hasGun(human);
	
	Inventory inv = event.getInventory();
	ItemStack prior = event.getOldCursor();
	
	// Don't really care what sort of drag, if we have a gun in inv and this was a gun, deny.
	if (alreadyHasGun && (inv != null && !InventoryType.PLAYER.equals(inv.getType()))
			&& (prior != null && isGun(prior))) {
		event.setResult(Result.DENY);
		// yes this will prevent drag style of weapon in chest invs. Oh well.
	}
	
}
 
开发者ID:ProgrammerDan,项目名称:AddGun,代码行数:18,代码来源:RailGun.java

示例3: onInventoryDrag

import org.bukkit.event.inventory.InventoryDragEvent; //导入方法依赖的package包/类
@EventHandler (priority = EventPriority.HIGHEST)
public void onInventoryDrag(InventoryDragEvent e){
	if(!isEnabled(e.getWhoClicked().getWorld()) || 
			e.getInventory().getType() != InventoryType.CRAFTING ||
			!e.getInventorySlots().contains(40)) return;

	if(shouldWeCancel(e.getOldCursor())){
		e.setResult(Event.Result.DENY);
		e.setCancelled(true);
	}
}
 
开发者ID:gvlfm78,项目名称:BukkitOldCombatMechanics,代码行数:12,代码来源:ModuleDisableOffHand.java

示例4: onInventoryDrag

import org.bukkit.event.inventory.InventoryDragEvent; //导入方法依赖的package包/类
@EventHandler
public void onInventoryDrag(InventoryDragEvent e) {
	if (e == null) return;
	if (e.getInventory() == null) return;
	if (e.getInventory().getTitle() == null) return;
	if (e.getInventory().getTitle().equals(CC(Main.finalconfig.getString("atm_title")))) {
		e.setResult(Result.DENY);
	}
}
 
开发者ID:mastercake10,项目名称:TimeIsMoney,代码行数:10,代码来源:ATM.java

示例5: onInventoryDrag

import org.bukkit.event.inventory.InventoryDragEvent; //导入方法依赖的package包/类
@EventHandler
public void onInventoryDrag(InventoryDragEvent e) {
	if(controller.isPlaying()
			&& e.getOldCursor().getType() == Material.EYE_OF_ENDER) {
		int size = e.getInventory().getSize();
		for(int slot : e.getRawSlots()) {
			if(slot < size) {
				e.setResult(Result.DENY);
				break;
			}
		}
	}
}
 
开发者ID:kyriog,项目名称:rftd,代码行数:14,代码来源:InventoryListener.java

示例6: onItemDrag

import org.bukkit.event.inventory.InventoryDragEvent; //导入方法依赖的package包/类
@EventHandler
public void onItemDrag(final InventoryDragEvent event) {
	if (event.getInventory() != null && event.getInventory().equals(this.inventory) && event.getWhoClicked() instanceof Player) {
		event.setCancelled(true);
		event.setResult(Result.DENY);
	}
}
 
开发者ID:Craftolution,项目名称:CraftoPlugin,代码行数:8,代码来源:Menu.java


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