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

List game & server version when starting server #1181

Merged
8 commits merged into from
Jun 4, 2022

Conversation

AZthemute
Copy link
Contributor

Description

Please carefully read the Contributing note and Code of conduct before making any pull requests.
And, Do not make a pull request to merge into stable unless it is a hotfix. Use the development branch instead.

Issues fixed by this PR

Outputs game and server version on startup. Currently hardcoded in the language files unfortunately. If anyone wants to fix my idiocy, I'd be pleased to accept it.

Type of changes

  • Bug fix
  • New feature
  • Enhancement
  • Documentation

Checklist:

  • My code follows the style guidelines of this project
  • My pull request is unique and no other pull requests have been opened for these changes
  • I have read the Contributing note and Code of conduct
  • I am responsible for any copyright issues with my code if it occurs in the future.

@@ -52,7 +52,8 @@
"run_mode_help": "Server run mode must be 'HYBRID', 'DISPATCH_ONLY', or 'GAME_ONLY'. Unable to start Grasscutter...",
"create_resources": "Creating resources folder...",
"resources_error": "Place a copy of 'BinOutput' and 'ExcelBinOutput' in the resources folder.",
"version": "Grasscutter version: %s-%s"
Copy link
Member

@4Benj 4Benj Jun 3, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't change this

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's wrong?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changing the substitution parameter count would normally be a problem but I'm not getting any hits for existing usage of this so it might be fine.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've traced it back to edc75b2 but it looks like the code that was referencing this translation string has since been replaced with https://github.com/mingjun97/Grasscutter/blob/2dc0120c81ff0c47af3f1e30069027d0622ea5c5/src/main/java/emu/grasscutter/Grasscutter.java#L84 so it's probably fine to repurpose this so long as the new version string is appropriate (I haven't checked that)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new version string is 1.1.2-dev so it wouldn't even be correct to use %s-%s.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new version string is 1.1.2-dev so it wouldn't even be correct to use %s-%s.

The second %s is for the git hash so we can easily identify someone’s build (primarily for development but also useful in stable)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new version string is 1.1.2-dev so it wouldn't even be correct to use %s-%s.

The second %s is for the git hash so we can easily identify someone’s build (primarily for development but also useful in stable)

Ohhhh sorry about that, I'll make sure to re-implement that as soon as I can.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup, it works for me now.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new version string is 1.1.2-dev so it wouldn't even be correct to use %s-%s.

The second %s is for the git hash so we can easily identify someone’s build (primarily for development but also useful in stable)

AFAICT it's only used to construct the version string, we may as well just have a single string for version and change the gradle script from git rev-parse --verify --short HEAD to git describe --tags --dirty

@@ -269,6 +269,8 @@ public void run() {
@Override
public void onStartFinish() {
Grasscutter.getLogger().info(translate("messages.status.free_software"));
Grasscutter.getLogger().info(translate("messages.status.game_version"));
Grasscutter.getLogger().info(translate("messages.status.version"));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do something like this but edit it to use the new translation system.
https://github.com/mingjun97/Grasscutter/blob/5aefad61eacfad17c46a4f139b5d5c8f56c0aff7/src/main/java/emu/grasscutter/Grasscutter.java#L84
(Originally from an old PR which was merged but was accidently removed)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the help, I've fiddled around with the code a little more and everything works perfectly on my side!

@@ -52,7 +52,8 @@
"run_mode_help": "服务器运行模式必须为 'HYBRID'(混合)、'DISPATCH_ONLY'(仅 Dispatch) 或 'GAME_ONLY'(仅游戏)。Grasscutter 启动失败...",
"create_resources": "正在创建 resources 目录...",
"resources_error": "请将 BinOutput 和 ExcelBinOutput 复制到 resources 目录。",
"version": "Grasscutter 版本:%s-%s"
"version": "Grasscutter 版本:%s",
"game_version": "游戏版本: 2.7.0"
Copy link
Contributor

@Tesutarin Tesutarin Jun 3, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

incorrect punctuation
"游戏版本:%s"
update other language files too

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry about that, I just used a translator because I didn't want to leave the other languages throwing errors constantly.

src/main/resources/languages/pl-PL.json Outdated Show resolved Hide resolved
src/main/java/emu/grasscutter/server/game/GameServer.java Outdated Show resolved Hide resolved
@ghost ghost merged commit d4bb7c9 into Grasscutters:development Jun 4, 2022
Birdulon pushed a commit to Birdulon/Grasscutter that referenced this pull request Aug 21, 2022
* When the server starts, it now outputs the game and server version. Too dumb to not hardcode it - sorry!

* ...

* sorry i dropped my spaghetti, I'll help clean that

* Doing simple stuff: now without hardcoding!

* Restored Git hash functionality

* Fixed other languages and made the output more useful.

* Forgot this file lol
This pull request was closed.
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

4 participants