ygtdmn / VelocityRcon

Add RCON support to Velocity.
MIT License
16 stars 11 forks source link

Unable to execute command #6

Open half-nothing opened 2 years ago

half-nothing commented 2 years ago

Hi.I have found a problem when I use mcrcon to connect velocity. I have tried on the vanilla server and I'm pretty sure it is effective. But when I use command "glist all" and "lpv help".The command line is not responding.I take a screen shot and the pictures are below.

The Vanilla Server: `7 }ZQHN)Y6}HHOX8DM4I$N

Velocity: @1$K1DRHXZH{}VF(T`3}H3W T(Q}PG`@WF)KKF3DO5U71AL

So,I use wireshark to capture and analyze packets.And I find this. 2I0YM(`BVP`R`WAN4XUC)MG It sent back my instructions verbatim! So,what happened?

emmaboecker commented 2 years ago

I'm having the same issue, it won't let me use any commands

Edit: Apparently it does execute commands, but I just don't get the response

isaaclepes commented 2 years ago

When using mrcon, Velocity does not respond to 'end' command. (or any command, really). I tried waiting, but after about 15 minutes it was obviously not going to shut down. When using mrcon, after entering a command, you are not returned to a ">" prompt for issuing another command, it simply hangs on a new line with a blinking cursor. Further, when connected via mrcon and I simply attempt the 'quit' command to disconnect, the session is not ended by VelocityRcon. When using mrcon from command line to send a command, the mrcon process remains alive until Velocity is stopped.

mrcon functions fine on my other 4 papermc servers as well as my old Waterfall instance using BungeeRcon.

latest.log only shows the following for attempts:

Lucifer2033 commented 2 years ago

hi I have the same problem it executes the command but no response is coming

IntangibleW commented 1 year ago

The same to me. I got no response from Rcon and log shows there is Rcon port listening: 屏幕截图_20230226_100053 屏幕截图_20230226_100131 I use velocity-3.2.0-SNAPSHOT-230

guilhermewerner commented 1 year ago

I have the same problem here. I run velocity as a daemon on a linux server and I need a way to send commands to it to reload the config. RCON would be perfect but this problem won't let me.

MeesJ commented 1 year ago

Same issue here

bitter-geek commented 1 year ago

So... is this plugin abandoned? I'm having the same issue mentioned above when trying to connect from a variety of different RCON clients. With no communication from the developer since this bug was initially reported over a year ago, should I start looking around for another option?

guilhermewerner commented 1 year ago

I forked it to try to resolve this bug, but in the end I just added Gradle support and for me it worked.

If anyone wants to test: https://github.com/TribuFu-Forks/VelocityRcon

MeesJ commented 1 year ago

I forked it to try to resolve this bug, but in the end I just added Gradle support and for me it worked.

If anyone wants to test: https://github.com/TribuFu-Forks/VelocityRcon

Cool! Would it be possible for you to compile it as a jar? I'll test it tomorrow.

bitter-geek commented 1 year ago

I agree, a jar file would be awesome for folks like me that don't speak Java. Also, what is Gradle?

guilhermewerner commented 1 year ago

I forked it to try to resolve this bug, but in the end I just added Gradle support and for me it worked. If anyone wants to test: https://github.com/TribuFu-Forks/VelocityRcon

Cool! Would it be possible for you to compile it as a jar? I'll test it tomorrow.

I created a test release: https://github.com/TribuFu-Forks/VelocityRcon/releases/tag/v.1.2-TEST

I agree, a jar file would be awesome for folks like me that don't speak Java. Also, what is Gradle?

It's a build system for Java, I prefer it to Maven, it's no big deal.

bitter-geek commented 1 year ago

Oh, gotcha. Thank you! I'll play around with it soon, too. I've wasted two days trying to figure this out only to find this bug report today. It's nice knowing where the problem is now, but frustrating that it's been known for this long without a fix.

bitter-geek commented 1 year ago

@GuilhermeWerner I tried to compile this code with some instructions I found online but I'm not having much luck. Again, I don't speak Java. Can you explain how to compile this or maybe just throw a jar file into the repo? Thanks for your help!

