Skip to content

Commit

Permalink
Merge pull request grakkit#19 from MercerK/bugfix/sql
Browse files Browse the repository at this point in the history
What's good, I should first mention that I'm not at all knowledgeable on driver-related stuff like this and thus concur that this is indeed black magic lmao

While this seems like a fix for a problem caused by a much larger issue, that issue has been found inherently ambiguous by @hb432 and others. Perhaps in the future we can attempt to patch that, however the severity of this issue is impactful enough that I think it's a good move to merge your pull request right now instead of venturing down that rabbit hole...

I compiled this myself and have confirmed that CoreProtect & other previously affected plugins seem to be working fine now. Thank you!
  • Loading branch information
brayjamin authored Jan 6, 2022
2 parents a91d150 + acda64d commit 8875bbf
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
6 changes: 3 additions & 3 deletions common/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
<dependency>
<artifactId>graal-sdk</artifactId>
<groupId>org.graalvm.sdk</groupId>
<version>21.2.0</version>
<version>21.3.0</version>
</dependency>
<dependency>
<artifactId>js</artifactId>
<groupId>org.graalvm.js</groupId>
<version>21.2.0</version>
<version>21.3.0</version>
</dependency>
<dependency>
<artifactId>minimal-json</artifactId>
Expand All @@ -19,7 +19,7 @@
<dependency>
<artifactId>truffle-api</artifactId>
<groupId>org.graalvm.truffle</groupId>
<version>21.2.0</version>
<version>21.3.0</version>
</dependency>
</dependencies>
<modelVersion>4.0.0</modelVersion>
Expand Down
4 changes: 4 additions & 0 deletions paper/src/main/java/grakkit/Main.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package grakkit;

import java.lang.reflect.Field;
import java.sql.DriverManager;

import java.util.HashMap;

Expand All @@ -20,6 +21,9 @@ public class Main extends JavaPlugin {

@Override
public void onLoad() {
// Black magic. This fixes a bug, as something is breaking SQL Integration for other plugins.
// See https://github.com/grakkit/grakkit/issues/14.
DriverManager.getDrivers();
Grakkit.patch(new Loader(this.getClassLoader())); // CORE - patch class loader with GraalJS
try {
Field internal = this.getServer().getClass().getDeclaredField("commandMap");
Expand Down

0 comments on commit 8875bbf

Please sign in to comment.