本文整理匯總了Java中net.milkbowl.vault.chat.Chat類的典型用法代碼示例。如果您正苦於以下問題:Java Chat類的具體用法?Java Chat怎麽用?Java Chat使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
Chat類屬於net.milkbowl.vault.chat包,在下文中一共展示了Chat類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: hook
import net.milkbowl.vault.chat.Chat; //導入依賴的package包/類
/**
* Registers the LuckPerms implementation of {@link Permission} and {@link Chat} with
* the service manager.
*
* @param plugin the plugin
*/
public void hook(LPBukkitPlugin plugin) {
try {
if (this.permissionHook == null) {
this.permissionHook = new VaultPermissionHook(plugin);
}
if (this.chatHook == null) {
this.chatHook = new VaultChatHook(plugin, this.permissionHook);
}
final ServicesManager sm = plugin.getServer().getServicesManager();
sm.register(Permission.class, this.permissionHook, plugin, ServicePriority.High);
sm.register(Chat.class, this.chatHook, plugin, ServicePriority.High);
} catch (Exception e) {
e.printStackTrace();
}
}
示例2: onEnable
import net.milkbowl.vault.chat.Chat; //導入依賴的package包/類
@Override
public void onEnable()
{
ServicesManager sm = handler.getServer().getServicesManager();
RegisteredServiceProvider<Permission> permProvider = sm.getRegistration(Permission.class);
if (permProvider != null)
perm = permProvider.getProvider();
RegisteredServiceProvider<Economy> econProvider = sm.getRegistration(Economy.class);
if (econProvider != null)
econ = econProvider.getProvider();
RegisteredServiceProvider<Chat> chatProvider = sm.getRegistration(Chat.class);
if (chatProvider != null)
chat = chatProvider.getProvider();
}
示例3: getVaultChat
import net.milkbowl.vault.chat.Chat; //導入依賴的package包/類
/**
* Если Vault установлен на сервере и включён, а также имеется какой-нибудь плагин,
* предоставляющий нужный интерфейс, он будет возвращён, иначе будет возвращено null.
* @return net.milkbowl.vault.chat.Chat
*/
public Chat getVaultChat()
{
if(chat == null)
{
if(plugin.getServer().getPluginManager().isPluginEnabled("Vault"))
{
plugin.logger.info("Found Vault! Searching for chat plugin...");
final ServicesManager servicesManager = plugin.getServer().getServicesManager();
RegisteredServiceProvider<Chat> provider = servicesManager.getRegistration(Chat.class);
if(provider != null)
chat = provider.getProvider();
if(chat != null && chat.isEnabled())
plugin.logger.log(Level.INFO, "Using {0} as chat provider.", chat.getName());
}
}
return chat;
}
示例4: ChatRenderer
import net.milkbowl.vault.chat.Chat; //導入依賴的package包/類
public ChatRenderer(RedisChat plugin) {
this.plugin = plugin;
// setup vault perms for looking up players group. and vault chat for getting chat prefixes.
RegisteredServiceProvider<Permission> rsp = plugin.getServer().getServicesManager().getRegistration(Permission.class);
vaultPerms = rsp.getProvider();
if (vaultPerms == null) {
throw new RuntimeException("Vault and a permissions plugin are required.");
}
RegisteredServiceProvider<Chat> rspc = plugin.getServer().getServicesManager().getRegistration(Chat.class);
vaultChat = rspc.getProvider();
if (vaultChat == null) {
throw new RuntimeException("Vault and a permissions plugin are required.");
}
// Setup the "base" NBT Tag that we'll use to render sender's hover data
this.baseTag = new NBTTagCompound();
this.baseTag.set("id", new NBTTagShort((short) 1));
this.baseTag.set("Damage", new NBTTagShort((short) 0));
this.baseTag.set("Count", new NBTTagByte((byte) 1));
NBTTagCompound tag = new NBTTagCompound();
NBTTagCompound dispTag = new NBTTagCompound();
tag.set("display", dispTag);
this.baseTag.set("tag", tag);
}
示例5: VaultHook
import net.milkbowl.vault.chat.Chat; //導入依賴的package包/類
public VaultHook(xEssentials pl) {
this.pl = pl;
RegisteredServiceProvider<Economy> ep = Bukkit.getServer().getServicesManager().getRegistration(net.milkbowl.vault.economy.Economy.class);
RegisteredServiceProvider<Chat> cp = Bukkit.getServer().getServicesManager().getRegistration(net.milkbowl.vault.chat.Chat.class);
RegisteredServiceProvider<Permission> pp = Bukkit.getServer().getServicesManager().getRegistration(net.milkbowl.vault.permission.Permission.class);
if(ep instanceof RegisteredServiceProvider) {
this.econ = ep.getProvider();
}
if(cp instanceof RegisteredServiceProvider) {
this.chat = cp.getProvider();
}
if(pp instanceof RegisteredServiceProvider) {
this.perm = pp.getProvider();
}
}
示例6: inGroup
import net.milkbowl.vault.chat.Chat; //導入依賴的package包/類
@Override
public boolean inGroup(final CommandSender player, final String groupname)
{
try
{
final Chat chat = getServiceProvider(Chat.class);
for (String group : chat.getPlayerGroups(getPlayer(player)))
{
if (group.equalsIgnoreCase(groupname))
{
return true;
}
}
}
catch (Exception e)
{
ess.getLogger().log(Level.WARNING, e.getMessage(), e);
}
return false;
}
示例7: invoke
import net.milkbowl.vault.chat.Chat; //導入依賴的package包/類
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);
}
示例8: setupChat
import net.milkbowl.vault.chat.Chat; //導入依賴的package包/類
/**
* This method will return whether or not the chat provider
* has been setup or not.
*/
private boolean setupChat ()
{
RegisteredServiceProvider<Chat> rsp = getServer().getServicesManager ().getRegistration (Chat.class);
if (null != rsp)
{
mChat = rsp.getProvider ();
}
return mChat != null;
}
示例9: getVaultChat
import net.milkbowl.vault.chat.Chat; //導入依賴的package包/類
public static Chat getVaultChat() {
if(chat == null){
RegisteredServiceProvider<Chat> provider = Bukkit.getServer().getServicesManager().getRegistration(Chat.class);
if (provider != null) {
return chat = provider.getProvider();
} else {
throw new RuntimeException("Vault Error: No ChatProvider found");
}
} else {
return chat;
}
}
示例10: setupChat
import net.milkbowl.vault.chat.Chat; //導入依賴的package包/類
private boolean setupChat() {
RegisteredServiceProvider<Chat> chatProvider = getServer().getServicesManager().getRegistration(net.milkbowl.vault.chat.Chat.class);
if (chatProvider != null) {
chat = chatProvider.getProvider();
}
return chat != null;
}
示例11: refreshVault
import net.milkbowl.vault.chat.Chat; //導入依賴的package包/類
private void refreshVault() {
Chat vaultChat = getServer().getServicesManager().load(Chat.class);
if (vaultChat != this.vaultChat) {
getLogger().info("New Vault Chat implementation registered: " + (vaultChat == null ? "null" : vaultChat.getName()));
}
this.vaultChat = vaultChat;
}
示例12: setupChat
import net.milkbowl.vault.chat.Chat; //導入依賴的package包/類
private boolean setupChat() {
if (!available()) {
return false;
}
RegisteredServiceProvider<Chat> rsp = Bukkit.getServicesManager().getRegistration(Chat.class);
if (rsp == null) {
return false;
}
chat = rsp.getProvider();
return chat != null;
}
示例13: setupChat
import net.milkbowl.vault.chat.Chat; //導入依賴的package包/類
public static boolean setupChat()
{
RegisteredServiceProvider<Chat> chatProvider = Skywars.pl.getServer().getServicesManager().getRegistration(net.milkbowl.vault.chat.Chat.class);
if (chatProvider != null) {
Skywars.chat = chatProvider.getProvider();
}
return (Skywars.chat != null);
}
示例14: unhook
import net.milkbowl.vault.chat.Chat; //導入依賴的package包/類
/**
* Unregisters the LuckPerms Vault hooks, if present.
*
* @param plugin the plugin
*/
public void unhook(LPBukkitPlugin plugin) {
final ServicesManager sm = plugin.getServer().getServicesManager();
if (this.permissionHook != null) {
sm.unregister(Permission.class, this.permissionHook);
this.permissionHook.getExecutor().shutdown();
this.permissionHook = null;
}
if (this.chatHook != null) {
sm.unregister(Chat.class, this.chatHook);
this.chatHook = null;
}
}
示例15: init
import net.milkbowl.vault.chat.Chat; //導入依賴的package包/類
@SuppressWarnings("null")
@Override
protected boolean init() {
economy = Bukkit.getServicesManager().getRegistration(Economy.class) == null ? null : Bukkit.getServicesManager().getRegistration(Economy.class).getProvider();
chat = Bukkit.getServicesManager().getRegistration(Chat.class) == null ? null : Bukkit.getServicesManager().getRegistration(Chat.class).getProvider();
return economy != null || chat != null;
}