Closed crymates closed 8 months ago
The command should be "/pay -100 @a" ;] Also possible just for some players like "/pay -100 @p[name=yololetsplay]". I Hope u know what I mean. It's default supported by minecraft using /execute and some other commands.
I think adminpay
using negative values does just that.
I don't know if @a
works for that though. I would suggest it's up to sponge to run the command using every player if @a
is used 🤔 (Including the developer uses the provided CommandExecutor
s)
@Erigitic while we're at it: Is there a specific reason for pay
being usable for adminpay
s purpose when used by a command block or console?
@MarkL4YG I have no idea why I made it so the pay command could be used from the console/command blocks. Odd... I will remove that from the next release as it really does not make much sense to have it in there as far as I can tell. Good catch!
@yololetsplay This would most likely have to be a custom implementation on our end to get it to affect all players. You said this can currently be done using the "/execute" command correct? If that's the case, what would be the advantage of having a custom implementation on Total Economy's end?
Ya the problem is with /execute I cannot remove any money, it's just that there the possibility of @a is given, it was just to explain ;]
Btw. u added /pay minus-amount bc of one of my tickets ;] The background behind is that there is no other way to remove money currently. But: The player cannot have an negative amount of money and this is okay.
If execute
works, why not just let them execute a command that pays you?
Doesn't /execute @a ~ ~ ~ /pay yololetsplay 50
work as intended?
@yololetsplay The adminpay command can handle negative amounts and can be run from the console and command blocks. /adminpay -100 Erigitic
@Erigitic but does /adminpay -100 @a
work?
@MarkL4YG I have no idea on that one.
@Erigitic me neither ^^ Maybe @yololetsplay could test if target selectors work on TEs commands.
However, I think, whenever a dev uses the CommandExecutor
it should be up to Sponge to parse (and implement) these arguments since they're doing the argument parsing. 🤔
@MarkL4YG U did it!! /adminpay -100 @a
works just great! Thx alot! U saved my day ;]
uhm, well, okay, glad I could help then ^^''
@yololetsplay Glad to hear that worked out!
Well guys, found an bug :D If you are alone on the server and run /adminpay @ -5 it works, but if you are more players online this issue is found in the console:
[13:42:32] [Server thread/INFO] [nucleus/]: Server ran the command: /adminpay @a -5
[13:42:32] [Server thread/ERROR] [Sponge/]: Error occurred while executing command 'adminpay @a -5' for source DedicatedServer: No value present
java.util.NoSuchElementException: No value present
at java.util.Optional.get(Optional.java:135) ~[?:1.8.0_111]
at com.erigitic.commands.AdminPayCommand.execute(AdminPayCommand.java:66) ~[AdminPayCommand.class:?]
at org.spongepowered.api.command.spec.CommandSpec.process(CommandSpec.java:351) ~[CommandSpec.class:1.11-2178-6.0.0-BETA-1999]
at org.spongepowered.api.command.dispatcher.SimpleDispatcher.process(SimpleDispatcher.java:333) ~[SimpleDispatcher.class:1.11-2178-6.0.0-BETA-1999]
at org.spongepowered.common.command.SpongeCommandManager.process(SpongeCommandManager.java:291) [SpongeCommandManager.class:1.11-2178-6.0.0-BETA-1999]
at net.minecraft.command.ServerCommandManager.func_71556_a(SourceFile:83) [bd.class:?]
at net.minecraft.server.dedicated.DedicatedServer.func_71333_ah(DedicatedServer.java:420) [lh.class:?]
at net.minecraft.server.dedicated.DedicatedServer.func_71190_q(DedicatedServer.java:385) [lh.class:?]
at net.minecraft.server.MinecraftServer.func_71217_p(MinecraftServer.java:624) [MinecraftServer.class:?]
at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:482) [MinecraftServer.class:?]
at java.lang.Thread.run(Thread.java:745) [?:1.8.0_111]
[13:42:53] [HikariPool-1 housekeeper/DEBUG] [com.zaxxer.hikari.pool.HikariPool/sponge]: HikariPool-1 - Pool stats (total=9, active=0, idle=9, waiting=0)
[13:42:54] [HikariPool-2 housekeeper/DEBUG] [com.zaxxer.hikari.pool.HikariPool/sponge]: HikariPool-2 - Pool stats (total=9, active=0, idle=9, waiting=0)
[13:42:56] [Server thread/DEBUG] [FML/]: Gathering id map for writing to world save world
[13:43:23] [HikariPool-1 housekeeper/DEBUG] [com.zaxxer.hikari.pool.HikariPool/sponge]: HikariPool-1 - Pool stats (total=9, active=0, idle=9, waiting=0)
[13:43:24] [HikariPool-2 housekeeper/DEBUG] [com.zaxxer.hikari.pool.HikariPool/sponge]: HikariPool-2 - Pool stats (total=9, active=0, idle=9, waiting=0)
Hope this helps you to maybe fix this in the next release ;]
Greetz, Hannes
Will try to reproduce this this evening and see what I'll come up with (Yep, living in CET). Thanks for providing the stack trace!
Thx alot @MarkL4YG ;]
So, I'm back with some results, but unfortunately I currently can't provide a fix commit due to lack of time ^^''
However!:
@Erigitic I would suggest reconstructing all commandExecutor
s in TotalEconomy because
CommadContext.<T>getOne
becomes an empty optional whenever multiple targets are used. (such cases are e.g. targetSelectors)
This is resolved by using
CommandContext.<Collection<?>>getAll(String key)
instead. It returns an Immutable collection of all targets - even one with only one entry if the target is just a player as normal. A fix that would support single and multiple targets would then just be an iteration over this collection for each individual target.
@MarkL4YG Sounds good. Will get this changed over within the week.
A "little" off topic: Seems like GitHub notifications don't update when texts are edited 🤔 "2 days ago yololetsplay commented on issue Erigitic/TotalEconomy#136 (at)yololetsplay Thx alot @MarkL4YG ;] Well, germany like me? :D"
@yololetsplay Yes, Germany ;)
Going to push this one off till later.
Is this fixed yet? /adminpay 100 @a
or /adminpay -100 @a
still doesn't work for me
No not yet. TotalEconomy is using Sponges CommandSpec builder and selects Player
as the second argument. Since Sponge parses the commands and then calls the executor it theoretically should be up to Sponge to support this.
However there is a new command system WIP and I don't know how that handles vanillas selectors.
Is there a special reason you need the all
selector here instead of just using salaries?
Could you add the function that /pay in console is able to reduce coins from all online players? It's just like paying fees. Currently /pay -[amount] is supported, that's nice, but, u know, for roleplay servers it would be great to easy setup an fees-system that way.
Greetz, Hannes