mirror of
https://github.com/PaperMC/Paper.git
synced 2025-08-15 04:05:50 -07:00
Revert "Added the ability to register commands dynamically."
This reverts commit 737d6347b1d74e13191df7c521d8db30fa174c9b. Because this is *NOT* how it should be. By: Erik Broes <erikbroes@grum.nl>
This commit is contained in:
@@ -3,9 +3,6 @@ package org.bukkit.plugin;
|
||||
import java.io.File;
|
||||
import java.util.Set;
|
||||
|
||||
import org.bukkit.command.CommandDefinition;
|
||||
import org.bukkit.command.CommandMap;
|
||||
import org.bukkit.command.PluginCommand;
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.event.Event.Priority;
|
||||
import org.bukkit.event.Listener;
|
||||
@@ -255,12 +252,4 @@ public interface PluginManager {
|
||||
* @return Set containing all current registered permissions
|
||||
*/
|
||||
public Set<Permission> getPermissions();
|
||||
|
||||
/**
|
||||
* Registers a plugin command dynamically.
|
||||
*
|
||||
* @param command Command definition to use
|
||||
* @param plugin Plugin to associate it with
|
||||
*/
|
||||
public void registerCommand(CommandDefinition command, Plugin plugin);
|
||||
}
|
||||
|
@@ -23,10 +23,7 @@ import java.util.regex.Matcher;
|
||||
import org.bukkit.Server;
|
||||
import java.util.regex.Pattern;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandMap;
|
||||
import org.bukkit.command.CommandDefinition;
|
||||
import org.bukkit.command.PluginCommand;
|
||||
import org.bukkit.command.PluginCommandUtil;
|
||||
import org.bukkit.command.PluginCommandYamlParser;
|
||||
import org.bukkit.command.SimpleCommandMap;
|
||||
|
||||
import org.bukkit.event.Event;
|
||||
@@ -273,7 +270,7 @@ public final class SimplePluginManager implements PluginManager {
|
||||
|
||||
public void enablePlugin(final Plugin plugin) {
|
||||
if (!plugin.isEnabled()) {
|
||||
List<Command> pluginCommands = PluginCommandUtil.parse(plugin);
|
||||
List<Command> pluginCommands = PluginCommandYamlParser.parse(plugin);
|
||||
|
||||
if (!pluginCommands.isEmpty()) {
|
||||
commandMap.registerAll(plugin.getDescription().getName(), pluginCommands);
|
||||
@@ -543,8 +540,4 @@ public final class SimplePluginManager implements PluginManager {
|
||||
public Set<Permission> getPermissions() {
|
||||
return new HashSet<Permission>(permissions.values());
|
||||
}
|
||||
|
||||
public void registerCommand(CommandDefinition command, Plugin plugin) {
|
||||
commandMap.register(plugin.getDescription().getName(), PluginCommandUtil.parse(command, plugin));
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user