Initial release v1.0.0
This commit is contained in:
commit
3fef65b903
314 files changed
+27448
No files matched your search
@@ -0,0 +1,74 @@
|
||||
package com.rsscripting.rswarehouse.item;
|
||||
|
||||
import com.rsscripting.rswarehouse.session.TransactionSession;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import com.rsscripting.rswarehouse.item.itemdao.ItemDAO;
|
||||
|
||||
public class TransactionConfirmHandler {
|
||||
|
||||
public static boolean handle(
|
||||
Player player,
|
||||
TransactionSession itemSession,
|
||||
ItemStack item,
|
||||
int amount
|
||||
) {
|
||||
|
||||
if (amount == 0) {
|
||||
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
if (amount > 0) {
|
||||
|
||||
ItemStack depositItem =
|
||||
item.clone();
|
||||
|
||||
depositItem.setAmount(
|
||||
1
|
||||
);
|
||||
|
||||
if (
|
||||
TransactionUtils.removeItems(
|
||||
player,
|
||||
depositItem,
|
||||
amount
|
||||
)
|
||||
) {
|
||||
|
||||
ItemDAO.addItem(
|
||||
player.getUniqueId()
|
||||
.toString(),
|
||||
player.getName(),
|
||||
depositItem,
|
||||
amount
|
||||
);
|
||||
|
||||
player.sendMessage(
|
||||
"§aYou have deposited "
|
||||
+ amount
|
||||
+ " items."
|
||||
);
|
||||
|
||||
itemSession.setAmount(
|
||||
0
|
||||
);
|
||||
|
||||
TransactionAmountMenu.open(
|
||||
player,
|
||||
itemSession.getWarehouseItemId(),
|
||||
0
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user