use of net.milkbowl.vault.permission.Permission in project CloudNet by Dytanic.
the class VaultInvoker method invoke.
public static void invoke() {
ServicesManager servicesManager = BukkitBootstrap.getPlugin(BukkitBootstrap.class).getServer().getServicesManager();
Permission permission = new VaultPermissionImpl();
servicesManager.register(Permission.class, permission, BukkitBootstrap.getPlugin(BukkitBootstrap.class), ServicePriority.Highest);
servicesManager.register(Chat.class, new VaultChatImpl(permission), BukkitBootstrap.getPlugin(BukkitBootstrap.class), ServicePriority.Highest);
}
use of net.milkbowl.vault.permission.Permission in project TriggerReactor by wysohn.
the class VaultSupport method setupPermissions.
private boolean setupPermissions() {
Plugin bukkitPlugin = plugin.getMain();
RegisteredServiceProvider<Permission> permissionProvider = bukkitPlugin.getServer().getServicesManager().getRegistration(net.milkbowl.vault.permission.Permission.class);
if (permissionProvider != null) {
permission = permissionProvider.getProvider();
}
return (permission != null);
}
use of net.milkbowl.vault.permission.Permission in project AuthMeReloaded by AuthMe.
the class VaultHandlerTest method shouldHandleNullAsGroups.
/**
* Bug #1702: VaultHandler may return null for groups list.
*/
@Test
public void shouldHandleNullAsGroups() {
// given
Permission permissionMock = vaultHandlerTest.permissionMock;
Player player = mock(Player.class);
given(permissionMock.getPlayerGroups(null, player)).willReturn(null);
// when
List<UserGroup> result = vaultHandlerTest.getGroups(player);
// then
assertThat(result, empty());
verify(permissionMock).getPlayerGroups(null, player);
}
use of net.milkbowl.vault.permission.Permission in project AuthMeReloaded by AuthMe.
the class VaultHandlerTest method shouldReturnGroups.
@Test
public void shouldReturnGroups() {
// given
Permission permissionMock = vaultHandlerTest.permissionMock;
Player player = mock(Player.class);
given(permissionMock.getPlayerGroups(null, player)).willReturn(new String[] { "abc", "test" });
// when
List<UserGroup> result = vaultHandlerTest.getGroups(player);
// then
List<String> groupNames = result.stream().map(UserGroup::getGroupName).collect(toList());
assertThat(groupNames, contains("abc", "test"));
verify(permissionMock).getPlayerGroups(null, player);
}
use of net.milkbowl.vault.permission.Permission in project AuthMeReloaded by AuthMe.
the class PermissionsManagerInitializationTest method setUpForVault.
private void setUpForVault() {
RegisteredServiceProvider<Permission> registeredServiceProvider = mock(RegisteredServiceProvider.class);
given(servicesManager.getRegistration(Permission.class)).willReturn(registeredServiceProvider);
Permission permission = mock(Permission.class);
given(registeredServiceProvider.getProvider()).willReturn(permission);
}
Aggregations