-
Notifications
You must be signed in to change notification settings - Fork 100
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
新增:版本更新检测 新增:Language2Value 对象新增 broadcast() 方法来发送给所有玩家 新增:/language2 send 命令现在可以使用 ALL 代替所有玩家 删除:FileUtils 工具的三个文本读取方法的异常打印
- Loading branch information
Showing
8 changed files
with
158 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
src/main/src/me/skymc/taboolib/listener/ListenerNetWork.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package me.skymc.taboolib.listener; | ||
|
||
import org.bukkit.event.EventHandler; | ||
import org.bukkit.event.EventPriority; | ||
import org.bukkit.event.Listener; | ||
|
||
import me.skymc.taboolib.Main; | ||
import me.skymc.taboolib.message.MsgUtils; | ||
import pw.yumc.Yum.events.PluginNetworkEvent; | ||
|
||
/** | ||
* @author sky | ||
* @since 2018年2月23日 下午11:10:03 | ||
*/ | ||
public class ListenerNetWork implements Listener { | ||
|
||
public static final String GG = "本监听只是为了防止本插件的更新检测被 YUM 插件阻止,别无它用。"; | ||
|
||
@EventHandler (priority = EventPriority.HIGHEST) | ||
public void onNetWork(PluginNetworkEvent e) { | ||
if (e.getPlugin() != null && e.getPlugin().equals(Main.getInst())) { | ||
// 取消阻止 | ||
e.setCancelled(false); | ||
// 后台提示 | ||
MsgUtils.warn("已取消 &4YUM &c对本插件网络访问的阻止!"); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
package me.skymc.taboolib.update; | ||
|
||
import java.io.File; | ||
import java.util.regex.Matcher; | ||
import java.util.regex.Pattern; | ||
|
||
import org.bukkit.scheduler.BukkitRunnable; | ||
|
||
import me.skymc.taboolib.Main; | ||
import me.skymc.taboolib.TabooLib; | ||
import me.skymc.taboolib.fileutils.FileUtils; | ||
import me.skymc.taboolib.message.MsgUtils; | ||
|
||
/** | ||
* @author sky | ||
* @since 2018年2月23日 下午10:39:14 | ||
*/ | ||
public class UpdateTask { | ||
|
||
/** | ||
* 检测更新 | ||
*/ | ||
public UpdateTask() { | ||
new BukkitRunnable() { | ||
|
||
@Override | ||
public void run() { | ||
// 是否禁用 | ||
if (!Main.getInst().getConfig().getBoolean("UPDATE-CHECK")) { | ||
return; | ||
} | ||
|
||
String value = FileUtils.getStringFromURL("https://github.com/Bkm016/TabooLib/releases", 1024); | ||
Pattern pattern = Pattern.compile("<a href=\"/Bkm016/TabooLib/releases/tag/(\\S+)\">"); | ||
Matcher matcher = pattern.matcher(value); | ||
if (matcher.find()) { | ||
// 最新版本 | ||
double newVersion = Double.valueOf(matcher.group(1)); | ||
// 如果是最新版 | ||
if (TabooLib.getPluginVersion() == newVersion) { | ||
MsgUtils.send("插件已是最新版, 无需更新!"); | ||
} | ||
else { | ||
MsgUtils.send("&8####################################################"); | ||
MsgUtils.send("检测到有新的版本更新!"); | ||
MsgUtils.send("当前版本: &f" + TabooLib.getPluginVersion()); | ||
MsgUtils.send("最新版本: &f" + newVersion); | ||
MsgUtils.send("下载地址: &fhttp://www.mcbbs.net/thread-773065-1-1.html"); | ||
MsgUtils.send("开源地址: &fhttps://github.com/Bkm016/TabooLib/"); | ||
MsgUtils.send("&8####################################################"); | ||
} | ||
} | ||
} | ||
}.runTaskLaterAsynchronously(Main.getInst(), 100); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters