init: 项目初始化
项目初始化
This commit is contained in:
63
hamster-core-proxy/build.gradle
Normal file
63
hamster-core-proxy/build.gradle
Normal file
@@ -0,0 +1,63 @@
|
||||
setArchivesBaseName("HamsterCore-Proxy")
|
||||
|
||||
evaluationDependsOn(':hamster-core-common')
|
||||
|
||||
configurations {
|
||||
api.extendsFrom apiShade
|
||||
implementation.extendsFrom implementationShade
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compileOnly project(":hamster-core-common")
|
||||
//noinspection GradlePackageUpdate
|
||||
compileOnly('net.md-5:bungeecord-api:1.17-R0.1-SNAPSHOT')
|
||||
|
||||
// https://mvnrepository.com/artifact/com.zaxxer/HikariCP
|
||||
//noinspection GradlePackageUpdate
|
||||
apiShade 'com.zaxxer:HikariCP:4.0.3'
|
||||
// https://mvnrepository.com/artifact/com.squareup.okhttp3/okhttp
|
||||
apiShade 'com.squareup.okhttp3:okhttp:4.10.0'
|
||||
// https://mvnrepository.com/artifact/net.kyori/adventure-platform-bungeecord
|
||||
apiShade 'net.kyori:adventure-platform-bungeecord:4.1.2'
|
||||
|
||||
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.9.0'
|
||||
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.9.0'
|
||||
}
|
||||
|
||||
test {
|
||||
useJUnitPlatform()
|
||||
}
|
||||
|
||||
processResources {
|
||||
inputs.property "version", project.version
|
||||
filesMatching("bungee.yml") {
|
||||
expand "version": project.version
|
||||
}
|
||||
}
|
||||
|
||||
task addSource {
|
||||
doLast {
|
||||
sourceSets {
|
||||
main {
|
||||
java.srcDirs += [
|
||||
project(':hamster-core-common').sourceSets.main.java
|
||||
]
|
||||
resources.srcDirs += [
|
||||
project(':hamster-core-common').sourceSets.main.resources
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
classes.dependsOn(addSource)
|
||||
|
||||
jar {
|
||||
from([
|
||||
configurations.implementationShade.collect {
|
||||
it.isDirectory() ? it : zipTree(it)
|
||||
},
|
||||
configurations.apiShade.collect {
|
||||
it.isDirectory() ? it : zipTree(it)
|
||||
}
|
||||
])
|
||||
}
|
@@ -0,0 +1,37 @@
|
||||
package cn.hamster3.core.proxy;
|
||||
|
||||
import cn.hamster3.core.common.constant.ConstantObjects;
|
||||
import net.md_5.bungee.api.plugin.Plugin;
|
||||
|
||||
public class HamsterCorePlugin extends Plugin {
|
||||
private static HamsterCorePlugin instance;
|
||||
|
||||
public static HamsterCorePlugin getInstance() {
|
||||
return instance;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoad() {
|
||||
instance = this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEnable() {
|
||||
long start = System.currentTimeMillis();
|
||||
getLogger().info("仓鼠核心正在启动...");
|
||||
long time = System.currentTimeMillis() - start;
|
||||
getLogger().info("仓鼠核心已启动,总计耗时 " + time + " ms.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDisable() {
|
||||
long start = System.currentTimeMillis();
|
||||
getLogger().info("仓鼠核心正在关闭...");
|
||||
ConstantObjects.WORKER_EXECUTOR.shutdownNow();
|
||||
getLogger().info("已暂停 WORKER_EXECUTOR.");
|
||||
ConstantObjects.SCHEDULED_EXECUTOR.shutdownNow();
|
||||
getLogger().info("已暂停 SCHEDULED_EXECUTOR.");
|
||||
long time = System.currentTimeMillis() - start;
|
||||
getLogger().info("仓鼠核心已关闭,总计耗时 " + time + " ms.");
|
||||
}
|
||||
}
|
3
hamster-core-proxy/src/main/resources/bungee.yml
Normal file
3
hamster-core-proxy/src/main/resources/bungee.yml
Normal file
@@ -0,0 +1,3 @@
|
||||
name: HamsterCore-Proxy
|
||||
main: cn.hamster3.core.proxy.HamsterCorePlugin
|
||||
version: ${version}
|
Reference in New Issue
Block a user