Archiviert
13
0

Implemented bukkit versioning

Dieser Commit ist enthalten in:
Nathan Adams 2011-10-31 04:02:54 +00:00
Ursprung 6c9cb5a95e
Commit b1671be875
2 geänderte Dateien mit 35 neuen und 0 gelöschten Zeilen

Datei anzeigen

@ -70,6 +70,7 @@ import org.bukkit.craftbukkit.inventory.CraftShapelessRecipe;
import org.bukkit.craftbukkit.map.CraftMapView;
import org.bukkit.scheduler.BukkitWorker;
import org.bukkit.craftbukkit.scheduler.CraftScheduler;
import org.bukkit.craftbukkit.util.Versioning;
import org.bukkit.util.permissions.DefaultPermissions;
import org.bukkit.event.world.WorldInitEvent;
import org.bukkit.permissions.Permission;
@ -82,6 +83,7 @@ public final class CraftServer implements Server {
private final String serverName = "Craftbukkit";
private final String serverVersion;
private final String protocolVersion = "1.8.1";
private final String bukkitVersion = Versioning.getBukkitVersion();
private final ServicesManager servicesManager = new SimpleServicesManager();
private final BukkitScheduler scheduler = new CraftScheduler(this);
private final SimpleCommandMap commandMap = new SimpleCommandMap(this);
@ -192,6 +194,10 @@ public final class CraftServer implements Server {
return serverVersion + " (MC: " + protocolVersion + ")";
}
public String getBukkitVersion() {
return bukkitVersion;
}
@SuppressWarnings("unchecked")
public Player[] getOnlinePlayers() {
List<EntityPlayer> online = server.players;

Datei anzeigen

@ -0,0 +1,29 @@
package org.bukkit.craftbukkit.util;
import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.bukkit.Bukkit;
public final class Versioning {
public static String getBukkitVersion() {
String result = "Unknown-Version";
InputStream stream = Bukkit.class.getClassLoader().getResourceAsStream("META-INF/maven/org.bukkit/bukkit/pom.properties");
Properties properties = new Properties();
if (stream != null) {
try {
properties.load(stream);
result = properties.getProperty("version");
} catch (IOException ex) {
Logger.getLogger(Versioning.class.getName()).log(Level.SEVERE, "Could not get Bukkit version!", ex);
}
}
return result;
}
}