本文整理汇总了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);
}
});
}
示例2: setScoreBoardRegister
import net.samagames.tools.CallBack; //导入依赖的package包/类
public void setScoreBoardRegister(CallBack<CustomNPC> scoreBoardRegister) {
this.scoreBoardRegister = scoreBoardRegister;
}
示例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);