Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
115 changes: 50 additions & 65 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
plugins {
id 'java'
id 'com.github.johnrengelman.shadow' version '7.1.2'
id 'com.gradleup.shadow' version '8.3.6'
id 'io.freefair.lombok' version '8.10.2'
id 'maven-publish' // for jitpack.io
id 'maven-publish'
}

group = 'com.github.server-utilities'
Expand All @@ -11,83 +11,70 @@ version = '1.0.0'
repositories {
mavenCentral()
mavenLocal()

// JitPack
maven { url 'https://jitpack.io' }
}

dependencies {
implementation('com.github.simplix-softworks:simplixstorage:3.2.7')
shadow('com.github.simplix-softworks:simplixstorage:3.2.7')

implementation('mysql:mysql-connector-java:8.0.33')
shadow('mysql:mysql-connector-java:8.0.33')

implementation('org.xerial:sqlite-jdbc:3.46.1.0')
.exclude(group: 'org.slf4j', module: 'slf4j-api')
shadow('org.xerial:sqlite-jdbc:3.46.1.0')
.exclude(group: 'org.slf4j', module: 'slf4j-api')

implementation('com.zaxxer:HikariCP:5.1.0')
.exclude(group: 'org.slf4j', module: 'slf4j-api')
.exclude(group: 'org.apache.logging.log4j', module: 'log4j-api')
.exclude(group: 'org.apache.logging.log4j', module: 'log4j-core')
.exclude(group: 'org.apache.logging.log4j', module: 'log4j-slf4j-impl')
shadow('com.zaxxer:HikariCP:5.1.0')
.exclude(group: 'org.slf4j', module: 'slf4j-api')
.exclude(group: 'org.apache.logging.log4j', module: 'log4j-api')
.exclude(group: 'org.apache.logging.log4j', module: 'log4j-core')
.exclude(group: 'org.apache.logging.log4j', module: 'log4j-slf4j-impl')

implementation('net.objecthunter:exp4j:0.4.8')
shadow('net.objecthunter:exp4j:0.4.8')
configurations {
implementation {
exclude group: 'org.slf4j', module: 'slf4j-api'
exclude group: 'org.apache.logging.log4j'
}
shadow {
exclude group: 'org.slf4j', module: 'slf4j-api'
exclude group: 'org.apache.logging.log4j'
}
}

implementation('com.google.re2j:re2j:1.7')
shadow('com.google.re2j:re2j:1.7')
dependencies {
implementation "me.nobeld:SimplixStorage:3.3.0-beta.3"
implementation 'mysql:mysql-connector-java:8.0.33'
implementation 'org.xerial:sqlite-jdbc:3.46.1.0'
implementation 'com.zaxxer:HikariCP:5.1.0'
implementation 'net.objecthunter:exp4j:0.4.8'
implementation 'com.google.re2j:re2j:1.7'
}

shadowJar {
relocate('de.leonhard', 'tv.quaint.thebase.lib.leonhard')
relocate('com.mysql', 'tv.quaint.thebase.lib.mysql')
relocate('com.zaxxer.hikari', 'tv.quaint.thebase.lib.hikari')
relocate('net.objecthunter.exp4j', 'tv.quaint.thebase.lib.exp4j')
relocate('com.google.re2j', 'tv.quaint.thebase.lib.re2j')
relocate('com.google.gson', 'tv.quaint.thebase.lib.google.gson')
relocate('com.google.guava', 'tv.quaint.thebase.lib.google.guava')
relocate('org.sqlite', 'tv.quaint.thebase.lib.sqlite')
relocate('org.xerial', 'tv.quaint.thebase.lib.xerial')
relocate('org.apache.commons', 'tv.quaint.thebase.lib.apache.commons')
relocate('org.yaml', 'tv.quaint.thebase.lib.yaml')
relocate('org.jetbrains', 'tv.quaint.thebase.lib.jetbrains')
relocate('org.bstats', 'tv.quaint.thebase.lib.bstats')
relocate('lombok', 'tv.quaint.thebase.lib.lombok')

exclude('com.google.common.*')
exclude('org.apache.logging.log4j.*')
exclude('org.slf4j.*')

archiveFileName = project.name + '-' + project.version + '.jar'
configurations = [project.configurations.implementation, project.configurations.shadow]
Map<String, String> relocations = [
'de.leonhard': 'gg.drak.thebase.lib.leonhard',
'com.mysql': 'gg.drak.thebase.lib.mysql',
'com.zaxxer.hikari': 'gg.drak.thebase.lib.hikari',
'net.objecthunter.exp4j': 'gg.drak.thebase.lib.exp4j',
'com.google.re2j': 'gg.drak.thebase.lib.re2j',
'com.google.gson': 'gg.drak.thebase.lib.google.gson',
'com.google.guava': 'gg.drak.thebase.lib.google.guava',
'org.sqlite': 'gg.drak.thebase.lib.sqlite',
'org.xerial': 'gg.drak.thebase.lib.xerial',
'org.apache.commons': 'gg.drak.thebase.lib.apache.commons',
'org.yaml': 'gg.drak.thebase.lib.yaml',
'org.bstats': 'gg.drak.thebase.lib.bstats'
]
relocations.each { src, dest -> relocate src, dest }

exclude 'com/google/common/**'
exclude 'org/apache/logging/log4j/**'
exclude 'org/slf4j/**'
exclude 'META-INF/**'
exclude '**/LICENSE'
exclude '**/README.md'
exclude '**/docs/**'

archiveFileName = "${project.name}-${project.version}.jar"
}

tasks.register('deploy', Copy) {
// Define the deployment directory
def deployDir = file(System.getenv("DEPLOY_DIR") ?: "$rootDir/deploy")
def deployDir = file(System.getenv('DEPLOY_DIR') ?: "$rootDir/deploy")
from shadowJar.archiveFile
into deployDir

// Ensure the deployment directory exists
doFirst {
println "Deploying to: $deployDir"
deployDir.mkdirs()
println "Generated JAR file: ${shadowJar.archiveFile}"
println "Generated JAR file: ${shadowJar.archiveFile.get()}"
}

// Copy the shadowJar output
from shadowJar.archiveFile
into deployDir
}

// Ensure that the deploy task runs after the shadowJar task
shadowJar.finalizedBy(deploy)

tasks.named('deploy').configure {
dependsOn 'shadowJar', 'sourcesJar', 'javadocJar', 'jar'
}
Expand All @@ -108,6 +95,4 @@ java {
wrapper {
gradleVersion = '8.9'
distributionType = Wrapper.DistributionType.BIN
}

// comment for testing
}
2 changes: 2 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ org.gradle.parallel = true
org.gradle.caching = true
org.gradle.vfs.watch = false

crate.version = 4.0.0-RC.2

# Other properties
#name = TheBase
#group = com.github.server-utilities
Expand Down
5 changes: 2 additions & 3 deletions gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,7 @@ done
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s
' "$PWD" ) || exit
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit

# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
Expand Down Expand Up @@ -206,7 +205,7 @@ fi
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'

# Collect all arguments for the java command:
# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
# and any embedded shellness will be escaped.
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
# treated as '${Hostname}' itself on the command line.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package tv.quaint;
package gg.drak.thebase;

import lombok.Getter;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
package tv.quaint.async;
package gg.drak.thebase.async;

import lombok.Getter;
import lombok.Setter;
import org.jetbrains.annotations.NotNull;

import javax.swing.*;
import java.util.concurrent.CompletableFuture;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
package tv.quaint.async;
package gg.drak.thebase.async;

import lombok.Getter;
import lombok.Setter;

import javax.swing.*;
import java.util.Optional;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ConcurrentSkipListSet;
Expand All @@ -15,33 +14,7 @@ public class AsyncUtils {
@Getter @Setter
private static AtomicLong currentTaskId = new AtomicLong(0);

// @Getter @Setter
// private static Timer taskThread;
//
//
// public static void restartTicker() {
// if (taskThread != null) {
// taskThread.stop();
// }
//
// taskThread = createNewTimer();
// taskThread.start();
// }
//
// public static Timer createNewTimer() {
// return new Timer(50, e -> {
// try {
// tickTasks();
// } catch (Exception ex) {
// ex.printStackTrace();
// }
// });
// }

public static void init() {
// restartTicker();
//
// getCurrentTaskId().set(0);
}

@Getter @Setter
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package tv.quaint.async;
package gg.drak.thebase.async;

import lombok.Getter;
import lombok.Setter;
import org.jetbrains.annotations.NotNull;
import tv.quaint.objects.handling.IEventable;
import gg.drak.thebase.objects.handling.IEventable;

import java.util.concurrent.CompletableFuture;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package tv.quaint.async;
package gg.drak.thebase.async;

import lombok.Getter;
import lombok.Setter;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package tv.quaint.async;
package gg.drak.thebase.async;

import org.jetbrains.annotations.NotNull;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package tv.quaint.async;
package gg.drak.thebase.async;

import lombok.Getter;
import lombok.Setter;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package tv.quaint.async;
package gg.drak.thebase.async;

import lombok.Getter;
import lombok.Setter;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package tv.quaint.async;
package gg.drak.thebase.async;

import java.util.concurrent.CompletableFuture;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package tv.quaint.events;
package gg.drak.thebase.events;

import lombok.Getter;
import lombok.Setter;
import tv.quaint.events.components.BaseEvent;
import tv.quaint.events.components.FunctionedCall;
import tv.quaint.objects.handling.IEventable;
import gg.drak.thebase.events.components.BaseEvent;
import gg.drak.thebase.events.components.FunctionedCall;
import gg.drak.thebase.objects.handling.IEventable;

import java.lang.reflect.Method;
import java.util.Arrays;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package tv.quaint.events;
package gg.drak.thebase.events;

/**
* Simple interface for tagging all EventListeners
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package tv.quaint.events;
package gg.drak.thebase.events;

import lombok.Getter;
import lombok.Setter;
import tv.quaint.events.components.BaseEvent;
import tv.quaint.events.processing.BaseProcessor;
import tv.quaint.events.processing.exception.BaseEventException;
import tv.quaint.events.processing.BaseEventExecutor;
import tv.quaint.objects.handling.IEventable;
import gg.drak.thebase.events.components.BaseEvent;
import gg.drak.thebase.events.processing.BaseProcessor;
import gg.drak.thebase.events.processing.exception.BaseEventException;
import gg.drak.thebase.events.processing.BaseEventExecutor;
import gg.drak.thebase.objects.handling.IEventable;

import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
package tv.quaint.events;
package gg.drak.thebase.events;

import lombok.Getter;
import lombok.Setter;
import org.jetbrains.annotations.NotNull;
import tv.quaint.events.components.BaseEvent;
import tv.quaint.events.processing.BaseEventPriority;
import tv.quaint.events.processing.exception.BaseEventException;
import tv.quaint.events.processing.BaseEventExecutor;
import tv.quaint.objects.handling.IEventable;
import gg.drak.thebase.events.components.BaseEvent;
import gg.drak.thebase.events.processing.BaseEventPriority;
import gg.drak.thebase.events.processing.exception.BaseEventException;
import gg.drak.thebase.events.processing.BaseEventExecutor;
import gg.drak.thebase.objects.handling.IEventable;

/**
* Stores relevant information for plugin listeners
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package tv.quaint.events.components;
package gg.drak.thebase.events.components;

import lombok.Getter;
import lombok.Setter;
import tv.quaint.events.BaseEventHandler;
import gg.drak.thebase.events.BaseEventHandler;

import java.util.Date;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package tv.quaint.events.components;
package gg.drak.thebase.events.components;

import lombok.Getter;
import lombok.Setter;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package tv.quaint.events.processing;
package gg.drak.thebase.events.processing;

import org.jetbrains.annotations.NotNull;
import tv.quaint.events.BaseEventListener;
import tv.quaint.events.components.BaseEvent;
import tv.quaint.events.processing.exception.BaseEventException;
import gg.drak.thebase.events.BaseEventListener;
import gg.drak.thebase.events.components.BaseEvent;
import gg.drak.thebase.events.processing.exception.BaseEventException;

/**
* Interface which defines the class for event call backs to plugins
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
package tv.quaint.events.processing;
package gg.drak.thebase.events.processing;

import lombok.Getter;

@Getter
public enum BaseEventPriority {
/**
* Event call is of very low importance and should be run first, to allow
Expand Down Expand Up @@ -36,8 +39,4 @@ public enum BaseEventPriority {
private BaseEventPriority(int slot) {
this.slot = slot;
}

public int getSlot() {
return slot;
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package tv.quaint.events.processing;
package gg.drak.thebase.events.processing;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
Expand Down
Loading