guilhermewerner commented 1 year ago

@GuilhermeWerner I tried to compile this code with some instructions I found online but I'm not having much luck. Again, I don't speak Java. Can you explain how to compile this or maybe just throw a jar file into the repo? Thanks for your help!

I left a .jar in the link I sent: https://github.com/TribuFu-Forks/VelocityRcon/releases/tag/v.1.2-TEST

image

bitter-geek commented 1 year ago

Wow. I don't know how I missed that... Sorry to bug you and thanks again!

half-nothing commented 1 year ago

@GuilhermeWerner I tried to compile this code with some instructions I found online but I'm not having much luck. Again, I don't speak Java. Can you explain how to compile this or maybe just throw a jar file into the repo? Thanks for your help!

I left a .jar in the link I sent: https://github.com/TribuFu-Forks/VelocityRcon/releases/tag/v.1.2-TEST

image

You solved the problem?

guilhermewerner commented 1 year ago

You solved the problem?

Technically I didn't change anything in the code. I forked it to investigate, debugged it and used gradle to compile.

After that I tested it on my servers and it worked, I've been using this "modified" version for months, and for me it worked, but I only recompiled the project using gradle, nothing else.

That's why I asked if more people could test it.

half-nothing commented 1 year ago

You solved the problem?

Technically I didn't change anything in the code. I forked it to investigate, debugged it and used gradle to compile.

After that I tested it on my servers and it worked, I've been using this "modified" version for months, and for me it worked, but I only recompiled the project using gradle, nothing else.

That's why I asked if more people could test it.

Maybe you should see this https://github.com/PaperMC/Velocity/issues/833 Anyway, I'll try the Vanilla Server's commands.

half-nothing commented 1 year ago

You solved the problem?

Technically I didn't change anything in the code. I forked it to investigate, debugged it and used gradle to compile.

After that I tested it on my servers and it worked, I've been using this "modified" version for months, and for me it worked, but I only recompiled the project using gradle, nothing else.

That's why I asked if more people could test it.

image The problem is still there, maybe I can look into it some time

bitter-geek commented 1 year ago

I'm able to send some commands with the Gradle version, but not others. The velocity version command works: image

But the glist command returns this: image

... when it should return this: image

So we're getting closer! I'm also not able to use any commands for any plugins, it says "no such command" when the same command works fine in the Velocity console.

aws1313 commented 1 year ago

For me it is fixed here: https://github.com/TISUnion/VelocityRcon

MeesJ commented 1 year ago

For me it is fixed here: https://github.com/TISUnion/VelocityRcon

All issues? Including the issue @bitter-geek reported?

aws1313 commented 1 year ago

I think so... It works with mcrcon and also with mcipc for me. velocity version :

image glist:

image glist all:

image

You can try it out yourself. I used https://github.com/TISUnion/VelocityRcon/releases/download/v1.1.1/VelocityRcon.jar

The issue with lpv still persists though. I have to send lpv help, wait a little bit an then send any other command in order to get the result of lpv help and if I understood it right this can't be fixed: image

aws1313 commented 1 year ago

Using mcipc you could work around this with something like:

from mcipc.rcon.je import Client
import time

def run_command(cmd, *args):
    with Client("HOST", PORT, passwd="PASSWORD") as c:
        c.run(cmd, *args)
        time.sleep(0.2)
        return '\n'.join(c.run("glist",).splitlines()[:-2])

if __name__ == '__main__':
    res = run_command("lpv", "help")
    print(res)
[LP] Running LuckPerms v5.4.102.
> /lpv user <user>
> /lpv group <group>
> /lpv track <track>
> /lpv log
> /lpv sync
> /lpv info
> /lpv editor [type]
> /lpv verbose <on|record|off|upload> [filter]
> /lpv tree [scope] [player]
> /lpv search <permission>
> /lpv networksync
> /lpv import <file>
> /lpv export <file>
> /lpv reloadconfig
> /lpv bulkupdate
> /lpv translations
> /lpv creategroup <group>
> /lpv deletegroup <group>
> /lpv listgroups
> /lpv createtrack <track>
> /lpv deletetrack <track>
> /lpv listtracks
DefomCode commented 11 months ago

