- Removal of additional command localization complexity
This commit is contained in:
@@ -125,8 +125,8 @@ public abstract class BaseLocFile implements IConfigSection
|
||||
}
|
||||
}
|
||||
|
||||
// Returns the value. If the localized string is empty,
|
||||
// returns a the key instead which is the default phrase.
|
||||
// Returns the localized string if available.
|
||||
// If the localized string is empty, returns a the key instead as the default phrase.
|
||||
public String getKey(String input)
|
||||
{
|
||||
if(localized == null)
|
||||
|
||||
@@ -36,35 +36,23 @@ public class CommandManager
|
||||
if(pair == null || pair.Second == null)
|
||||
return;
|
||||
|
||||
String key = pair.Second;
|
||||
|
||||
if(key.contains(","))
|
||||
{
|
||||
|
||||
String[] keys = key.split(",");
|
||||
register(keys, command);
|
||||
return;
|
||||
}
|
||||
|
||||
key = key.toLowerCase();
|
||||
command.registeredNames.add(key);
|
||||
|
||||
Command old = commands.put(key, command);
|
||||
|
||||
if(old != null)
|
||||
{
|
||||
GlobalLog.warn(LogFilter.Core, "Writing over a command with the key " + key);
|
||||
return;
|
||||
}
|
||||
|
||||
GlobalLog.log(LogFilter.Core, "Command registered under key " + key);
|
||||
}
|
||||
|
||||
// Registers a command under multiple names!
|
||||
public void register(String[] keys, Command command)
|
||||
{
|
||||
String[] keys = pair.Second.split(",");
|
||||
|
||||
for(int i = 0; i < keys.length; ++i)
|
||||
register(new Pair<String, String>(null, keys[i].trim()), command);
|
||||
{
|
||||
String key = keys[i].trim().toLowerCase();
|
||||
|
||||
command.registeredNames.add(key);
|
||||
Command old = commands.put(key, command);
|
||||
|
||||
if(old != null)
|
||||
{
|
||||
GlobalLog.warn(LogFilter.Core, "Writing over a command with the key " + key);
|
||||
return;
|
||||
}
|
||||
|
||||
GlobalLog.log(LogFilter.Core, "Command registered under key " + key);
|
||||
}
|
||||
}
|
||||
|
||||
// Calls the command but on a whole new thread!
|
||||
@@ -74,9 +62,9 @@ public class CommandManager
|
||||
if(input == null || !input.isValid())
|
||||
return false;
|
||||
|
||||
// If we haven't already split a multisplit command (or even assessed that),
|
||||
// then verify if we even need to register the commands at all. If it's
|
||||
// not enabled, don't register it.
|
||||
// At this point, verify that the command is enabled. If we don't have any info
|
||||
// on if it's enabled or not, we assume it's enabled to prevent broken functionality due
|
||||
// to formatting or casing issues.
|
||||
if(input.key != null && !commandEnabler.isEnabled(input.key))
|
||||
return false;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user