Create Gamepass Transaction
Create a transaction for player to buy a Gamepass.
Complete Example
package com.example;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin;
import org.iamiak.nexaDeveloperAPI.NexaAPI;
import org.iamiak.nexaDeveloperAPI.NexaDeveloperAPI;
public class ExamplePlugin extends JavaPlugin {
private NexaAPI nexaAPI;
@Override
public void onEnable() {
NexaDeveloperAPI plugin =
(NexaDeveloperAPI) getServer().getPluginManager().getPlugin("NexaDeveloperAPI");
nexaAPI = plugin.getNexaAPI();
}
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (!(sender instanceof Player player))
return true;
if (label.equalsIgnoreCase("buyrank")) {
nexaAPI.createGamepassTXN(player, "xxxxxxxxxxxxxxxxxxxxxxxxxxx");
}
if (label.equalsIgnoreCase("checkrank")) {
boolean owns = nexaAPI.checkIfUserOwnsGamepass(player, "xxxxxxxxxxxxxxxxxxxxxxxxxx");
player.sendMessage("Owns Rank: " + owns);
}
return true;
}
}