added info to about command
This commit is contained in:
parent
bfb50b1955
commit
a83fcc7f52
4 changed files with 27 additions and 8 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -1,3 +1,3 @@
|
||||||
.idea/
|
.idea/
|
||||||
.out/production/
|
out/production/
|
||||||
Resurrection.iml
|
Resurrection.iml
|
||||||
|
|
|
@ -4,6 +4,7 @@ import net.brysonsteck.Resurrection.commands.CommandAbout;
|
||||||
import net.brysonsteck.Resurrection.commands.CommandHowLong;
|
import net.brysonsteck.Resurrection.commands.CommandHowLong;
|
||||||
import net.brysonsteck.Resurrection.commands.CommandResurrect;
|
import net.brysonsteck.Resurrection.commands.CommandResurrect;
|
||||||
import net.brysonsteck.Resurrection.player.PlayerListener;
|
import net.brysonsteck.Resurrection.player.PlayerListener;
|
||||||
|
import net.brysonsteck.Resurrection.player.TimeCheck;
|
||||||
import net.brysonsteck.Resurrection.startup.CheckForUpdate;
|
import net.brysonsteck.Resurrection.startup.CheckForUpdate;
|
||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
import org.bukkit.plugin.PluginDescriptionFile;
|
import org.bukkit.plugin.PluginDescriptionFile;
|
||||||
|
@ -68,6 +69,7 @@ public class Resurrection extends JavaPlugin implements Listener {
|
||||||
// check for updates
|
// check for updates
|
||||||
System.out.println("[Resurrection] Checking for updates...");
|
System.out.println("[Resurrection] Checking for updates...");
|
||||||
CheckForUpdate check = new CheckForUpdate();
|
CheckForUpdate check = new CheckForUpdate();
|
||||||
|
boolean outdated = false;
|
||||||
if (check.isSuccess()) {
|
if (check.isSuccess()) {
|
||||||
String newestVersion = check.getVersion();
|
String newestVersion = check.getVersion();
|
||||||
String newestVersionURL = check.getVersionURL();
|
String newestVersionURL = check.getVersionURL();
|
||||||
|
@ -77,6 +79,7 @@ public class Resurrection extends JavaPlugin implements Listener {
|
||||||
System.out.println("[Resurrection] A new version of Resurrection is available! (current: " + pluginInfo.getVersion() + ", newest: " + newestVersion);
|
System.out.println("[Resurrection] A new version of Resurrection is available! (current: " + pluginInfo.getVersion() + ", newest: " + newestVersion);
|
||||||
System.out.println("[Resurrection] You can download the latest release on GitHub here \\/");
|
System.out.println("[Resurrection] You can download the latest release on GitHub here \\/");
|
||||||
System.out.println("[Resurrection] " + newestVersionURL);
|
System.out.println("[Resurrection] " + newestVersionURL);
|
||||||
|
outdated = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -87,7 +90,7 @@ public class Resurrection extends JavaPlugin implements Listener {
|
||||||
this.getServer().getPluginManager().registerEvents(new PlayerListener(), this);
|
this.getServer().getPluginManager().registerEvents(new PlayerListener(), this);
|
||||||
|
|
||||||
// register commands
|
// register commands
|
||||||
this.getCommand("about").setExecutor(new CommandAbout(pluginInfo.getVersion()));
|
this.getCommand("about").setExecutor(new CommandAbout(pluginInfo.getVersion(), outdated));
|
||||||
this.getCommand("resurrect").setExecutor(new CommandResurrect());
|
this.getCommand("resurrect").setExecutor(new CommandResurrect());
|
||||||
this.getCommand("howlong").setExecutor(new CommandHowLong());
|
this.getCommand("howlong").setExecutor(new CommandHowLong());
|
||||||
|
|
||||||
|
@ -134,6 +137,9 @@ public class Resurrection extends JavaPlugin implements Listener {
|
||||||
// String[] array = ";bryzinga,false,0".split(";");
|
// String[] array = ";bryzinga,false,0".split(";");
|
||||||
// System.out.println(array.length);
|
// System.out.println(array.length);
|
||||||
|
|
||||||
|
TimeCheck timeCheck = new TimeCheck((System.currentTimeMillis() + 86400000) - System.currentTimeMillis());
|
||||||
|
System.out.println(timeCheck.formatTime());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package net.brysonsteck.Resurrection.commands;
|
package net.brysonsteck.Resurrection.commands;
|
||||||
|
|
||||||
|
import net.brysonsteck.Resurrection.startup.CheckForUpdate;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandExecutor;
|
import org.bukkit.command.CommandExecutor;
|
||||||
|
@ -8,10 +9,11 @@ import org.bukkit.entity.Player;
|
||||||
|
|
||||||
public class CommandAbout implements CommandExecutor {
|
public class CommandAbout implements CommandExecutor {
|
||||||
String currentVersion;
|
String currentVersion;
|
||||||
boolean checked = false;
|
boolean outdated;
|
||||||
|
|
||||||
public CommandAbout(String currentVersion) {
|
public CommandAbout(String currentVersion, boolean outdated) {
|
||||||
this.currentVersion = currentVersion;
|
this.currentVersion = currentVersion;
|
||||||
|
this.outdated = outdated;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -25,7 +27,18 @@ public class CommandAbout implements CommandExecutor {
|
||||||
|
|
||||||
if (commandSender instanceof Player) {
|
if (commandSender instanceof Player) {
|
||||||
Player p = (Player) commandSender;
|
Player p = (Player) commandSender;
|
||||||
p.sendMessage(aboutMessage);
|
p.sendMessage(ChatColor.GREEN + "" + ChatColor.BOLD + "Resurrection" + ChatColor.RESET);
|
||||||
|
p.sendMessage("");
|
||||||
|
p.sendMessage(ChatColor.YELLOW + "Resurrection is a Spigot Minecraft plugin that forces players to wait 24 hours before respawning.");
|
||||||
|
p.sendMessage(ChatColor.YELLOW + "This server is running version " + ChatColor.AQUA + currentVersion + ChatColor.YELLOW + " of Resurrection.");
|
||||||
|
p.sendMessage("");
|
||||||
|
if (outdated) {
|
||||||
|
p.sendMessage(ChatColor.RED + "A newer version of this plugin is available. Please notify a server admin to update this plugin for new features and/or stability improvements.");
|
||||||
|
p.sendMessage("");
|
||||||
|
}
|
||||||
|
p.sendMessage(ChatColor.YELLOW + "\u00a9 2021 Bryson Steck");
|
||||||
|
p.sendMessage(ChatColor.YELLOW + "This plugin is licensed under the GNU Affero General Public License v3.0. Read more here: ");
|
||||||
|
p.sendMessage(ChatColor.YELLOW + "For more information on this plugin or to download it for yourself, visit the GitHub repository at https://github.com/brysonsteck/resurrection");
|
||||||
} else {
|
} else {
|
||||||
System.out.println(aboutMessage);
|
System.out.println(aboutMessage);
|
||||||
}
|
}
|
||||||
|
|
|
@ -73,7 +73,7 @@ public class CommandHowLong implements CommandExecutor {
|
||||||
|
|
||||||
Player p = Bukkit.getPlayer(strings[0]);
|
Player p = Bukkit.getPlayer(strings[0]);
|
||||||
if (p == null) {
|
if (p == null) {
|
||||||
commandSender.sendMessage(ChatColor.RED + "ERROR: Player does not exist or is offline!");
|
System.out.println(ChatColor.RED + "[Resurrection] ERROR: Player does not exist or is offline!");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -90,13 +90,13 @@ public class CommandHowLong implements CommandExecutor {
|
||||||
|
|
||||||
TimeCheck timeCheck = new TimeCheck(resurrectionTime - currentTime);
|
TimeCheck timeCheck = new TimeCheck(resurrectionTime - currentTime);
|
||||||
|
|
||||||
commandSender.sendMessage(p.getDisplayName() + " will respawn in " + timeCheck.formatTime());
|
System.out.println("[Resurrection] " + p.getDisplayName() + " will respawn in " + timeCheck.formatTime());
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
commandSender.sendMessage("ERROR: An error has occurred while trying to get time information. This is a bug in the program and not your fault.");
|
System.out.println("[Resurrection] ERROR: An error has occurred while trying to get time information. This is a bug in the program and not your fault.");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue