Skip to content

Commit

Permalink
v2.9.7
Browse files Browse the repository at this point in the history
  • Loading branch information
TheJeterLP authored Dec 30, 2022
2 parents bd675a6 + 9ec5314 commit ce6f5b0
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<name>ChatEx</name>
<inceptionYear>2022</inceptionYear>

<version>2.9.6</version>
<version>2.9.7</version>
<description>ChatManagement plugin for Bukkit</description>
<url>https://www.spigotmc.org/resources/chatex-continued.71041/</url>

Expand Down
14 changes: 9 additions & 5 deletions src/main/java/de/jeter/chatex/PlayerListener.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
import de.jeter.updatechecker.Result;
import de.jeter.updatechecker.UpdateChecker;
import net.md_5.bungee.api.chat.ClickEvent;
import net.md_5.bungee.api.chat.ComponentBuilder;
import net.md_5.bungee.api.chat.HoverEvent;
import net.md_5.bungee.api.chat.TextComponent;
import net.md_5.bungee.api.chat.hover.content.Text;
Expand Down Expand Up @@ -54,10 +53,15 @@ public void onJoin(PlayerJoinEvent e) {

if (Config.CHECK_UPDATE.getBoolean() && e.getPlayer().hasPermission("chatex.notifyupdate") && checker != null) {
if (checker.getResult() == Result.UPDATE_FOUND) {
TextComponent msg = new TextComponent(Locales.UPDATE_FOUND.getString(null).replaceAll("%oldversion", ChatEx.getInstance().getDescription().getVersion()).replaceAll("%newversion", ChatEx.getInstance().getUpdateChecker().getLatestRemoteVersion()));
msg.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new Text("§aClick to download")));
msg.setClickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL, checker.getDownloadLink()));
e.getPlayer().spigot().sendMessage(msg);
try {
Class.forName("net.md_5.bungee.api.chat.TextComponent");
TextComponent msg = new TextComponent(Locales.UPDATE_FOUND.getString(null).replaceAll("%oldversion", ChatEx.getInstance().getDescription().getVersion()).replaceAll("%newversion", ChatEx.getInstance().getUpdateChecker().getLatestRemoteVersion()));
msg.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new Text("§aClick to download")));
msg.setClickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL, checker.getDownloadLink()));
e.getPlayer().spigot().sendMessage(msg);
} catch (ClassNotFoundException ex) {
e.getPlayer().sendMessage(Locales.UPDATE_FOUND.getString(null).replaceAll("%oldversion", ChatEx.getInstance().getDescription().getVersion()).replaceAll("%newversion", ChatEx.getInstance().getUpdateChecker().getLatestRemoteVersion()));
}
}
}
}
Expand Down

0 comments on commit ce6f5b0

Please # to comment.