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


Java InventoryInteractEvent类代码示例

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


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

示例1: onInventoryMoveItem

import org.bukkit.event.inventory.InventoryInteractEvent; //导入依赖的package包/类
@EventHandler
public void onInventoryMoveItem(InventoryInteractEvent event) {
	//System.out.println("E");
	
	if (openchests.containsKey(event.getInventory())) {
		System.out.println("move");
		openchests.get(event.getInventory()).getInventory().setContents(event.getInventory().getContents());
		openchests.remove(event.getInventory());
	} else {
		for (int i = 0; i < openchests.size(); i++) {
			Chest c = ((List<Chest>) openchests.values()).get(i);
			if (c.getInventory().equals(event.getInventory())) {
				((List<Inventory>) openchests.keySet()).get(i).setContents(event.getInventory().getContents());
			}
		}
	}
}
 
开发者ID:GigaGamma,项目名称:McLink,代码行数:18,代码来源:ActionBind.java

示例2: BasicMenu

import org.bukkit.event.inventory.InventoryInteractEvent; //导入依赖的package包/类
public BasicMenu(final Minigame minigame, int rows, String title, final EventListener<InventoryClickEvent> onClick) {
	Validate.notNull(minigame, "Minigame cannot be null");
	Validate.isTrue(rows >= 1 && rows <= 9, "Rows must be an integer between 1-9, inclusive");
	this.size = rows * 9;
	if (title == null)
		title = "";
	this.inv = Bukkit.createInventory(null, size, title);
	if (onClick != null) {
		minigame.listenEvent(new EventListener<InventoryInteractEvent>() {
			@Override
			public void onEvent(InventoryInteractEvent event) {
				HumanEntity human = event.getWhoClicked();
				if (!(human instanceof Player) || !minigame.isPlaying(((Player) human)))
					return;
				if (!(event instanceof InventoryClickEvent)) {
					event.setCancelled(true);
					return;
				}
				InventoryClickEvent e = (InventoryClickEvent) event;
				if (inv.equals(e.getClickedInventory()))
					onClick.onEvent(e);
			}
		});
	}
}
 
开发者ID:DonkeyCore,项目名称:MinigameManager,代码行数:26,代码来源:BasicMenu.java

示例3: onInteract

import org.bukkit.event.inventory.InventoryInteractEvent; //导入依赖的package包/类
@EventHandler
public void onInteract(InventoryInteractEvent e) {
    if(GUIWindow.windows.containsKey(e.getInventory().getTitle())){
        e.setResult(Event.Result.DENY);
        e.setCancelled(true);
    }
}
 
开发者ID:MusicalCreeper01,项目名称:SpigotItemGenerator,代码行数:8,代码来源:GUIListener.java

示例4: onInventoryInteract

import org.bukkit.event.inventory.InventoryInteractEvent; //导入依赖的package包/类
@EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST)
public void onInventoryInteract(InventoryInteractEvent e) {
    Player player = (Player) e.getWhoClicked();
    if (plugin.pm.isGhost(player)) {
        e.setCancelled(true);
        player.closeInventory();
    }

}
 
开发者ID:ddonofrio,项目名称:libelula,代码行数:10,代码来源:EventManager.java

示例5: onInventoryInteract

import org.bukkit.event.inventory.InventoryInteractEvent; //导入依赖的package包/类
@EventHandler
public void onInventoryInteract(InventoryInteractEvent event) {
	Player clicker = (Player) event.getWhoClicked();
	Inventory view = event.getInventory();
	 if ((view.equals(clicker))) {
		 event.setCancelled(true);
	 }
}
 
开发者ID:ProjectRixor,项目名称:Rixor,代码行数:9,代码来源:FilterEvents.java

示例6: onInventoryInteract

import org.bukkit.event.inventory.InventoryInteractEvent; //导入依赖的package包/类
@EventHandler
public void onInventoryInteract(InventoryInteractEvent event)
{
    if (!event.getWhoClicked().isOp())
        event.setCancelled(true);
}
 
开发者ID:SamaGames,项目名称:Hub,代码行数:7,代码来源:PlayerListener.java

示例7: PagedMenu

import org.bukkit.event.inventory.InventoryInteractEvent; //导入依赖的package包/类
public PagedMenu(final MinigameShell minigame, int pageRows, int pages, String title, final ItemStack backItem, final ItemStack nextItem, final EventListener<InventoryClickEvent> onClick) {
	Validate.notNull(minigame, "Minigame cannot be null");
	Validate.isTrue(pageRows > 0 && pageRows <= 9, "There must be between 1-9 rows, inclusive, per page");
	Validate.isTrue(pages > 0, "There must be at least 1 page");
	if (title == null)
		title = "";
	Validate.notNull(backItem, "The \"back\" item cannot be null");
	Validate.notNull(nextItem, "The \"next\" item cannot be null");
	this.invs = new Inventory[pages];
	this.backItem = backItem;
	this.nextItem = nextItem;
	this.shell = minigame;
	for (int i = 0; i < pages; i++)
		this.invs[i] = Bukkit.createInventory(null, pageRows * 9, String.format(title, i + 1));
	if (onClick != null) {
		EventListener<InventoryInteractEvent> listener = new EventListener<InventoryInteractEvent>() {
			@Override
			public void onEvent(InventoryInteractEvent event) {
				HumanEntity human = event.getWhoClicked();
				if (minigame != null && minigame instanceof Minigame)
					if (!(human instanceof Player) || !((Minigame) minigame).isPlaying(((Player) human)))
						return;
				if (!(event instanceof InventoryClickEvent)) {
					event.setCancelled(true);
					return;
				}
				InventoryClickEvent e = (InventoryClickEvent) event;
				for (int i = 0; i < invs.length; i++) {
					if (invs[i].equals(e.getClickedInventory())) {
						ItemStack item = e.getCurrentItem();
						Player player = (Player) human;
						if (backItem.equals(item))
							player.openInventory(invs[i - 1]);
						else if (nextItem.equals(item))
							player.openInventory(invs[i + 1]);
						else
							onClick.onEvent(e);
					}
				}
			}
		};
		// if we have a minigame instance, lets create the menu listeners based off of it 
		if (minigame instanceof Minigame)
			((Minigame) minigame).listenEvent(listener);
		else
			// otherwise, we can use a generic empty shell (warning: persists until plugin deactivates!!!!!)
			MinigameManager.getMinigameManager().addListener(shell, InventoryInteractEvent.class, listener);
	}
}
 
