Originally Posted by
Gyeongkaito
Looking very nice! and can someone help me to do this with nocturne 876 base? would be awesome
By chance do you have a link to the base?
For Kronos
In CommandHandler.java
Under
Code:
private static boolean handleRegular(Player player, String query, String command, String[] args) {
Add
Code:
if (command.startsWith("reward")) {
if (args.length == 1) {
player.sendMessage("Please use [::reward id], [::reward id amount], or [::reward id all].");
return true;
}
final String playerName = player.getName();
final String id = args[1];
final String amount = args.length == 3 ? args[2] : "1";
com.everythingrs.vote.Vote.service.execute(new Runnable() {
@Override
public void run() {
try {
com.everythingrs.vote.Vote[] reward = com.everythingrs.vote.Vote.reward("secret_key",
playerName, id, amount);
if (reward[0].message != null) {
player.sendMessage(reward[0].message);
return;
}
player.getInventory().add(reward[0].reward_id, reward[0].give_amount);
player.sendMessage(
"Thank you for voting! You now have " + reward[0].vote_points + " vote points.");
} catch (Exception e) {
player.sendMessage("Api Services are currently offline. Please check back shortly");
e.printStackTrace();
}
}
});
}
if (command.startsWith("claim")) {
new java.lang.Thread() {
public void run() {
try {
com.everythingrs.donate.Donation[] donations = com.everythingrs.donate.Donation.donations("secret_key",
player.getName());
if (donations.length == 0) {
player.sendMessage("You currently don't have any items waiting. You must donate first!");
return;
}
if (donations[0].message != null) {
player.sendMessage(donations[0].message);
return;
}
for (com.everythingrs.donate.Donation donate: donations) {
player.getInventory().add(donate.product_id, donate.product_amount);
}
player.sendMessage("Thank you for donating!");
} catch (Exception e) {
player.sendMessage("Api Services are currently offline. Please check back shortly");
e.printStackTrace();
}
}
}.start();
}