本文整理汇总了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;
}
示例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();
}
}
}
}
示例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);
}
示例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.");
}
}
示例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());
}
示例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);
}
示例7: getShopkeeper
import com.nisovin.shopkeepers.Shopkeeper; //导入依赖的package包/类
Shopkeeper getShopkeeper(Entity villager) {
return this.plugin.getShopkeeperByEntity(villager);
}
示例8: HiringHandler
import com.nisovin.shopkeepers.Shopkeeper; //导入依赖的package包/类
protected HiringHandler(UIType uiType, Shopkeeper shopkeeper) {
super(uiType, shopkeeper);
}
示例9: EditorHandler
import com.nisovin.shopkeepers.Shopkeeper; //导入依赖的package包/类
protected EditorHandler(UIType uiType, Shopkeeper shopkeeper) {
super(uiType, shopkeeper);
}
示例10: TradingHandler
import com.nisovin.shopkeepers.Shopkeeper; //导入依赖的package包/类
public TradingHandler(UIType uiType, Shopkeeper shopkeeper) {
super(uiType, shopkeeper);
}
示例11: UISession
import com.nisovin.shopkeepers.Shopkeeper; //导入依赖的package包/类
UISession(Shopkeeper shopkeeper, UIHandler handler) {
this.shopkeeper = shopkeeper;
this.uiHandler = handler;
}
示例12: getShopkeeper
import com.nisovin.shopkeepers.Shopkeeper; //导入依赖的package包/类
public Shopkeeper getShopkeeper() {
return shopkeeper;
}
示例13: UIHandler
import com.nisovin.shopkeepers.Shopkeeper; //导入依赖的package包/类
protected UIHandler(UIType uiType, Shopkeeper shopkeeper) {
this.uiType = uiType;
this.shopkeeper = shopkeeper;
}
示例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;
}
}
示例15: OpenTradeEvent
import com.nisovin.shopkeepers.Shopkeeper; //导入依赖的package包/类
public OpenTradeEvent(Player player, Shopkeeper shopkeeper) {
this.player = player;
this.shopkeeper = shopkeeper;
}