Added getPermissions() to the CommandSender API to get a unmodifiable Collection of all Permissions. The ConsoleSender returns an empty Set where as the UserConnection gives its real Permissions.

This commit is contained in:
Fabian Fassbender 2014-02-08 14:17:01 +01:00
parent 9a4f0a6f59
commit 4faf507ad9
3 changed files with 18 additions and 0 deletions

View File

@ -82,4 +82,10 @@ public interface CommandSender
* @param value the value of the node
*/
public void setPermission(String permission, boolean value);
/**
* Get all Permissions which this CommandSender has
* @return a unmodifiable Collection of Strings which represent their permissions
*/
public Collection<String> getPermissions();
}

View File

@ -400,6 +400,12 @@ public final class UserConnection implements ProxiedPlayer
}
}
@Override
public Collection<String> getPermissions()
{
return Collections.unmodifiableCollection(permissions);
}
@Override
public String toString()
{

View File

@ -82,4 +82,10 @@ public class ConsoleCommandSender implements CommandSender
{
throw new UnsupportedOperationException( "Console has all permissions" );
}
@Override
public Collection<String> getPermissions()
{
return Collections.emptySet();
}
}