Sell items to the server

Discussion in 'Plugin Development' started by AppleMen, Nov 16, 2013.

Thread Status:
Not open for further replies.
  1. Offline

    AppleMen

    Hello!

    How can I sell items to the server in this code?

    Code:java
    1. if (event.getCurrentItem().equals(DiamondItem)) {
    2. eco.depositPlayer(player.getName(), 200);
    3. }


    Thanks!
     
  2. Offline

    The_Doctor_123

    Then you give them an item?
     
  3. Offline

    iFamasssxD

    Remove the item from the player after it gives them the money.
     
  4. Offline

    AppleMen

    How can I remove the item they click on? So like, I have the diamond in my inventory. And I click on it, how does it goes away and gives me the right money?

    This didn't worked :/
    Code:java
    1. player.getInventory().removeItem(new ItemStack(Material.DIAMOND), 1);


    How can I remove the item of a player inventory then?

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 5, 2016
  5. Offline

    Blah1

    AppleMen you just made an item and then removed it. Loop through the players inventory to see if they have the item an then remove it.
     
  6. Offline

    AppleMen

    How? I can't find the code that finds out if the player has the item. I got this now:
    Code:java
    1. if (event.getCurrentItem().equals(Material.DIAMOND)) {
    2. player.getInventory().remove(new ItemStack(Material.DIAMOND, 1));
    3. eco.depositPlayer(player.getName(), 200);
    4. }
     
  7. Offline

    Blah1

    AppleMen my shop plugin has this in it. Wait till it gets approved today then look at the source.
     
  8. Offline

    AppleMen

    Whats the name? So i can look into it when it is approved.
     
  9. Offline

    Blah1

  10. Offline

    drtshock

    bshop is too similar to shop :(
     
  11. Offline

    Blah1

    drtshock the name or the concept? Because ive never heard of/used "Shop". And hopefully its not the concept because there are a lot of plugins out there that have the same concept
     
  12. Offline

    drtshock

    The name. You need to have a completely unique name. But let's handle this on BukkitDev from now on :)
     
  13. Offline

    AppleMen

    Blah1 I see that the plugin is approved When will there be a download available? Or the source?
     
  14. Offline

    Blah1

    AppleMen just waiting on the file to get approved now :)
     
  15. Offline

    AppleMen

    Okay :)
     
Thread Status:
Not open for further replies.

Share This Page