1
mirror of https://github.com/carm-outsource/TimeReward.git synced 2024-09-18 18:55:49 +00:00

项目初始化

This commit is contained in:
Carm Jos 2022-02-27 22:07:22 +08:00
commit dc96a8d1cf
14 changed files with 511 additions and 0 deletions

38
.github/workflows/maven.yml vendored Normal file
View File

@ -0,0 +1,38 @@
# This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven
name: Build & Tests
on:
# 支持手动触发构建
workflow_dispatch:
push:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: "Set up JDK"
uses: actions/setup-java@v2
with:
java-version: '11'
distribution: 'adopt'
cache: maven
server-id: github
server-username: MAVEN_USERNAME
server-password: MAVEN_TOKEN
- name: "Package"
run: mvn -B package --file pom.xml -Dmaven.javadoc.skip=true
env:
MAVEN_USERNAME: ${{ github.repository_owner }}
MAVEN_TOKEN: ${{secrets.GITHUB_TOKEN}}
- name: "Target Stage"
run: mkdir staging && cp asset/*.jar staging
- name: "Upload artifact"
uses: actions/upload-artifact@v2
with:
name: Artifact
path: staging

41
.github/workflows/release.yml vendored Normal file
View File

@ -0,0 +1,41 @@
name: Release & Upload
on:
release:
types:
- published # 创建release的时候触发
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: "Checkout"
uses: actions/checkout@v2
- name: "Set up JDK"
uses: actions/setup-java@v2
with:
java-version: '11'
distribution: 'adopt'
cache: maven
server-id: github
server-username: MAVEN_USERNAME
server-password: MAVEN_TOKEN
- name: "Maven Package"
run: mvn -B package --file pom.xml -Dmaven.javadoc.skip=true -DskipTests
env:
MAVEN_USERNAME: ${{ github.repository_owner }}
MAVEN_TOKEN: ${{secrets.GITHUB_TOKEN}}
- name: "Upload Release Asset"
id: upload-release-asset
uses: shogo82148/actions-upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: asset/*.jar
asset_content_type: application/java-archive

5
.gitignore vendored Normal file
View File

@ -0,0 +1,5 @@
/.idea/
/target/
./*.iml
*.iml
asset/

55
README.md Normal file
View File

@ -0,0 +1,55 @@
```text
_____ _ _____ _ _ _
| __ \ (_) | __ \ | | | | (_)
| |__) |___ __ _ _ ___ _ __ | |__) | __ ___ | |_ ___ ___| |_ _ ___ _ __
| _ // _ \/ _` | |/ _ \| '_ \ | ___/ '__/ _ \| __/ _ \/ __| __| |/ _ \| '_ \
| | \ \ __/ (_| | | (_) | | | | | | | | | (_) | || __/ (__| |_| | (_) | | | |
|_| \_\___|\__, |_|\___/|_| |_| |_| |_| \___/ \__\___|\___|\__|_|\___/|_| |_|
__/ |
|___/
```
# timereward
[![workflow](https://github.com/CarmJos/timereward/actions/workflows/maven.yml/badge.svg?branch=master)](https://github.com/CarmJos/timereward/actions/workflows/maven.yml)
![Support](https://img.shields.io/badge/Minecraft-Java%201.16--Latest-yellow)
![](https://visitor-badge.glitch.me/badge?page_id=timereward.readme)
区域保护插件将不符合条件的玩家弹出区域基于EasyPlugin实现。
本插件由 [重庆溢鹏多赛科技有限公司](https://ypchongqing.com) 请求本人开发,经过授权后开源。
## 插件依赖
- **[必须]** 插件本体基于 [Spigot-API](https://hub.spigotmc.org/stash/projects/SPIGOT) 、 [BukkitAPI](http://bukkit.org/) 实现。
- **[自带]** 插件功能基于 [EasyPlugin](https://github.com/CarmJos/EasyPlugin) 实现。
- **[自带]** 数据功能基于 [EasySQL](https://github.com/CarmJos/EasySQL) 实现。
详细依赖列表可见 [Dependencies](https://github.com/CarmJos/timereward/network/dependencies) 。
## 插件指令
指令主指令为 `/TimeReward`
```text
```
## 插件权限
```text
# TimeReward.admin
- 建筑魔杖的管理权限。
```
## 配置文件
### 插件配置文件 ([config.yml](src/main/resources/config.yml))
详见源文件。
### 消息配置文件 ([messages.yml](src/main/java/cc/carm/plugin/timereward/configuration/PluginMessages.java))
详见代码源文件,将在首次启动时生成配置。

Binary file not shown.

198
pom.xml Normal file
View File

@ -0,0 +1,198 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<properties>
<java.version>11</java.version>
<maven.compiler.source>${java.version}</maven.compiler.source>
<maven.compiler.target>${java.version}</maven.compiler.target>
<easyplugin.version>1.3.9</easyplugin.version>
<easysql.version>0.3.8</easysql.version>
</properties>
<groupId>cc.carm.plugin</groupId>
<artifactId>timereward</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>TimeReward</name>
<description>区域保护插件将不符合条件的玩家弹出区域基于EasyPlugin实现。</description>
<url>https://github.com/CarmJos/TimeReward</url>
<ciManagement>
<system>GitHub Actions</system>
<url>https://github.com/CarmJos/TimeReward/actions/workflows/maven.yml</url>
</ciManagement>
<distributionManagement>
<downloadUrl>https://github.com/CarmJos/TimeReward/releases</downloadUrl>
</distributionManagement>
<repositories>
<repository>
<id>central</id>
<url>https://repo1.maven.org/maven2/</url>
</repository>
<repository>
<id>carm-repo</id>
<name>Carm's Repo</name>
<url>https://repo.carm.cc/repository/maven-public/</url>
</repository>
<repository>
<id>nexus</id>
<url>https://mvn.lumine.io/repository/maven-public/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>cc.carm.lib</groupId>
<artifactId>easysql-beecp</artifactId>
<version>${easysql.version}</version>
<scope>compile</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>cc.carm.lib</groupId>
<artifactId>easyplugin-main</artifactId>
<version>${easyplugin.version}</version>
<scope>compile</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>cc.carm.lib</groupId>
<artifactId>easyplugin-configuration</artifactId>
<version>${easyplugin.version}</version>
<scope>compile</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>catserver</groupId>
<artifactId>CatServer</artifactId>
<version>1.12.2-b10faff</version>
<scope>system</scope>
<systemPath>${project.basedir}/lib/CatServerSRG-b10faff.jar</systemPath>
</dependency>
<dependency>
<groupId>me.clip</groupId>
<artifactId>placeholderapi</artifactId>
<version>2.10.9</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.13.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jetbrains</groupId>
<artifactId>annotations</artifactId>
<version>23.0.0</version>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.1</version>
<configuration>
<useSystemClassLoader>false</useSystemClassLoader>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
<encoding>UTF-8</encoding>
<compilerArgument>-parameters</compilerArgument>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.2.0</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>3.2.0</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>jar-no-fork</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.2.3</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<createDependencyReducedPom>false</createDependencyReducedPom>
</configuration>
</execution>
</executions>
<configuration>
<finalName>${project.name}-${project.version}</finalName>
<outputDirectory>${project.basedir}/asset</outputDirectory>
<relocations>
<relocation>
<pattern>cc.carm.lib</pattern>
<shadedPattern>cc.carm.plugin.timereward.lib</shadedPattern>
</relocation>
</relocations>
<filters>
<filter>
<artifact>*:*</artifact>
<excludes>
<exclude>META-INF/MANIFEST.MF</exclude>
<exclude>META-INF/*.txt</exclude>
</excludes>
</filter>
</filters>
</configuration>
</plugin>
</plugins>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
</build>
</project>

View File

@ -0,0 +1,62 @@
package cc.carm.plugin.timereward;
import cc.carm.lib.easyplugin.EasyPlugin;
import cc.carm.lib.easyplugin.i18n.EasyPluginMessageProvider;
import cc.carm.plugin.timereward.configuration.PluginConfig;
import cc.carm.plugin.timereward.manager.ConfigManager;
public class Main extends EasyPlugin {
private static Main instance;
public Main() {
super(new EasyPluginMessageProvider.zh_CN());
instance = this;
}
protected static ConfigManager configManager;
@Override
public boolean initialize() {
log("加载插件配置文件...");
Main.configManager = new ConfigManager();
if (!Main.configManager.initConfig()) {
error("插件配置文件初始化失败,请检查文件权限。");
return false;
}
log("加载玩家管理器...");
log("注册监听器...");
log("注册指令...");
return true;
}
@Override
protected void shutdown() {
}
@Override
public boolean isDebugging() {
return PluginConfig.DEBUG.get();
}
public static Main getInstance() {
return instance;
}
public static void info(String... messages) {
getInstance().log(messages);
}
public static void severe(String... messages) {
getInstance().error(messages);
}
public static void debugging(String... messages) {
getInstance().debug(messages);
}
}

View File

@ -0,0 +1,4 @@
package cc.carm.plugin.timereward;
public class TimeRewardAPI {
}

View File

@ -0,0 +1,12 @@
package cc.carm.plugin.timereward.configuration;
import cc.carm.lib.easyplugin.configuration.impl.ConfigSound;
import cc.carm.lib.easyplugin.configuration.values.ConfigValue;
import org.bukkit.Sound;
public class PluginConfig {
public static final ConfigValue<Boolean> DEBUG = new ConfigValue<>(
"debug", Boolean.class, false
);
}

View File

@ -0,0 +1,14 @@
package cc.carm.plugin.timereward.configuration;
import cc.carm.lib.easyplugin.configuration.language.EasyMessageList;
import cc.carm.lib.easyplugin.configuration.language.MessagesRoot;
public class PluginMessages extends MessagesRoot {
public static final EasyMessageList NOT_ONLINE = new EasyMessageList(
new String[]{"&7玩家 &c%(player) &7并不在线。"},
new String[]{"%(player)"}
);
}

View File

@ -0,0 +1,50 @@
package cc.carm.plugin.timereward.manager;
import cc.carm.lib.easyplugin.configuration.file.FileConfig;
import cc.carm.lib.easyplugin.configuration.language.MessagesConfig;
import cc.carm.lib.easyplugin.configuration.language.MessagesInitializer;
import cc.carm.plugin.timereward.Main;
import cc.carm.plugin.timereward.configuration.PluginMessages;
public class ConfigManager {
private FileConfig pluginConfiguration;
private MessagesConfig messageConfiguration;
public boolean initConfig() {
try {
pluginConfiguration = new FileConfig(Main.getInstance(), "config.yml");
messageConfiguration = new MessagesConfig(Main.getInstance(), "messages.yml");
FileConfig.pluginConfiguration = () -> pluginConfiguration;
FileConfig.messageConfiguration = () -> messageConfiguration;
MessagesInitializer.initialize(messageConfiguration, PluginMessages.class);
return true;
} catch (Exception ex) {
return false;
}
}
public FileConfig getPluginConfig() {
return FileConfig.pluginConfiguration.get();
}
public FileConfig getMessageConfig() {
return FileConfig.messageConfiguration.get();
}
public void reload() throws Exception {
getPluginConfig().reload();
getMessageConfig().reload();
}
public void saveConfig() throws Exception {
getPluginConfig().save();
getMessageConfig().save();
}
}

View File

@ -0,0 +1,6 @@
# ${project.name} - ${project.description}
# 项目地址: ${project.url}
# 下载地址: ${project.distributionManagement.downloadUrl}
version: ${project.version}
debug: false

View File

@ -0,0 +1,5 @@
# ${project.name} - ${project.description}
# 项目地址: ${project.url}
# 下载地址: ${project.distributionManagement.downloadUrl}
version: ${project.version}

View File

@ -0,0 +1,21 @@
main: cc.carm.plugin.timereward.Main
name: TimeReward
version: ${project.version}
description: ${project.description}
website: ${project.url}
authors:
- CarmJos
commands:
"TimeReward":
permission: "TimeReward.admin"
description: "在线自动领奖的基础指令。"
usage: "/TimeReward help"
permissions:
"TimeReward.admin":
description: "区域保护插件的管理员权限。"
default: op