• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java WandUpgradePath类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: getInventoryTitle

import com.elmakers.mine.bukkit.api.wand.WandUpgradePath; //导入依赖的package包/类
protected String getInventoryTitle(CastContext context)
{
    Wand wand = context.getWand();
    WandUpgradePath path = (wand == null ? null : wand.getPath());
    String pathName = (path == null ? null : path.getName());
    if (pathName == null) {
        pathName = "";
    }
    String title = context.getMessage("title", "Shop ($balance)");
    title = title.replace("$path", pathName);
    return title;
}
 
开发者ID:elBukkit,项目名称:MagicLib,代码行数:13,代码来源:BaseShopAction.java


示例2: finish

import com.elmakers.mine.bukkit.api.wand.WandUpgradePath; //导入依赖的package包/类
@Override
public void finish(com.elmakers.mine.bukkit.api.action.CastContext context) {
    SpellResult result = context.getResult();

    // Notify other plugins of this spell cast
    CastEvent castEvent = new CastEvent(mage, this, result);
    Bukkit.getPluginManager().callEvent(castEvent);

    // Message targets
    if (result.isSuccess() && !mage.isQuiet()) {
        messageTargets("cast_player_message");
    }

    // Track cast counts
    if (result.isSuccess() && trackCasts) {
        castCount++;
        if (template != null) {
            template.castCount++;
        }

        // Reward SP
        Wand wand = context.getWand();
        WandUpgradePath path = wand == null ? null : wand.getPath();
        if (earns > 0 && wand != null && path != null && path.earnsSP() && controller.isSPEnabled() && !mage.isAtMaxSkillPoints()) {
            long now = System.currentTimeMillis();
            int scaledEarn = earns;
            if (lastEarn > 0 && earnCooldown > 0 && now < lastEarn + earnCooldown) {
                scaledEarn = (int)Math.floor((double)earns * (now - lastEarn) / earnCooldown);
                if (scaledEarn > 0) {
                    context.playEffects("earn_scaled_sp");
                }
            } else {
                context.playEffects("earn_sp");
            }
            if (scaledEarn > 0) {
                mage.addSkillPoints(scaledEarn);
                lastEarn = now;
            }
        }

        // Check for level up
        // This currently only works on wands.
        if (wand != null && !wand.isLocked() && controller.isSpellUpgradingEnabled() && wand.getSpellLevel(spellKey.getKey()) == spellKey.getLevel())
        {
            SpellTemplate upgrade = getUpgrade();
            long requiredCasts = getRequiredUpgradeCasts();
            if (upgrade != null && requiredCasts > 0 && getCastCount() >= requiredCasts)
            {
                String upgradePath = getRequiredUpgradePath();
                WandUpgradePath currentPath = wand.getPath();
                if (upgradePath == null || upgradePath.isEmpty() || (currentPath != null && currentPath.hasPath(upgradePath)))
                {
                    Spell newSpell = mage.getSpell(upgrade.getKey());
                    if (isActive()) {
                        deactivate(true, true);
                        if (newSpell != null && newSpell instanceof MageSpell) {
                            ((MageSpell)newSpell).activate();
                        }
                    }
                    wand.addSpell(upgrade.getKey());
                    Messages messages = controller.getMessages();
                    String levelDescription = upgrade.getLevelDescription();
                    if (levelDescription == null || levelDescription.isEmpty()) {
                        levelDescription = upgrade.getName();
                    }
                    playEffects("upgrade");
                    mage.sendMessage(messages.get("wand.spell_upgraded").replace("$name", upgrade.getName()).replace("$wand", getName()).replace("$level", levelDescription));
                    mage.sendMessage(upgrade.getUpgradeDescription().replace("$name", upgrade.getName()));

                    SpellUpgradeEvent upgradeEvent = new SpellUpgradeEvent(mage, wand, this, newSpell);
                    Bukkit.getPluginManager().callEvent(upgradeEvent);
                }
            }
        }
    }
}
 
开发者ID:elBukkit,项目名称:MagicLib,代码行数:77,代码来源:BaseSpell.java


示例3: showItems

