mirror of
https://github.com/Ne0nx3r0/BetterAlias.git
synced 2024-11-23 12:05:40 +01:00
re-adding support for !*
This commit is contained in:
parent
8c0b3ae954
commit
03186b6056
@ -27,7 +27,7 @@ public class Alias
|
||||
|
||||
public boolean hasCommandFor(int length)
|
||||
{
|
||||
return this.parameters.containsKey(length);
|
||||
return this.parameters.containsKey(length) || this.parameters.containsKey(-1);
|
||||
}
|
||||
|
||||
public String getPermissionNode()
|
||||
@ -42,7 +42,14 @@ public class Alias
|
||||
|
||||
Iterable<AliasCommand> getCommands(int length)
|
||||
{
|
||||
return this.parameters.get(length);
|
||||
List<AliasCommand> commands = this.parameters.get(length);
|
||||
|
||||
if(commands != null)
|
||||
{
|
||||
return commands;
|
||||
}
|
||||
|
||||
return this.parameters.get(-1);
|
||||
}
|
||||
|
||||
void setCommandsFor(int length,List<AliasCommand> commandsList)
|
||||
|
@ -72,48 +72,57 @@ public class AliasManager
|
||||
|
||||
if(!sArg.equalsIgnoreCase("permission"))
|
||||
{
|
||||
int iArg = Integer.parseInt(sArg);
|
||||
|
||||
List<String> sArgLines = new ArrayList<String>();
|
||||
|
||||
if(yml.isList(sAlias+"."+sArg))
|
||||
{
|
||||
sArgLines = yml.getStringList(sAlias+"."+sArg);
|
||||
}
|
||||
else
|
||||
{
|
||||
sArgLines.add(yml.getString(sAlias+"."+sArg));
|
||||
}
|
||||
|
||||
for(String sArgLine : sArgLines)
|
||||
{
|
||||
AliasCommandTypes type = AliasCommandTypes.PLAYER;
|
||||
int iArg;
|
||||
|
||||
if(sArgLine.contains(" "))
|
||||
if(sArg.equals("*"))
|
||||
{
|
||||
String sType = sArgLine.substring(0,sArgLine.indexOf(" "));
|
||||
|
||||
if(sType.equalsIgnoreCase("console"))
|
||||
{
|
||||
type = AliasCommandTypes.CONSOLE;
|
||||
|
||||
sArgLine = sArgLine.substring(sArgLine.indexOf(" ")+1);
|
||||
}
|
||||
else if(sType.equalsIgnoreCase("reply"))
|
||||
{
|
||||
type = AliasCommandTypes.REPLY_MESSAGE;
|
||||
|
||||
sArgLine = sArgLine.substring(sArgLine.indexOf(" ")+1);
|
||||
}
|
||||
iArg = -1;
|
||||
}
|
||||
|
||||
sArgLine = this.replaceColorCodes(sArgLine);
|
||||
|
||||
commandsList.add(new AliasCommand(sArgLine,type));
|
||||
else
|
||||
{
|
||||
iArg = Integer.parseInt(sArg);
|
||||
}
|
||||
|
||||
List<String> sArgLines = new ArrayList<String>();
|
||||
|
||||
if(yml.isList(sAlias+"."+sArg))
|
||||
{
|
||||
sArgLines = yml.getStringList(sAlias+"."+sArg);
|
||||
}
|
||||
else
|
||||
{
|
||||
sArgLines.add(yml.getString(sAlias+"."+sArg));
|
||||
}
|
||||
|
||||
for(String sArgLine : sArgLines)
|
||||
{
|
||||
AliasCommandTypes type = AliasCommandTypes.PLAYER;
|
||||
|
||||
if(sArgLine.contains(" "))
|
||||
{
|
||||
String sType = sArgLine.substring(0,sArgLine.indexOf(" "));
|
||||
|
||||
if(sType.equalsIgnoreCase("console"))
|
||||
{
|
||||
type = AliasCommandTypes.CONSOLE;
|
||||
|
||||
sArgLine = sArgLine.substring(sArgLine.indexOf(" ")+1);
|
||||
}
|
||||
else if(sType.equalsIgnoreCase("reply"))
|
||||
{
|
||||
type = AliasCommandTypes.REPLY_MESSAGE;
|
||||
|
||||
sArgLine = sArgLine.substring(sArgLine.indexOf(" ")+1);
|
||||
}
|
||||
}
|
||||
|
||||
sArgLine = this.replaceColorCodes(sArgLine);
|
||||
|
||||
commandsList.add(new AliasCommand(sArgLine,type));
|
||||
}
|
||||
|
||||
alias.setCommandsFor(iArg,commandsList);
|
||||
}
|
||||
|
||||
alias.setCommandsFor(iArg,commandsList);
|
||||
}
|
||||
}
|
||||
|
||||
this.aliases.put(sAlias, alias);
|
||||
@ -220,6 +229,10 @@ public class AliasManager
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else if(text.equalsIgnoreCase("*"))
|
||||
{
|
||||
text = commandString;
|
||||
}
|
||||
else if(text.length() >= 2 && text.substring(1,2).equalsIgnoreCase("p"))
|
||||
{
|
||||
int iParam = -1;
|
||||
|
@ -1,6 +1,6 @@
|
||||
name: BetterAlias
|
||||
main: com.ne0nx3r0.betteralias.BetterAlias
|
||||
version: '1.0.1'
|
||||
version: '1.1.0'
|
||||
database: false
|
||||
description: Command alias system
|
||||
commands:
|
||||
|
Loading…
Reference in New Issue
Block a user