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


Java Shopkeeper类代码示例

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


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

示例1: check

import com.nisovin.shopkeepers.Shopkeeper; //导入依赖的package包/类
@Override
public boolean check(String playerID) throws QuestRuntimeException {
	int count = amount.getInt(playerID);
	for (Shopkeeper s : ShopkeepersPlugin.getInstance().getAllShopkeepers()) {
		if (s instanceof PlayerShopkeeper) {
			PlayerShopkeeper ps = (PlayerShopkeeper) s;
			if (ps.getOwner() != null && PlayerConverter.getID(ps.getOwner()).equals(playerID)) {
				count --;
				if (count == 0) {
					return true;
				}
			}
		}
	}
	return false;
}
 
开发者ID:Co0sh,项目名称:BetonQuest,代码行数:17,代码来源:HavingShopCondition.java

示例2: closeAll

import com.nisovin.shopkeepers.Shopkeeper; //导入依赖的package包/类
public void closeAll(Shopkeeper shopkeeper) {
	if (shopkeeper == null) return;
	assert shopkeeper != null;
	Iterator<Entry<String, UISession>> iter = playerSessions.entrySet().iterator();
	while (iter.hasNext()) {
		Entry<String, UISession> entry = iter.next();
		UISession session = entry.getValue();
		if (session.getShopkeeper().equals(shopkeeper)) {
			iter.remove();
			Player player = Bukkit.getPlayerExact(entry.getKey());
			if (player != null) {
				player.closeInventory();
			}
		}
	}
}
 
开发者ID:nisovin,项目名称:Shopkeepers,代码行数:17,代码来源:UIManager.java

示例3: closeAllDelayed

import com.nisovin.shopkeepers.Shopkeeper; //导入依赖的package包/类
public void closeAllDelayed(final Shopkeeper shopkeeper) {
	if (shopkeeper == null) return;

	// deactivate currently active UIs:
	shopkeeper.deactivateUI();

	// delayed because this is/was originally called from inside the PlayerCloseInventoryEvent
	Bukkit.getScheduler().runTaskLater(ShopkeepersPlugin.getInstance(), new Runnable() {
		public void run() {
			closeAll(shopkeeper);

			// reactivate UIs:
			shopkeeper.activateUI();
		}
	}, 1);
}
 
开发者ID:nisovin,项目名称:Shopkeepers,代码行数:17,代码来源:UIManager.java

示例4: onVillagerClick

import com.nisovin.shopkeepers.Shopkeeper; //导入依赖的package包/类
@EventHandler(priority = EventPriority.LOWEST)
public void onVillagerClick(PlayerInteractEntityEvent event) {
	if (!(event.getRightClicked() instanceof Villager)) { return; }
	Villager villager = (Villager) event.getRightClicked();
	
	if (this.module.shopkeepers.isShopkeeper(villager)) {
		Shopkeeper vlg = this.module.shopkeepers.getShopkeeper(villager);
		String vlgId = vlg.getUniqueId().toString();
		
		if(this.module.isVillagerChatter(vlgId)) {
			if(this.module.isEditingVillager(event.getPlayer().getUniqueId())) {
				this.module.transferVillagerMessages(event.getPlayer().getUniqueId().toString(), vlgId);
				
				sendSuccess(event.getPlayer(), "ChatVillager editiert. Chatnachrichten �berschrieben.");
			} 
			else {
				List<String> messages = this.module.getVillagerChatter(vlgId);
				
				for(String msg : messages) {
					sendNeutral(event.getPlayer(), msg);
				}
			}
			
			event.setCancelled(true);
		} 
		else if(this.module.isEditingVillager(event.getPlayer().getUniqueId())) {
			this.module.transferVillagerMessages(event.getPlayer().getUniqueId().toString(), vlgId);
			
			sendSuccess(event.getPlayer(), "Villager zum ChatVillager gemacht. Chatnachrichten �bertragen.");
			
			event.setCancelled(true);
		}
	}
	else if (this.module.isEditingVillager(event.getPlayer().getUniqueId())) {
		sendFailure(event.getPlayer(), "Shopkeepers muss aktiv sein und der Villager muss mindestens ein Shopkeeper sein.");
	}
}
 
开发者ID:Craftolution,项目名称:CraftoPlugin,代码行数:38,代码来源:VillagerChatListener.java

示例5: setActionButtons

import com.nisovin.shopkeepers.Shopkeeper; //导入依赖的package包/类
protected void setActionButtons(Inventory inventory) {
	final Shopkeeper shopkeeper = this.getShopkeeper();
	// TODO restructure this to allow button types to be registered and unregistered (instead of this condition
	// check here)

	if (Settings.enableChestOptionOnPlayerShop && shopkeeper.getType().isPlayerShopType()) {
		// chest button:
		inventory.setItem(8, Settings.createChestButtonItem());
	} else {
		// naming button:
		boolean useNamingButton = false;
		if (!shopkeeper.getType().isPlayerShopType()) {
			useNamingButton = true;
		} else {
			// naming via button enabled?
			if (!Settings.namingOfPlayerShopsViaItem) {
				// no naming button for citizens player shops if renaming is disabled for those
				if (Settings.allowRenamingOfPlayerNpcShops || shopkeeper.getShopObject().getObjectType() != DefaultShopObjectTypes.CITIZEN()) {
					useNamingButton = true;
				}
			}
		}

		if (useNamingButton) {
			inventory.setItem(8, Settings.createNameButtonItem());
		}
	}

	// sub-type cycle button:
	ItemStack typeItem = shopkeeper.getShopObject().getSubTypeItem();
	if (typeItem != null) {
		inventory.setItem(17, Utils.setItemStackNameAndLore(typeItem, Settings.msgButtonType, Settings.msgButtonTypeLore));
	}

	// delete button:
	inventory.setItem(26, Settings.createDeleteButtonItem());
}
 
