Skip to content

Commit

Permalink
feat: database support
Browse files Browse the repository at this point in the history
  • Loading branch information
titivermeesch committed Oct 19, 2024
1 parent 877728d commit 10fbe29
Show file tree
Hide file tree
Showing 57 changed files with 2,344 additions and 2,017 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 16
node-version: 20
cache: yarn
cache-dependency-path: docs/yarn.lock
- name: Install dependencies
Expand Down
7 changes: 5 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ java {


group = 'me.playbosswar.com'
version = '8.8.1'
version = '8.9.0'
description = 'CommandTimer'

repositories {
Expand All @@ -37,6 +37,7 @@ shadowJar {
include(dependency('org.jeasy:easy-rules-core:4.1.0'))
include(dependency('org.apache.commons:commons-text:1.10.0'))
include(dependency('io.sentry:sentry:7.0.0'))
include(dependency('com.j256.ormlite:ormlite-jdbc:6.1'))
}
// Needed in case the server software already packs sentry
relocate 'io.sentry', 'me.playbosswar.com.commandtimer.sentry'
Expand All @@ -51,6 +52,8 @@ dependencies {
implementation 'com.googlecode.json-simple:json-simple:1.1.1'
implementation 'org.apache.commons:commons-text:1.10.0'
implementation 'io.sentry:sentry:7.0.0'
implementation 'com.j256.ormlite:ormlite-jdbc:6.1'
implementation 'org.apache.commons:commons-pool2:2.12.0'
compileOnly 'io.papermc.paper:paper-api:1.21-R0.1-SNAPSHOT'
compileOnly 'me.clip:placeholderapi:2.11.6'
compileOnly 'org.jetbrains:annotations:23.1.0'
Expand All @@ -61,7 +64,7 @@ publishing {
maven(MavenPublication) {
groupId = 'me.playbosswar.com'
artifactId = 'commandtimer-java21'
version = '8.8.1'
version = '8.9.0'

from components.java
}
Expand Down
2 changes: 1 addition & 1 deletion docs/.nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
16.17.0
20.13.1
2 changes: 1 addition & 1 deletion docs/docs/events/index.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
sidebar_position: 4
sidebar_position: 5
---

# Events
Expand Down
2 changes: 1 addition & 1 deletion docs/docs/extensions/index.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
sidebar_position: 3
sidebar_position: 4
---

# Extensions
Expand Down
2 changes: 1 addition & 1 deletion docs/docs/faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ Add `register: true` in your MyCommand config and restart/reload the server

## Can I donate?

If you would like to donate, this can be done through my PayPal account `titivermeesch@live.be`
If you would like to donate, this can be done through my PayPal account `titivermeesch@gmail.com`
35 changes: 35 additions & 0 deletions docs/docs/storage/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
---
title: Storage
sidebar_position: 3
---

# Storage

There are currently 2 options to tasks. Local JSON files is the default option.

## Local JSON files

It's the most straightforward way to store tasks and does not require any additional setup.

Each time a task is created, a new file will be created in `plugins/CommandTimer/timers` with a unique ID associated
with that task. The ID is visible in the global tasks list (`/cmt` command).

## SQL Database (BETA)

CommandTimer supports SQL databases since v8.9.0. To use this feature you need to set up the following section in
`config.yml`:

```yaml
database:
enabled: true
url: jdbc:mysql://localhost:3306/commandtimer?user=root&password=admin
```
The `url` needs to point to the correct database instance database itself. The plugin will create the necessary tables.
The value `commandtimer` in the example above can be changed to anything you like as long as the database exists.

Using SQL as storage option will still create local JSON files for each task, but this is only to keep track of specific
metadata that are unique to each server. All other data will be stored in the SQL database.

**If you already have tasks saved in JSON files, you can use the command `/cmt migrateToDatabase` to move your JSON
files inside the database**
Loading

0 comments on commit 10fbe29

Please sign in to comment.