VoucherTopup is a spigot plugin to allow player topup/refill/donate with truemoney wallet gift voucher system and very configurable, 100% free and open source!
git clone https://github.com/MinecraftChannel/VoucherTopup
cd VoucherTopup
mvn clean install
- Java (JDK) 8 or above
- Maven
- Minecraft Deluxe (1.15.2)
Events
import com.google.gson.JsonObject;
import th.in.mcch.vouchertopup.api.events.PlayerTopupEvent;
import th.in.mcch.vouchertopup.api.events.TopupSuccessEvent;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
public class MyPlugin implements Listener {
@EventHandler
public void onTopup(PlayerTopupEvent e) {
Player player = e.getPlayer();
String input = e.getInput();
e.setCancelled(true);
}
@EventHandler
public void onTopupError(TopupErrorEvent e) {
Player player = e.getPlayer();
JsonObject result = e.getResult();
}
@EventHandler
public void onTopupFailed(TopupFailedEvent e) {
Player player = e.getPlayer();
JsonObject result = e.getResult();
}
@EventHandler
public void onTopupSuccess(TopupSuccessEvent e) {
Player player = e.getPlayer();
JsonObject result = e.getResult();
System.out.println(result);
JsonObject status = e.getResult().getAsJsonObject().get("status").getAsJsonObject();
System.out.println(status);
JsonObject voucher = e.getResult().getAsJsonObject().get("data").getAsJsonObject().get("voucher").getAsJsonObject();
System.out.println(voucher);
double amount = voucher.get("redeemed_amount_baht").getAsDouble();
System.out.println("Redeem amount: " + amount + " by " + player.getName());
}
}