diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilText.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilText.java index 360a418c2..fe42fdf3c 100644 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilText.java +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilText.java @@ -24,7 +24,7 @@ public class UtilText { try { - InputStream inputStream = CurrencyType.class.getResourceAsStream("ascii.png"); + InputStream inputStream = CurrencyType.class.getResourceAsStream("/ascii.png"); BufferedImage image = ImageIO.read(inputStream); char[] text = new char[] diff --git a/Plugins/Mineplex.Core/pom.xml b/Plugins/Mineplex.Core/pom.xml index 9ca17ceef..6dd7ec6c3 100644 --- a/Plugins/Mineplex.Core/pom.xml +++ b/Plugins/Mineplex.Core/pom.xml @@ -44,5 +44,9 @@ org.apache.httpcomponents httpclient + + com.mineplex + spigot + diff --git a/Plugins/Mineplex.Core/src/mineplex/core/updater/FileUpdater.java b/Plugins/Mineplex.Core/src/mineplex/core/updater/FileUpdater.java index 4b11a5e29..5df3e3a33 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/updater/FileUpdater.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/updater/FileUpdater.java @@ -4,7 +4,10 @@ import java.io.File; import java.io.FileInputStream; import java.io.FilenameFilter; import java.io.IOException; +import java.util.Properties; +import mineplex.core.updater.command.BuildVersionCommand; +import mineplex.core.updater.command.RestartServerCommand; import org.apache.commons.codec.digest.DigestUtils; import org.bukkit.Bukkit; import org.bukkit.entity.Player; @@ -34,28 +37,33 @@ public class FileUpdater extends MiniPlugin private boolean _needUpdate; private boolean _enabled = true; + + private Properties _buildProperties; public FileUpdater(JavaPlugin plugin, Portal portal, String serverName, Region region) { super("File Updater", plugin); - + _portal = portal; _serverName = serverName; _region = region; - + GetPluginMd5s(); - + if (new File("IgnoreUpdates.dat").exists()) _enabled = false; - + // Register the server command type for future use ServerCommandManager.getInstance().registerCommandType("RestartCommand", RestartCommand.class, new RestartHandler(plugin, _serverName, _region)); + + loadBuildProperties(); } - + @Override public void addCommands() { addCommand(new RestartServerCommand(this)); + addCommand(new BuildVersionCommand(this)); } @EventHandler @@ -224,6 +232,25 @@ public class FileUpdater extends MiniPlugin } } + private void loadBuildProperties() + { + _buildProperties = new Properties(); + + try + { + _buildProperties.load(this.getClass().getResourceAsStream("/version.properties")); + } + catch (IOException e) + { + e.printStackTrace(); + } + } + + public Properties getBuildProperties() + { + return _buildProperties; + } + public Region getRegion() { return _region; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/updater/command/BuildVersionCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/updater/command/BuildVersionCommand.java new file mode 100644 index 000000000..0e5e2b10f --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/updater/command/BuildVersionCommand.java @@ -0,0 +1,33 @@ +package mineplex.core.updater.command; + +import java.util.Properties; + +import org.bukkit.entity.Player; + +import mineplex.core.command.CommandBase; +import mineplex.core.common.Rank; +import mineplex.core.common.util.C; +import mineplex.core.updater.FileUpdater; + +public class BuildVersionCommand extends CommandBase +{ + public BuildVersionCommand(FileUpdater plugin) + { + super(plugin, Rank.MODERATOR, "bversion"); + } + + @Override + public void Execute(Player caller, String[] args) + { + Properties buildProperties = Plugin.getBuildProperties(); + + String git = buildProperties.getProperty("build.git", "Unknown"); + String date = buildProperties.getProperty("build.date", "Unknown"); + String user = buildProperties.getProperty("build.user", "Unknown"); + + caller.sendMessage(C.cRedB + "Build Version;"); + caller.sendMessage(" " + C.cGold + "Date " + C.cWhite + date); + caller.sendMessage(" " + C.cGold + "User " + C.cWhite + user); + caller.sendMessage(" " + C.cGold + "Git " + C.cWhite + git); + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/updater/RestartServerCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/updater/command/RestartServerCommand.java similarity index 93% rename from Plugins/Mineplex.Core/src/mineplex/core/updater/RestartServerCommand.java rename to Plugins/Mineplex.Core/src/mineplex/core/updater/command/RestartServerCommand.java index 1067506b0..544ae231e 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/updater/RestartServerCommand.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/updater/command/RestartServerCommand.java @@ -1,4 +1,4 @@ -package mineplex.core.updater; +package mineplex.core.updater.command; import org.bukkit.entity.Player; @@ -9,6 +9,7 @@ import mineplex.core.common.util.Callback; import mineplex.core.common.util.F; import mineplex.core.common.util.UtilPlayer; import mineplex.core.portal.Portal; +import mineplex.core.updater.FileUpdater; import mineplex.serverdata.commands.RestartCommand; public class RestartServerCommand extends CommandBase diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/ascii.png b/Plugins/Mineplex.Hub/ascii.png similarity index 100% rename from Plugins/Mineplex.Core.Common/src/mineplex/core/common/ascii.png rename to Plugins/Mineplex.Hub/ascii.png diff --git a/Plugins/Nautilus.Game.Arcade/ascii.png b/Plugins/Nautilus.Game.Arcade/ascii.png new file mode 100644 index 000000000..587966dc3 Binary files /dev/null and b/Plugins/Nautilus.Game.Arcade/ascii.png differ diff --git a/Plugins/plugin.xml b/Plugins/plugin.xml index 5febc2a54..c36f68b81 100644 --- a/Plugins/plugin.xml +++ b/Plugins/plugin.xml @@ -20,6 +20,7 @@ plugin.yml version.properties + ascii.png true diff --git a/Plugins/pom.xml b/Plugins/pom.xml index f17e2b4ff..cd99db999 100644 --- a/Plugins/pom.xml +++ b/Plugins/pom.xml @@ -117,7 +117,7 @@ com.mineplex spigot 1.8.8-R0.1-SNAPSHOT - compile + provided redis.clients