开发者ID:DonkeyCore,项目名称:MinigameManager,代码行数:50,代码来源:PagedMenu.java

示例8: onInventoryInteract

import org.bukkit.event.inventory.InventoryInteractEvent; //导入依赖的package包/类
@EventHandler
public void onInventoryInteract(InventoryInteractEvent event) {
    if (event.getInventory().getHolder() instanceof Block) {
        processEvent(event, (Player) event.getWhoClicked());
    }
}
 
开发者ID:caseif,项目名称:Steel,代码行数:7,代码来源:PlayerWorldListener.java

示例9: onInventoryAction

import org.bukkit.event.inventory.InventoryInteractEvent; //导入依赖的package包/类
@EventHandler
public void onInventoryAction(final InventoryInteractEvent event) {
    if (event.getInventory().getHolder() instanceof InfoInventory) {
        event.setResult(Event.Result.DENY);
    }
}
 
开发者ID:Mayomi,项目名称:PlotSquared-Chinese,代码行数:7,代码来源:InventoryListener.java

示例10: onInventoryInteract

import org.bukkit.event.inventory.InventoryInteractEvent; //导入依赖的package包/类
public void onInventoryInteract(InventoryInteractEvent event) {
	event.setCancelled(true);
}
 
开发者ID:EstiNet,项目名称:gFeatures,代码行数:4,代码来源:EventHub.java

示例11: eventTrigger

import org.bukkit.event.inventory.InventoryInteractEvent; //导入依赖的package包/类
@Override
public void eventTrigger(Event event) {
	if(event.getEventName().equalsIgnoreCase("playerjoinevent")){
		eh.onPlayerJoin((PlayerJoinEvent)event);
	}
	else if(event.getEventName().equalsIgnoreCase("playerdropitemevent")){
		eh.onPlayerDrop((PlayerDropItemEvent)event);
	}
	else if(event.getEventName().equalsIgnoreCase("playerinteractevent")){
		eh.onPlayerInteract((PlayerInteractEvent)event);
	}
	else if(event.getEventName().equalsIgnoreCase("inventoryclickevent")){
		eh.onInventoryClick((InventoryClickEvent)event);
	}
	else if(event.getEventName().equalsIgnoreCase("playertoggleflightevent")){
		eh.onPlayerToggleFlight((PlayerToggleFlightEvent)event);
	}
	else if(event.getEventName().equalsIgnoreCase("playermoveevent")){
		eh.onPlayerMove((PlayerMoveEvent)event);
	}
	else if(event.getEventName().equalsIgnoreCase("playerdropitemevent")){
		eh.onPlayerDrop((PlayerDropItemEvent) event);
	}
	else if(event.getEventName().equalsIgnoreCase("playerinteractentityevent")){
		eh.onPlayerInteractEntity((PlayerInteractEntityEvent) event);
	}
	else if(event.getEventName().equalsIgnoreCase("entitydamagebyentityevent")){
		eh.onEntityDamageByEntity((EntityDamageByEntityEvent) event);
	}
	else if(event.getEventName().equalsIgnoreCase("playerquitevent")){
		eh.onPlayerLeave((PlayerQuitEvent) event);
	}
	else if(event.getEventName().equalsIgnoreCase("foodlevelchangeevent")){
		eh.onFoodLevelChange((FoodLevelChangeEvent) event);
	}
	else if(event.getEventName().equalsIgnoreCase("entitydamageevent")){
		eh.onEntityDamage((EntityDamageEvent) event);
	}
	else if(event.getEventName().equalsIgnoreCase("weatherchangeevent")){
		eh.onWeatherChange((WeatherChangeEvent) event);
	}
	else if(event.getEventName().equalsIgnoreCase("inventoryinteractevent")){
		eh.onInventoryInteract((InventoryInteractEvent) event);
	}
	else if(event.getEventName().equalsIgnoreCase("worldloadevent")){
		eh.onWorldLoad((WorldLoadEvent) event);
	}
}
 
开发者ID:EstiNet,项目名称:gFeatures,代码行数:49,代码来源:gHub.java

示例12: onInteract

import org.bukkit.event.inventory.InventoryInteractEvent; //导入依赖的package包/类
public void onInteract(InventoryInteractEvent e) {

        if (e.getWhoClicked() instanceof Player) {
            e.getWhoClicked().getLocation().getWorld().getName();
        }

    }
 
开发者ID:Relicum,项目名称:SuperSkyBros,代码行数:8,代码来源:InventoryInteract.java


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