Skip to content

Commit

Permalink
修复sqlite数据库初始化问题(之前修了没修好)
Browse files Browse the repository at this point in the history
  • Loading branch information
Gingmzmzx committed Jan 3, 2023
1 parent e191249 commit 38089ff
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>center.xzy.qb</groupId>
<artifactId>MessageSync</artifactId>
<version>1.9-SNAPSHOT</version>
<version>1.10-SNAPSHOT</version>
<packaging>jar</packaging>

<name>MessageSync</name>
Expand Down
16 changes: 9 additions & 7 deletions src/main/java/center/xzy/qb/messagesync/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,19 +35,21 @@ public final class Main extends JavaPlugin {
@Override
public void onEnable() {
instance = this;
try {
dbConn = DriverManager.getConnection("jdbc:sqlite:"+System.getProperty("user.dir")+"/plugins/MessageSync/user.db");
initDatabase(dbConn);
} catch (SQLException e) {
throw new RuntimeException(e);
}

// Plugin startup logic
// config.yml
getConfig().options().copyDefaults();
saveDefaultConfig();
Plugin plugin = getPlugin(Main.class);

// 初始化Sqlite数据库
try {
dbConn = DriverManager.getConnection("jdbc:sqlite:"+System.getProperty("user.dir")+"/plugins/MessageSync/user.db");
initDatabase(dbConn);
} catch (SQLException e) {
throw new RuntimeException(e);
}

// reg commands
getCommand("ms").setExecutor(new CommandHandler());
getCommand("say").setExecutor(new sayHandler());
Expand All @@ -57,7 +59,7 @@ public void onEnable() {
getServer().getPluginManager().registerEvents(new inventoryEventHandler(), this);

// check TitleManager
// more code...
// TODO connect TitleManager

// WebSocket
if (getConfig().getBoolean("enable-socket")){
Expand Down

0 comments on commit 38089ff

Please sign in to comment.