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


Java CallBack类代码示例

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


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

示例1: addItem

import net.samagames.tools.CallBack; //导入依赖的package包/类
@Override
public void addItem(int itemID, int priceCoins, int priceStars, boolean selected, CallBack<Boolean> callBack)
{
    PlayerData playerData = api.getPlayerManager().getPlayerData(uuid);
    Transaction transactionItem = new Transaction();
    transactionItem.setItemId(itemID);
    transactionItem.setPriceCoins(priceCoins);
    transactionItem.setPriceStars(priceStars);
    transactionItem.setSelected(selected);
    transactionItem.setUuidBuyer(uuid);

    //Directly update in base for security
    api.getPlugin().getExecutor().execute(() -> {
        try {
            api.getGameServiceManager().createTransaction(playerData.getPlayerBean(), transactionItem);
            //May be optimised
            refresh(true);
            if (callBack != null)
                callBack.done(true, null);
        } catch (Exception e) {
            if (callBack != null)
                callBack.done(false, e);
        }
    });
}
 
开发者ID:SamaGames,项目名称:SamaGamesCore,代码行数:26,代码来源:PlayerShop.java

示例2: setScoreBoardRegister

import net.samagames.tools.CallBack; //导入依赖的package包/类
public void setScoreBoardRegister(CallBack<CustomNPC> scoreBoardRegister) {
    this.scoreBoardRegister = scoreBoardRegister;
}
 
开发者ID:SamaGames,项目名称:SamaGamesAPI,代码行数:4,代码来源:NPCManager.java

示例3: addItem

import net.samagames.tools.CallBack; //导入依赖的package包/类
/**
 * Add an item with transaction to player
 * @param itemID id of the item
 * @param priceCoins the paid price in coins of the transaction
 * @param priceStars the paid price in stars of the transaction
 * @param selected is this item selected (you need to unselect other item if there is a hierarchy)
 * @param callBack The callback executed at the end of the database update
 * @return
 */
void addItem(int itemID, int priceCoins, int priceStars, boolean selected, CallBack<Boolean> callBack);
 
开发者ID:SamaGames,项目名称:SamaGamesAPI,代码行数:11,代码来源:IPlayerShop.java


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