From 037a2f8353267700e074585c9423a54bdd19a22a Mon Sep 17 00:00:00 2001 From: Shaun Bennett Date: Wed, 20 Jan 2016 13:04:31 -0500 Subject: [PATCH] Change craftbukkit to provided scope, add ascii.png to Hub and Arcade, new /bversion command --- .../mineplex/core/common/util/UtilText.java | 2 +- Plugins/Mineplex.Core/pom.xml | 4 ++ .../mineplex/core/updater/FileUpdater.java | 37 +++++++++++++++--- .../updater/command/BuildVersionCommand.java | 33 ++++++++++++++++ .../{ => command}/RestartServerCommand.java | 3 +- .../core/common => Mineplex.Hub}/ascii.png | Bin Plugins/Nautilus.Game.Arcade/ascii.png | Bin 0 -> 2516 bytes Plugins/plugin.xml | 1 + Plugins/pom.xml | 2 +- 9 files changed, 74 insertions(+), 8 deletions(-) create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/updater/command/BuildVersionCommand.java rename Plugins/Mineplex.Core/src/mineplex/core/updater/{ => command}/RestartServerCommand.java (93%) rename Plugins/{Mineplex.Core.Common/src/mineplex/core/common => Mineplex.Hub}/ascii.png (100%) create mode 100644 Plugins/Nautilus.Game.Arcade/ascii.png 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 0000000000000000000000000000000000000000..587966dc34dccb49992236660b344f46c66c965c GIT binary patch literal 2516 zcmV;_2`l!AP)_m$LuoG-{_;|FwLyek9-e9{o+0 zt{v=kxUxLj#$TG<{@vsA(t+;4Y`%iR(R_=0csqm{AF?AYF2&A2N`T$69)+sEz4oK| z-fw1)Pdy(<`QJ;5%uk!KNS=&l^Pip=vC!iJAC%$T4oX$sKV$WQ6*}Vtat%YEgsQg zy+yY2@3I3tW^ug*M1K?AVJl4d*K+`Naj$hma5=j}k#CE`d^-mSp@5979Z`ai-+T2~ zD8RENe6#GA!oUm+L$uhdIaRHRzuC^!}-@-{%kNL6V{FC&2H0HW4HRD66h2e_U4Si2J;4r`Lp1yCuv z>P48LTTpGx5CJR-U_`*(D4?1EHne^L%&tt3SFi^mR9>x!U%l5x#;?E9E4Lb^A!W?| zM_Fu?MMn)e8JM_|S8#TRvyP$J@i(L*%MhY)=tRy3tlj(cgC3N-j>cr&nsUc~-Fb{b zC1dMX_{}pA6R|@maQF-zAT|E$psH-`=mJ(;oM2H#wbG_UTG9Lu%O*X)cCTZ{C9Mo& zkfZ2K|1A-VY>=qa&3`&T#9CIxP8pk6zJfc*t z_>C%+**lNO?oErLyK%htyBYmaTx?;+ukv}wD3~o{?NaLit7zw=zM(k#4u$aCX2u@S z6pP~70jli;s!3$}#$x;Qi>r5Sc}F_iq7Q+iLzzI;E9yC zVBTF0A=TmNXXqB^|3^fv{8jp2Wh|n{rw+?DJE8}>qh{I}stAC27qKZI&1#Dtg={n1ueJt8 z39u=yZZWW_IzRgSdUSjYL|cJCnum+o^ZHDAWqxLS%KXPc!MEf2pPlrRgoHA!v;#0W z8fjmt1ZU=6Wr!--0PJz@6YLDtmO#dQ+VDMk9%_aRM`U{~|a&9BrG-SG;P55Z`_;APHfs(8}yF4mm*Yhdt9F8Y|!WZRTCT zS?~T;?GQ!0|D6h9Up1GAycfWD6=zWzWJzNTB~ib6wtUsAVygFvE5w8{(B*RH>BzMw zl_?sXydJh^okCRc15&?>?4Y|0Jyo`d=#woG%UzVsXXc;f0Bv?yGBsXTD3O-ZcD~rc zDrr>;o^>|@f`JSNKv`^7MnCO~M*s^eu zt)IFcety~N`rVT;fB*K%ZMOBC)UFHN`?iRnrz|OnVAh*{5hYS)h84^cTfSKfk8psi zc6??-3XONxn|>L@5Us!0j{2>J+c`jw8&q1ynEYr2w9JBK-bPlU1dpg`4scaIqHIld zFf?k@(^1&^(eZixi*S%^e%B+&QvOCp28-SA)2wGD8U^&MTuL2ar%5QlV}T>q$v#@7 zEQ{(LmaM$$GQGaB*XO(lBAE@8E&thj;LAC{+pU_a$X^w&k$C;9vJssB{z?LZxz@(VhE|&;mmuxnYWNLy2`BjLj=H5UgUYS73x@-k57(vceN7wgnJfS3EXKDz)lN1 z9GP{Mn%%xC27zLHUYv!<`Nol%Bt*s`%2`hyv(6CKH>x8<^_!Xc1=IK5w>v@Tsxj_-rq9_Dr&vFet*y%i2D0m;m$HpafB!$h{1AOJJ;{^gAJwI zTW||8jpn@9&usrby@?scv#Y|~PcXn7r(_YYwV^79`MH>Wm z5DH=nu9^p>{H`E`VW98IF5hsZmqhEMG64`0000 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