import com.elmakers.mine.bukkit.api.wand.WandUpgradePath; //导入依赖的package包/类
public SpellResult showItems(CastContext context, List<ShopItem> items) {
       Mage mage = context.getMage();
       this.context = context;
	Player player = mage.getPlayer();
	if (player == null) {
           return SpellResult.PLAYER_REQUIRED;
       }

       this.showingItems = new HashMap<Integer, ShopItem>();

       // Load items
       itemStacks = new ArrayList<ItemStack>();
       String costString = context.getMessage("cost_lore", "Costs: $cost");
       for (ShopItem shopItem : items) {
           int currentSlot = itemStacks.size();
           if (shopItem == null) {
               this.showingItems.put(currentSlot, null);
               itemStacks.add(new ItemStack(Material.AIR));
               continue;
           }
           ItemStack item = InventoryUtils.getCopy(shopItem.getItem());
           if (item == null) continue;

           ItemMeta meta = item.getItemMeta();
           if (meta == null) {
               itemStacks.add(item);
               continue;
           }
           List<String> lore = meta.getLore();
           if (lore == null) {
               lore = new ArrayList<String>();
           }
           String costs = costString.replace("$cost", getItemCost(context, shopItem));
           lore.add(ChatColor.GOLD + costs);
           meta.setLore(lore);
           item.setItemMeta(meta);
           item = InventoryUtils.makeReal(item);
           InventoryUtils.setMeta(item, "shop", Integer.toString(currentSlot));
           if (showConfirmation) {
               InventoryUtils.setMeta(item, "confirm", "true");
           }
           this.showingItems.put(currentSlot, shopItem);
           itemStacks.add(item);
       }

       if (itemStacks.size() == 0) {
           Wand wand = mage.getActiveWand();
           if (wand != null && autoUpgrade) {
               com.elmakers.mine.bukkit.api.wand.WandUpgradePath path = wand.getPath();
               WandUpgradePath nextPath = path != null ? path.getUpgrade(): null;
               if (nextPath != null && path.checkUpgradeRequirements(wand, null) && !path.canEnchant(wand)) {
                   path.upgrade(wand, mage);
                   return SpellResult.CAST;
               }
           }
           context.showMessage("no_items", "There is nothing for you to buy here");
           return SpellResult.FAIL;
       }
       Inventory displayInventory = getInventory(context);
       mage.activateGUI(this, displayInventory);

       return SpellResult.CAST;
}
 
开发者ID:elBukkit,项目名称:MagicLib,代码行数:64,代码来源:BaseShopAction.java


示例4: WandUpgradeEvent

import com.elmakers.mine.bukkit.api.wand.WandUpgradePath; //导入依赖的package包/类
public WandUpgradeEvent(Mage mage, Wand wand, WandUpgradePath oldPath, WandUpgradePath newPath) {
    this.mage = mage;
    this.wand = wand;
    this.oldPath = oldPath;
    this.newPath = newPath;
}
 
开发者ID:elBukkit,项目名称:MagicAPI,代码行数:7,代码来源:WandUpgradeEvent.java


示例5: getOldPath

import com.elmakers.mine.bukkit.api.wand.WandUpgradePath; //导入依赖的package包/类
public WandUpgradePath getOldPath() {
    return oldPath;
}
 
开发者ID:elBukkit,项目名称:MagicAPI,代码行数:4,代码来源:WandUpgradeEvent.java


示例6: getNewPath

import com.elmakers.mine.bukkit.api.wand.WandUpgradePath; //导入依赖的package包/类
public WandUpgradePath getNewPath() {
    return newPath;
}
 
开发者ID:elBukkit,项目名称:MagicAPI,代码行数:4,代码来源:WandUpgradeEvent.java


示例7: getBoundWandPath

import com.elmakers.mine.bukkit.api.wand.WandUpgradePath; //导入依赖的package包/类
public WandUpgradePath getBoundWandPath(String templateKey); 
开发者ID:elBukkit,项目名称:MagicAPI,代码行数:2,代码来源:Mage.java


示例8: getPath

import com.elmakers.mine.bukkit.api.wand.WandUpgradePath; //导入依赖的package包/类
public WandUpgradePath getPath(String key); 
开发者ID:elBukkit,项目名称:MagicAPI,代码行数:2,代码来源:MageController.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java DoneCallback类代码示例发布时间:2022-05-16
下一篇:
Java ClientSession类代码示例发布时间:2022-05-16
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap