13
0
geforkt von Mirrors/Paper

Added new plugin.yml option 'load', possible values are 'startup' and 'postworld' (default postworld)

By: Dinnerbone <dinnerbone@dinnerbone.com>
Dieser Commit ist enthalten in:
Bukkit/Spigot 2011-06-22 17:45:53 +01:00
Ursprung e2779f623c
Commit ba32a78b3b
2 geänderte Dateien mit 32 neuen und 0 gelöschten Zeilen

Datei anzeigen

@ -24,6 +24,7 @@ public final class PluginDescriptionFile {
private ArrayList<String> authors = new ArrayList<String>();
private String website = null;
private boolean database = false;
private PluginLoadOrder order = PluginLoadOrder.POSTWORLD;
@SuppressWarnings("unchecked")
public PluginDescriptionFile(final InputStream stream) throws InvalidDescriptionException {
@ -108,6 +109,10 @@ public final class PluginDescriptionFile {
return softDepend;
}
public PluginLoadOrder getLoad() {
return order;
}
/**
* Gets the description of this plugin
*
@ -213,6 +218,16 @@ public final class PluginDescriptionFile {
}
}
if (map.containsKey("load")) {
try {
order = PluginLoadOrder.valueOf(((String)map.get("load")).toUpperCase().replaceAll("\\W", ""));
} catch (ClassCastException ex) {
throw new InvalidDescriptionException(ex, "load is of wrong type");
} catch (IllegalArgumentException ex) {
throw new InvalidDescriptionException(ex, "load is not a valid choice");
}
}
if (map.containsKey("author")) {
try {
String extra = (String) map.get("author");
@ -241,6 +256,7 @@ public final class PluginDescriptionFile {
map.put("main", main);
map.put("version", version);
map.put("database", database);
map.put("order", order.toString());
if (commands != null) {
map.put("command", commands);

Datei anzeigen

@ -0,0 +1,16 @@
package org.bukkit.plugin;
/**
* Represents the order in which a plugin should be initialized and enabled
*/
public enum PluginLoadOrder {
/**
* Indicates that the plugin will be loaded at startup
*/
STARTUP,
/**
* Indicates that the plugin will be loaded after the first/default world was created
*/
POSTWORLD
}