Skip to content
This repository has been archived by the owner on Oct 1, 2024. It is now read-only.

Commit

Permalink
删除无用引用
Browse files Browse the repository at this point in the history
  • Loading branch information
Aruvelut-123 committed Aug 15, 2024
1 parent a5ea4d3 commit 5c1adc7
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 15 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/build-releases.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ jobs:
if: success() || failure()
with:
report_paths: '**/build/test-results/test*/TEST-*.xml'
- name: Fix before uploads
run: rm ./target/IDK-1.2.6.jar && cp ./target/IDK-jar-with-dependencies.jar ./target/IDK-1.2.6.jar && rm ./target/IDK-jar-with-dependencies.jar
- name: Upload Jar Asset
uses: JasonEtco/upload-to-release@master
env:
Expand Down
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>idk</groupId>
<artifactId>IDK</artifactId>
<version>1.2.7-alpha-3</version>
<version>1.2.7</version>
<packaging>jar</packaging>

<name>IDK</name>
Expand Down
26 changes: 19 additions & 7 deletions src/main/java/idk/team/IDK.java
Original file line number Diff line number Diff line change
@@ -1,17 +1,12 @@
package idk.team;

import idk.team.plugin.IDKPluginManagement;
import org.apache.logging.log4j.LogManager;
import org.bukkit.Bukkit;
import org.bukkit.configuration.Configuration;
import org.bukkit.configuration.MemoryConfiguration;
import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.java.JavaPlugin;

import java.io.*;
import java.net.URL;
import java.net.URLClassLoader;
import java.net.URLDecoder;
import java.util.Arrays;
import java.util.Enumeration;
import java.util.Objects;
Expand All @@ -20,23 +15,36 @@
import java.util.logging.Logger;

public final class IDK extends JavaPlugin {
//获取插件数据文件夹的绝对路径
public String data_folder = this.getDataFolder().getAbsolutePath();
//获取插件消息配置
public IDKMessageConfig messages = new IDKMessageConfig(data_folder, this.getConfig().getString("lang")) {
protected void finalize() throws Throwable {
super.finalize();
}
};
//获取Bukkit的Logger
public Logger logger = Bukkit.getLogger();
//获取Bukkit的Logger
public static Logger log = Bukkit.getLogger();
//获取IDK的实例
public static IDK idk;
//测试版本
public boolean test_build = false;
//Beta版本
public boolean beta_build = false;
//Alpha版本
public boolean alpha_build = true;
//调试模式
public boolean debug = true;
//插件前缀
public String prefix = messages.getString("prefix");
//配置版本
int config_ver = 4;
//插件列表
String plugins = null;

//解压jar包
public static void unzipJar(String destinationDir, String jarPath) throws IOException {
File file = new File(jarPath);
JarFile jar = new JarFile(file);
Expand Down Expand Up @@ -77,19 +85,21 @@ public static void unzipJar(String destinationDir, String jarPath) throws IOExce
}
}

//插件加载逻辑
@Override
public void onLoad() {
this.plugins = Arrays.toString(Bukkit.getPluginManager().getPlugins());
Configuration defaults = new MemoryConfiguration();
defaults.set("config-version", 4);
defaults.set("plugin-management", true);
defaults.set("debug", true);
defaults.set("debug", false);
defaults.set("download-source", "papermc");
defaults.set("lang", "en");
defaults.set("test-notify", "true");
this.getConfig().setDefaults(defaults);
}

//插件启用逻辑
private boolean notfirsttime = false;

@Override
Expand All @@ -116,6 +126,7 @@ public void onEnable() {
}
}

//重新加载插件
public void reload() {
this.reloadConfig();
messages.reload(this.getConfig().getString("lang"));
Expand All @@ -131,9 +142,10 @@ public void reload() {
}
}

//插件关闭逻辑
@Override
public void onDisable() {
//插件关闭逻辑
logger.info(prefix+messages.getString("stop"));
}
}
}
2 changes: 1 addition & 1 deletion src/main/java/idk/team/IDKMessageConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public IDKMessageConfig(String file_path, String lang) {
String str = "message-ver: 9\n" +
"prefix: '§1'" +
"main:\n" +
" - 'IDK Plugin Version 1.2.7-alpha-3'\n" +
" - 'IDK Plugin Version 1.2.7'\n" +
" - 'Made by Baymaxawa'\n" +
"reload: 'Config reloaded!'\n" +
"failed: 'Config reload failed! Check details below!'\n" +
Expand Down
4 changes: 2 additions & 2 deletions src/main/resources/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ config-version: 4
#default: true
plugin-management: true
#enable debug
#default: true
debug: true
#default: false
debug: false
#it can be with like "papermc" or "modrinth" or "both"
#papermc means download from papermc
#modrinth means download from modrinth
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/messages.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
message-ver: 9
prefix: '§1'
main:
- 'IDK Plugin Version 1.2.7-alpha-3'
- 'IDK Plugin Version 1.2.7'
- 'Made by Baymaxawa'
reload: 'Config reloaded!'
failed: 'Config reload failed! Check details below!'
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/messages_zh.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
message-ver: 9
prefix: '§1'
main:
- 'IDK插件,版本1.2.7-alpha-3'
- 'IDK插件,版本1.2.7'
- '由Baymaxawa制作'
reload: '配置文件已重载!'
failed: '配置文件重载失败!请查看下面的详情信息!'
Expand Down

0 comments on commit 5c1adc7

Please sign in to comment.