Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.rs.utils;
- import java.io.BufferedReader;
- import java.io.InputStreamReader;
- import java.net.URL;
- import com.rs.cores.CoresManager;
- import com.rs.game.World;
- import com.rs.game.player.Player;
- public class Donations {
- public static final void checkDonation(final Player player) {
- if (player.getTemporaryAttributtes().get("CheckingDonation") != null)
- return;
- player.getTemporaryAttributtes().put("CheckingDonation", Boolean.TRUE);
- player.getPackets().sendGameMessage("Checking donation...");
- CoresManager.slowExecutor.execute(new Runnable() {
- @Override
- public void run() {
- try {
- int productId = 0;
- int price = 0;
- URL url = new URL(
- "http://armars.x10host.com/donate7/checkdonate.php?pass=pass&username="
- + player.getUsername().toLowerCase());
- //System.out.println("http://vap.webege.com/donate4/checkdonate.php?pass=pass&username="
- // + player.getUsername().toLowerCase());
- BufferedReader reader = new BufferedReader(
- new InputStreamReader(url.openStream()));
- String string = reader.readLine();
- while (string !=null) {
- if(string.startsWith("p")) {
- productId = Integer.parseInt(string.substring(10));
- string = reader.readLine();
- }
- if(string.startsWith("s")) {
- price = Integer.parseInt(string.substring(7));
- }
- break;
- }
- boolean noresult = string == null || string.equalsIgnoreCase("false") || productId == 0 || price == 0;
- reader.close();
- if (noresult) {
- player.getPackets()
- .sendGameMessage(
- "<col=ff0000>We were unable to locate your donation, please try again later.");
- } else
- CompleteProcess(player, productId, price);
- } catch (Throwable e) {
- e.printStackTrace();
- player.getPackets()
- .sendGameMessage(
- "<col=ff0000>We were unable to verify your donation, please try again later.");
- }
- player.getTemporaryAttributtes().remove("CheckingDonation");
- }
- });
- }
- public static void CompleteProcess(Player player, int productId, int price) {
- if(productId == 1 && price == 10) {
- player.getPackets().sendGameMessage("<shad=cc0ff><img=1>You Have Recieved Your : Regular Donator Rank");
- player.setDonator(true);
- player.getPackets().sendGameMessage("Enjoy Your Donation, Thanks for Donating!!");
- for(Player p : World.getPlayers()) {
- if (p ==null) {
- continue;
- }
- p.getPackets().sendGameMessage("<shad=cc0ff><img=1>" + player.getDisplayName() + " has just donated for Regular Donator Rank");
- }
- } else if(productId == 2 && price == 15) {
- player.getPackets().sendGameMessage("<shad=cc0ff><img=1>You Have Recieved Your : Super Donator Rank");
- if(!player.isDonator())
- player.setDonator(true);
- player.setExtremeDonator(true);
- player.getPackets().sendGameMessage("Enjoy Your Donation, Thanks for Donating!!");
- for(Player p : World.getPlayers()) {
- if (p ==null) {
- continue;
- }
- p.getPackets().sendGameMessage("<shad=cc0ff><img=1>" + player.getDisplayName() + " has just donated for Super Donator Rank");
- }
- } else if(productId == 3 && price == 25) {
- player.getPackets().sendGameMessage("<shad=cc0ff><img=1>You Have Recieved Your : Extreme Donator Rank");
- if(!player.isDonator())
- player.setDonator(true);
- player.setExtremeDonator(true);
- player.getPackets().sendGameMessage("Enjoy Your Donation, Thanks for Donating!!");
- for(Player p : World.getPlayers()) {
- if (p ==null) {
- continue;
- }
- p.getPackets().sendGameMessage("<shad=cc0ff><img=1>" + player.getDisplayName() + " has just donated for Extreme Donator Rank");
- }
- } else if(productId == 4 && price == 50) {
- player.getPackets().sendGameMessage("<shad=cc0ff><img=1>You Have Recieved Your : Pink Donator Rank");
- if(!player.isDonator())
- player.setDonator(true);
- player.setExtremeDonator(true);
- player.getPackets().sendGameMessage("Enjoy Your Donation, Thanks for Donating!!");
- for(Player p : World.getPlayers()) {
- if (p ==null) {
- continue;
- }
- p.getPackets().sendGameMessage("<shad=cc0ff><img=1>" + player.getDisplayName() + " has just donated for Pink Donator Rank");
- }
- } else if(productId == 5 && price == 100) {
- player.getPackets().sendGameMessage("<shad=cc0ff><img=1>You Have Recieved Your : Wizard Donator Rank");
- if(!player.isDonator())
- player.setDonator(true);
- player.setExtremeDonator(true);
- player.getPackets().sendGameMessage("Enjoy Your Donation, Thanks for Donating!!");
- for(Player p : World.getPlayers()) {
- if (p ==null) {
- continue;
- }
- p.getPackets().sendGameMessage("<shad=cc0ff><img=1>" + player.getDisplayName() + " has just donated for Wizard Donator Rank");
- }
- }else
- player.getPackets()
- .sendGameMessage(
- "<col=ff0000>We were unable to verify your donation, please try again later.");
- }
- /*Example of what to do!
- * Copy this and change the numbers for productId and Price for item
- * if(productId == Id && price == Price) {
- player.getPackets().sendGameMessage("<shad=cc0ff><img=1>You Have Recieved Your : Product Name");
- here put your add item method
- if (player.getInventory().getFreeSlots() <= 0) {
- player.getBank().addItem(24154, 1, 1, true);
- player.getBank().addItem(995, 5000000, 1, true);
- p.sm("<col=FF0000>"+player.getDisplayName()+" "+"<col=0000A0>"+"has voted for 5M VaporityGP And a spin ticket.");
- player.sm("You don't have space in your inventory, So we placed your reward in bank.");
- } else {
- player.getInventory().addItem(995, 5000000);
- player.getInventory().addItem(24154, 1);
- p.sm("<col=FF0000>"+player.getDisplayName()+" "+"<col=0000A0>"+"has voted for 5M VaporityGP And a spin ticket.");
- }
- player.getPackets().sendGameMessage("Enjoy Your Donation, Thanks for Donating!!");
- for(Player p : World.getPlayers()) {
- if (p ==null) {
- continue;
- }
- p.getPackets().sendGameMessage("<shad=cc0ff><img=1>" + player.getUsername() + " has just donated for Regular Donator Rank");
- }
- }
- * */
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement