Search in sources :

Example 1 with Permission

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);
}
Also used : ServicesManager(org.bukkit.plugin.ServicesManager) Permission(net.milkbowl.vault.permission.Permission) BukkitBootstrap(de.dytanic.cloudnet.bridge.BukkitBootstrap)

Example 2 with Permission

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);
}
Also used : Permission(net.milkbowl.vault.permission.Permission) Plugin(org.bukkit.plugin.Plugin)

Example 3 with Permission

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);
}
Also used : Player(org.bukkit.entity.Player) Permission(net.milkbowl.vault.permission.Permission) UserGroup(fr.xephi.authme.data.limbo.UserGroup) Test(org.junit.Test)

Example 4 with Permission

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);
}
Also used : Player(org.bukkit.entity.Player) Permission(net.milkbowl.vault.permission.Permission) UserGroup(fr.xephi.authme.data.limbo.UserGroup) Test(org.junit.Test)

Example 5 with Permission

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);
}
Also used : Permission(net.milkbowl.vault.permission.Permission)

Aggregations

Permission (net.milkbowl.vault.permission.Permission)8 UserGroup (fr.xephi.authme.data.limbo.UserGroup)2 Player (org.bukkit.entity.Player)2 Plugin (org.bukkit.plugin.Plugin)2 Test (org.junit.Test)2 API.uChatAPI (br.net.fabiozumbi12.UltimateChat.Bukkit.API.uChatAPI)1 UChatBungee (br.net.fabiozumbi12.UltimateChat.Bukkit.Bungee.UChatBungee)1 UCConfig (br.net.fabiozumbi12.UltimateChat.Bukkit.config.UCConfig)1 UCLang (br.net.fabiozumbi12.UltimateChat.Bukkit.config.UCLang)1 VisibleForTesting (com.google.common.annotations.VisibleForTesting)1 BukkitBootstrap (de.dytanic.cloudnet.bridge.BukkitBootstrap)1 IOException (java.io.IOException)1 Chat (net.milkbowl.vault.chat.Chat)1 Economy (net.milkbowl.vault.economy.Economy)1 InvalidConfigurationException (org.bukkit.configuration.InvalidConfigurationException)1 YamlConfiguration (org.bukkit.configuration.file.YamlConfiguration)1 ServicesManager (org.bukkit.plugin.ServicesManager)1