mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2024-12-22 17:27:38 +00:00
WorldEdit version is now printed on load.
This commit is contained in:
parent
28f76f869c
commit
4d06bc5df1
@ -1,3 +1,3 @@
|
||||
Manifest-Version: 1.0
|
||||
Class-Path: jnbt.jar truezip.jar ant.jar
|
||||
|
||||
WorldEdit-Version: 1.1
|
@ -20,7 +20,12 @@
|
||||
import com.sk89q.worldedit.snapshots.SnapshotRepository;
|
||||
import java.util.Map;
|
||||
import java.util.HashSet;
|
||||
import com.sk89q.worldedit.ServerInterface;
|
||||
import java.util.jar.Manifest;
|
||||
import java.util.jar.Attributes;
|
||||
import java.net.URL;
|
||||
import java.io.IOException;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
/**
|
||||
* Entry point for the plugin for hey0's mod.
|
||||
@ -28,6 +33,10 @@ import com.sk89q.worldedit.ServerInterface;
|
||||
* @author sk89q
|
||||
*/
|
||||
public class WorldEdit extends Plugin {
|
||||
/**
|
||||
* Logger.
|
||||
*/
|
||||
private static final Logger logger = Logger.getLogger("Minecraft");
|
||||
/**
|
||||
* WorldEditLibrary's properties file.
|
||||
*/
|
||||
@ -60,6 +69,8 @@ public class WorldEdit extends Plugin {
|
||||
PluginListener.Priority.MEDIUM);
|
||||
loader.addListener(PluginLoader.Hook.LOGIN, listener, this,
|
||||
PluginListener.Priority.MEDIUM);
|
||||
|
||||
logger.log(Level.INFO, "WorldEdit version " + getWorldEditVersion() + " loaded.");
|
||||
}
|
||||
|
||||
/**
|
||||
@ -111,4 +122,23 @@ public class WorldEdit extends Plugin {
|
||||
|
||||
worldEdit.clearSessions();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the WorldEdit version.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
private String getWorldEditVersion() {
|
||||
try {
|
||||
String classContainer = WorldEdit.class.getProtectionDomain()
|
||||
.getCodeSource().getLocation().toString();
|
||||
URL manifestUrl = new URL("jar:" + classContainer + "!/META-INF/MANIFEST.MF");
|
||||
Manifest manifest = new Manifest(manifestUrl.openStream());
|
||||
Attributes attrib = manifest.getMainAttributes();
|
||||
String ver = (String)attrib.getValue("WorldEdit-Version");
|
||||
return ver != null ? ver : "(unavailable)";
|
||||
} catch (IOException e) {
|
||||
return "(unknown)";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user