emibergo02 / rediseconomy Goto Github PK
View Code? Open in Web Editor NEWEconomy plugin made with redis
Economy plugin made with redis
Could you please allow the plugin to migrate from the CMI economy? thanks
Adding support for MMO Profiles would be really good. You would be one of the first people to do it; giving you the edge over other economy providers.
https://www.spigotmc.org/resources/mmoprofiles.109942/
Their API can be found here; https://gitlab.com/phoenix-dvpmt/mmoprofiles
The cause of this problem:
java.lang.NullPointerException: Cannot invoke
"org.bukkit.command.PluginCommand.setExecutor(org.bukkit.command.CommandExecutor)"
because the return value of "org.bukkit.Server.getPluginCommand(String)" is null
at dev.unnm3d.rediseconomy.RedisEconomyPlugin.onEnable(RedisEconomyPlugin.java:75) ~[RedisEconomy-3.2.1-SNAPSHOT.jar:?]
. . .
is probably caused by CMI overriding /pay and other commands (check #10)
Discord -> https://discord.gg/EXdPs7BBq9
It would be nice if the plugin will leave an option for server owners to disable transaction history.
We have 500 MB data on our Redis server. That's not really much, but we don't have a lot of players,
so it would grow upon the players count.
Another idea is purging transactions data after some period of time, let's say a month.
Also could be configurable in the config file.
Hi. How safe is Redis Eco? Will the balance of the players remain after the restart of the dedicated server, I still have a bad understanding of how the Redis-server works.
When sending large amounts of money sometimes the player gets confused and puts an extra 0
format can be added to throw money.
example;
/pay {player} 400k (=/pay {player} 400000)
/pay {player} 2m (=/pay {player} 2000000)
add %playerPrefix% to commands message
I would like to have a way of transferring money between currencies
I have followeds your steps on how to create a redis.uri but what now? what do I have to do to activate it on my server?
I am renting a server from sparked host.
After restarting the server, the following error occurs: [00:35:10 INFO]: [RedisEconomy] Enabling RedisEconomy v4.2.3-SNAPSHOT*
[00:35:10 ERROR]: Error occurred while enabling RedisEconomy v4.2.3-SNAPSHOT (Is it up to date?)
java.lang.IllegalArgumentException: Listener can not be null
at org.apache.commons.lang.Validate.notNull(Validate.java:192) ~[patched_1.17.1.jar:git-Purpur-1428]
at org.bukkit.plugin.java.JavaPluginLoader.createRegisteredListeners(JavaPluginLoader.java:273) ~[patched_1.17.1.jar:git-Purpur-1428]
at org.bukkit.plugin.SimplePluginManager.registerEvents(SimplePluginManager.java:660) ~[patched_1.17.1.jar:git-Purpur-1428]
at dev.unnm3d.rediseconomy.RedisEconomyPlugin.onEnable(RedisEconomyPlugin.java:88) ~[RedisEconomy-4.2.3-SNAPSHOT.jar:?]
at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:264) ~[patched_1.17.1.jar:git-Purpur-1428]
at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:370) ~[patched_1.17.1.jar:git-Purpur-1428]
at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:500) ~[patched_1.17.1.jar:git-Purpur-1428]
at org.bukkit.craftbukkit.v1_17_R1.CraftServer.enablePlugin(CraftServer.java:561) ~[patched_1.17.1.jar:git-Purpur-1428]
at org.bukkit.craftbukkit.v1_17_R1.CraftServer.enablePlugins(CraftServer.java:475) ~[patched_1.17.1.jar:git-Purpur-1428]
at net.minecraft.server.dedicated.DedicatedServer.initServer(DedicatedServer.java:323) ~[patched_1.17.1.jar:git-Purpur-1428]
at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1233) ~[patched_1.17.1.jar:git-Purpur-1428]
at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:322) ~[patched_1.17.1.jar:git-Purpur-1428]
at java.lang.Thread.run(Thread.java:833) ~[?:?]
[00:35:10 INFO]: [RedisEconomy] Disabling RedisEconomy v4.2.3-SNAPSHOT
[09:47:02 WARN]: [RedisEconomy] Async task for RedisEconomy v4.3.9-SNAPSHOT generated an exception
org.bukkit.plugin.messaging.ChannelNotRegisteredException: Attempted to send a plugin message through the unregistered channel `BungeeCord'.
at org.bukkit.plugin.messaging.StandardMessenger.validatePluginMessage(StandardMessenger.java:544) ~[purpur-api-1.20.4-R0.1-SNAPSHOT.jar:?]
at org.bukkit.craftbukkit.v1_20_R3.entity.CraftPlayer.sendPluginMessage(CraftPlayer.java:2346) ~[purpur-1.20.4.jar:git-Purpur-2153]
at dev.unnm3d.rediseconomy.config.ConfigManager.sendServerIdRequest(ConfigManager.java:122) ~[RedisEconomy-4.3.9-SNAPSHOT.jar:?]
at dev.unnm3d.rediseconomy.config.ConfigManager$1.lambda$onJoin$0(ConfigManager.java:98) ~[RedisEconomy-4.3.9-SNAPSHOT.jar:?]
at dev.unnm3d.shaded.universalScheduler.foliaScheduler.FoliaScheduler.lambda$runTaskLaterAsynchronously$13(FoliaScheduler.java:140) ~[RedisEconomy-4.3.9-SNAPSHOT.jar:?]
at io.papermc.paper.threadedregions.scheduler.FoliaAsyncScheduler$AsyncScheduledTask.run(FoliaAsyncScheduler.java:217) ~[purpur-1.20.4.jar:?]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539) ~[?:?]
at java.util.concurrent.FutureTask.run(FutureTask.java:264) ~[?:?]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:304) ~[?:?]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) ~[?:?]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) ~[?:?]
at java.lang.Thread.run(Thread.java:833) ~[?:?]
```
hello so i have question can you add mysql database? Cause if i want to change my redis server or reset all of my player balance etc.. it would be easier to do that maybe redis server shutdown or something happen might get so much data loss
I use the plugin without any problems with other plugins, but I have problems when I want to use it with the Townyadvanced plugin. There is no error in the console and logs. When I asked the developer of the Towny plugin, he replied, "There are lots of economy plugins that dont properly implement vault." I don't know what to do in this case.
I am making a baltop command which combines Vault balance and Bank plugin's balances. You use Lettuce as a dependency and method Currency#getOrderedAccounts returns Lettuce's ScoredValue. And due to how Papaer loads lettuce dependency I can't use this ScoredValue. So I have to use reflections to do this:
return currency.getOrderedAccounts(n)
.thenApply(balances -> {
List<Account> accounts = new ArrayList<>();
for (Object tuple : balances) {
try {
Method getValueMethod = tuple.getClass().getMethod("getValue");
Object valueResult = getValueMethod.invoke(tuple);
Method getScoreMethod = tuple.getClass().getMethod("getScore");
Object scoreResult = getScoreMethod.invoke(tuple);
String valueAsString = String.valueOf(valueResult);
UUID uuid = UUID.fromString(valueAsString);
String username = RedisEconomyAPI.getAPI().getUsernameFromUUIDCache(uuid);
double amount = (Double) scoreResult;
// Add the new Account object to the list
accounts.add(new Account(username == null ? valueAsString + "-Unknown" : username, uuid, amount));
//System.out.println("Added account: " + username + " with balance: " + amount);
} catch (Exception e){
e.printStackTrace();
}
}
return accounts;
}).toCompletableFuture();
Paper loads libraries listed in plugin.yml with URLClassLoader. If i add Lettuce as a library it will be loaded with a different class loader than yours Lettuce thus I can't cast your ScoredValue to mine. Please make some DTO for this class to return instead of raw Lettuce object.
In general, people do not recommend keeping data in redis. As far as I can see you keep your data in redis, how healthy do you think that is? I want to use this plugin but I don't want my data to be lost (in case of power failure etc.).
Im sorry for my bad english
Heya!
We're currently switching from CMI's currency system to yours and noticed a few QoL things that'd make the integration into other plugins and the general usability a bit easier.
Internal Vault currency name
Have an internal currency name that supports legacy color codes.
Why? It seems like a handful of plugins doesn't support MiniMessage yet and therefore, currency names look completely off.
Edit:
If it is not possible to get such an internal value due to vault we would like to ask if it would be possible to add minedown support (minedown supports colour leagecy code) and make it adjustable in the config file whether you want to use this or minimessage.
https://github.com/Phoenix616/MineDown
Example with QuickShop-Hikari (QS dev is aware):
Possible config option:
currencies:
- currencyName: vault
currencySingle: <i><b><green>I</green></b></i>
currencyPlural: <i><b><green>I</green></b></i>
currencyNameInternal: §2§lI
decimalFormat: '#.##'
languageTag: en-US
startingBalance: 100.0
payTax: 0.0
Set default Vault currency when none is specified
When using a command like balance/money <player> <currency> give <amount> [reason...]
, make <currency>
optional by falling back to a specified default currency set in the config (Vault, QuestPoints etc).
Hi, i have a problem with the placeholder %rediseco_bal_short_%
When i use it, i wanna have for example 15.6 k but i have written 15.6$k
I may thinks it will be cool to get an other placeholder without "currency name" include when we use the placeholder
Thanks for looking my message
Have a nice day
Please add new placeholders:
%rediseco_top_1_prefix_<currency>%
%rediseco_top_1_suffix_<currency>%
%rediseco_top_1_displayname_<currency>%
%rediseco_top_position_<short/formatted>_<currency>%
- Shows what position the player is at in the leaderboardDisplayName must be stored in the database, since it cannot be obtained for an offline player. Prefix and Suffix can be taken from the Vault (or stored in the database as well)
Hello, I get this error when trying to load RedisEconomy
[18:24:46] [Server thread/ERROR]: Error occurred while enabling RedisEconomy v3.2.1-SNAPSHOT (Is it up to date?)
java.lang.NullPointerException: Cannot invoke "org.bukkit.command.PluginCommand.setExecutor(org.bukkit.command.CommandExecutor)" because the return value of "org.bukkit.Server.getPluginCommand(String)" is null
at dev.unnm3d.rediseconomy.RedisEconomyPlugin.onEnable(RedisEconomyPlugin.java:75) ~[RedisEconomy-3.2.1-SNAPSHOT.jar:?]
at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:264) ~[paper-api-1.19.2-R0.1-SNAPSHOT.jar:?]
at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:370) ~[paper-api-1.19.2-R0.1-SNAPSHOT.jar:?]
at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:542) ~[paper-api-1.19.2-R0.1-SNAPSHOT.jar:?]
at org.bukkit.craftbukkit.v1_19_R1.CraftServer.enablePlugin(CraftServer.java:567) ~[paper-1.19.2.jar:git-light-"aaf5e39"]
at org.bukkit.craftbukkit.v1_19_R1.CraftServer.enablePlugins(CraftServer.java:481) ~[paper-1.19.2.jar:git-light-"aaf5e39"]
at net.minecraft.server.MinecraftServer.loadWorld0(MinecraftServer.java:640) ~[paper-1.19.2.jar:git-light-"aaf5e39"]
at net.minecraft.server.MinecraftServer.loadLevel(MinecraftServer.java:426) ~[paper-1.19.2.jar:git-light-"aaf5e39"]
at net.minecraft.server.dedicated.DedicatedServer.initServer(DedicatedServer.java:309) ~[paper-1.19.2.jar:git-light-"aaf5e39"]
at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1105) ~[paper-1.19.2.jar:git-light-"aaf5e39"]
at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:308) ~[paper-1.19.2.jar:git-light-"aaf5e39"]
at java.lang.Thread.run(Thread.java:833) ~[?:?]
Add an option to change money format (including for bal and top placeholders):
For example:
private static final DecimalFormat df = new DecimalFormat("###,###", new DecimalFormatSymbols(Locale.US));
public static String format(int input) {
return df.format(input);
}
(you forgot remove println() in 4.2.6 and update`s description on spigotmc has invalid placeholders, should be %rediseco_top_1_playerprefix_%)
Moving the private chat with Unmn3d on Discord here.
We've experienced balance resets when using RedisEconomy due to a race condition caused by EssentialsX economy forwarding vault transactions for some plugins, notably (but probably not limited to) quickshop.
Debug trace follows:
[02:09:32 INFO]: 01 Sent update account <account> to 0.0 [A]
[02:09:32 INFO]: 01 Sent update account <account> to 98668.0 [B]
Essentials, instead of doing a balance update based on addition and substraction, will reset the entire balance to 0, then set the new balance with the precomputed value. Since these two actions are triggered pretty much at the same time (not concurrently, but one right after the other), depending on the database and server load, the instructions might not be stored in the database in strict chronological order - needless to say this could be an issue, allowing some exploits in terms of balance amounts.
TLDR; classic race condition issue, [A] [B] should be executed in that order, but [B] ends up being stored before [A].
Proposed solutions (as someone who has never used redis):
Extra resources
/testbalance <cycle count> <player>
docker compose up
, ports 50001, 50002)Note
/browse-transaction
seems to always return the correct order, didn't test it in depth thoCreate a placeholder that displays a shorthand of the balance; for example rather than 10000.00, display 10k (this helps with higher account balances)
Two of the planned features can be accomplished directly through Treasury! Treasury allows for as many currencies to be registered as desired, and is based upon transactions, so transaction history can be fetched easily.
I'm the author of the library – we're currently working on an API revamp (version 2), so we recommend plugins to delay in writing an implementation for Treasury until we can release a beta version of v2.
add minimum payment amount, so that players do not spam /pay player 0.0001, and maybe it's worth adding cooldown.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.