Remember MoneyDrop for Bukkit? Well let me introduce you to WalletDrop for Sponge. With permission from DrakeSpirit, this is a continuation of MoneyDrop with a different name.
Donations
Creating plugins for Sponge takes time and effort. If you enjoy the hard work I’ve put into to this please feel free to get my a cup of coffee. It is much appreciated.
Pixelmon doesnt works like that… u are not actually killing an entity…
If a pokemon gets incapacitied it just dissappears…
u cant damage a pokemon with a sword etc.
So… sadly it wont work for pixelmon pokemons if its not defined
and probably its not…
Edit: trainers are giving money… actually it would be inappropriate if pokemon would give money…
A few things: (Stuff I posted in StackBan also applies, but I won’t repost it here)
There’s no guarantee that the EconomyService will be available in GameState.POST_INITIALIZATION. For that matter, if it changes afterwards, your code will break. Just get it from the ServiceManager when you need it (or, if you insist on using a global variable, listen for ChangeServiceProviderEvent).
I’m curious as to why you make a wrapper for the Economy API methods in WalletDrop.java.
I’m also immensely curious as to what the purpose of WalletDrop.java:90-97 is.
Don’t just assume the format of the money. Currency has a format(BigDecimal) method, which properly formats it for use in a message.
In the config, why do you number all the keys? Numbers are unrelated to the function of the keys.
In your DataManipulator, you shouldn’t just make compareTo return 0. That implies that they are all equal. It’s really easy to just put `return getValue() - arg0.getValue();’
It wouldn’t take much effort for this to be multi-currency, and it’d be a really good idea.
I’m not sure what you mean by assuming currency format
WalletDrop.java:90-97 mostly came directly from the original MoneyDrop plugin. The if statement doesn’t make too much sense to me but it got overlooked during porting.
Due to the large number of keys in the config I added numbers to a select few as to order them in a more readable fashion. (Working around the alphabetical nature of HOCON). I made a post a long time ago regarding insertion order but nothing ever came of it. If you have info on this I’m interested.
At the time I wasn’t sure what to do with compareTo so I left the return value alone. I’ll update this in next release
I’d be all for adding multi-currency…once I figure all that out. help is appreciated.
By ‘assume currency format’ I mean assume that the currency is formatted ‘$#,###,##0.00’. Assuming that the symbol is $, the decimal places are 2, etc. Again, the Currency class has a format() method, letting the economy plugin decide what a given amount of money looks like.
It’s really easy to get multi-currency. Make 'em configurable. Since they’re catalog types, you can get them directly from the config (assuming you wait until the economy service is registered to do so). Just check the config whenever you’d normally call getDefaultCurrency().
Another thing I noticed: In certain places, you’re storing the amount of money in a double. This isn’t a good idea. It’s provided in a BigDecimal for a reason - a double can overflow, a BigDecimal can’t. The point of the economy API is to allow for most any weird economy possible. I dunno, maybe they’re roleplaying Zimbabwe, whose currency exchange rate to USD is about 4,000,000,000,000,000. BigDecimal is arbitrary-precision, too, unlike double which can lose precision information.
Would this plugin work if its a customized entity? I’m curious if this could be compatible with pixelmon and allow players to earn money through each pokemon they beat in a battle.
I keep getting an error when i try to use this plugin. I’m rather new to them, so if you could help me out with a possible fix it’d be greatly appreciated.