From 0eaffd7aef4d717acc2556559826f40e24ea26ae Mon Sep 17 00:00:00 2001 From: Brettflan Date: Mon, 19 Mar 2012 08:24:01 -0500 Subject: [PATCH] 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. --- src/com/massivecraft/factions/zcore/MPlugin.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/com/massivecraft/factions/zcore/MPlugin.java b/src/com/massivecraft/factions/zcore/MPlugin.java index 427da45e..18c03280 100644 --- a/src/com/massivecraft/factions/zcore/MPlugin.java +++ b/src/com/massivecraft/factions/zcore/MPlugin.java @@ -199,6 +199,9 @@ public abstract class MPlugin extends JavaPlugin 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)) { List args = new ArrayList(Arrays.asList(commandString.split("\\s+")));