Is this going to be decided? I tried all the solutions that I found here, but nothing helped me, there is no connection to rcon at all.

bitter-geek commented 11 months ago

@DefomCode I don't think this original version is ever going to be fixed. My guess is the developer has abandoned the project.

@aws1313 I'll try this soon. Is this your fork? I'm curious what was done to make things work.

aws1313 commented 11 months ago

@DefomCode I don't think this original version is ever going to be fixed. My guess is the developer has abandoned the project.

@aws1313 I'll try this soon. Is this your fork? I'm curious what was done to make things work.

@bitter-geek No, it is not my fork, but I have looked at the code. It seems that problem was that Velocity's responses work with ComponentMessages from KyoriPowered/adventure, but this plugin only uses raw strings. So the things your glist command returned like velocity.command.glist-player-plural or velocity.command.glist-view-all were some sort of ComponentMessage identifier/key. The plugin originally just returned them but they should have been interpreted/used by the ComponentApi. In the fixed version (which I linked) the identifier/key is taken, formatted to the correct message and then returned.

bitter-geek commented 11 months ago

@aws1313 Interesting! I gave it a try and the core commands work, but I'm not having any luck with plugin commands. I don't think I'm doing anything wrong, but I'm still pretty new to all of this.

When I run the plugin command from the console itself it works fine, but when I run it from rcon it says: Error executing: rc (TextComponentImpl{content="No such command", style=StyleImpl{obfuscated=not_set, bold=not_set, strikethrough=not_set, underlined=not_set, italic=not_set, color=NamedTextColor{name="red", value="#ff5555"}, clickEvent=null, hoverEvent=null, insertion=null, font=null}, children=[]})

aws1313 commented 11 months ago

@bitter-geek Can you give a little bit more information about which commands you are trying and which rcon client you are using? It still works fine for me...

ygtdmn commented 11 months ago

Hey guys, I stopped Minecraft development years ago and this repo is not active anymore. However, I can accept any pull requests and also give full control to a new maintainer. Hit me up on twitter/YigitDuman

bitter-geek commented 11 months ago

@aws1313 Sure, I'm trying to use RustyConnector to dynamically add/remove servers to the proxy (necessary for my environment but not working well with Waterfall). I'm also using mcrcon for the commands.

It could be some kind of wonky permissions thing (I've seen strange cases where RCON can't run commands in server plugins) but I don't know how to resolve it if that's the case.

aws1313 commented 11 months ago

@bitter-geek I was able to reproduce your problem. However, in this case the error is not caused by VelocityCron, but by RustyConnector itself. The way RustyConnector processes commands results in only commands from the console being accepted and executed. In addition, the responses are always sent to the console. I have created a fork of RustyConnector and fixed the error there. If you use the .jar file from the release "RustyConnector v0.7.1 for VelocityRcron" it should work. The main problem was

.requires(source -> source instanceof ConsoleCommandSource)

in line 40 in "/plugin/velocity/central/command/CommandRusty.java" in the original repository which forced the command to be sent from console.

bitter-geek commented 11 months ago

@aws1313 Dang! You're a wizard! I'll give this a try soon. I really appreciate your help!

bitter-geek commented 11 months ago

Hey @aws1313, I gave the RustyConnector .jar you made a try but it says I can't run it because it was compiled in a version of Java that's too high for my system. I'm running version 17. I know you're not really supporting this plugin, but if you have a few spare minutes and could re-compile the changes you made in a version that's <= 17 that would be awesome.

aws1313 commented 11 months ago

@bitter-geek Oops. I'm sorry... I recompiled it with Java 17 and created a new release and you can download the correct .jar file here. I hope it works this time...

bitter-geek commented 11 months ago

@aws1313 no need to be sorry! I just appreciate the help. It appears to be working now! Thank you! Do you have like a... "buy me a coffee" link or anything?

aws1313 commented 10 months ago

@bitter-geek No, I don't have a "Buy me a coffee" or anything like that, but I don't need that anyways. I'm just glad I could help you (and maybe others who will read this in the future) :)