Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added admin commands, refactored help command, and created command descriptions + more #23

Merged
merged 6 commits into from Apr 19, 2022

Conversation

4Benj
Copy link
Member

@4Benj 4Benj commented Apr 19, 2022

Changes:

  • Added default to usage() for command annotations
  • Added descriptions to commands
  • Added account.hasPermission(permission) instead of using !permissions.contains("*") && !permissions.contains(permissionNode) and changed the usage in CommandMap
  • Added a wip kick command. at the moment it just closes the session which just freaks out the server because the client tries to connect like 10 times before it gives up and reconnects (This is more of a placeholder thing until we can actually disconnect players and send like a server message or something)
  • Added a stop command which just kills the server and notifies the players
  • Added a broadcast command which messages all players
  • Reimplemented my sendmsg command but made it sendservermessage (sendmsg as a player sends a direct message from the sent player... I think, I haven't had another device to test it on)
  • Changed reload command so there is feedback when sending as player
  • Refactored help command to make it look better, display it's description, and not display the same command multiple times because of aliases
  • Removed "usage: " from all usages

Screenshot of help command is console:
image

Screenshot of help command in-game:
/help
image
/help sendmessage
image

Additonal stuff: Fixed + refactored help command. Removed 'Usage: ' from all commands. Created 'player.hasPermission(permission)' function. Created default for Usage annotation. Created hashmap version of 'getHandlers' and renamed the original to getHandlersAsList()
@alt3ri
Copy link
Member

alt3ri commented Apr 19, 2022

<3

@SpikeHD
Copy link
Contributor

SpikeHD commented Apr 19, 2022

Just as a heads up since they were just added, this is gonna have residual Usage: XYZ strings for the usages of setworldlevel and givechar :)

@4Benj
Copy link
Member Author

4Benj commented Apr 19, 2022

Didn't realise that was merged, sorry. I'll make the same changes to those commands as I did with the others

@ghost ghost requested a review from KingRainbow44 April 19, 2022 10:50
@Lubin502831
Copy link

How to solve the relic entry

@4Benj
Copy link
Member Author

4Benj commented Apr 19, 2022

How to solve the relic entry

I'm not sure, go ask on the discord and please keep PR comments about the PR

(Still broken but now it actually disconnects the player)
@4Benj
Copy link
Member Author

4Benj commented Apr 19, 2022

Just a heads up in case this gets pushed in.
This is the error that spams the console due to the client trying to keep it's connection alive when it's been closed by the server.
Probably should go into a known-issues part of the readme or something (along with the relic thing) until we find a way to actually kick players from the game server.
This also happens when you quickly stop and start the server (even without the /stop command) and the client isn't given enough time to timeout.

[INFO] Client disconnected from 127.0.0.1
[INFO] Client connected from 127.0.0.1
io.jpower.kcp.netty.KcpException: State=-1 after update()
        at io.jpower.kcp.netty.UkcpServerChannel.run(UkcpServerChannel.java:395)
        at io.netty.util.concurrent.PromiseTask.runTask(PromiseTask.java:98)
        at io.netty.util.concurrent.ScheduledFutureTask.run(ScheduledFutureTask.java:170)
        at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:164)
        at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:469)
        at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:500)
        at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:986)
        at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
        at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
        at java.lang.Thread.run(Unknown Source)

@MlgmXyysd
Copy link
Member

MlgmXyysd commented Apr 19, 2022

Just a heads up in case this gets pushed in. This is the error that spams the console due to the client trying to keep it's connection alive when it's been closed by the server. Probably should go into a known-issues part of the readme or something (along with the relic thing) until we find a way to actually kick players from the game server. This also happens when you quickly stop and start the server (even without the /stop command) and the client isn't given enough time to timeout.

[INFO] Client disconnected from 127.0.0.1
[INFO] Client connected from 127.0.0.1
io.jpower.kcp.netty.KcpException: State=-1 after update()
        at io.jpower.kcp.netty.UkcpServerChannel.run(UkcpServerChannel.java:395)
        at io.netty.util.concurrent.PromiseTask.runTask(PromiseTask.java:98)
        at io.netty.util.concurrent.ScheduledFutureTask.run(ScheduledFutureTask.java:170)
        at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:164)
        at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:469)
        at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:500)
        at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:986)
        at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
        at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
        at java.lang.Thread.run(Unknown Source)

The same error here, but not shutting down the server. This error also occurs when the client exits abnormally. For example, network disconnection, direct click on X (window exit button) and so on.

@KingRainbow44 KingRainbow44 merged commit 59d0120 into Grasscutters:main Apr 19, 2022
qinastar pushed a commit to qinastar/ys that referenced this pull request Nov 1, 2022
…element

added Quest Trigger EXECs
* added EXEC_ADD_CUR_AVATAR_ENERGY
* added EXEC_CHANGE_AVATAR_ELEMET
* added new function 'changeAvatarElement' in avatar.java
* changed hardcoded MC depot skill to read json data in HandlerSetPlayerBornDataReq.Data
* changed refill function in EnergyManager.java
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants