Skip to content

Commit

Permalink
fix(inject): Fixed failed injection.
Browse files Browse the repository at this point in the history
  • Loading branch information
CarmJos committed Jan 4, 2024
1 parent 2a67608 commit 1ba3272
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
</properties>
<groupId>com.artformgames</groupId>
<artifactId>bungeeauthproxy</artifactId>
<version>1.0.1</version>
<version>1.0.2</version>

<name>BungeeAuthProxy</name>
<url>https://github.com/ArtformGames/BungeeAuthProxy</url>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
})
public interface Config extends Configuration {

@HeaderComment("Debug mode for developers, with more detailed logs.")
ConfiguredValue<Boolean> DEBUG = ConfiguredValue.of(false);

@HeaderComment("MineCraft service settings")
Expand Down Expand Up @@ -38,10 +39,12 @@ interface PROXY extends Configuration {
@HeaderComment("Proxy port")
ConfiguredValue<Integer> PORT = ConfiguredValue.of(7890);

@HeaderComment("Proxy authentication settings")
@HeaderComment({
"Proxy authentication settings",
"If proxy authentication is not required, set 'enabled' to false."
})
interface AUTH extends Configuration {

@HeaderComment("Whether to enable proxy authentication")
ConfiguredValue<Boolean> ENABLED = ConfiguredValue.of(false);

ConfiguredValue<String> USERNAME = ConfiguredValue.of("proxy-username");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,14 @@ public byte[] transform(ClassLoader loader, String className, Class<?> classBein

handleMethod.setBody("{com.artformgames.injector.bungeeauthproxy.BungeeAuthProxyInjector.submitRequest($1, $2, $3);}");

// remove unused static initializer
CtConstructor staticBlock = clazz.getClassInitializer();
if (staticBlock != null) clazz.removeConstructor(staticBlock);

// remove unused cache field
CtField cacheField = clazz.getField("addressCache");
clazz.removeField(cacheField); // remove cache field
clazz.removeField(cacheField);


return clazz.toBytecode();
} catch (Exception e) {
Expand Down

0 comments on commit 1ba3272

Please sign in to comment.