Spigot PointsAPI 2.0.0

The best live-statistic Points plugin with an API.

  1. alzdoesmc submitted a new resource:

    PointsAPI - The best live-statistic Points plugin with an API.

    Read more about this resource...
     
  2. i could see potential in this, but doesn't NetworkCoins do this?
     
  3. I guess, but I don't see the option to use a configuration file.
     
  4. I have had issues with NetworkCoins MySQL losing connection all the time, making it useless.
    Has this been thoroughly tested with MySQL?
     
  5. It's still on the to-do, but I plan on starting it tomorrow. I know a lot of MySQL syntax as well, except the only syntax I don't know is how to make tables :p
     
  6. Snow? :p I'm assuming you meant to type "slow", so can you tell me what you are doing that might be making the issue so I can improve it?
     
  7. Okay. Also, do you keep the connection open all the time, or re-open a new connection every time you access the database?
     
  8. Normally keep it on all the time, but I suppose I could open a connection everytime I prepare a statement.
     
  9. can you make this work with bossshop? and also can you make it have a scoreboard with infoboard?
     
  10. False comment removed

    As for InfoBoard, I've never heard of it. I might look into it soon.
     
    #10 alzdoesmc, Dec 20, 2014
    Last edited: Jan 16, 2015
  11. alzdoesmc updated PointsAPI with a new update entry:

    MySQL Support

    Read the rest of this update entry...
     
  12. False, please read the API docs before stating that BossShop has to implement your plugin, it quite easily allows other plugins to register themselves.

    http://dev.bukkit.org/bukkit-plugins/bossshop/pages/boss-shop-api/
     
  13. Thanks for the tip.

    However, for anyone, I recommend (especially to @broluigi) that you create your own plugin that leans against this. PointsAPI was made for a simple purpose: to bring an easy-to-use points system to your server. In fact, it was originally made for one person, but since I wanted to share it with people, this is what I did. I do not plan on adding support for BossShop. It's very easily to create an inventory, as seen here...just made this in a flash (without an IDE on Hastebin, so errors are to be expected):

    Code (Java):

    public class Main extends JavaPlugin implements Listener {
    @Override
    public void onEnable(){
    Bukkit.getServer().getPluginManager().registerEvents(this, this);
    }

    private Inventory getMainShopInventory(){
    Inventory inv = Bukkit.createInventory(null, 9, "Buy Shop");
    {
    ItemStack item = new ItemStack(Material.DIAMOND_SWORD, 1);
    ItemMeta meta = item.getItemMeta();
    List<String> lore = new ArrayList<String>();
    lore.add("50");
    meta.setLore(lore);
    item.setItemMeta(meta);
    inv.setItem(0, new ItemStack(item));
    }
    {
    ItemStack item = new ItemStack(Material.DIAMOND_PICKAXE, 1);
    ItemMeta meta = item.getItemMeta();
    List<String> lore = new ArrayList<String>();
    lore.add("45");
    meta.setLore(lore);
    item.setItemMeta(meta);
    inv.setItem(1, new ItemStack(item));
    }
    {
    ItemStack item = new ItemStack(Material.DIAMOND_SPADE, 1);
    ItemMeta meta = item.getItemMeta();
    List<String> lore = new ArrayList<String>();
    lore.add("45");
    meta.setLore(lore);
    item.setItemMeta(meta);
    inv.setItem(2, new ItemStack(item));
    }
    return inv;
    }

    @EventHandler
    public void onInteract(PlayerInteractEvent event){
    Player player = event.getPlayer();
    if((event.getAction() == Action.RIGHT_CLICK_AIR)||(event.getAction() == Action.RIGHT_CLICK_BLOCK)){
    if(player.getItemInHand() != null){
    ItemStack hand = player.getItemInHand();
    if(hand.getType() == Material.EMERALD){
    event.setCancelled(true);
    player.openInventory(getMainShopInventory());
    }
    }
    }
    }

    @EventHandler
    public void onClick(InventoryClickEvent event){
    if(event.getWhoClicked() instanceof Player){
    Player player = (Player)event.getWhoClicked();
    if(event.getInventory().getName().equals(getMainShopInventory().getName())){
    if(event.getCurrentItem() != null){
    event.setCancelled(true);
    ItemStack clicked = event.getCurrentItem();
    player.closeInventory();
    try {
    buyItem(player, clicked.getType(), Integer.parseInt(clicked.getItemMeta().getLore().get(0)));
    } catch (NumberFormatException ex) {
    player.sendMessage("Invalid price");
    }
    }
    }
    }
    }

    private void buyItem(Player player, Material mat, int price){
    if(PointsAPI.getPoints(player)>=price){
    player.getInventory().addItem(new ItemStack(mat, 1));
    player.sendMessage("You have purchased " + mat.toString() + " for " + price + " points!");
    PointsAPI.takePoints(player, price);
    player.sendMessage("New point balance: " + PointsAPI.getPoints(player) + " point(s)");
    }
    else{
    player.sendMessage("You do not have enough points!");
    }
    }
    }
     
    The alignment is messed up in XenForo, so use the hastebin link below. Not everything may work, but you never know. I didn't thoroughly test this, but you can easily look up on how to create an inventory on youtube or even on this site.
    http://hastebin.com/iherasavul.avrasm

    I might add BossShop support in the future; however, it is not my number one priority, I have lots of other things to do, currently.
     
  14. Please update this! It is awesome!
     
  15. Thanks, I'm pretty sure it's compatible with 1.8. I'll need to get the code again somehow, because my computer's partitions got screwed up when I tried installing Ubuntu. But other than that, there may be an update soon.
     
  16. PM me, i'll send you the source.
     
  17. I know how to use decompiler. ;)
     
  18. Tought you ment you didn`t know it.

    -------------

    Could you add me on skype? My skype is: justmaxnl