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