Double-space (or more) after command alias is no longer accepted, i.e. "f--home" (replace "-" with " " since GitHub is combining multiple spaces). Otherwise, command prevention routines (in Factions itself and in other plugins) can be bypassed. For example, preventing the "f-home" command wouldn't prevent anyone from using "f--home" or "f-----home" instead.
This commit is contained in:
parent
d31bac8da8
commit
0eaffd7aef
@ -199,6 +199,9 @@ public abstract class MPlugin extends JavaPlugin
|
|||||||
|
|
||||||
for (String alias : command.aliases)
|
for (String alias : command.aliases)
|
||||||
{
|
{
|
||||||
|
// disallow double-space after alias, so specific commands can be prevented (preventing "f home" won't prevent "f home")
|
||||||
|
if (commandString.startsWith(alias+" ")) return false;
|
||||||
|
|
||||||
if (commandString.startsWith(alias+" ") || commandString.equals(alias))
|
if (commandString.startsWith(alias+" ") || commandString.equals(alias))
|
||||||
{
|
{
|
||||||
List<String> args = new ArrayList<String>(Arrays.asList(commandString.split("\\s+")));
|
List<String> args = new ArrayList<String>(Arrays.asList(commandString.split("\\s+")));
|
||||||
|
Loading…
Reference in New Issue
Block a user