mirror of
https://github.com/YouHaveTrouble/YardWatch.git
synced 2026-05-11 22:16:58 +00:00
display api version in /yw command feedback
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
package me.youhavetrouble.yardwatch;
|
package me.youhavetrouble.yardwatch;
|
||||||
|
|
||||||
|
import com.google.common.io.Resources;
|
||||||
import me.youhavetrouble.yardwatch.commands.YardWatchCommand;
|
import me.youhavetrouble.yardwatch.commands.YardWatchCommand;
|
||||||
import me.youhavetrouble.yardwatch.hooks.FactionsUUIDProtection;
|
import me.youhavetrouble.yardwatch.hooks.FactionsUUIDProtection;
|
||||||
import me.youhavetrouble.yardwatch.hooks.GriefPreventionProtection;
|
import me.youhavetrouble.yardwatch.hooks.GriefPreventionProtection;
|
||||||
@@ -13,13 +14,25 @@ import org.bukkit.plugin.RegisteredServiceProvider;
|
|||||||
import org.bukkit.plugin.ServicePriority;
|
import org.bukkit.plugin.ServicePriority;
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.net.URL;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@SuppressWarnings("UnstableApiUsage")
|
||||||
public final class YardWatch extends JavaPlugin {
|
public final class YardWatch extends JavaPlugin {
|
||||||
|
|
||||||
|
private static String yardWatchApiVersion = "Unknown";
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onEnable() {
|
public void onEnable() {
|
||||||
|
|
||||||
|
try {
|
||||||
|
URL url = Resources.getResource("apiversion.txt");
|
||||||
|
yardWatchApiVersion = Resources.toString(url, com.google.common.base.Charsets.UTF_8);
|
||||||
|
} catch (IOException e) {
|
||||||
|
getLogger().warning("Failed to read YardWatch API version.");
|
||||||
|
}
|
||||||
|
|
||||||
PluginCommand command = getCommand("yardwatch");
|
PluginCommand command = getCommand("yardwatch");
|
||||||
if (command != null) {
|
if (command != null) {
|
||||||
command.setExecutor(new YardWatchCommand(this));
|
command.setExecutor(new YardWatchCommand(this));
|
||||||
@@ -96,4 +109,8 @@ public final class YardWatch extends JavaPlugin {
|
|||||||
public void onDisable() {
|
public void onDisable() {
|
||||||
getServer().getServicesManager().unregisterAll(this);
|
getServer().getServicesManager().unregisterAll(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static String getYardWatchApiVersion() {
|
||||||
|
return yardWatchApiVersion;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ public class YardWatchCommand implements TabExecutor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void sendDefault(CommandSender sender) {
|
private void sendDefault(CommandSender sender) {
|
||||||
sender.sendMessage("YardWatch " + version);
|
sender.sendMessage(String.format("YardWatch %s (Implementing YardWatch API %s)", version, YardWatch.getYardWatchApiVersion()));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void sendHooks(CommandSender sender) {
|
private void sendHooks(CommandSender sender) {
|
||||||
|
|||||||
Reference in New Issue
Block a user