本文整理汇总了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;
}