Solved Prison Auto-Sell

Discussion in 'Plugin Development' started by BladdonB, May 25, 2015.

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

    BladdonB

    I am making a prison plugin for a person, how would I make it so when they break a block it would give them money instead of the block.

    Essentials and Vault (fyi)
     
  2. Use the BlockBreakEvent.
    Check if the block someone is mining is the one you want to be mineable, if yes, set it to Material.AIR. (You might also want to cancel the event to prevent drops.)
    Then use your economy code to give someone money.
     
  3. Offline

    BladdonB

    ok thx

    How to cancel event?

    EDIT by Timtower: merged posts
     
    Last edited by a moderator: May 25, 2015
  4. Offline

    Corndogoz

    event.setCanceled(true);
     
  5. Offline

    BladdonB

  6. Offline

    Corndogoz

    no problemo :D
     
  7. Offline

    Zombie_Striker

    @BladdonB
    @Corndogoz
    No, that is not the way to do it.
    Code:
    Event#.getDrops().clear();
    Minecraft stores all ItemStacks that It should drop in an Array list. Just clear all the drops.
     
  8. Offline

    Corndogoz

    well, both ways work, your way is simpler, but for new people, more complecated :p
     
  9. Offline

    xMrPoi

    I'm not sure why I'm getting this feeling but I feel like clearing the drops would be more resource friendly than setting it to air and canceling on every block break.

    Also, if you've figured out what to do and have gotten this workng, please mark the thread as solved :)
     
Thread Status:
Not open for further replies.

Share This Page