Advertisement
Guest User

Untitled

a guest
Dec 8th, 2019
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.49 KB | None | 0 0
  1. package com.ruseps.net.packet.command.impl;
  2.  
  3. import com.ruseps.model.Item;
  4. import com.ruseps.net.packet.command.Command;
  5. import com.ruseps.net.packet.command.CommandHeader;
  6. import com.ruseps.sql.requests.NewDonationRequest;
  7. import com.ruseps.world.World;
  8. import com.ruseps.world.content.PlayerPanel;
  9. import com.ruseps.world.content.PlayersOnlineInterface;
  10. import com.ruseps.world.entity.impl.player.Player;
  11. import com.teamgames.gamepayments.GamePaymentsResponse;
  12. import com.teamgames.gamepayments.Transaction;
  13.  
  14.  
  15. @CommandHeader(command = { "claimdonation" }, description = "Claims all the User's current donations.")
  16. public class ClaimDonation extends Command {
  17.  
  18.     @Override
  19.     public boolean execute(Player player, String[] args) throws Exception {
  20.      
  21.             new java.lang.Thread() {
  22.                 public void run() {
  23.                     try {
  24.                         final GamePaymentsResponse gamepaymentsResponse = Transaction.getResponse("GfPlOSuyYQM7HtRT7ATwV0s1NGcuuhX8YYYYYsfYK8UbyAHZeoNZ0cPUBWEeLd8FUdP2Ch3u", player.getUsername());
  25.                         Transaction[] transaction = gamepaymentsResponse.getTransactions();
  26.                         if (!gamepaymentsResponse.getMessage().equalsIgnoreCase("SUCCESS")) {
  27.                             player.getPacketSender().sendMessage(gamepaymentsResponse.getExtendedMessage());
  28.                             return;
  29.                         }
  30.                         for (Transaction transaction1 : transaction) {
  31.                             player.getInventory().add(new Item(Integer.parseInt(transaction1.productId), transaction1.quantity));
  32.                         }
  33.                         for (Transaction transactional : transaction) {
  34.                         player.incrementAmountDonated2(transactional.price);
  35.                         NewDonationRequest.checkForRankUpdate(player);
  36.                         PlayerPanel.refreshPanel(player);
  37.                         }
  38.                         player.getPacketSender().sendMessage("@blu@Thank you for donating on Vulcan [PS]!");
  39.                         World.sendMessage(player.getUsername() + "has just donated to support Vulcan [PS]!" );
  40.                     } catch (Exception e) {
  41.                         player.getPacketSender().sendMessage("@red@Donating Services are currently offline. Please check back shortly!");
  42.                         e.printStackTrace();
  43.                     }    
  44.                 }
  45.             }.start();
  46.            
  47.             return false;
  48.         }
  49.  
  50.     @Override
  51.     public String[] getUsage() {
  52.         return new String[] {
  53.             "::claimdonation"
  54.         };
  55.     }
  56.  
  57. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement