geforkt von Mirrors/Paper
Server administrators can now specify custom aliases in bukkit.yml which override any aliases set by plugins.
By: Dinnerbone <dinnerbone@dinnerbone.com>
Dieser Commit ist enthalten in:
Ursprung
dc11d556ba
Commit
b02e6095bd
@ -6,6 +6,7 @@ import org.bukkit.entity.Player;
|
|||||||
import org.bukkit.inventory.Recipe;
|
import org.bukkit.inventory.Recipe;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
import org.bukkit.command.PluginCommand;
|
import org.bukkit.command.PluginCommand;
|
||||||
|
|
||||||
@ -263,4 +264,11 @@ public interface Server {
|
|||||||
* @return True to indicate that the recipe was added.
|
* @return True to indicate that the recipe was added.
|
||||||
*/
|
*/
|
||||||
public boolean addRecipe(Recipe recipe);
|
public boolean addRecipe(Recipe recipe);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets a list of command aliases defined in the server properties.
|
||||||
|
*
|
||||||
|
* @return Map of aliases to command names
|
||||||
|
*/
|
||||||
|
public Map<String, String> getCommandAliases();
|
||||||
}
|
}
|
||||||
|
@ -150,6 +150,22 @@ public final class SimpleCommandMap implements CommandMap {
|
|||||||
return knownCommands.get(name.toLowerCase());
|
return knownCommands.get(name.toLowerCase());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void registerServerAliases() {
|
||||||
|
Map<String, String> values = server.getCommandAliases();
|
||||||
|
|
||||||
|
for (String alias : values.keySet()) {
|
||||||
|
String target = values.get(alias);
|
||||||
|
Command command = getCommand(target);
|
||||||
|
|
||||||
|
if (command != null) {
|
||||||
|
// We register these as commands so they have absolute priority.
|
||||||
|
knownCommands.put(alias.toLowerCase(), command);
|
||||||
|
} else {
|
||||||
|
server.getLogger().warning("Could not register custom alias '" + alias + "' to command '" + target + "' because the command does not exist.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private static class VersionCommand extends Command {
|
private static class VersionCommand extends Command {
|
||||||
private final Server server;
|
private final Server server;
|
||||||
|
|
||||||
|
@ -220,6 +220,15 @@ public class ConfigurationNode {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a list of all keys at the root path
|
||||||
|
*
|
||||||
|
* @return List of keys
|
||||||
|
*/
|
||||||
|
public List<String> getKeys() {
|
||||||
|
return new ArrayList<String>(root.keySet());
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets a list of objects at a location. If the list is not defined,
|
* Gets a list of objects at a location. If the list is not defined,
|
||||||
* null will be returned. The node must be an actual list.
|
* null will be returned. The node must be an actual list.
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren