Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
wea_ondara
committed
Feb 9, 2016
1 parent
6ae327e
commit 2fd6cfa
Showing
2 changed files
with
73 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
58 changes: 58 additions & 0 deletions
58
src/main/java/net/alpenblock/bungeeperms/testsuite/bukkit/tests/VaultDisplayableTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
package net.alpenblock.bungeeperms.testsuite.bukkit.tests; | ||
|
||
import net.alpenblock.bungeeperms.BungeePerms; | ||
import net.alpenblock.bungeeperms.User; | ||
import net.alpenblock.bungeeperms.testsuite.bukkit.BukkitTest; | ||
import net.alpenblock.bungeeperms.testsuite.bukkit.BukkitTestSuite; | ||
import net.milkbowl.vault.chat.Chat; | ||
import org.bukkit.Bukkit; | ||
import org.bukkit.command.CommandSender; | ||
import org.bukkit.plugin.RegisteredServiceProvider; | ||
|
||
public class VaultDisplayableTest extends BukkitTest | ||
{ | ||
|
||
@Override | ||
public boolean test(CommandSender sender) | ||
{ | ||
if (Bukkit.getPlayer(BukkitTestSuite.getTestplayer()) == null) | ||
{ | ||
throw new RuntimeException("test player " + BukkitTestSuite.getTestplayer() + " not found"); | ||
} | ||
|
||
User u = BungeePerms.getInstance().getPermissionsManager().getUser(BukkitTestSuite.getTestplayer()); | ||
if (u == null) | ||
{ | ||
throw new RuntimeException("test player " + BukkitTestSuite.getTestplayer() + " not found"); | ||
} | ||
|
||
if (Bukkit.getPluginManager().getPlugin("Vault") == null) | ||
{ | ||
throw new RuntimeException("vault not present"); | ||
} | ||
RegisteredServiceProvider<Chat> rsp = Bukkit.getServicesManager().getRegistration(Chat.class); | ||
if (rsp == null) | ||
{ | ||
throw new RuntimeException("vault: no chat service provider found"); | ||
} | ||
Chat chat = rsp.getProvider(); | ||
if (!chat.getName().equals("BungeePerms")) | ||
{ | ||
throw new RuntimeException("vault: chat service provider is not bungeeperms"); | ||
} | ||
|
||
sender.sendMessage("BP Prefix: " + u.buildPrefix().replaceAll("§", "&")); | ||
sender.sendMessage("Vault Prefix: " + chat.getPlayerPrefix(Bukkit.getPlayer(BukkitTestSuite.getTestplayer())).replaceAll("§", "&")); | ||
sender.sendMessage("BP Suffix: " + u.buildSuffix().replaceAll("§", "&")); | ||
sender.sendMessage("Vault Suffix: " + chat.getPlayerSuffix(Bukkit.getPlayer(BukkitTestSuite.getTestplayer())).replaceAll("§", "&")); | ||
|
||
return result(); | ||
} | ||
|
||
@Override | ||
public String getName() | ||
{ | ||
return "VaultDisplayableTest"; | ||
} | ||
|
||
} |