Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-11-16 04:50:05 +01:00
Implemented bukkit versioning
Dieser Commit ist enthalten in:
Ursprung
6c9cb5a95e
Commit
b1671be875
@ -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);
|
||||
@ -191,6 +193,10 @@ public final class CraftServer implements Server {
|
||||
public String getVersion() {
|
||||
return serverVersion + " (MC: " + protocolVersion + ")";
|
||||
}
|
||||
|
||||
public String getBukkitVersion() {
|
||||
return bukkitVersion;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public Player[] getOnlinePlayers() {
|
||||
|
29
src/main/java/org/bukkit/craftbukkit/util/Versioning.java
Normale Datei
29
src/main/java/org/bukkit/craftbukkit/util/Versioning.java
Normale Datei
@ -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;
|
||||
}
|
||||
}
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren