Confirmable Items! - 7/14/14

Discussion in 'Empire Updates' started by Aikar, Jul 14, 2014.

  1. Hey everyone. We have a few "Redeemable" items such as Vault Vouchers and Stable Vouchers.

    One issue that has plagued them is accidental use when a player intended to keep it instead to sell the voucher or send to someone.

    Today we have resolved this issue by making the vouchers require confirmation before redeeming!



    We have also updated the new Permanent Derelict protection vouchers to also be self-redeemable and use this new confirmation system, so you no longer need to work with staff to redeem.

    This system was designed so we can very easily add confirmation prompt to any usable item we create in the future :)

    See:
    https://gist.github.com/aikar/b3c7c5556f1d8a5d52e9
    https://gist.github.com/aikar/e86af3575ba3cef709d3
    porphos, Seffychan, Olaf_C and 21 others like this.
  2. Ooo sounds interesting!
    No more accedently using vouchers!

    FIRST
  3. Whoop! Another slam dunk by Aikar!
    *crowd goes wild!*
  4. Just tested with a vault voucher, pretty cool :p
    Will the chest ui be added for more things like residences flags or multiple vault pages?
    Lukas3226 likes this.
  5. yes, as we can find time to squeeze in things like this.
    607, cadgamer101 and samsimx like this.
  6. Sounds cool. Wouldn't want to accidentally claim something like that. :p Thanks, Aikar!
    607 likes this.
  7. Will this be implemented for i-day chests? This is awesome, though, I've always been totally paranoid that I would accidentally use a Vault Voucher. XD
  8. Ive accidentally used them so many times trying to put them into item frames lol - Good work Aikar! :)
  9. Oops! I knew I was missing something. I was first wanting to create this for the I Day chest, but simply did not have enough time.

    I will add it to them soon.
  10. On a slightly different note, here's a little bit of contrast.
    When I looked at the code, I had no idea whatsoever what it meant.
    I asked my brother to come take a look at it. In 2 minutes, he told me exactly what it did even better than you did in the OP :p
  11. This looks great! :D

    Any chance you could publish some of the full files? :p
  12. That's a lot of code for java there. Looks like a command block. :p
    You're flying, right?
  13. mba2012 likes this.
  14. It is quite a bit of lines sure, but in java, so much of the code is "generated" for you by the IDE.

    Most of the time writing code in java is not spent typing the code, but figuring out the logic you want it to do.

    Writing the code for this confirm chest system, while its only 86 lines, it still took 2+ hours in total for figuring out how to design it, thinking of pitfalls, testing, and fixing bugs (like I accidentally had the first paper slot associated with confirming too).

    Typing add(Material.Foo).onClick(new <Control+Space> pops up new Predicate<Player>, which I then hi-light and hit alt enter and it then expand it to
    Code:
    .onClick(new Predicate<Player>() {
                    @Override
                    public boolean apply(@Nullable Player input) {
    
                    }
                })
    So, multiple lines done in seconds.
    mba2012, 607 and PenguinDJ like this.
  15. Yet he posted a link to it in a public place
  16. My point is that I can't see it on his main gist page :p