Change craftbukkit to provided scope, add ascii.png to Hub and Arcade, new /bversion command

This commit is contained in:
Shaun Bennett 2016-01-20 13:04:31 -05:00
parent 8977735baf
commit 037a2f8353
9 changed files with 74 additions and 8 deletions

View File

@ -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[]

View File

@ -44,5 +44,9 @@
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
</dependency>
<dependency>
<groupId>com.mineplex</groupId>
<artifactId>spigot</artifactId>
</dependency>
</dependencies>
</project>

View File

@ -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;
@ -35,6 +38,8 @@ 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);
@ -50,12 +55,15 @@ public class FileUpdater extends MiniPlugin
// 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;

View File

@ -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<FileUpdater>
{
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);
}
}

View File

@ -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<FileUpdater>

View File

Before

Width:  |  Height:  |  Size: 2.5 KiB

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

View File

@ -20,6 +20,7 @@
<includes>
<include>plugin.yml</include>
<include>version.properties</include>
<include>ascii.png</include>
</includes>
<filtering>true</filtering>
</resource>

View File

@ -117,7 +117,7 @@
<groupId>com.mineplex</groupId>
<artifactId>spigot</artifactId>
<version>1.8.8-R0.1-SNAPSHOT</version>
<scope>compile</scope>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>redis.clients</groupId>