geforkt von Mirrors/Paper
Add optional prefix value to plugin.yml. Addresses BUKKIT-838
By: Aidan Matzko <amatzko48@gmail.com>
Dieser Commit ist enthalten in:
Ursprung
b004c409f0
Commit
43002d0cbb
@ -30,6 +30,7 @@ public final class PluginDescriptionFile {
|
|||||||
private String description = null;
|
private String description = null;
|
||||||
private List<String> authors = null;
|
private List<String> authors = null;
|
||||||
private String website = null;
|
private String website = null;
|
||||||
|
private String prefix = null;
|
||||||
private boolean database = false;
|
private boolean database = false;
|
||||||
private PluginLoadOrder order = PluginLoadOrder.POSTWORLD;
|
private PluginLoadOrder order = PluginLoadOrder.POSTWORLD;
|
||||||
private List<Permission> permissions = null;
|
private List<Permission> permissions = null;
|
||||||
@ -160,6 +161,10 @@ public final class PluginDescriptionFile {
|
|||||||
return classLoaderOf;
|
return classLoaderOf;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getPrefix() {
|
||||||
|
return prefix;
|
||||||
|
}
|
||||||
|
|
||||||
private void loadMap(Map<?, ?> map) throws InvalidDescriptionException {
|
private void loadMap(Map<?, ?> map) throws InvalidDescriptionException {
|
||||||
try {
|
try {
|
||||||
name = map.get("name").toString();
|
name = map.get("name").toString();
|
||||||
@ -311,6 +316,9 @@ public final class PluginDescriptionFile {
|
|||||||
} else {
|
} else {
|
||||||
permissions = ImmutableList.<Permission>of();
|
permissions = ImmutableList.<Permission>of();
|
||||||
}
|
}
|
||||||
|
if (map.containsKey("prefix")) {
|
||||||
|
prefix = map.get("prefix").toString();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private Map<String, Object> saveMap() {
|
private Map<String, Object> saveMap() {
|
||||||
@ -349,6 +357,10 @@ public final class PluginDescriptionFile {
|
|||||||
map.put("class-loader-of", classLoaderOf);
|
map.put("class-loader-of", classLoaderOf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (prefix != null) {
|
||||||
|
map.put("prefix", prefix);
|
||||||
|
}
|
||||||
|
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -11,7 +11,6 @@ import java.util.logging.Logger;
|
|||||||
* The API for PluginLogger is exactly the same as {@link java.util.logging.Logger}.
|
* The API for PluginLogger is exactly the same as {@link java.util.logging.Logger}.
|
||||||
*/
|
*/
|
||||||
public class PluginLogger extends Logger {
|
public class PluginLogger extends Logger {
|
||||||
|
|
||||||
private String pluginName;
|
private String pluginName;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -20,7 +19,8 @@ public class PluginLogger extends Logger {
|
|||||||
*/
|
*/
|
||||||
public PluginLogger(Plugin context) {
|
public PluginLogger(Plugin context) {
|
||||||
super(context.getClass().getCanonicalName(), null);
|
super(context.getClass().getCanonicalName(), null);
|
||||||
pluginName = "[" + context.getDescription().getName() + "] ";
|
String prefix = context.getDescription().getPrefix();
|
||||||
|
pluginName = prefix != null ? new StringBuilder().append("[").append(prefix).append("] ").toString() : "[" + context.getDescription().getName() + "] ";
|
||||||
setParent(context.getServer().getLogger());
|
setParent(context.getServer().getLogger());
|
||||||
setLevel(Level.ALL);
|
setLevel(Level.ALL);
|
||||||
}
|
}
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren