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