Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.ruseps.net.packet.command.impl;
- import com.ruseps.model.Item;
- import com.ruseps.net.packet.command.Command;
- import com.ruseps.net.packet.command.CommandHeader;
- import com.ruseps.sql.requests.NewDonationRequest;
- import com.ruseps.world.World;
- import com.ruseps.world.content.PlayerPanel;
- import com.ruseps.world.content.PlayersOnlineInterface;
- import com.ruseps.world.entity.impl.player.Player;
- import com.teamgames.gamepayments.GamePaymentsResponse;
- import com.teamgames.gamepayments.Transaction;
- @CommandHeader(command = { "claimdonation" }, description = "Claims all the User's current donations.")
- public class ClaimDonation extends Command {
- @Override
- public boolean execute(Player player, String[] args) throws Exception {
- new java.lang.Thread() {
- public void run() {
- try {
- final GamePaymentsResponse gamepaymentsResponse = Transaction.getResponse("GfPlOSuyYQM7HtRT7ATwV0s1NGcuuhX8YYYYYsfYK8UbyAHZeoNZ0cPUBWEeLd8FUdP2Ch3u", player.getUsername());
- Transaction[] transaction = gamepaymentsResponse.getTransactions();
- if (!gamepaymentsResponse.getMessage().equalsIgnoreCase("SUCCESS")) {
- player.getPacketSender().sendMessage(gamepaymentsResponse.getExtendedMessage());
- return;
- }
- for (Transaction transaction1 : transaction) {
- player.getInventory().add(new Item(Integer.parseInt(transaction1.productId), transaction1.quantity));
- }
- for (Transaction transactional : transaction) {
- player.incrementAmountDonated2(transactional.price);
- NewDonationRequest.checkForRankUpdate(player);
- PlayerPanel.refreshPanel(player);
- }
- player.getPacketSender().sendMessage("@blu@Thank you for donating on Vulcan [PS]!");
- World.sendMessage(player.getUsername() + "has just donated to support Vulcan [PS]!" );
- } catch (Exception e) {
- player.getPacketSender().sendMessage("@red@Donating Services are currently offline. Please check back shortly!");
- e.printStackTrace();
- }
- }
- }.start();
- return false;
- }
- @Override
- public String[] getUsage() {
- return new String[] {
- "::claimdonation"
- };
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement