1
mirror of https://github.com/CarmJos/MoeTeleport.git synced 2026-06-04 16:46:10 +08:00

9 Commits

Author SHA1 Message Date
carm 3a016fb560 Merge remote-tracking branch 'origin/master' 2022-04-03 20:54:52 +08:00
carm 7cf0b9ed01 [3.1.1] 版本修复
- `[R]` 重写存储源初始化方法。
- `[F]` 修复服务器在未安装 Essentials 时出现无法加载插件的问题。
2022-04-03 20:54:38 +08:00
carm 5f6a44d96f Update README.md 2022-03-08 22:54:38 +08:00
carm d24278b81c Update README.md 2022-03-08 22:54:15 +08:00
carm d1ff8a12d4 添加使用统计图 2022-03-08 06:22:45 +08:00
carm 3c07da0e3f 修改措辞 2022-03-05 10:25:28 +08:00
carm 61d97c2df4 修正打包位置错误 2022-03-02 20:34:57 +08:00
carm 514f757fe8 修正打包位置错误 2022-03-02 20:34:49 +08:00
carm 33c2f9de78 修正一个命名错误 2022-02-27 23:16:19 +08:00
16 changed files with 105 additions and 153 deletions
+8 -2
View File
@@ -15,7 +15,7 @@
项目代码符合开发规范,适合新手开发者学习Bukkit,制作属于自己的插件。 项目代码符合开发规范,适合新手开发者学习Bukkit,制作属于自己的插件。
本插件由 [璎珞服务器](https://www.yingluo.world/) 请求本人开发,经过授权后开源。 本插件由 [璎珞服务器](https://www.yingluo.world/) 委托本人开发,经过授权后开源。
## 功能与优势 ## 功能与优势
@@ -107,6 +107,9 @@ homes:
``` ```
## 使用统计
[![bStats](https://bstats.org/signatures/bukkit/MoeTeleport.svg)](https://bstats.org/plugin/bukkit/MoeTeleport/14459)
## 支持与捐赠 ## 支持与捐赠
若您觉得本插件做的不错,您可以捐赠支持我! 若您觉得本插件做的不错,您可以捐赠支持我!
@@ -118,7 +121,9 @@ homes:
## 开源协议 ## 开源协议
本项目源码采用 [GNU General Public License v3.0](https://opensource.org/licenses/GPL-3.0) 开源协议。 本项目源码采用 [GNU General Public License v3.0](https://opensource.org/licenses/GPL-3.0) 开源协议。
> ### 关于 GPL 协议 <details>
<summary>关于 GPL 协议</summary>
> GNU General Public Licence (GPL) 有可能是开源界最常用的许可模式。GPL 保证了所有开发者的权利,同时为使用者提供了足够的复制,分发,修改的权利: > GNU General Public Licence (GPL) 有可能是开源界最常用的许可模式。GPL 保证了所有开发者的权利,同时为使用者提供了足够的复制,分发,修改的权利:
> >
> #### 可自由复制 > #### 可自由复制
@@ -133,3 +138,4 @@ homes:
> 需要注意的是,分发的时候,需要明确提供源代码和二进制文件,另外,用于某些程序的某些协议有一些问题和限制,你可以看一下 @PierreJoye 写的 Practical Guide to GPL Compliance 一文。使用 GPL 协议,你必须在源代码代码中包含相应信息,以及协议本身。 > 需要注意的是,分发的时候,需要明确提供源代码和二进制文件,另外,用于某些程序的某些协议有一些问题和限制,你可以看一下 @PierreJoye 写的 Practical Guide to GPL Compliance 一文。使用 GPL 协议,你必须在源代码代码中包含相应信息,以及协议本身。
> >
> *以上文字来自 [五种开源协议GPL,LGPL,BSD,MIT,Apache](https://www.oschina.net/question/54100_9455) 。* > *以上文字来自 [五种开源协议GPL,LGPL,BSD,MIT,Apache](https://www.oschina.net/question/54100_9455) 。*
</details>
+6 -14
View File
@@ -15,7 +15,7 @@
<groupId>cc.carm.plugin</groupId> <groupId>cc.carm.plugin</groupId>
<artifactId>moeteleport</artifactId> <artifactId>moeteleport</artifactId>
<version>3.1.0</version> <version>3.1.1</version>
<name>MoeTeleport</name> <name>MoeTeleport</name>
<description>喵喵传送,简单的传送、设置家的插件。</description> <description>喵喵传送,简单的传送、设置家的插件。</description>
@@ -179,7 +179,7 @@
<dependency> <dependency>
<groupId>org.jetbrains</groupId> <groupId>org.jetbrains</groupId>
<artifactId>annotations</artifactId> <artifactId>annotations</artifactId>
<version>22.0.0</version> <version>23.0.0</version>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
@@ -280,6 +280,10 @@
</filter> </filter>
</filters> </filters>
<relocations> <relocations>
<relocation>
<pattern>cc.carm.lib</pattern>
<shadedPattern>cc.carm.plugin.moeteleport.lib</shadedPattern>
</relocation>
<relocation> <relocation>
<pattern>de.themoep.minedown</pattern> <pattern>de.themoep.minedown</pattern>
<shadedPattern>cc.carm.plugin.moeteleport.lib.minedown</shadedPattern> <shadedPattern>cc.carm.plugin.moeteleport.lib.minedown</shadedPattern>
@@ -292,18 +296,6 @@
<pattern>org.json</pattern> <pattern>org.json</pattern>
<shadedPattern>cc.carm.plugin.moeteleport.lib.json</shadedPattern> <shadedPattern>cc.carm.plugin.moeteleport.lib.json</shadedPattern>
</relocation> </relocation>
<relocation>
<pattern>cc.carm.lib.easyplugin</pattern>
<shadedPattern>cc.carm.plugin.ultradepository.lib.easyplugin</shadedPattern>
</relocation>
<relocation>
<pattern>cc.carm.lib.easysql</pattern>
<shadedPattern>cc.carm.plugin.moeteleport.lib.easysql</shadedPattern>
</relocation>
<relocation>
<pattern>cc.carm.lib.githubreleases4j</pattern>
<shadedPattern>cc.carm.plugin.moeteleport.lib.github</shadedPattern>
</relocation>
</relocations> </relocations>
</configuration> </configuration>
</plugin> </plugin>
@@ -34,10 +34,11 @@ import java.util.Arrays;
public class Main extends EasyPlugin { public class Main extends EasyPlugin {
private static Main instance; private static Main instance;
private static DataStorage storage;
private WarpManager warpManager; protected DataStorage storage;
private UserManager userManager; protected WarpManager warpManager;
private RequestManager requestManager; protected UserManager userManager;
protected RequestManager requestManager;
public Main() { public Main() {
super(new EasyPluginMessageProvider.zh_CN()); super(new EasyPluginMessageProvider.zh_CN());
@@ -57,7 +58,7 @@ public class Main extends EasyPlugin {
getInstance().log(messages); getInstance().log(messages);
} }
public static void serve(String... messages) { public static void severe(String... messages) {
getInstance().error(messages); getInstance().error(messages);
} }
@@ -74,23 +75,25 @@ public class Main extends EasyPlugin {
info("加载配置文件..."); info("加载配置文件...");
if (!ConfigManager.initConfig()) { if (!ConfigManager.initConfig()) {
serve("配置文件初始化失败,请检查。"); severe("配置文件初始化失败,请检查。");
setEnabled(false); setEnabled(false);
return false; return false;
} }
info("初始化存储方式..."); info("初始化存储方式...");
StorageMethod storageMethod = StorageMethod.read(PluginConfig.STORAGE_METHOD.get()); StorageMethod storageMethod = StorageMethod.read(PluginConfig.STORAGE_METHOD.get());
info(" 正在使用 " + storageMethod.name() + " 进行数据存储");
storage = storageMethod.createStorage(); try {
if (!storage.initialize()) { info(" 正在使用 " + storageMethod.name() + " 进行数据存储");
serve("初始化存储失败,请检查配置文件。"); storage = storageMethod.createStorage();
storage.shutdown(); storage.initialize();
} catch (Exception ex) {
severe("初始化存储失败,请检查配置文件。");
setEnabled(false); setEnabled(false);
return false; // 初始化失败,不再继续加载 return false; // 初始化失败,不再继续加载
} }
info("加载地标管理器..."); info("加载地标管理器...");
warpManager = new WarpManager(); warpManager = new WarpManager();
@@ -98,7 +101,7 @@ public class Main extends EasyPlugin {
this.userManager = new UserManager(); this.userManager = new UserManager();
if (Bukkit.getOnlinePlayers().size() > 0) { if (Bukkit.getOnlinePlayers().size() > 0) {
info(" 加载现有用户数据..."); info(" 加载现有用户数据...");
getUserManager().loadAll(); this.userManager.loadAll();
} }
info("加载请求管理器..."); info("加载请求管理器...");
@@ -147,16 +150,16 @@ public class Main extends EasyPlugin {
@Override @Override
protected void shutdown() { protected void shutdown() {
info("关闭所有请求..."); info("关闭所有请求...");
getRequestManager().shutdown(); this.requestManager.shutdown();
info("保存用户数据..."); info("保存用户数据...");
getUserManager().unloadAll(true); this.userManager.unloadAll(true);
info("保存地标数据..."); info("保存地标数据...");
getWarpManager().saveWarps(); this.warpManager.saveWarps();
info("终止存储源..."); info("终止存储源...");
getStorage().shutdown(); this.storage.shutdown();
info("卸载监听器..."); info("卸载监听器...");
Bukkit.getServicesManager().unregisterAll(this); Bukkit.getServicesManager().unregisterAll(this);
@@ -174,21 +177,5 @@ public class Main extends EasyPlugin {
} }
} }
protected DataStorage getStorage() {
return storage;
}
protected WarpManager getWarpManager() {
return getInstance().warpManager;
}
protected UserManager getUserManager() {
return getInstance().userManager;
}
protected RequestManager getRequestManager() {
return getInstance().requestManager;
}
} }
@@ -6,8 +6,6 @@ import cc.carm.plugin.moeteleport.manager.WarpManager;
import cc.carm.plugin.moeteleport.storage.DataStorage; import cc.carm.plugin.moeteleport.storage.DataStorage;
import cc.carm.plugin.moeteleport.storage.StorageMethod; import cc.carm.plugin.moeteleport.storage.StorageMethod;
import java.util.function.Supplier;
public class MoeTeleport { public class MoeTeleport {
public static void outputInfo() { public static void outputInfo() {
@@ -15,27 +13,27 @@ public class MoeTeleport {
} }
public static DataStorage getStorage() { public static DataStorage getStorage() {
return Main.getInstance().getStorage(); return Main.getInstance().storage;
} }
public static WarpManager getWarpManager() { public static WarpManager getWarpManager() {
return Main.getInstance().getWarpManager(); return Main.getInstance().warpManager;
} }
public static UserManager getUserManager() { public static UserManager getUserManager() {
return Main.getInstance().getUserManager(); return Main.getInstance().userManager;
} }
public static RequestManager getRequestManager() { public static RequestManager getRequestManager() {
return Main.getInstance().getRequestManager(); return Main.getInstance().requestManager;
} }
public void registerCustomStorage(DataStorage storage) { public void setStorage(DataStorage storage) {
registerCustomStorage(() -> storage); Main.getInstance().storage = storage;
} }
public void registerCustomStorage(Supplier<DataStorage> storageSupplier) { public void registerCustomStorage(Class<? extends DataStorage> storageClazz) {
StorageMethod.CUSTOM.setStorageSupplier(storageSupplier); StorageMethod.CUSTOM.setStorageClazz(storageClazz);
} }
} }
@@ -58,8 +58,8 @@ public class UserManager {
return data; return data;
} catch (Exception e) { } catch (Exception e) {
Main.serve("无法正常读取玩家数据,玩家操作将不会被保存,请检查数据配置!"); Main.severe("无法正常读取玩家数据,玩家操作将不会被保存,请检查数据配置!");
Main.serve("Could not load user's data, please check the data configuration!"); Main.severe("Could not load user's data, please check the data configuration!");
e.printStackTrace(); e.printStackTrace();
return new UserData(userUUID); return new UserData(userUUID);
} }
@@ -77,8 +77,8 @@ public class UserManager {
"耗时 " + (System.currentTimeMillis() - start) + "ms。"); "耗时 " + (System.currentTimeMillis() - start) + "ms。");
} catch (Exception e) { } catch (Exception e) {
Main.serve("无法正常保存玩家数据,请检查数据配置!"); Main.severe("无法正常保存玩家数据,请检查数据配置!");
Main.serve("Could not save user's data, please check the data configuration!"); Main.severe("Could not save user's data, please check the data configuration!");
e.printStackTrace(); e.printStackTrace();
} }
} }
@@ -143,8 +143,8 @@ public class UserManager {
try { try {
task.run(MoeTeleport.getStorage()); task.run(MoeTeleport.getStorage());
} catch (Exception exception) { } catch (Exception exception) {
Main.serve("无法正常更改玩家数据,请检查数据配置!"); Main.severe("无法正常更改玩家数据,请检查数据配置!");
Main.serve("Could not edit user's data, please check the data configuration!"); Main.severe("Could not edit user's data, please check the data configuration!");
exception.printStackTrace(); exception.printStackTrace();
} }
} }
@@ -19,7 +19,7 @@ public class WarpManager {
try { try {
MoeTeleport.getStorage().saveWarps(); MoeTeleport.getStorage().saveWarps();
} catch (Exception exception) { } catch (Exception exception) {
Main.serve("保存地标数据失败,请检查配置文件。"); Main.severe("保存地标数据失败,请检查配置文件。");
exception.printStackTrace(); exception.printStackTrace();
} }
} }
@@ -33,7 +33,7 @@ public class WarpManager {
try { try {
MoeTeleport.getStorage().setWarp(name, new WarpInfo(name,owner, location)); MoeTeleport.getStorage().setWarp(name, new WarpInfo(name,owner, location));
} catch (Exception exception) { } catch (Exception exception) {
Main.serve("保存地标数据 " + name + " 失败,请检查配置文件。"); Main.severe("保存地标数据 " + name + " 失败,请检查配置文件。");
exception.printStackTrace(); exception.printStackTrace();
} }
@@ -51,7 +51,7 @@ public class WarpManager {
try { try {
MoeTeleport.getStorage().delWarp(name); MoeTeleport.getStorage().delWarp(name);
} catch (Exception exception) { } catch (Exception exception) {
Main.serve("删除地标数据 " + name + " 失败,请检查配置文件。"); Main.severe("删除地标数据 " + name + " 失败,请检查配置文件。");
exception.printStackTrace(); exception.printStackTrace();
} }
} }
@@ -15,9 +15,9 @@ public interface DataStorage {
/** /**
* 在插件加载存储源时执行。 * 在插件加载存储源时执行。
* *
* @return 是否初始化成功 * @throws Exception 当出现任何错误时抛出
*/ */
boolean initialize(); void initialize() throws Exception;
/** /**
* 在插件被卸载时执行。 * 在插件被卸载时执行。
@@ -10,25 +10,24 @@ import org.jetbrains.annotations.Nullable;
import java.util.Arrays; import java.util.Arrays;
import java.util.Optional; import java.util.Optional;
import java.util.function.Supplier;
public enum StorageMethod { public enum StorageMethod {
CUSTOM(0, new String[]{}, CustomStorage::new), CUSTOM(0, new String[]{}, CustomStorage.class),
YAML(1, new String[]{"yml"}, YAMLStorage::new), YAML(1, new String[]{"yml"}, YAMLStorage.class),
JSON(2, new String[]{}, JSONStorage::new), JSON(2, new String[]{}, JSONStorage.class),
MYSQL(3, new String[]{"my-sql", "mariadb", "sql", "database"}, MySQLStorage::new), MYSQL(3, new String[]{"my-sql", "mariadb", "sql", "database"}, MySQLStorage.class),
ESSENTIALS(11, new String[]{"essential", "ess", "EssentialsX", "essX"}, EssentialStorage::new); ESSENTIALS(11, new String[]{"essential", "ess", "EssentialsX", "essX"}, EssentialStorage.class);
private final int id; private final int id;
private final String[] alias; private final String[] alias;
private @NotNull Supplier<@NotNull DataStorage> storageSupplier; private @NotNull Class<? extends DataStorage> storageClazz;
StorageMethod(int id, String[] alias, @NotNull Supplier<@NotNull DataStorage> storageSupplier) { StorageMethod(int id, String[] alias, @NotNull Class<? extends DataStorage> storageClazz) {
this.id = id; this.id = id;
this.alias = alias; this.alias = alias;
this.storageSupplier = storageSupplier; this.storageClazz = storageClazz;
} }
public static @NotNull StorageMethod read(String s) { public static @NotNull StorageMethod read(String s) {
@@ -65,15 +64,15 @@ public enum StorageMethod {
return alias; return alias;
} }
public @NotNull Supplier<@NotNull DataStorage> getStorageSupplier() { public @NotNull Class<? extends DataStorage> getStorageClazz() {
return storageSupplier; return storageClazz;
} }
public void setStorageSupplier(@NotNull Supplier<@NotNull DataStorage> storageSupplier) { public void setStorageClazz(@NotNull Class<? extends DataStorage> storageClazz) {
this.storageSupplier = storageSupplier; this.storageClazz = storageClazz;
} }
public @NotNull DataStorage createStorage() { public @NotNull DataStorage createStorage() throws Exception {
return getStorageSupplier().get(); return getStorageClazz().newInstance();
} }
} }
@@ -17,10 +17,10 @@ public class CustomStorage implements DataStorage {
@Override @Override
@TestOnly @TestOnly
public boolean initialize() { public void initialize() throws UnsupportedOperationException {
Main.serve("您选择使用自定义存储,但并没有应用成功。"); Main.severe("您选择使用自定义存储,但并没有应用成功。");
Main.serve("You are using CustomStorage, but not overwrite the methods."); Main.severe("You are using CustomStorage, but not overwrite the methods.");
return false; throw new UnsupportedOperationException("您选择使用自定义存储,但并没有应用成功。");
} }
@Override @Override
@@ -31,14 +31,14 @@ public class CustomStorage implements DataStorage {
@Override @Override
@TestOnly @TestOnly
public @Nullable UserData loadData(@NotNull UUID uuid) { public @Nullable UserData loadData(@NotNull UUID uuid) throws UnsupportedOperationException {
return null; throw new UnsupportedOperationException("您选择使用自定义存储,但并没有应用成功。");
} }
@Override @Override
@TestOnly @TestOnly
public void saveUserData(@NotNull UserData data) { public void saveUserData(@NotNull UserData data) throws UnsupportedOperationException {
throw new UnsupportedOperationException("您选择使用自定义存储,但并没有应用成功。");
} }
@Override @Override
@@ -26,7 +26,7 @@ public class MySQLStorage implements DataStorage {
Map<String, WarpInfo> warpsMap = new HashMap<>(); Map<String, WarpInfo> warpsMap = new HashMap<>();
@Override @Override
public boolean initialize() { public void initialize() throws Exception {
try { try {
Main.info(" 尝试连接到数据库..."); Main.info(" 尝试连接到数据库...");
String url = String.format("jdbc:mysql://%s:%s/%s?useSSL=false", String url = String.format("jdbc:mysql://%s:%s/%s?useSSL=false",
@@ -38,9 +38,7 @@ public class MySQLStorage implements DataStorage {
); );
this.sqlManager.setDebugMode(() -> Main.getInstance().isDebugging()); this.sqlManager.setDebugMode(() -> Main.getInstance().isDebugging());
} catch (Exception exception) { } catch (Exception exception) {
Main.serve("无法连接到数据库,请检查配置文件"); throw new Exception("无法连接到数据库,请检查配置文件", exception);
exception.printStackTrace();
return false;
} }
try { try {
@@ -58,20 +56,15 @@ public class MySQLStorage implements DataStorage {
.build().execute(); .build().execute();
} catch (SQLException exception) { } catch (SQLException exception) {
Main.serve("无法创建插件所需的表,请检查数据库权限。"); throw new Exception("无法创建插件所需的表,请检查数据库权限。", exception);
exception.printStackTrace();
return false;
} }
Main.info(" 加载地标数据..."); Main.info(" 加载地标数据...");
try { try {
this.warpsMap = loadWarps(); this.warpsMap = loadWarps();
} catch (Exception e) { } catch (Exception e) {
Main.serve("无法加载地标数据,请检查数据库权限和相关表。"); throw new Exception("无法加载地标数据,请检查数据库权限和相关表。", e);
e.printStackTrace();
} }
return true;
} }
@Override @Override
@@ -16,17 +16,10 @@ import java.util.UUID;
public class EssentialStorage extends PluginBasedStorage { public class EssentialStorage extends PluginBasedStorage {
private Essentials essentials;
public EssentialStorage() { public EssentialStorage() {
super("Essentials"); super("Essentials");
} }
@Override
public boolean initialize() {
return super.initialize() && (this.essentials = (Essentials) getDependPlugin()) != null;
}
@Override @Override
public @Nullable UserData loadData(@NotNull UUID uuid) { public @Nullable UserData loadData(@NotNull UUID uuid) {
return new EssentialUserData(uuid, getEssentials()); return new EssentialUserData(uuid, getEssentials());
@@ -40,7 +33,7 @@ public class EssentialStorage extends PluginBasedStorage {
try { try {
Location warpLocation = getEssentials().getWarps().getWarp(warpName); Location warpLocation = getEssentials().getWarps().getWarp(warpName);
UUID owner = getEssentials().getWarps().getLastOwner(warpName); UUID owner = getEssentials().getWarps().getLastOwner(warpName);
warps.put(warpName, new WarpInfo(warpName,owner, new DataLocation(warpLocation))); warps.put(warpName, new WarpInfo(warpName, owner, new DataLocation(warpLocation)));
} catch (Exception ignore) { } catch (Exception ignore) {
} }
} }
@@ -74,7 +67,7 @@ public class EssentialStorage extends PluginBasedStorage {
} }
public Essentials getEssentials() { public Essentials getEssentials() {
return essentials; return (Essentials) getDependPlugin();
} }
public static class EssentialUserData extends UserData { public static class EssentialUserData extends UserData {
@@ -30,17 +30,9 @@ public class JSONStorage extends FileBasedStorage {
Map<String, WarpInfo> warpsMap = new HashMap<>(); Map<String, WarpInfo> warpsMap = new HashMap<>();
@Override @Override
public boolean initialize() { public void initialize() throws Exception {
if (super.initialize()) { super.initialize();
try { this.warpsMap = loadWarps();
this.warpsMap = loadWarps();
return true;
} catch (Exception e) {
Main.serve("无法加载地标数据,请检查文件权限和相关配置。");
e.printStackTrace();
}
}
return false;
} }
@Override @Override
@@ -26,22 +26,14 @@ public class YAMLStorage extends FileBasedStorage {
FileConfiguration warpsConfiguration; FileConfiguration warpsConfiguration;
@Override @Override
public boolean initialize() { public void initialize() throws Exception {
if (super.initialize()) { super.initialize();
try { this.warpsDataFile = new File(getDataFolder(), "warps.yml");
this.warpsDataFile = new File(getDataFolder(), "warps.yml"); if (!this.warpsDataFile.exists() && !warpsDataFile.createNewFile()) {
if (!this.warpsDataFile.exists()) { throw new Exception("无法创建 warps.yml 文件。");
boolean success = warpsDataFile.createNewFile();
}
this.warpsConfiguration = YamlConfiguration.loadConfiguration(warpsDataFile);
this.warpsMap = loadWarps();
return true;
} catch (Exception e) {
Main.serve("无法加载地标数据,请检查文件权限和相关配置。");
e.printStackTrace();
}
} }
return false; this.warpsConfiguration = YamlConfiguration.loadConfiguration(warpsDataFile);
this.warpsMap = loadWarps();
} }
@Override @Override
@@ -20,16 +20,14 @@ public abstract class FileBasedStorage implements DataStorage {
protected @Nullable File dataFolder; protected @Nullable File dataFolder;
@Override @Override
public boolean initialize() { public void initialize() throws Exception {
try { this.dataFolder = new File(Main.getInstance().getDataFolder(), FILE_PATH.get());
this.dataFolder = new File(Main.getInstance().getDataFolder(), FILE_PATH.get()); if (!dataFolder.exists()) {
if (!dataFolder.exists()) { if (!dataFolder.mkdir()) {
return dataFolder.mkdir(); throw new Exception("无法创建数据文件夹!");
} else {
return dataFolder.isDirectory();
} }
} catch (Exception ex) { } else if (!dataFolder.isDirectory()) {
return false; throw new Exception("数据文件夹路径对应的不是一个文件夹!");
} }
} }
@@ -20,8 +20,10 @@ public abstract class PluginBasedStorage implements DataStorage {
} }
@Override @Override
public boolean initialize() { public void initialize() throws NullPointerException {
return dependPlugin != null; if (dependPlugin == null) {
throw new NullPointerException("该存储类型依赖的插件不存在,请检查配置文件");
}
} }
public Plugin getDependPlugin() { public Plugin getDependPlugin() {
@@ -18,16 +18,16 @@ public class UpdateChecker {
MoeTeleport.outputInfo(); MoeTeleport.outputInfo();
if (behindVersions == null) { if (behindVersions == null) {
Main.serve("检查更新失败,请您定期查看插件是否更新,避免安全问题。"); Main.severe("检查更新失败,请您定期查看插件是否更新,避免安全问题。");
Main.serve("下载地址 " + downloadURL); Main.severe("下载地址 " + downloadURL);
} else if (behindVersions == 0) { } else if (behindVersions == 0) {
Main.info("检查完成,当前已是最新版本。"); Main.info("检查完成,当前已是最新版本。");
} else if (behindVersions > 0) { } else if (behindVersions > 0) {
Main.info("发现新版本! 目前已落后 " + behindVersions + " 个版本。"); Main.info("发现新版本! 目前已落后 " + behindVersions + " 个版本。");
Main.info("最新版下载地址 " + downloadURL); Main.info("最新版下载地址 " + downloadURL);
} else { } else {
Main.serve("检查更新失败! 当前版本未知,请您使用原生版本以避免安全问题。"); Main.severe("检查更新失败! 当前版本未知,请您使用原生版本以避免安全问题。");
Main.serve("最新版下载地址 " + downloadURL); Main.severe("最新版下载地址 " + downloadURL);
} }
}); });