开发者ID:nisovin,项目名称:Shopkeepers,代码行数:38,代码来源:EditorHandler.java

示例6: openWindow

import com.nisovin.shopkeepers.Shopkeeper; //导入依赖的package包/类
@Override
protected boolean openWindow(Player player) {
	final Shopkeeper shopkeeper = this.getShopkeeper();
	OpenTradeEvent event = new OpenTradeEvent(player, shopkeeper);
	Bukkit.getPluginManager().callEvent(event);
	if (event.isCancelled()) {
		Log.debug("Trade window not opened: cancelled by another plugin");
		return false;
	}

	// create and open trading window:
	String title = this.getInventoryTitle();
	return NMSManager.getProvider().openTradeWindow(title, shopkeeper.getRecipes(), player);
}
 
开发者ID:nisovin,项目名称:Shopkeepers,代码行数:15,代码来源:TradingHandler.java

示例7: getShopkeeper

import com.nisovin.shopkeepers.Shopkeeper; //导入依赖的package包/类
Shopkeeper getShopkeeper(Entity villager) {
	return this.plugin.getShopkeeperByEntity(villager);
}
 
开发者ID:Craftolution,项目名称:CraftoPlugin,代码行数:4,代码来源:ShopkeepersWrapper.java

示例8: HiringHandler

import com.nisovin.shopkeepers.Shopkeeper; //导入依赖的package包/类
protected HiringHandler(UIType uiType, Shopkeeper shopkeeper) {
	super(uiType, shopkeeper);
}
 
开发者ID:nisovin,项目名称:Shopkeepers,代码行数:4,代码来源:HiringHandler.java

示例9: EditorHandler

import com.nisovin.shopkeepers.Shopkeeper; //导入依赖的package包/类
protected EditorHandler(UIType uiType, Shopkeeper shopkeeper) {
	super(uiType, shopkeeper);
}
 
开发者ID:nisovin,项目名称:Shopkeepers,代码行数:4,代码来源:EditorHandler.java

示例10: TradingHandler

import com.nisovin.shopkeepers.Shopkeeper; //导入依赖的package包/类
public TradingHandler(UIType uiType, Shopkeeper shopkeeper) {
	super(uiType, shopkeeper);
}
 
开发者ID:nisovin,项目名称:Shopkeepers,代码行数:4,代码来源:TradingHandler.java

示例11: UISession

import com.nisovin.shopkeepers.Shopkeeper; //导入依赖的package包/类
UISession(Shopkeeper shopkeeper, UIHandler handler) {
	this.shopkeeper = shopkeeper;
	this.uiHandler = handler;
}
 
开发者ID:nisovin,项目名称:Shopkeepers,代码行数:5,代码来源:UISession.java

示例12: getShopkeeper

import com.nisovin.shopkeepers.Shopkeeper; //导入依赖的package包/类
public Shopkeeper getShopkeeper() {
	return shopkeeper;
}
 
开发者ID:nisovin,项目名称:Shopkeepers,代码行数:4,代码来源:UISession.java

示例13: UIHandler

import com.nisovin.shopkeepers.Shopkeeper; //导入依赖的package包/类
protected UIHandler(UIType uiType, Shopkeeper shopkeeper) {
	this.uiType = uiType;
	this.shopkeeper = shopkeeper;
}
 
开发者ID:nisovin,项目名称:Shopkeepers,代码行数:5,代码来源:UIHandler.java

示例14: requestUI

import com.nisovin.shopkeepers.Shopkeeper; //导入依赖的package包/类
public boolean requestUI(String uiIdentifier, Shopkeeper shopkeeper, Player player) {
	UIType uiManager = this.get(uiIdentifier);
	if (uiManager == null) {
		Log.debug("Unknown interface type: " + uiIdentifier);
		return false;
	}

	if (player == null || shopkeeper == null) {
		Log.debug("Cannot open " + uiIdentifier + ": invalid argument(s): null");
		return false;
	}

	UIHandler uiHandler = shopkeeper.getUIHandler(uiIdentifier);
	if (uiHandler == null) {
		Log.debug("Cannot open " + uiIdentifier + ": this shopkeeper is not handling/supporting this type of interface window.");
		return false;
	}

	String playerName = player.getName();
	if (!uiHandler.canOpen(player)) {
		Log.debug("Cannot open " + uiIdentifier + " for '" + playerName + "'.");
		return false;
	}

	UISession oldSession = this.getSession(player);
	// filtering out duplicate open requests:
	if (oldSession != null && oldSession.getShopkeeper().equals(shopkeeper) && oldSession.getUIHandler().equals(uiHandler)) {
		Log.debug(uiIdentifier + " is already opened for '" + playerName + "'.");
		return false;
	}

	Log.debug("Opening " + uiIdentifier + "...");
	boolean isOpen = uiHandler.openWindow(player);
	if (isOpen) {
		Log.debug(uiIdentifier + " opened");
		// old window already should automatically have been closed by the new window.. no need currently, to do
		// that here
		playerSessions.put(playerName, new UISession(shopkeeper, uiHandler));
		return true;
	} else {
		Log.debug(uiIdentifier + " NOT opened");
		return false;
	}
}
 
开发者ID:nisovin,项目名称:Shopkeepers,代码行数:45,代码来源:UIManager.java

示例15: OpenTradeEvent

import com.nisovin.shopkeepers.Shopkeeper; //导入依赖的package包/类
public OpenTradeEvent(Player player, Shopkeeper shopkeeper) {
	this.player = player;
	this.shopkeeper = shopkeeper;
}
 
开发者ID:nisovin,项目名称:Shopkeepers,代码行数:5,代码来源:OpenTradeEvent.java


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