Compare commits
No commits in common. "be38934c3b1194dbbeb4db751b15a3d9f4009d03" and "648bf9267f9464fbb3ca3f198f075d14d3ffa1d2" have entirely different histories.
be38934c3b
...
648bf9267f
3 changed files with 3 additions and 25 deletions
2
pom.xml
2
pom.xml
|
@ -57,7 +57,7 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>eu.m724</groupId>
|
<groupId>eu.m724</groupId>
|
||||||
<artifactId>jarupdater</artifactId>
|
<artifactId>jarupdater</artifactId>
|
||||||
<version>0.1.7</version>
|
<version>0.1.5</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
|
|
|
@ -48,10 +48,10 @@ public class GiantsPlugin extends JavaPlugin implements CommandExecutor {
|
||||||
);
|
);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
getLogger().warning(e.getMessage());
|
getLogger().warning(e.getMessage());
|
||||||
getLogger().warning("Failed checking JAR signature. This is not important right now, but it usually indicates future problems.");
|
getLogger().warning("Failed checking JAR signature. This is not important right now, but it usually forecasts future problems.");
|
||||||
} catch (JarVerifier.VerificationException e) {
|
} catch (JarVerifier.VerificationException e) {
|
||||||
getLogger().warning(e.getMessage());
|
getLogger().warning(e.getMessage());
|
||||||
getLogger().warning("Plugin JAR is of invalid signature. Please re-download the JAR.");
|
getLogger().warning("Plugin JAR is of invalid signature. It's possible that the signature has changed, in which case it's normal. But I can't verify that, you must see the version changelog yourself.");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* bStats is optional. not anymore
|
/* bStats is optional. not anymore
|
||||||
|
|
|
@ -1,12 +1,7 @@
|
||||||
package eu.m724.giants.updater;
|
package eu.m724.giants.updater;
|
||||||
|
|
||||||
import net.md_5.bungee.api.ChatColor;
|
|
||||||
import net.md_5.bungee.api.chat.ClickEvent;
|
|
||||||
import net.md_5.bungee.api.chat.HoverEvent;
|
|
||||||
import net.md_5.bungee.api.chat.TextComponent;
|
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
|
|
||||||
import java.nio.file.NoSuchFileException;
|
import java.nio.file.NoSuchFileException;
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
|
@ -22,21 +17,6 @@ public class UpdateCommand {
|
||||||
this.updater = updater;
|
this.updater = updater;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void sendChangelogMessage(CommandSender sender, String changelogUrl) {
|
|
||||||
if (changelogUrl != null) {
|
|
||||||
if (sender instanceof Player) {
|
|
||||||
TextComponent textComponent = new TextComponent("Click here to open changelog");
|
|
||||||
textComponent.setUnderlined(true);
|
|
||||||
textComponent.setColor(ChatColor.AQUA);
|
|
||||||
textComponent.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, TextComponent.fromLegacyText(changelogUrl)));
|
|
||||||
textComponent.setClickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL, changelogUrl));
|
|
||||||
sender.spigot().sendMessage(textComponent);
|
|
||||||
} else {
|
|
||||||
sender.sendMessage("Changelog: " + changelogUrl);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||||
sender.sendMessage("Please wait...");
|
sender.sendMessage("Please wait...");
|
||||||
sender.sendMessage("Channel: " + updater.getEnvironment().getChannel());
|
sender.sendMessage("Channel: " + updater.getEnvironment().getChannel());
|
||||||
|
@ -50,13 +30,11 @@ public class UpdateCommand {
|
||||||
if (metadata != null) {
|
if (metadata != null) {
|
||||||
sender.sendMessage("An update is available!");
|
sender.sendMessage("An update is available!");
|
||||||
sender.sendMessage("Giants " + metadata.getLabel() + " released " + formatDate(metadata.getTimestamp()));
|
sender.sendMessage("Giants " + metadata.getLabel() + " released " + formatDate(metadata.getTimestamp()));
|
||||||
sendChangelogMessage(sender, metadata.getChangelogUrl());
|
|
||||||
sender.sendMessage("To download: /giants update download");
|
sender.sendMessage("To download: /giants update download");
|
||||||
} else {
|
} else {
|
||||||
sender.sendMessage("No new updates");
|
sender.sendMessage("No new updates");
|
||||||
updater.getCurrentVersion().thenAccept(metadata2 -> {
|
updater.getCurrentVersion().thenAccept(metadata2 -> {
|
||||||
sender.sendMessage("You're on Giants " + metadata2.getLabel() + " released " + formatDate(metadata2.getTimestamp()));
|
sender.sendMessage("You're on Giants " + metadata2.getLabel() + " released " + formatDate(metadata2.getTimestamp()));
|
||||||
sendChangelogMessage(sender, metadata2.getChangelogUrl());
|
|
||||||
}).exceptionally(e -> {
|
}).exceptionally(e -> {
|
||||||
sender.sendMessage("Error retrieving information about current version, see console for details. " + e.getMessage());
|
sender.sendMessage("Error retrieving information about current version, see console for details. " + e.getMessage());
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
|
Loading…
Reference in a new issue