Add disabled commands
This commit is contained in:
parent
9adcb05d45
commit
0189ad9c17
@ -240,4 +240,11 @@ public abstract class ProxyServer
|
|||||||
* @return a new {@link CustomTabList} instance
|
* @return a new {@link CustomTabList} instance
|
||||||
*/
|
*/
|
||||||
public abstract CustomTabList customTabList(ProxiedPlayer player);
|
public abstract CustomTabList customTabList(ProxiedPlayer player);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the commands which are disabled and will not be run on this proxy.
|
||||||
|
*
|
||||||
|
* @return the set of disabled commands
|
||||||
|
*/
|
||||||
|
public abstract Collection<String> getDisabledCommands();
|
||||||
}
|
}
|
||||||
|
@ -43,6 +43,15 @@ public interface ConfigurationAdapter
|
|||||||
*/
|
*/
|
||||||
public boolean getBoolean(String path, boolean def);
|
public boolean getBoolean(String path, boolean def);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get a list from the specified path.
|
||||||
|
*
|
||||||
|
* @param path the path to retrieve the list form.
|
||||||
|
* @param def the default value
|
||||||
|
* @return the retrieved list
|
||||||
|
*/
|
||||||
|
public Collection<?> getList(String path, Collection<?> def);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the configuration all servers which may be accessible via the proxy.
|
* Get the configuration all servers which may be accessible via the proxy.
|
||||||
*
|
*
|
||||||
|
@ -86,7 +86,12 @@ public class PluginManager
|
|||||||
public boolean dispatchCommand(CommandSender sender, String commandLine)
|
public boolean dispatchCommand(CommandSender sender, String commandLine)
|
||||||
{
|
{
|
||||||
String[] split = argsSplit.split( commandLine );
|
String[] split = argsSplit.split( commandLine );
|
||||||
Command command = commandMap.get( split[0].toLowerCase() );
|
String commandName = split[0].toLowerCase();
|
||||||
|
if ( proxy.getDisabledCommands().contains( commandName ) )
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
Command command = commandMap.get( commandName );
|
||||||
if ( command == null )
|
if ( command == null )
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
|
@ -518,4 +518,9 @@ public class BungeeCord extends ProxyServer
|
|||||||
{
|
{
|
||||||
return new Custom( player );
|
return new Custom( player );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Collection<String> getDisabledCommands()
|
||||||
|
{
|
||||||
|
return config.getDisabledCommands();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,7 @@ package net.md_5.bungee.config;
|
|||||||
|
|
||||||
import com.google.common.base.Preconditions;
|
import com.google.common.base.Preconditions;
|
||||||
import gnu.trove.map.TMap;
|
import gnu.trove.map.TMap;
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
@ -14,6 +15,7 @@ import net.md_5.bungee.tab.GlobalPing;
|
|||||||
import net.md_5.bungee.tab.Global;
|
import net.md_5.bungee.tab.Global;
|
||||||
import net.md_5.bungee.tab.ServerUnique;
|
import net.md_5.bungee.tab.ServerUnique;
|
||||||
import net.md_5.bungee.util.CaseInsensitiveMap;
|
import net.md_5.bungee.util.CaseInsensitiveMap;
|
||||||
|
import net.md_5.bungee.util.CaseInsensitiveSet;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Core configuration for the proxy.
|
* Core configuration for the proxy.
|
||||||
@ -43,6 +45,7 @@ public class Configuration
|
|||||||
*/
|
*/
|
||||||
private boolean onlineMode = true;
|
private boolean onlineMode = true;
|
||||||
private int playerLimit = -1;
|
private int playerLimit = -1;
|
||||||
|
private Collection<String> disabledCommands;
|
||||||
|
|
||||||
public void load()
|
public void load()
|
||||||
{
|
{
|
||||||
@ -55,6 +58,8 @@ public class Configuration
|
|||||||
onlineMode = adapter.getBoolean( "online_mode", onlineMode );
|
onlineMode = adapter.getBoolean( "online_mode", onlineMode );
|
||||||
playerLimit = adapter.getInt( "player_limit", playerLimit );
|
playerLimit = adapter.getInt( "player_limit", playerLimit );
|
||||||
|
|
||||||
|
disabledCommands = new CaseInsensitiveSet( (Collection<String>) adapter.getList( "disabled_commands", Arrays.asList( "find" ) ) );
|
||||||
|
|
||||||
Preconditions.checkArgument( listeners != null && !listeners.isEmpty(), "No listeners defined." );
|
Preconditions.checkArgument( listeners != null && !listeners.isEmpty(), "No listeners defined." );
|
||||||
|
|
||||||
Map<String, ServerInfo> newServers = adapter.getServers();
|
Map<String, ServerInfo> newServers = adapter.getServers();
|
||||||
|
@ -234,6 +234,12 @@ public class YamlConfig implements ConfigurationAdapter
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Collection<?> getList(String path, Collection<?> def)
|
||||||
|
{
|
||||||
|
return get( path, def );
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public Collection<String> getPermissions(String group)
|
public Collection<String> getPermissions(String group)
|
||||||
|
Loading…
Reference in New Issue
Block a user