diff --git a/src/main/java/com/timvisee/dungeonmaze/DungeonMaze.java b/src/main/java/com/timvisee/dungeonmaze/DungeonMaze.java index 0b5dfe9..de81900 100644 --- a/src/main/java/com/timvisee/dungeonmaze/DungeonMaze.java +++ b/src/main/java/com/timvisee/dungeonmaze/DungeonMaze.java @@ -50,8 +50,7 @@ public void onEnable() { // Show a status message Core.getLogger().info("Starting Dungeon Maze v" + getVersionName() + "..."); - // TODO: Show proper detected Minecraft server name here, instead of just BUKKIT - Core.getLogger().info("Detected Minecraft version: v" + MinecraftUtils.getMinecraftVersion() + " (BUKKIT)"); + Core.getLogger().info("Detected Minecraft version: v" + MinecraftUtils.getMinecraftVersion() + " (" + MinecraftUtils.getMinecraftServerName() + ")"); // Initialize the core initCore(); diff --git a/src/main/java/com/timvisee/dungeonmaze/command/executable/StatusCommand.java b/src/main/java/com/timvisee/dungeonmaze/command/executable/StatusCommand.java index a49ea0c..cdc32da 100644 --- a/src/main/java/com/timvisee/dungeonmaze/command/executable/StatusCommand.java +++ b/src/main/java/com/timvisee/dungeonmaze/command/executable/StatusCommand.java @@ -146,9 +146,10 @@ public void printServerStatus(CommandSender sender) { sender.sendMessage(ChatColor.GRAY + "" + ChatColor.ITALIC + "Server Status:"); // Print the server status + sender.sendMessage(ChatColor.GOLD + "Detected Minecraft Version: " + ChatColor.WHITE + MinecraftUtils.getMinecraftVersion()); + sender.sendMessage(ChatColor.GOLD + "Detected Minecraft Server: " + ChatColor.WHITE + MinecraftUtils.getMinecraftServerName()); sender.sendMessage(ChatColor.GOLD + "Server Version: " + ChatColor.WHITE + Bukkit.getVersion()); sender.sendMessage(ChatColor.GOLD + "Bukkit Version: " + ChatColor.WHITE + Bukkit.getBukkitVersion()); - sender.sendMessage(ChatColor.GOLD + "Detected Minecraft Version: " + ChatColor.WHITE + MinecraftUtils.getMinecraftVersion()); sender.sendMessage(ChatColor.GOLD + "Running Plugins: " + ChatColor.WHITE + Bukkit.getPluginManager().getPlugins().length); // Get the world manager diff --git a/src/main/java/com/timvisee/dungeonmaze/util/MinecraftUtils.java b/src/main/java/com/timvisee/dungeonmaze/util/MinecraftUtils.java index d8cf59b..aa7ef8e 100644 --- a/src/main/java/com/timvisee/dungeonmaze/util/MinecraftUtils.java +++ b/src/main/java/com/timvisee/dungeonmaze/util/MinecraftUtils.java @@ -27,4 +27,29 @@ public static String getMinecraftVersion() { // Get and return the Minecraft version number return rawVersion.substring(start, end); } + + /** + * Get the name of the current running Minecraft server system, such as CraftBukkit or Spigot. + * + * @return The current Minecraft server name. + */ + public static String getMinecraftServerName() { + // Get the raw version + final String rawVersion = Bukkit.getVersion(); + + // Check whether this is a CraftBukkit or Bukkit server + if(rawVersion.toLowerCase().contains("bukkit")) + return "CraftBukkit"; + + // Check whether this is a PaperSpigot server + if(rawVersion.toLowerCase().contains("paperspigot")) + return "PaperSpigot"; + + // Check whether this is a Spigot server + if(rawVersion.toLowerCase().contains("spigot")) + return "Spigot"; + + // Return unknown + return "Unknown"; + } }