forked from WorldStarHipHopX/playforia
-
-
Notifications
You must be signed in to change notification settings - Fork 32
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
More deobfuscation, code quality improvements, and Applet decoupling #130
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
PhilippvK
approved these changes
Dec 30, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Thank you for the efforts!
- Unused static fields that are never set are removed - Deobfuscated unused methods and constructors are removed - Deobfuscated empty methods are removed - Unused local variables are removed - Identical catch clauses are combined - For loops are converted into for-each loops - Redundant variables are inlined - Unused method parameters are removed - The unused FileUtil class is removed - The Stub inner class in Game is converted to static - Redundant throws clauses are removed - Large if-elses are converted to switch statements - Unnecessary multiplications by 1.0D to cast to double are removed
Url opening with Desktop.browse()
This enables removing a dependency on Applet APIs which are deprecated since Java 9. The browse API can only open URIs so this required changing existing code to construct URIs instead of URLs.
The Applet API is deprecated since Java 9. There were two fields in Parameters referencing the Applet host, documentBaseHost and codeBaseHost, and both are safe to remove: - codeBaseHost was used as a fallback for the server parameter, but since that is always set in Game, the field is not necessary - documentBaseHost was used as a fallback for the sitename parameter, but that parameter is hardcoded to "playray" in Game so the field is not necessary
Applet APIs are deprecated since Java 9. Instead of using an AppletStub to pass parameters to the applet, we can just construct a map and pass that to the Parameters class. This initially broke retrying a connection in case of server restarts since previously the Parameters were constructed every time in AApplet's run method but now they're only constructed once upon start-up. The retries were fixed fixed by removing the nulling of the params field in AApplet's destroy field.
This is no longer used.
The only place that uses the applet is TellFriendHandler and the method it calls opens a pop-up and accepts any Java AWT component. Therefore, it is safe to rename to applet field in Parameters is to rootComponent to remove the coupling from the deprecated Applet class.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR contains the following changes:
getAppletContext().showDocument()
toDesktop.browse()
. This will enable completely dropping Applet from the codebase soon as there's only minor things remaining.